NFS 即network file system

可用于向k8s集群提供持久存储

最小化安装centos后  把网卡设置好了后

1.关闭防火墙

[root@NFS ~]# systemctl stop firewalld
[root@NFS ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@NFS ~]# firewall-cmd --state
not running

2.关闭 selinux

[root@NFS ~]#  setenforce
[root@NFS ~]# sed -i 's/^ *SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

重启后生效

[root@NFS ~]# reboot
[root@NFS ~]# sestatus
SELinux status: disabled

3.yum安装 配置 nfs服务端

yum update一下再安装

yum -y install  nfs-utils

配置 任意ip可以以root的权限对/k8s文件夹进行读写

[root@NFS ~]# cat /etc/exports
/k8s *(rw,sync,no_root_squash)
#创建一个k8s目录
[root@NFS ~]# mkdir /k8s
#给权限
[root@NFS /]# chmod 777 /k8s

设置开机自启 并启动

[root@NFS /]# systemctl enable rpcbind
[root@NFS /]# systemctl enable nfs-server
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
[root@NFS /]# systemctl start rpcbind
[root@NFS /]# systemctl start nfs-server

加载配置并查看

[root@NFS /]# exportfs -r
[root@NFS /]# exportfs
/k8s <world>

4.安装配置 nfs客户端,  在每个k8s节点上做.

yum安装

yum -y install nfs-utils

创建要挂载nfs的文件夹

mkdir /nfs

查看nfs   我的nfs服务端安装在192.168.1.250 上

[root@m1 ~]# showmount -e 192.168.1.250
Export list for 192.168.1.250:
/k8s *

挂载nfs 中的k8s目录到 /nfs

[root@m1 ~]# mount -t nfs 192.168.1.250:/k8s /nfs

自动挂载

[root@m1 ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot. touch /var/lock/subsys/local
mount -t nfs 192.168.1.250:/k8s /nfs

给权限防止因为权限没有执行 除了root,其他用户的只有读和执行的权限

chmod  /etc/rc.local

测试

[root@m1 nfs]# vi hello
[root@m1 nfs]# ll
total
-rw-r--r--. root root Nov : hello

至此 nfs实践结束

centos7上搭建NFS的实践的更多相关文章

  1. centos7上搭建开源系统jforum

    centos7上搭建好tomcat,mysql; 将 jforum-2.6.2.war放到tomcat目录的webapps下: 启动tomcat,./startup.sh ,查看webapp下jfor ...

  2. windows上搭建NFS服务器及客户端 挂载

    在Windows相关系统上搭建NFS服务及客户端挂载  有两种方式: 第一种: (Windows Server2008R2等类似企业版这样的版本的Server服务上有自带的NFS服务进行搭建) (特别 ...

  3. [深度学习] centos7上搭建基于Anaconda3的caffe+pycaffe环境(python3.6)

    本文记录从零开始在CentOS7.x系统上搭建Caffe深度学习平台,并配置pycaffe环境.(由于在虚拟机上搭建,所以为CPU_ONLY模式) 1.选择CentOS7 mini版镜像安装虚拟机 镜 ...

  4. 如何在centos6和centos7上部署nfs共享服务器和客户端

    nfs共享服务为中小型企业在存储上提供了有效的节省空间,许多大型的网站也在使用nfs,如百度和阿里等,下面结合自己所学的知识,阐述如何在centos6和centos7下配置nfs.注:除了必要的说明外 ...

  5. Centos7上搭建redis主从

    1. 节点(服务器)数量说明 按照redis官方建议:salve和master的数量按照2n+1台服务器(1台master节点,2n台slave节点) 有兴趣的可以了解下redis的master选举机 ...

  6. Centos7下搭建NFS服务器与连接详解

    一,环境介绍    本实验使用了两台centos7虚拟机,其中         服务器:192.168.1.188    客户端:192.168.1.189 二,实验步骤    192.168.1.1 ...

  7. centos7上搭建http服务器以及设置目录访问

    参考文献:http://www.jb51.net/article/137596.htm,原文摘抄如下,并根据具体需要作了相应的修改. 步骤: 1. 安装httpd服务 sudo yum install ...

  8. 在centos7上搭建博客之小白教程~

    原理 http使用方法一编译安装,php模块打入方式实现. 软件版本 在本次实验中,我们需要用到的软件版本如下: apr-1.6.2 apr-util-1.6.0 httpd-2.4.28 maria ...

  9. centos7 上搭建私有云

    OwnCloud环境搭建 一. 环境搭建 1. 环境需求 服务器操作系统:Centos7.0 外网服务器操作系统:Centos7.0 Php版本号:5.4.16 Mysql版本号:5.5.52 Apa ...

随机推荐

  1. 九款Web服务器性能压力测试工具

    一.http_load 程序非常小,解压后也不到100Khttp_load以并行复用的方式运行,用以测试web服务器的吞吐量与负载.但是它不同于大多数压力测试工具,它可以以一个单一的进程运行,一般不会 ...

  2. Linux设备驱动程序 之 并发及其管理

    竞态产生 Linux系统找那个存在大量的并发联系,因此会导致可能的竞态: 1. 正在运行的用户空间进程可以以多种组合方式访问我们的代码: 2. SMP系统甚至可以再不同的处理器上同时执行我们的代码: ...

  3. python中list不能做索引

    先看python中内置的list不能作为字典的key. 可将list或者ndarray转化为tuple再做索引. list不能进行hash: import numpy as np a1 = np.ar ...

  4. vue 动态渲染数据很慢或不渲染

    vue 动态渲染数据很慢或不渲染 原因是因为vue检测速度很慢,因为多层循环了,在VUE 2.x的时候还能渲染出来,1.x的时候压根渲染不出来.解决方式:在动态改变数据的方法,第一行加上 this.$ ...

  5. Flutter移动电商实战 --(6)dio基础_Get_Post请求和动态组件协作

    上篇文章中,我们只看到了 dio 的使用方式,但并未跟应用关联起来,所以这一篇将 dio 网络请求与应用界面结合起来,当然这也是为以后的实战作基础准备,基础打牢,我们才能飞速前进. 1.案例说明 我们 ...

  6. js实现简单的文件上传

    文件下载:https://www.cnblogs.com/xiaomili/p/10521160.html  html: <form name="form1" id=&quo ...

  7. PCL点云库(Point Cloud Library)简介

    博客转载自:http://www.pclcn.org/study/shownews.php?lang=cn&id=29 什么是PCL PCL(Point Cloud Library)是在吸收了 ...

  8. 小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_2-3.热部署在Eclipse和IDE里面的使用

    笔记 3.热部署在Eclipse和IDE里面的使用     简介:讲解热部署的好处及使用注意事项,在eclipse里面默认开启,在IDE里面默认关闭                  1.增加依赖 & ...

  9. LVS系列三、LVS集群-IP-TUN模式

    一.LVS-IP TUN集群概述 DR方式是通过MAC,规模是一个交换网络.而TUN方式,是通过给数据包加上新的IP头部来实现,这个可以跨整个广域网.TUN模式可以解决DR模式下不能跨网段的问题,甚至 ...

  10. WMPageController设置menuView的左右视图

    效果图如下: 绿色的是自定义的emenuView的rightView哟!!! 代码实现如下: // // CategoryVC.m // JSHui // // Created by Apple on ...