CentOS6.6 Shared File Mounting between 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[ html] view plaincopyprint?
- Yuminstallnfs-utils
2. Set the service to start [plain] view plaincopyprint?
- Chkconfigrpcbindon
- Chkconfignfson
3. Start the service [plain] view plaincopyprint?
- Servicerpcbindstart
- Servicenfsstart
Centos Server 1 set [plain] view plaincopyprint?
- /Www/wwwroot/www.lanmps.com/uploads192.168.1.20 (rw, no_root_squash, no_all_squash, sync)
Then reload [plain] view plaincopyprint?
- Exportfs-r
View [plain] view plaincopyprint in the shared list?
- Exportfs
Centos Server 2 settings 1. Check if Server 1 has shared [plain] view plaincopyprint?
- Showmount-e192.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-tnfs-orw192.168.1.100:/www/wwwroot/www.lanmps.com/uploads/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 shared [plain] view plaincopyprint?
- Umount/www/wwwroot/www.lanmps.com/uploads
6. Set the Mounting Mode for boot. method 1 (recommended): edit the/etc/rc. local file and add the [html] view plaincopyprint?
- Mount-tnfs-orw192.168.1.100:/www/wwwroot/www.lanmps.com/uploads/www/wwwroot/www.lanmps.com/uploads
Method 2: edit/etc/fstab and find that this item is not successful. The network function is loaded at the end. Therefore, recommended method 1.
[Html] view plaincopyprint?
- 192.168.1.100:/www/wwwroot/www.lanmps.cn/uploads/www/wwwroot/www.lanmps.cn/uploadsnfsdefaults,soft,intr00
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