Centos6.2 + NFS network file server configuration instance
1. Environment Introduction:
A) Server: 192.168.0.11 (StoreData)
B) Client: 192.168.0.208 (WriteData), 192.168.0.160 (ReadData), 192.168.0.10 (ReadData)
2. software installation:
Yum-y installportmap nfs * # server and client must be installed
3. NFSServer configuration (server configuration ):
[Root @ guanying01 ~] # Mkdir-p/u2/img_server
[Root @ guanying01 ~] # Echo "/u2/img_server 192.168.0.0/24 (rw, no_root_squash)">/etc/exports
Configuration File parameters:
/U2/img_server/is the shared directory. Use the absolute path.
192.168.0.0/24 (rw, no_root_squash, no_all_squash, sync) is the client address and permission. The address can be a network segment, an IP address or a domain name. The domain name supports wildcards, such as * .taoying.com, there is no space between the address and permission. Permission description:
Rw: read-write, which can be read and written;
Ro: read-only, read-only;
Sync: writes files to both the hard disk and memory;
Async: files are stored in memory instead of directly written into memory;
No_root_squash: If the NFS client uses root to connect to the server, it also has root permissions for the Directory shared by the server. It is obviously not safe to enable this feature.
Root_squash: If the NFS client uses root to connect to the server, it has anonymous user permissions for the Directory shared by the server. Generally, it uses nobody or nfsnobody;
All_squash: No matter which user the NFS client uses to connect to the server, the directory shared by the server is anonymous;
Anonuid: UID value of an anonymous user, usually nobody or nfsnobody, which can be set here;
Anongid: the GID value of an anonymous user.
4. Start NFS:
Service nfs start
Service portmap start # note that the client also needs to be enabled; otherwise, mount fails due to an error in mount.
5. Application (execute the following content on the client side ):
Mkdir-p/u1/img_server
Mount 192.168.0.11:/u2/img_server/u1/img_server-tnfs
6. Problems and Solutions:
Problem 1: when the client is mounted, the following problem occurs: the network may be unstable. By default, NFS uses the UDP protocol instead of the TCP protocol:
[Root @ gy01 ~] # Mount-t nfs192.168.0.11:/u1/img_server/u1/img_server
Mount. nfs: Input/output error
Solution:
[Root @ gy01 ~] # Mount-t nfs 192.168.0.11:/u2/img_server/u1/img_server-o proto = tcp-o nolock
Question 2. for some reason, 208 is not mounted, and the data written by the program is written under/u1/img_server on the local disk, to avoid Overwriting data under/u1/img_server during mounting and write data under this directory to NFS server shared storage, perform the following operations:
Solution:
[Root @ gy208 ~] # Mv img_server img_server.bak
[Root @ gy208 ~] # Mkdir img_server
[Root @ gy208 ~] # Mount 192.168.0.11:/u2/img_server/u1/img_server-t nfs
[Root @ gy208 ~] #/Bin/cp-rf/u1/img_server.bak/img/*/u1/img_server/img
This article is from the "linuxblind open space" blog, please be sure to keep this source http://linuxblind.blog.51cto.com/7616603/1299991