54. NFS introduction, NFS server installation configuration, NFS configuration options

1. Introduction to NFS

  • NFS is short for Network File System
  • NFS was first developed by Sun, and divided into three versions: 2, 3, and 4. 2 and 3 were drafted and developed by Sun, and 4.0 began.
  • Netapp company participated in and led the development, the latest version is 4.1
  • NFS data transmission is based on the RPC 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 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

54. NFS introduction, NFS server installation configuration, NFS configuration options

2. NFS server installation and configuration

yum install -y nfs-utils rpcbind
 vim /etc/exports //加入如下内容
/home/nfstestdir 192.168.127.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000)  //(192.168.127.0/24) 允许链接共享文件的ip或者网段

54. NFS introduction, NFS server installation configuration, NFS configuration options

After saving the configuration file, perform the following preparations

 mkdir /home/nfstestdir
 chmod 777 /home/nfstestdir
  • start nfs service
    systemctl start rpcbind 
    systemctl start nfs
    或者
    systemctl enable rpcbind 
    systemctl enable nfs

    54. NFS introduction, NFS server installation configuration, NFS configuration options

    3. NFS configuration options

  • rw read and write
  • ro Ragnarok Online
  • sync synchronization 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 In contrast to the above options, the root user on the client is constrained and limited to a common user
  • all_squash All users on the client are limited to a common user when using NFS to share directories
  • anonuid/anongid is used in conjunction with the above options to define the uid and gid of the limited user
    54. NFS introduction, NFS server installation configuration, NFS configuration options

The client is mounted (another machine is selected as the client, and the following ip is the server ip). If the connection cannot be made, check the firewall configuration or close the firewall

yum install -y nfs-utils
 showmount -e 192.168.127.128 //该ip为NFS服务端ip
 mount -t nfs 192.168.127.128:/home/nfstestdir /mnt
 df -h
 touch /mnt/test.txt
 ls -l /mnt/test.txt //可以看到文件的属主和属组都为1000

54. NFS introduction, NFS server installation configuration, NFS configuration options

Guess you like

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