rhel 6以前rpcbind为portmap
在两个节点都进行配置,互为服务器和客户端:
查看软件是否安装:
[root@node1 ~]# rpm -aq|egrep "nfs-utils|rpcbind"
nfs-utils-lib-1.1.5-6.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
nfs-utils-1.2.3-39.el6.x86_64
如未安装请使用安装光盘进行安装:
检查服务是否开机启动:
[root@node1 ~]# chkconfig --list|egrep "nfs-utils|rpcbind"
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@node1 ~]# chkconfig --list|egrep "nfs|rpcbind"
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
修改nfs要映射的目录:
[root@node1 ~]# more /etc/exports
/arch1 node2(rw,sync,no_root_squash)
在第二台服务器上配置(配置同上):
[root@node2 ~]# rpm -aq|egrep "nfs-utils|rpcbind"
nfs-utils-lib-1.1.5-6.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
nfs-utils-1.2.3-39.el6.x86_64
[root@node2 ~]# chkconfig --list|egrep "nfs|rpcbind"
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@node2 ~]# more /etc/exports
/arch2 node1(rw,sync,no_root_squash)
启动rpcbind服务和nfs服务:
[root@node1 ~]# service rpcbind start
Starting rpcbind: [ OK ]
[root@node1 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]
[root@node2 ~]# service rpcbind start
Starting rpcbind: [ OK ]
[root@node2 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]
修改/etc/fstab文件:
[root@node1 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri May 27 12:08:43 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/sysvg-LogVol00 / ext4 defaults 1 1
UUID=396d126c-0bba-42b7-8cf7-0e7fbe913c24 /boot ext4 defaults 1 2
UUID=a3e29be2-66cd-4e5f-8adb-56a9a3d6d9c8 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
node2:/arch2 /arch2 nfs rw,bg,hard,nointr,wsize=32768,rsize=32768,vers=4,timeo=600 0 0
[root@node2 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri May 27 12:20:53 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/sysvg-LogVol00 / ext4 defaults 1 1
UUID=7a21bb9a-2092-4cfb-b6ed-c570c68abec6 /boot ext4 defaults 1 2
UUID=fad2b0cf-e67c-4113-83e7-e8043f5da9f5 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
node1:/arch1 /arch1 nfs rw,bg,hard,nointr,wsize=32768,rsize=32768,vers=4,timeo=600 0 0
mount nfs文件系统:
[root@node1 ~]# mount -a
[root@node1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sysvg-LogVol00 35G 24G 9.3G 73% /
tmpfs 939M 137M 802M 15% /dev/shm
/dev/sda1 504M 40M 439M 9% /boot
node2:/arch2 35G 13G 21G 39% /arch2
[root@node2 ~]# mount -a
[root@node2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sysvg-LogVol00 35G 13G 21G 39% /
tmpfs 939M 135M 805M 15% /dev/shm
/dev/sda1 504M 40M 439M 9% /boot
node1:/arch1 35G 24G 9.3G 73% /arch1
可以看到两个服务器互相都把另一台服务器上的NFS目录挂载上了。
在两个节点都进行配置,互为服务器和客户端:
查看软件是否安装:
[root@node1 ~]# rpm -aq|egrep "nfs-utils|rpcbind"
nfs-utils-lib-1.1.5-6.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
nfs-utils-1.2.3-39.el6.x86_64
如未安装请使用安装光盘进行安装:
检查服务是否开机启动:
[root@node1 ~]# chkconfig --list|egrep "nfs-utils|rpcbind"
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@node1 ~]# chkconfig --list|egrep "nfs|rpcbind"
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
修改nfs要映射的目录:
[root@node1 ~]# more /etc/exports
/arch1 node2(rw,sync,no_root_squash)
在第二台服务器上配置(配置同上):
[root@node2 ~]# rpm -aq|egrep "nfs-utils|rpcbind"
nfs-utils-lib-1.1.5-6.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
nfs-utils-1.2.3-39.el6.x86_64
[root@node2 ~]# chkconfig --list|egrep "nfs|rpcbind"
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@node2 ~]# more /etc/exports
/arch2 node1(rw,sync,no_root_squash)
启动rpcbind服务和nfs服务:
[root@node1 ~]# service rpcbind start
Starting rpcbind: [ OK ]
[root@node1 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]
[root@node2 ~]# service rpcbind start
Starting rpcbind: [ OK ]
[root@node2 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]
修改/etc/fstab文件:
[root@node1 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri May 27 12:08:43 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/sysvg-LogVol00 / ext4 defaults 1 1
UUID=396d126c-0bba-42b7-8cf7-0e7fbe913c24 /boot ext4 defaults 1 2
UUID=a3e29be2-66cd-4e5f-8adb-56a9a3d6d9c8 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
node2:/arch2 /arch2 nfs rw,bg,hard,nointr,wsize=32768,rsize=32768,vers=4,timeo=600 0 0
[root@node2 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri May 27 12:20:53 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/sysvg-LogVol00 / ext4 defaults 1 1
UUID=7a21bb9a-2092-4cfb-b6ed-c570c68abec6 /boot ext4 defaults 1 2
UUID=fad2b0cf-e67c-4113-83e7-e8043f5da9f5 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
node1:/arch1 /arch1 nfs rw,bg,hard,nointr,wsize=32768,rsize=32768,vers=4,timeo=600 0 0
mount nfs文件系统:
[root@node1 ~]# mount -a
[root@node1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sysvg-LogVol00 35G 24G 9.3G 73% /
tmpfs 939M 137M 802M 15% /dev/shm
/dev/sda1 504M 40M 439M 9% /boot
node2:/arch2 35G 13G 21G 39% /arch2
[root@node2 ~]# mount -a
[root@node2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sysvg-LogVol00 35G 13G 21G 39% /
tmpfs 939M 135M 805M 15% /dev/shm
/dev/sda1 504M 40M 439M 9% /boot
node1:/arch1 35G 24G 9.3G 73% /arch1
可以看到两个服务器互相都把另一台服务器上的NFS目录挂载上了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24668589/viewspace-2125216/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24668589/viewspace-2125216/