由于目前是使用了两台web服务器,正常来说:每个web上面都需要一个项目的文件
在此,考虑到更新方便,我将项目的目录设置为NFS共享方式
 
192.168.1.41挂载使用:
mount -t nfs 10.100.16.40:/usr/share/nginx/html//usr/share/nginx/html/
 
#服务端安装nfs
yum -y install nfs-unitls rpcbind
 
#编辑/etc/exports配置文件
[root@localhost conf]# cat /etc/exports 
/usr/share/nginx/html      192.168.1.*(rw,sync,no_root_squash)
 
#启动nfs
service rpcbind start
service nfs start
chkconfig rpcbind on
chkconfig nfs on
 
客户端:
[root@localhost html]# showmount -e 192.168.1.40
Export list for 192.168.1.40:
/usr/share/nginx/html 192.168.1.*
 
#挂载
mount –t nfs 192.168.1.40:/usr/share/nginx/html//usr/share/nginx/html/
 
#验证是否挂载
[root@localhost html]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/sda3            280G  6.9G  258G  3% /
tmpfs                3.9G     0  3.9G  0% /dev/shm
/dev/sda1            504M   36M  443M  8% /boot
192.168.1.41:/usr/share/nginx/html/
                      280G  6.3G 259G   3% /usr/share/nginx/html



#客户端不能挂载
[root@bbs ~]# mount -t nfs 192.168.1.41:/usr/share/nginx/html//usr/share/nginx/html/
mount.nfs: Stale NFS file handle
#出现这个情况一般是,服务器端的nfs服务挂了导致的
 
#解决方法:在客户端卸载umount -lf /usr/share/nginx/html
再重新挂载就好!