NFS 服务器搭建及配置(2)

9999的用户名和群组是web。(具体意思,参考上面自己翻译吧)
 
配置完exports后,保存退出,下面执行挂载操作:
假设我们配的是:
/data/www/static/discuz/data 10.200.22.176(rw,sync,no_subtree_check,no_root_squash,nohide,anonuid=9999,anongid=9999)
在客户端,及目标主机挂载:
mount -t nfs  10.200.21.155:/data/www/static/discuz/data  /data

为了服务器重启后,自动实现挂载,需要在本地配置文件/etc/fstab中配置
10.200.21.155:/data/www/static/discuz/data  /data  nfs rsize=8192,nfsvers=4,wsize=8192,timeo=14,intr,bg,retry=100,nofail 0 0

(fstab 的配置规则,这里就不展开描述了,下篇磁盘管理会详解介绍的)
注意:
        如果现配置了/etc/fstab文件, 再执行挂载,可以用以下简单地命令:mount    /data
 
到此nfs的所有配置就结束了,下面给出常用的命令:
在服务器端查看共享目录:
[root@web-storage-1 flwu]# showmount -e
Export list for web-storage-1:
/data/web_log                          lewa-console-1,lewa-beta-1,lewa-bi-3,lewa-bi-2,lewa-bi-1
/data/cdn                              lewa-bi-3,lewa-bi-2,lewa-bi-1
/data/apps                            web-private-2,web-private-1
/data/yun                              web-public-3,web-public-2,web-public-1
/data/fcfiles/theme                    web-private-1,web-public-3,web-public-2,web-public-1
/data/www/static/discuz/xwb/log        web-public-3,web-public-2,web-public-1
/data/www/static/discuz/xwb/cache      web-public-3,web-public-2,web-public-1
/data/www/static/discuz/uc_server/data web-public-3,web-public-2,web-public-1
/data/www/static/discuz/static        web-public-3,web-public-2,web-public-1
/data/www/static/discuz/data          web-public-3,web-public-2,web-public-1

在客户端查看已挂载的目录:
[root@web-public-2 log]# mount -l
/dev/xvda1 on / type xfs (rw) [/]
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/mapper/lewa-data on /data type ext4 (rw)
/dev/mapper/lewa-web on /web type ext4 (rw)
/dev/mapper/lewa-Hadoop_data on /hadoop_data type ext4 (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
web-storage-1:/data/www/static/discuz/uc_server/data on /web/bbs/htdoc/uc_server/data type nfs (rw,vers=4,addr=10.200.21.155,clientaddr=10.135.23.201)
web-storage-1:/data/www/static/discuz/static on /web/bbs/htdoc/static type nfs (rw,vers=4,addr=10.200.21.155,clientaddr=10.135.23.201)
web-storage-1:/data/www/static/discuz/xwb/cache on /web/bbs/htdoc/xwb/cache type nfs (rw,vers=4,addr=10.200.21.155,clientaddr=10.135.23.201)
web-storage-1:/data/www/static/discuz/data on /web/bbs/htdoc/data type nfs (rw,vers=4,addr=10.200.21.155,clientaddr=10.135.23.201)
web-storage-1:/data/fcfiles/theme on /web/theme/htdoc/theme type nfs (rw,vers=4,addr=10.200.21.155,clientaddr=10.135.23.201)
web-storage-1:/data/www/static/discuz/xwb/log on /web/bbs/htdoc/xwb/log type nfs (rw,rsize=8192,nfsvers=4,wsize=8192,timeo=14,intr,bg,retry=100,addr=10.200.21.155,clientaddr=10.135.23.201)

注意(挂载时报类型不匹配时):
nfs挂载后,要在客户端上安装nfs-utils库,否则会包文件类型错误,而导致挂载不上去。
关于nfs的配置,了解到这里,足够用了,关于mount命令更详细的见:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/500a2e4f94812ae5e17459786e90f56d.html