Fourteen weeks of NFS introduction, NFS server installation and configuration, NFS configuration options

Introduction to NFS

NFS is the abbreviation of Network File System.
NFS was first developed by Sun. Protocol, RPC is short for Remote Procedure Call.
The NFS application scenario is: the three machines A, B, and C need to ensure that the files to be accessed are the same, A shares the data, B and C mount the data directory shared by A respectively, so that B and C can access The data is consistent with that on A

Fourteen weeks of NFS introduction, NFS server installation and configuration, NFS configuration options

NFS server installation configuration

First install two packages on the server
yum install -y nfs-utils rpcbind The
client installs only one package
yum install -y nfs-utils
Then edit vim /etc/exports on the server and add a line /home/nfstestdir target IP/ port(rw,sync,all_squash,anonuid=1000,anongid=1000).
It is mainly divided into three parts, the first part is the shared directory, the second part is the ip to allow access, which can be an IP or an IP segment, and the third part is the permission options in parentheses.
Then save and exit.
Then create a directory mkdir /home/nfstestdir and change the permissions to 777, chmod 777 /home/nfstestdir
start rpcbind systemctl start rpcbind
start nfs systemctl start nfc
start rpcbind systemctl enable rpcbind
start nfc systemctl enable nfs

NFS configuration options

rw Read-write
ro Read-only
sync Synchronous mode, memory data is written to disk in real time
async Asynchronous mode
no_root_squash After the client mounts the NFS shared directory, the root user is not restricted and has great permissions.
root_squash Compared with the above options, the root on the client The user is constrained to be limited to a common user
all_squash All users on the client are limited to a common user
anonuid/anongid when using NFS shared directories Use with the above options to define the uid and gid of the limited user

The client mounts
showmount -e IP //The ip is the NFS server ip
. If the connection fails, we need to close the firewalls of the server and the client first, and selinux.
systemctl stop firewalld closes the firewall
setenforce 0 closes selinux

mount -t nfs server IP:/home/nfstestdir /mnt df -h mount
and then create a file in it, and then go back to /home/nfstestdir on the server to see that there is a file that is the same as the client .

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326772332&siteId=291194637