What is NFS?
Network File System (NFS) is a networking protocol for distributed file sharing. A file system defines the way data in the form of files is stored and retrieved from storage devices, such as hard disk drives, solid-state drives and tape drives. NFS is a network file sharing protocol that defines the way files are stored and retrieved from storage devices across networks.
Network File System (NFS) is used by UNIX/LINUX clients for file access. NFS uses port 2049.
In Master Node
- yum install nfs-utils
- systemctl start nfs-server rpcbind
- systemctl enable nfs-server rpcbind
- mkdir /mnt/sharedoc
- chmod 777 /mnt/sharedoc/
- vim /etc/exports
- /mnt/sharedoc 192.168.0.0/16(rw,sync,no_root_squash) # shown in fig 2
- exportfs -r
- firewall-cmd --permanent --add-service=mountd
- firewall-cmd --permanent --add-service=rpc-bind
- firewall-cmd --permanent --add-service=nfs
- firewall-cmd --reload
In Client Node
- yum
install nfs-utils
- showmount
-e 192.168.76.xxx #it will show mount
location, change xxx with your master's ip address
- mkdir
/mnt/nfsdrive
- mount
192.168.76.xxx:/mnt/sharedoc /mnt/nfsdrive/
- df
-h