Shared File Mounting and Centos mounting among linux centos servers
File Sharing and mounting between linux Centos (6.6) servers
Purpose: Because Server Load balancer is configured on the server, file uploading on multiple servers must be synchronized. The purpose is to set Server 1 as the master file server.
Server 1: 192.168.1.100
Server 2: 192.168.1.20
The wind is coming. Stay Fox
Install basic kit [per server] 1.nfs
yum install nfs-utils
2. Set service auto-start
chkconfig rpcbind onchkconfig nfs on
3. Start the service
service rpcbind startservice nfs start
Centos Server 1 settings
/www/wwwroot/www.lanmps.com/uploads 192.168.1.20(rw,no_root_squash,no_all_squash,sync)
Then reload
exportfs -r
View share list
exportfs
Centos Server 2 settings 1. Check if Server 1 is shared
showmount -e 192.168.1.100
If a share exists, the share list is displayed.
2. Directory settings
The two server directories are the same, so you do not need to set them.
If it is different or not, create mkdir-p/www/wwwroot/www.lanmps.com/uploads
3. Mount
mount -t nfs -o rw 192.168.1.100:/www/wwwroot/www.lanmps.com/uploads /www/wwwroot/www.lanmps.com/uploads
4. Check whether the disk is mounted.
Method 1:
df -h
Method 2:
Directly go to the/www/wwwroot/www.lanmps.com/uploads directory and check whether the file can be modified.
5. Uninstall and delete sharing
umount /www/wwwroot/www.lanmps.com/uploads
6. Set boot mounting and automatic loading
Method 1 (recommended): Edit the/etc/rc. local file and add
mount -t nfs -o rw 192.168.1.100:/www/wwwroot/www.lanmps.com/uploads /www/wwwroot/www.lanmps.com/uploads
Method 2: edit/etc/fstab to find that this item is not successful and the network function is loaded at the end. Therefore, we recommend that you
Method 1
192.168.1.100:/www/wwwroot/www.lanmps.cn/uploads /www/wwwroot/www.lanmps.cn/uploads nfs defaults,soft,intr 0 0
Note: 192.168.1.100:/www/wwwroot/www.lanmps.cn/uploads this is a shared directory
/Www/wwwroot/www.lanmps.cn/uploadsis the mount point
Nfs is type
The soft parameter is used to output error messages to users.
In order to solve the network failure, the intr parameter can be terminated by pressing ctrl + c.
For more functions, see:
Http://www.server110.com/linux/201404/10169.html (Thanks for providing)
Http://www.linuxidc.com/Linux/2013-05/84777.htm