------------------------服务端--------------------
环境
OS:Centos 7
服务端IP:192.168.56.142
客户端IP:192.168.56.141
142的目录/archlog 挂载到141的目录/archlog2下
1.安装nfs
yum -y install nfs-utils
2.编辑exports文件
vim /etc/exports
写入
/archlog 192.168.1.141(rw,sync,all_squash,anonuid=1001,anongid=6000)
或是配置如下
/archlog 192.168.1.141(rw,sync,all_squash,anonuid=0,anongid=0)
格式是:
要共享的目录 对方的IP及掩码或者域名(权限,同步更新)
这里的anonuid和anongid分别是141服务器上oracle用户的id和组
可以通过id oracle查看
[oracle@host01 archlog2]$ id oracle
uid=1001(oracle) gid=6000(oinstall) groups=6000(oinstall),5001(asmdba),6001(dba)
3.先为rpcbind和nfs做开机启动:(必须先启动rpcbind服务)
systemctl enable rpcbind.service
systemctl enable nfs-server.service
然后分别启动rpcbind和nfs服务:
systemctl restart rpcbind.service
systemctl restart nfs-server.service
systemctl stop rpcbind.service
systemctl stop nfs-server.service
systemctl status rpcbind.service
systemctl status nfs-server.service
4.查看挂载输出的目录
[root@host02 /]# exportfs -rv
exporting 192.168.56.141:/archlog
--------------客户端-----------------------------------------
1.安装nfs
yum -y install nfs-utils
2.创建挂载的目录
mkdir -p /archlog2
chown -R oracle:oinstall /archlog2
我这里也创建一个跟服务器一致的目录,实际情况可以不需要一致.
3.手工mount
mount -t nfs 192.168.56.142:/archlog /archlog2
4.umount
切换到其他目录执行如下命令,在当前目录执行会包系统资源忙的错误.
umount -f /archlog2