1 Basic Architecture for NFS
The NFS network File system is also the networked filesystem.
NFS was first developed by Sun, 2,3,4 three editions, 2 and 3 were drafted by Sun, and 4.0 began to be involved and led by NetApp, with the latest version of 4.1
NFS data transfer is based on the RPC protocol, and RPC is a shorthand for remote Procedure call, which translates to a long-distance procedure invocation.
The NFS Application scenario is: A,b,c three machines need to ensure that the files are accessed is the same, a shared data out, B and C respectively to mount A shared data directory, so B and C access to the data and a consistent. NFS allows files and directories to be shared between different machines through the network. Similar to the shared folder mechanism used by WinDOS over a local area network. The NFS Mount structure diagram is as follows:
After the server is set up with a shared directory/public, other clients with Access to NFS servers can mount the directory locally, and the client's use of the directory depends on the specific authorization configuration of that directory, such as read-only, on the service side.
2 Principle of NFS communication
1) First NFS server starts the RPC service and turns on port 111
2) server continues to start the NFS service and registers port information with RPC.
3) Client initiates RPC service, requests NFS port information to server RPC
4) Server RPC feedback NFS port information to client
5) The client establishes and sever the NFS connection by acquiring the NFS port and transmits the data.
Summary: NFS itself does not have a cross-network communication mechanism, relying on the RPC protocol, the unified Management of NFS port, so as to achieve normal communication.
3 server-Side installation configuration
yum install -y nfs-utils rpcbindvim /etc/exports //加入如下内容/home/nfstestdir 192.168.226.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000)保存配置文件后,执行如下准备操作mkdir /home/nfstestdirchmod 777 /home/nfstestdirsystemctl start rpcbind //从前面原理中得知须先启动rpc,后启动nfssystemctl start nfssystemctl enable rpcbind systemctl enable nfs
4 Description of NFS configuration options
RW Read/write
RO Read Only
Sync sync mode, memory data is written to disk in real time
Async non-synchronous mode, which indicates that the in-memory data is written to disk periodically
No_root_squash Client Mounts NFS shared directory, the root user is not constrained and permissions are large
Root_squash with the above option, the root user on the client receives a constraint that is limited to a normal user
All_squash all users on the client are limited to an ordinary user when using the NFS shared directory
Anonuid/anongid is used with the above options to define the UID and GID of the qualified user
Linux Learning Summary (47) NFS service configuration on the previous page