溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

NFS服務(wù)器的安裝與配置方法

發(fā)布時(shí)間:2021-09-18 02:12:39 來源:億速云 閱讀:156 作者:chen 欄目:云計(jì)算

這篇文章主要介紹“NFS服務(wù)器的安裝與配置方法”,在日常操作中,相信很多人在NFS服務(wù)器的安裝與配置方法問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”NFS服務(wù)器的安裝與配置方法”的疑惑有所幫助!接下來,請(qǐng)跟著小編一起來學(xué)習(xí)吧!

## 本次實(shí)驗(yàn)用來實(shí)現(xiàn)ssh免密碼登錄的密鑰共享,避免了當(dāng)集群中節(jié)點(diǎn)增加后還要手動(dòng)一一配置原所有節(jié)點(diǎn)與新節(jié)點(diǎn)之間的免密登錄的問題

## 在每個(gè)節(jié)點(diǎn)上都安裝NFS 
[root@hadoop4 ~]# yum -y install nfs-utils rpcbind

## 檢測(cè)是否安裝 nfs rpcbind
[root@hadoop4 ~]# rpm -qa | grep nfs
nfs4-acl-tools-0.3.3-6.el6.x86_64
nfs-utils-lib-1.1.5-9.el6.x86_64
nfs-utils-1.2.3-54.el6.x86_64
[root@hadoop4 ~]# rpm -qa | grep rpcbind
rpcbind-0.2.0-11.el6.x86_64

## 設(shè)置開機(jī)啟動(dòng)
[root@hadoop4 ~]# chkconfig rpcbind on
[root@hadoop4 ~]# chkconfig nfs on

## 啟動(dòng)服務(wù)
[root@hadoop4 ~]# service rpcbind start
[root@hadoop4 ~]# service nfs start
啟動(dòng) NFS 服務(wù):                                            [確定]
關(guān)掉 NFS 配額:                                            [確定]
啟動(dòng) NFS mountd:                                          [確定]
啟動(dòng) NFS 守護(hù)進(jìn)程:                                        [確定]
正在啟動(dòng) RPC idmapd:                                      [確定]

## 查詢NFS服務(wù)器狀態(tài)
[root@hadoop4 ~]# service nfs status
rpc.svcgssd 已停
rpc.mountd (pid 10816) 正在運(yùn)行...
nfsd (pid 10832 10831 10830 10829 10828 10827 10826 10825) 正在運(yùn)行...
rpc.rquotad (pid 10811) 正在運(yùn)行...

## 在服務(wù)器端(機(jī)器名hadoop4),設(shè)置共享目錄(設(shè)置共享目錄為/home/grid/),編輯修改/etc/exports
[root@hadoop4 ~]# vim /etc/exports
/home/grid *(rw,sync,no_root_squash)

## 在服務(wù)器端重啟 rpcbind 和 nfs 服務(wù)(注意要先重啟rpcbind,后重啟nfs)
[root@hadoop4 ~]# service rpcbind restart
[root@hadoop4 ~]# service nfs restart

## 驗(yàn)證
[root@hadoop4 ~]# showmount -e 192.168.0.106
Export list for 192.168.0.106:
/home/grid *

## 在客戶端(機(jī)器名hadoop5、hadoop6)將共享目錄掛載到本地(客戶端不需要啟動(dòng)rpcbind和nfs服務(wù)即可掛載)
[root@hadoop5 ~]# mkdir /nfs_share
[root@hadoop5 ~]# mount -t nfs 192.168.0.106:/home/grid /nfs_share

## 查看
[root@hadoop5 ~]# mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
Desktop on /media/sf_Desktop type vboxsf (gid=493,rw)
Desktop on /mnt/Desktop type vboxsf (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.0.106:/home/grid on /nfs_share type nfs (rw,vers=4,addr=192.168.0.106,clientaddr=192.168.0.107)

## 設(shè)置開機(jī)自動(dòng)掛載,在客戶端修改/etc/fstab,增加一行
[root@hadoop5 ~]# vim /etc/fstab
192.168.0.106:/home/grid /nfs_share nfs defaults 1 1

## 刪除原來分發(fā)的密鑰文件,使用掛載過來的密鑰
## 將每個(gè)節(jié)點(diǎn)的公鑰文件都發(fā)送到服務(wù)器端,在服務(wù)器端將所有的公鑰文件追加到 ~/.ssh/authorized_keys 文件中
## authorized_keys 文件生成的過程就不演示了
## 在各節(jié)點(diǎn)創(chuàng)建共享目錄文件 authorized_keys 的軟連接(注意authorized_keys 文件權(quán)限為644)
[root@hadoop5 ~]# mv /home/grid/.ssh/authorized_keys  /home/grid/.ssh/authorized_keys.bak
[root@hadoop5 ~]# ln -s /nfs_share/.ssh/authorized_keys /home/grid/.ssh/authorized_keys


到此,關(guān)于“NFS服務(wù)器的安裝與配置方法”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI