OS + Centos 7 NFS Server

S

Centos7安装配置NFS服务和挂载

https://www.cnblogs.com/lixiuran/p/7117000.html

现在有3台服务器 s1(主),s2(从), s3(从)需要实现文件实时同步,我们可以安装Nfs服务端和客户端来实现!
一、安装 NFS 服务器所需的软件包:
yum install -y nfs-utils
二、编辑exports文件,添加从机

vim /etc/exports
/home/nfs/ 192.168.248.0/24(rw,sync,fsid=0)
同192.168.248.0/24一个网络号的主机可以挂载NFS服务器上的/home/nfs/目录到自己的文件系统中
rw表示可读写;sync表示同步写,fsid=0表示将/data找个目录包装成根目录
三、启动nfs服务
先为rpcbind和nfs做开机启动:(必须先启动rpcbind服务)

systemctl enable rpcbind.service
systemctl enable nfs-server.service
然后分别启动rpcbind和nfs服务:

systemctl start rpcbind.service
systemctl start nfs-server.service
确认NFS服务器启动成功:

rpcinfo -p
检查 NFS 服务器是否挂载我们想共享的目录 /home/nfs/:
exportfs -r
#使配置生效
exportfs
#可以查看到已经ok
/home/nfs 192.168.248.0/24
四、在从机上安装NFS 客户端
首先是安裝nfs,同上,然后启动rpcbind服务
先为rpcbind做开机启动:
systemctl enable rpcbind.service
然后启动rpcbind服务:
systemctl start rpcbind.service
注意:客户端不需要启动nfs服务
检查 NFS 服务器端是否有目录共享:showmount -e nfs服务器的IP
showmount -e 192.168.248.208
Export list for 192.168.248.208:
/home/nfs 192.168.248.0/24
在从机上使用 mount 挂载服务器端的目录/home/nfs到客户端某个目录下:
cd /home && mkdir /nfs
mount -t nfs 192.168.248.208:/home/nfs /home/nfs
df -h 查看是否挂载成功。

http://blog.csdn.net/taiyang1987912/article/details/41696319
http://www.linuxidc.com/Linux/2015-05/117378.htm


复制代码
[root@localhost ~]# showmount -e 172.19.162.102
clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host) 解决方法: [root@pro-www-m root]# rpcinfo -p 172.19.162.102
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 20048 mountd
100005 1 tcp 20048 mountd
100005 2 udp 20048 mountd
100005 2 tcp 20048 mountd
100005 3 udp 20048 mountd
100005 3 tcp 20048 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049 nfs_acl
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 3 udp 2049 nfs_acl
100021 1 udp 31206 nlockmgr
100021 3 udp 31206 nlockmgr
100021 4 udp 31206 nlockmgr
100021 1 tcp 31241 nlockmgr
100021 3 tcp 31241 nlockmgr
100021 4 tcp 31241 nlockmgr
iptables -I INPUT -p tcp -s 172.19.162.100 --dport 111 -j ACCEPT
iptables -I INPUT -p udp -s 172.19.162.100 --dport 111 -j ACCEPT
iptables -I INPUT -p tcp -s 172.19.162.100 --dport 2049 -j ACCEPT
iptables -I INPUT -p udp -s 172.19.162.100 --dport 2049 -j ACCEPT
iptables -I INPUT -p tcp -s 172.19.162.100 --dport 20048 -j ACCEPT
iptables -I INPUT -p udp -s 172.19.162.100 --dport 20048 -j ACCEPT
iptables -I INPUT -p tcp -s 172.19.162.100 --dport 31206 -j ACCEPT
iptables -I INPUT -p udp -s 172.19.162.100 --dport 31206 -j ACCEPT

END

猜你喜欢

转载自www.cnblogs.com/lindows/p/12161267.html