Article Directory:
Intro to a .NFS
Two .NFS server configuration
Three .NFS client configuration
Four .NFS service troubleshooting
Intro to a .NFS
NFS is an acronym for Network File System, the Chinese called the Network File System, its main function is through the network (LAN) so that you can share files or directories between different host systems, NFS client (usually an application server, for example, Web) may be NFS server shared data directory is mounted to the NFS client system via a local mount (Mount) manner (that is, at a certain point off) from the local client to see, NFS server shared directory if it is the client's own disk partition or directories, but in fact it is the directory remote NFS server.
Network share NFS network file system like Windows system, security features, network drive mappings, this is also a linux samba similar service, but under normal circumstances, Windows Network Sharing Service or samba service office LAN users to share, while small and medium sized Internet website NFS cluster architecture common back-end data sharing, if large sites, it is possible that will be used in more complex distributed file system moosefs (mfs), GlusterFS.
Two .NFS server configuration
Preparing for Deployment Services 2.1
system version | And the host name of the server roles | IP addresses |
CentOS Linux release 7.6.1810 (Core) | NFS server --General | 192.168.2.8 |
CentOS Linux release 7.6.1810 (Core) | NFS client --Client | 192.168.2.38 |
2.2 NFS check whether the installation package (installed by default):
nfs-utils: nfs service of the main program, including rpc.nfsd, rpc.mountd two daemons and associated documentation files and execute commands
rpcbind: centos6 rpc following main routine (centos5 is under the portmap)
If these packages do not exist, use yum -y install nfs-utils rpcbind install the package, the package is installed after the general user creates nfsnobody
Check for nfsnobody user
2.3 nfs modify the configuration file / etc / exports
# The default configuration file is present, but it is an empty file, it is worth noting that 24 and (no spaces in between below
The configuration file format, there are strict requirements: the shared directories allow access to IP or IP segment (permission)
# Permissions Introduction: rw-- read and write, ro-- read-only; sync-- simultaneously writing data to the memory and hard drive to ensure data is not lost;
save async-- first data to memory, and then written to the hard disk, this efficiency is higher, but the data may be lost;
root_squash-- time when the NFS client to access the root administrator, mapped to the anonymous user NFS server
no_root_squash-- when NFS clients to access when the root administrator, is mapped to the NFS server root administrator
all_aquash-- no matter what NFS client user log in, NFS servers are mapped to the anonymous user
2.4 start the nfs service and add boot from the start, the process of inspection services
View service process is as follows:
2.5 NFS server to view information about --showmount
Note: showmount available command parameters and functions: -e-- display a list of shared NFS servers; -a-- native display case mount the file resources; -d-- List only the directories mounted by some customers; -h - display help information; -v-- version number is displayed.
If you modify the NFS configuration file / etc / exports, you can use the exportfs command to restart the scanning / etc / exports file, without restarting the NFS service
Note: exportfs command commonly used options, -a-- represent all mounting or unmounting; -r-- remount; -u-- uninstall a directory; -v-- display the shared directory
2.6 New Shared directory / data files
Three .NFS client configuration
3.1 Create a directory to mount and mount nfs
3.2 View nfs directory files, and create a new file on the client
In this case, the server / data directory the following files:
The new server also exists in the client document describing the client user has read and write permissions
Four .NFS service troubleshooting
1. First, clear nfs server mount directory name, often can not find the NFS file server, they are mistaken operation and maintenance personnel due to the mount directory;
2. If the client can not mount the nfs service, first check the network problems, ensure that the NFS client to the server of the network flow;
3. The client mount directories can not read and write the file in question, usually caused by insufficient user rights;