System environment:
[Email protected] ~]# cat/etc/redhat-release
CentOS Release 6.7 (Final)
[Email protected] ~]#
[Email protected] ~]# uname-r
2.6.32-573.el6.x86_64
[Email protected] ~]# uname-m
x86_64
[Email protected] ~]# Rpm-qa nfs-utils rpcbind
[email protected] ~]# Yum install nfs-utils rpcbind-y
...........
has been installed:
nfs-utils.x86_64 1:1.2.3-64.el6 rpcbind.x86_64 0:0.2.0-11.el6
To be installed as a dependency:
keyutils.x86_64 0:1.4-5.el6 libevent.x86_64 0:1.4.13-4.el6
libgssglue.x86_64 0:0.1-11.el6 libtirpc.x86_64 0:0.2.1-10.el6
nfs-utils-lib.x86_64 0:1.1.5-11.el6 Python-argparse.noarch 0:1.2.1-2.1.el6
Complete!
[Email protected] ~]# Rpm-qa nfs-utils rpcbind
Nfs-utils-1.2.3-64.el6.x86_64
Rpcbind-0.2.0-11.el6.x86_64
[Email protected] ~]#/etc/init.d/rpcbind status
Rpcbind has stopped
[[email protected] ~]#/etc/init.d/rpcbind start
Starting rpcbind: [OK]
[Email protected] ~]#/etc/init.d/rpcbind status
Rpcbind (PID 27104) is running ...
[[email protected] ~]# Lsof-i: 111
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
Rpcbind 27104 RPC 6u IPv4 31439 0t0 UDP *:sunrpc
Rpcbind 27104 RPC 8u IPv4 31442 0t0 TCP *:sunrpc (LISTEN)
Rpcbind 27104 RPC 9u IPv6 31444 0t0 UDP *:sunrpc
Rpcbind 27104 RPC 11u IPv6 31447 0t0 TCP *:sunrpc (LISTEN)
[Email protected] ~]# Netstat-lntup|grep Rpcbind
TCP 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 27104/rpcbind
TCP 0 0::: 111:::* LISTEN 27104/rpcbind
UDP 0 0 0.0.0.0:991 0.0.0.0:* 27104/rpcbind
UDP 0 0 0.0.0.0:111 0.0.0.0:* 27104/rpcbind
UDP 0 0::: 991:::* 27104/rpcbind
UDP 0 0::: 111:::* 27104/rpcbind
[Email protected] ~]# chkconfig--list rpcbind
Rpcbind 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off
[Email protected] ~]# 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
[Email protected] ~]#/ETC/INIT.D/NFS status
RPC.SVCGSSD has stopped
RPC.MOUNTD has stopped
NFSD has stopped
Rpc.rquotad has stopped
[[email protected] ~]#/etc/init.d/nfs start
Start NFS service: [OK]
Turn off NFS quotas: [OK]
Start NFS mountd: [OK]
Start the NFS daemon: [OK]
Starting RPC IDMAPD: [OK]
[[email protected] ~]# Netstat-lntup|grep 2049------NFS Primary Port
TCP 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN-
TCP 0 0::: 2049:::* LISTEN-
UDP 0 0 0.0.0.0:2049 0.0.0.0:*-
UDP 0 0::: 2049:::*-
[Email protected] ~]# 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
100011 1 UDP 875 Rquotad
100011 2 UDP 875 Rquotad
100011 1 TCP 875 Rquotad
100011 2 TCP 875 Rquotad
100005 1 UDP 40562 Mountd
100005 1 TCP 43893 Mountd
100005 2 UDP 53127 Mountd
100005 2 TCP 36081 MOUNTD
100005 3 UDP 56672 Mountd
100005 3 TCP 52133 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 1 UDP 42438 nlockmgr
100021 3 UDP 42438 nlockmgr
100021 4 UDP 42438 nlockmgr
100021 1 TCP 36179 Nlockmgr
100021 3 TCP 36179 Nlockmgr
100021 4 TCP 36179 Nlockmgr
Add to boot:
[Email protected] ~]# cat/etc/rc.local
......
/etc/init.d/rpcbind start
/etc/init.d/nfs start
[Email protected] ~]# ps-ef|egrep "Nfs|rpc"
RPC 27104 1 0 10:35? 00:00:00 Rpcbind
Root 27208 2 0 10:44? 00:00:00 [rpciod/0]
Root 27209 2 0 10:44? 00:00:00 [RPCIOD/1]
Root 27218 1 0 10:44? 00:00:00 Rpc.rquotad disk quotas into town
Root 27223 1 0 10:44? 00:00:00 RPC.MOUNTD Rights Management validation
Root 27230 2 0 10:44? 00:00:00 [NFSD4]
Root 27231 2 0 10:44? 00:00:00 [Nfsd4_callbacks]
Root 27232 2 0 10:44? 00:00:00 [NFSD] =====>NFS main process
Root 27233 2 0 10:44? 00:00:00 [NFSD] =====>NFS main process
Root 27234 2 0 10:44? 00:00:00 [NFSD] =====>NFS main process
Root 27235 2 0 10:44? 00:00:00 [NFSD]
Root 27236 2 0 10:44? 00:00:00 [NFSD]
Root 27237 2 0 10:44? 00:00:00 [NFSD]
Root 27238 2 0 10:44? 00:00:00 [NFSD]
Root 27239 2 0 10:44? 00:00:00 [NFSD]
Root 27270 1 0 10:44? 00:00:00 RPC.IDMAPD
Root 27299 2056 0 10:54 pts/1 00:00:00 grep-e nfs|rpc
[Email protected] ~]# Mkdir/data
[Email protected] ~]# Cat/etc/exports
/data 10.0.0.* (Rw,sync)
[[email protected] ~]#/etc/init.d/nfs Reload Reload Service
[[email protected] ~]# showmount-e 127.0.0.1 ======> View shared records
Export list for 127.0.0.1:
/data 10.0.0.*
[[email protected] ~]# mount-t NFS 10.0.0.7:/data/mnt Mount/data directory under/mnt
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda3 19G 1.5G 16G 9%/
Tmpfs 937M 0 937M 0%/dev/shm
/DEV/SDA1 190M 36M 145M 20%/boot
10.0.0.7:/data 19G 1.5G 16G 9%/mnt ======> mounted successfully
[Email protected] mnt]# Touch/data/oldboy.txt
[Email protected] mnt]# ll/data/
Total dosage 0
-rw-r--r--1 root root 0 November 11:16 oldboy.txt
[[email protected] ~]#/etc/init.d/rpcbind start
Starting rpcbind: [OK]
[Email protected] ~]# chkconfig rpcbind on
[Email protected] ~]# showmount-e 10.0.0.7
Export list for 10.0.0.7:
/data 10.0.0.0/24
Client Mount:
[Email protected] ~]# mount-t NFS 10.0.0.7:/data/mnt
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda3 19G 1.5G 16G 9%/
Tmpfs 937M 0 937M 0%/dev/shm
/DEV/SDA1 190M 36M 145M 20%/boot
10.0.0.7:/data 19G 1.5G 16G 9%/mnt
[[email protected] data]# Touch oldboy.txt =======> Server Create a file oldboy.txt
[email protected] data]# LL
Total dosage 0
-rw-r--r--1 root root 0 November 11:25 oldboy.txt
[email protected] mnt]# LL
Total dosage 0
-rw-r--r--1 root root 0 November 11:25 oldboy.txt ======> client view is present
[[email protected] mnt]# Touch Abc.txt ======> The client does not have permission to write
Touch: Unable to create "Abc.txt": Insufficient permissions
This problem occurs because the permissions are incorrect, the server side needs to authorize this directory, and the permissions are Nfsnobody
[[email protected] data]# chown-r nfsnobody/data/======> Authorized server has write access to/data
[Email protected] data]# ll/data/
Total dosage 0
-rw-r--r--1 nfsnobody Root 0 November 11:25 oldboy.txt ======> Master permissions changed
And then create it on the client
[[email protected] mnt]# Touch abc.txt =======> Client has been able to create files successfully
[Email protected] mnt]#
[[email protected] ~]#/etc/init.d/rpcbind start
Starting rpcbind: [OK]
[Email protected] ~]# chkconfig rpcbind on
[[email protected] ~]# mount-t NFS 10.0.0.7:/data/mnt =======> Mount
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda3 19G 1.5G 16G 9%/
Tmpfs 937M 0 937M 0%/dev/shm
/DEV/SDA1 190M 36M 145M 20%/boot
10.0.0.7:/data 19G 1.5G 16G 9%/mnt =======> mounted successfully
[[email protected] mnt]# Touch 9.txt
[email protected] mnt]# LL
-rw-r--r--1 nfsnobody nfsnobody 0 November 11:41 9.txt
[Email protected] data]# rm-f 9.txt
has been deleted.
Conclusion: Regardless of which NFS directory is created, other clients can delete and solve the shared storage problem.
Check the idea:
1 Ping
2 Telnet
3 if no route to host appears, you must check the firewall and security policy
4 Showmount
This article is from the "Linux" blog, so be sure to keep this source http://chenjisong.blog.51cto.com/7858025/1715888
A Summary of NFS learning