In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to build NFS under Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to build NFS under Linux.
A brief introduction to NFS
NFS is the abbreviation of Network File System, that is, the network file system. A distributed document protocol developed by SUN. The function is to enable different machines and different operating systems to share personal data through the network, so that applications can access the data located on the server disk through the network.
NFS relies on RPC protocol in the process of file transfer or information transfer. RPC, remote procedure call (Remote Procedure Call), is a mechanism that enables clients to execute programs in other systems. NFS itself does not provide protocols and functions for information transmission, but NFS allows us to share data through the network, because NFS uses the transmission protocol provided by RPC. It can be said that NFS is a program that uses PRC.
Environment description:
System: CentOS release 6.7 (Final)
NFS IP: 10.219.24.22
Web IP: 10.219.24.25
Iptables: firewall is not running
Operation procedure:
1. Software installation. NFS only needs to install two software, which is usually installed as the default software of the system.
[root@mysql01 ~] # rpm-qa | grep rpcbind*
Rpcbind-0.2.0-11.el6.x86_64
[root@mysql01 ~] # rpm-qa | grep nfs-utils
Nfs-utils-1.2.3-64.el6.x86_64
Nfs-utils-lib-1.1.5-11.el6.x86_64
Description:
[root@mysql01 ~] # yum install rpcbind nfs-utils (install yum if it is not installed)
Rpcbind package: RPC main program under centos
Nfs-utils package: NFS service main program, including basic commands and monitoring programs for NFS
2. Enable RCP service
[root@mysql01 ~] # / etc/init.d/rpcbind start
View rpcbind service port
[root@mysql01 ~] # netstat-antlp | grep rpcbind
Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 01. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 15. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0
Tcp 0 0: 111: * LISTEN 1462/rpcbind
[root@mysql01] # rpcinfo-p localhost
Program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 41757 status
100024 1 tcp 42661 status
3. Enable NFS service
[root@mysql01 ~] # / etc/init.d/nfs start
Starting NFS services: [OK]
Starting NFS quotas: [OK]
Starting NFS mountd: [OK]
Starting NFS daemon: [OK]
Starting RPC idmapd: [OK]
[root@mysql01] # rpcinfo-p localhost
Program vers proto port service
.
100005 3 tcp 59454 mountd
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049 nfs_acl
100227 3 tcp 2049 nfs_acl
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 2 udp 2049 nfs_acl
100227 3 udp 2049 nfs_acl
....
100021 4 tcp 42905 nlockmgr
Note: many newly registered nfs ports should be seen on rpc
Two services boot self-starting
[root@mysql01 ~] # chkconfig rpcbind on
[root@mysql01 ~] # chkconfig nfs on
4. The server configures a shared directory (/ oradata)
4.1 confirm that the rpcbind and nfs service processes are normal before configuration
[root@nfs01 ~] # / etc/init.d/nfs status
[root@nfs01 ~] # / etc/init.d/rpcbind status
[root@nfs01 ~] # ps-ef | egrep "rpc | nfs"
4.2 create a shared directory and authorize ("nfsnobody")
# nfsnobody users are automatically created by the system after the rpc and nfs processes are enabled
[root@mysql01] # df-h
Filesystem Size Used Avail Use% Mounted on
/ dev/sda3 35G 8.9G 25G 27% /
Tmpfs 491m 76K 491m 1% / dev/shm
/ dev/sda1 2.9G 4.5M 2.7G 1% / tmp
/ dev/sr0 3.7G 3.7g 0100% / media/CentOS_6.7_Final
[root@mysql01 ~] # mkdir / oradata
[root@mysql01] # chown-R nfsnobody.nfsnobody / oradata
[root@mysql01 ~] # chmod 777 / oradata
4.3 modify server configuration file (/ etc/exports)
[root@mysql01 ~] # cat / etc/exports
# share / data by andy for XXXX at 20170812
/ oradata 10.219.24.0 Compact 8 (rw,sync)
[root@mysql01 ~] #
4.3 View the configuration loaded by the system
[root@mysql01 ~] # cat / var/lib/nfs/etab
/ oradata 10.219.24.0 Compact 8 (rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)
4.4 reload the service smoothly
[root@mysql01] # showmount-e localhost
5. Client configuration
[root@mysql02 ~] # / etc/init.d/rpcbind status
Rpcbind (pid 1469) is running...
[root@mysql02 ~] # / etc/init.d/rpcbind start
Mount the nfs shared directory
[root@mysql02] # mount-t nfs 10.219.24.22:/oradata / mnt
[root@mysql02] # df-h
Filesystem Size Used Avail Use% Mounted on
/ dev/sda3 35G 8.7g 25g 26% /
Tmpfs 491m 76K 491m 1% / dev/shm
/ dev/sda1 2.9G 4.5M 2.7G 1% / tmp
/ dev/sr0 3.7G 3.7g 0100% / media/CentOS_6.7_Final
10.219.24.22:/oradata
35g 8.9g 25g 27% / mnt
6. Boot and mount automatically
Method 1:
[root@mysql02 ~] # echo "mount-t nfs 10.219.24.22:/oradata / mnt" > > / etc/rc.local
Method 2:
Enable the netfs service
[root@mysql02 ~] # chkconfig netfs on
[root@mysql02 ~] # vi / etc/fstab
[root@mysql02 ~] # cat / etc/fstab
10.219.24.22:/oradata / mnt nfs defaults 0 0
7. Inspection
-- nfs server
[root@mysql01 ~] # touch / oradata/aa
-- client
[root@mysql02 ~] # cd / mnt
[root@mysql02 mnt] # ll
Total 0
-rw-r--r--. 1 root root 0 Aug 13 04:31 aa
Thank you for your reading, the above is the content of "how to build NFS under Linux". After the study of this article, I believe you have a deeper understanding of how to build NFS under Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.