LinuxCentos (6.6) server file sharing and mounting purpose: Because server load balancer is set, file uploading on multiple servers must be synchronized. here, server 1 is set as the main file server 1: 192.168.1.100 Server 2: 192.168.1.20. install basic kit [per server] 1.nfs[ html] v
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
[Html]View plaincopyprint?
- Yum install nfs-utils
2. set Service auto-start
[Plain]View plaincopyprint?
- Chkconfig rpcbind on
- Chkconfig nfs on
3. start the service
[Plain]View plaincopyprint?
- Service rpcbind start
- Service nfs start
Centos server 1 settings
[Plain]View plaincopyprint?
- /Www/wwwroot/www.lanmps.com/uploads 192.168.1.20 (rw, no_root_squash, no_all_squash, sync)
Then reload
[Plain]View plaincopyprint?
- Exportfs-r
View Share List
[Plain]View plaincopyprint?
- Exportfs
Centos Server 2 settings 1. check if server 1 is shared
[Plain]View plaincopyprint?
- Showmount-e 192.168.1.100
If shared, the shared 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
[Plain]View plaincopyprint?
- Mount-t nfs-o rw 192.168.1.100:/www/wwwroot/www.lanmps.com/uploads
4. check whether the disk is mounted.
Method 1:
[Plain]View plaincopyprint?
- 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
[Plain]View plaincopyprint?
- 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
[Html]View plaincopyprint?
- Mount-t nfs-o rw 192.168.1.100:/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
[Html]View plaincopyprint?
- 192.168.1.100:/www/wwwroot/www.lanmps.cn/uploads nfs ULTS ults, 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