[@JCluster01 ~]# rpm -qa|grep nfs
nfs-utils-1.2.3-64.el6.x86_64
nfs-utils-lib-1.1.5-11.el6.x86_64
[@JCluster01 ~]# rpm -qa|grep rpcbind
rpcbind-0.2.0-11.el6.x86_64
系统默认已安装了nfs-utils、rpcbind两个软件包。[@JCluster01 ~]# vi /etc/exports
/opt/uploadfiles 10.2.176.134(rw,sync,no_root_squash)
/opt/uploadfiles 10.2.176.135(rw,sync,no_root_squash)
/opt/uploadfiles 10.2.176.136(rw,sync,no_root_squash)
[@JCluster01 ~]# exportfs -rf
[@JCluster01 ~]# service rpcbind start
Starting rpcbind: [ OK ]
[@JCluster01 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: rpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
rpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
rpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
[ OK ]
Starting NFS daemon: rpc.nfsd: address family inet6 not supported by protocol TCP
[ OK ]
Starting RPC idmapd:
[@JCluster01 ~]# service rpcbind status
rpcbind (pid 3028) is running...
[@JCluster01 ~]# service nfs status
rpc.svcgssd is stopped
rpc.mountd (pid 93356) is running...
nfsd (pid 93376 93375 93374 93373 93372 93371 93370 93369) is running...
rpc.rquotad (pid 93339) is running...
[@JCluster01 ~]# service rpcbind stop
Stopping rpcbind: [ OK ]
[@JCluster01 ~]# service nfs stop
Shutting down NFS daemon: [ OK ]
Shutting down NFS mountd: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Shutting down RPC idmapd: [ OK ]
[@JCluster01 ~]# chkconfig --list rpcbind
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[@JCluster01 ~]# chkconfig --list nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
设置rpcbind和nfs服务在系统运行级别3和5自动启动。[@JCluster01 ~]# chkconfig --level 35 rpcbind on
[@JCluster01 ~]# chkconfig --level 35 nfs on
[@JCluster01 ~]# showmount -e
Export list for JCluster01:
/opt/uploadfiles 10.2.176.136,10.2.176.135,10.2.176.134
[@JCluster02 ~]mkdir /opt/uploadfiles
[@JCluster02 ~]# mount -t nfs 10.2.176.133:/opt/uploadfiles/ /opt/uploadfiles/
[@JCluster02 ~]# mount |grep nfs
10.2.176.133:/opt/uploadfiles/ on /opt/uploadfiles type nfs (rw,vers=4,addr=10.2.176.133,clientaddr=10.2.176.134)
启动自动挂载nfs文件系统[@JCluster02 ~]# vi /etc/fstab
10.2.176.133:/opt/uploadfiles /opt/uploadfiles nfs defaults 0 0
[@JCluster02 ~]# mount -a
[@JCluster02 ~]# reboot
如果重启机器后,未挂载成功,参考下面修改方式,添加标黄的脚本[@JCluster02 ~]# vi /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/opt/monitor/sec/bin/monitor > /dev/null 2>&1
mount -t nfs 10.2.176.133:/opt/uploadfiles /opt/uploadfiles
[@JCluster02 ~]# reboot