




已閱讀5頁,還剩57頁未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
集群架設(shè)鐘毅 廈門大學(xué)物理學(xué)系復(fù)雜系統(tǒng)研究室 2012年8月前言集群就是一堆計算機(jī)通過某種方式聯(lián)系在一起的統(tǒng)一的整體.它有一個主節(jié)點(diǎn),負(fù)責(zé)管理賬戶,回答用戶的請求,以及命令其它計算機(jī)即子節(jié)點(diǎn)(計算節(jié)點(diǎn))完成某項任務(wù). 為了能夠給子節(jié)點(diǎn)下命令,我們必須搭建SSH服務(wù),并且要達(dá)到無密碼互訪(因?yàn)樽庸?jié)點(diǎn)要反饋計算結(jié)果或者其它信息給主節(jié)點(diǎn));為了管理用戶賬號的方便,我們要建立NIS服務(wù),而要建立NIS服務(wù),又必須先搭建NFS服務(wù). NFS服務(wù)的一項重要的功能是,把主節(jié)點(diǎn)的某個或者某些目錄共享給子節(jié)點(diǎn),這樣,只要在主節(jié)點(diǎn)的共享區(qū)域安裝了某個軟件,那么該軟件就可以被所有子節(jié)點(diǎn)利用.我們復(fù)雜系統(tǒng)小組的成員都喜歡編寫Fortran程序,所以我們有必要安裝Fortran編譯器-ifort軟件,這是intel公司提供的免費(fèi)Fortran編譯器.又考慮到我們經(jīng)常要進(jìn)行大規(guī)模模擬計算,這就必須安裝MPICH2這個并行計算軟件. 此外,我們還必須安裝Torque這個作業(yè)管理器,對用戶提交的作業(yè)進(jìn)行管理.有必要說明的是,這里展示的是每種軟件的安裝步驟,以及遇到問題時的處理方法;這里面沒有對各種軟件的功能進(jìn)行詳細(xì)的解說喲,也沒有對linux的命令進(jìn)行解說,要知道它們的功能,請參看最后面列出的參考文獻(xiàn)吧. 還有一點(diǎn)必須說明,之所以整理這個安裝筆記,是為了讓師弟師妹們在自己架設(shè)集群的時候有一份比較完整的參考資料. 好了,廢話少說,開始動手吧,O(_)O哈哈 一安裝與連接internet兩臺電腦Hostname分別為centos1,centos21. 安裝CentOS6.3 , 分區(qū)的時候選擇如下方式centos1的分區(qū):/ : 90GB/var : 10GB/tmp : 10GBSwap : 3GB/disk1 : 20GBcentos2的分區(qū):/ : 20GB/var : 10GB/tmp : 10GBSwap : 3GB/disk2 : 90GB選擇安裝basic server 的安裝包。2. 連接internet以root 用戶登錄,然后分別做如下的事情a. 設(shè)IProotcentos1 # vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0BOOTPROTO=staticBROADCAST=55HWADDR=00:26:2D:D0:69:18IPADDR=07NETMASK=GATEWAY=NM_CONTROLLED=yesONBOOT=yesTYPE=EthernetUUID=001bde85-8379-4fcc-9b4e-8f98260f5893以上涂了顏色的為新加的b. 啟動網(wǎng)卡rootcentos1 # ifup eth0rootcentos1 # /etc/init.d/network restartc. 看是否正常啟動了rootcentos1 # ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:26:2D:D0:69:18 inet addr:07 Bcast:55 Mask: inet6 addr: 2001:da8:e800:100:226:2dff:fed0:6918/64 Scope:Global inet6 addr: fe80:226:2dff:fed0:6918/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:747 errors:0 dropped:0 overruns:0 frame:0 TX packets:34 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:81563 (79.6 KiB) TX bytes:4544 (4.4 KiB) Interrupt:18出現(xiàn)IP了就是正常啟動了。d. 設(shè)置DNS的IProotcentos1 # vi /etc/resolv.confnameserver nameserver 0e. 檢查是否能夠解析域名了rootcentos1 # nslookup Server: Address: #53Non-authoritative answer: canonical name = .Name: Address: 47出現(xiàn)IP了就是設(shè)置成功了。f. 調(diào)整時間,設(shè)置成現(xiàn)在的時間rootcentos1 # date -s 07/26/2012Thu Jul 26 00:00:00 CST 2012rootcentos1 # date -s 17:10:15Thu Jul 26 17:10:15 CST 2012rootcentos1 # clock wg. 對于centos2 重復(fù)以上步驟就可以了?,F(xiàn)在就可以坐在某一臺WIN7電腦前,用putty 同時登錄兩臺電腦了。centos1 的 IP :07centos2 的 IP :08二兩臺電腦間(即節(jié)點(diǎn)間)創(chuàng)建SSH信任連接1. 在centos1 與 centos2中分別建立可以信任的主機(jī)的Hostname與它的IP的對應(yīng) a. rootcentos1 # vi /etc/hosts localhost07 centos08 centos2rootcentos1 # hostnamecentos1rootcentos1 # hostname -i07 b. rootcentos2 # vi /etc/hosts localhost08 centos207 centos1rootcentos2 # hostnamecentos2rootcentos2 # hostname -i082. 我們的目標(biāo)是a) 在節(jié)點(diǎn)centos1和centos2中有相同的用戶,以及相同的用戶賬號密碼b)可以在任意一節(jié)點(diǎn)上直接用當(dāng)前的賬號登陸到其它節(jié)點(diǎn)上去,而不用密碼(A)如果兩臺主機(jī)之間沒有建立NFS與NIS服務(wù),則執(zhí)行下面的步驟:1)用root賬戶把centos1(主結(jié)點(diǎn))上的 /etc/passwd, /etc/shadow/, /etc/group/, /etc/gshadow/ 復(fù)制到其它節(jié)點(diǎn)上去。(rootcentos1 #scp /etc/passwd root08:/etc/passwd ).2) 執(zhí)行以下命令在centos1中以cv登陸,a. cvcentos1 $ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/cv/.ssh/id_rsa):Created directory /home/cv/.ssh.Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /home/cv/.ssh/id_rsa.Your public key has been saved in /home/cv/.ssh/id_rsa.pub.上面涂了顏色的后面直接用回車就可以。b.cvcentos1 $ ls -aldrwx-. 2 cv cv 4096 Jul 27 16:30 .sshc.cvcentos1 .ssh$ ls al-rw-. 1 cv cv 1675 Jul 27 16:30 id_rsa-rw-r-r-. 1 cv cv 392 Jul 27 16:30 id_rsa.pub在centos2中以cv登陸,重復(fù)以上步驟,最后cvcentos2 .ssh$ ls -al-rw-. 1 cv cv 1679 Jul 27 16:30 id_rsa-rw-r-r-. 1 cv cv 392 Jul 27 16:30 id_rsa.pub就是說在centos1與centos2中的 /home/cv/.ssh/目錄下,都產(chǎn)生了私匙id_rsa 與公匙id_rsa.pub。我們應(yīng)該把這兩個公匙的內(nèi)容集中起來,放入同一個文件authorized_keys中,然后把這個文件再分別放入centos1與centos2中的 /home/cv/.ssh/目錄下,并且改變權(quán)限:chmod 600 authorized_keys 然后就可以了。用到的命令為(要按順序進(jìn)行操作)cvcentos2 .ssh$ cp id_rsa.pub authorized_keyscvcentos1 .ssh$ scp id_rsa.pub cvcentos2:/home/cv/cvcentos2 $ cat id_rsa.pub ./.ssh/authorized_keyscvcentos2 .ssh$ scp authorized_keys cvcentos1:/home/cv/.ssh/然后,在centos2上cvcentos2 .ssh$ ssh centos1Last login: Fri Jul 27 16:48:12 2012 from centos2cvcentos1 $在centos1上cvcentos1 .ssh$ ssh centos2Last login: Fri Jul 27 16:29:53 2012 from 39cvcentos2 $可見,已經(jīng)不用密碼就相互登錄了。(B) 如果兩臺主機(jī)之間已經(jīng)建立NFS與NIS服務(wù),則執(zhí)行下面的步驟:1)用root 用戶登錄主節(jié)點(diǎn),然后執(zhí)行以下命令root # useradd -g complex -m chong01(注:新增用戶chong01,強(qiáng)制建立/home/chong01目錄)root # passwd chong01New UNIX password:Retype new UNIX password:passwd: password updated successfullyroot # /usr/lib/yp/ypinit m (注:這里是更新主節(jié)點(diǎn)上的NIS數(shù)據(jù)庫,讓子節(jié)點(diǎn)也認(rèn)識新用戶)At this point, we have to construct a list of the hosts which will run NISservers. BlueMoon3 is in the list of NIS server hosts. Please continue to addthe names for the other hosts, one per line. When you are done with thelist, type a . next host to add: BlueMoon3 next host to add: (注:這邊直接按ctrl+d組合鍵)The current list of NIS servers looks like this:BlueMoon3Is this correct? y/n: y yWe need a few minutes to build the databases.Building /var/yp/complexlab/ypservers.2)用新建立的賬號chong01登錄主節(jié)點(diǎn),執(zhí)行以下命令chong01 $ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/chong01/.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:open /home/chong01/.ssh/id_rsa failed: Permission denied.(注:權(quán)限不夠)Saving the key failed: /home/chong01/.ssh/id_rsa.chong01 $ ls -aldrw- 2 chong01 complex 4096 2012-07-27 16:58 .ssh/-rw-r-r- 1 chong01 complex 181 2012-07-27 16:58 .vimrcchong01 $ chmod +x .ssh (注:修改權(quán)限)chong01 $ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/chong01/.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /home/chong01/.ssh/id_rsa.Your public key has been saved in /home/chong01/.ssh/id_rsa.pub.The key fingerprint is:ee:ce:2e:27:07:ec:4d:28:09:32:9c:4e:5f:bf:a6:2e chong01BlueMoon3chong01 $ cd .sshchong01 .ssh$ ls -al-rw- 1 chong01 complex 1675 2012-07-27 17:01 id_rsa-rw-r-r- 1 chong01 complex 399 2012-07-27 17:01 id_rsa.pubchong01 .ssh$ cp id_rsa.pub authorized_keys (注:這一步非常重要)chong01 .ssh$ ssh anna01The authenticity of host anna01 () cant be established.RSA key fingerprint is 06:21:14:d4:02:f2:3f:d3:40:67:13:d6:32:c2:7c:2e.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added anna01, (RSA) to the list of known hosts.Last login: Fri Jul 27 11:04:31 2012 from bluemoon3chong01anna01 $可見,已經(jīng)可以無密碼登錄子節(jié)點(diǎn)anna01了。說明:1)主節(jié)點(diǎn)上架設(shè)了NFS與NIS服務(wù),子節(jié)點(diǎn)把主節(jié)點(diǎn)的/home掛載到自己的/home目錄上;所以當(dāng)主節(jié)點(diǎn)上新增用戶時,要重新建立數(shù)據(jù)庫;同時,由于SSH以無密碼方式登錄別的節(jié)點(diǎn)時,是比較兩個節(jié)點(diǎn)的$HOME/.ssh/目錄下面文件authorized_keys里面的內(nèi)容,所以這個文件一定要建立;又由于主節(jié)點(diǎn)與子節(jié)點(diǎn)共用/home,因此只要建立這個文件且把公匙放進(jìn)去就能無密碼訪問了。特別注意,NIS的作業(yè)在于,主節(jié)點(diǎn)與所有子節(jié)點(diǎn)上的賬號密碼都是一樣的。2) 權(quán)限問題最重要。比如用chongyi登錄:chongyicentos1 $ ls al drwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 root root 4096 Jul 28 10:07 test (即/home/chongyi/下有屬于root的目錄test)chongyicentos1 $ cd test-bash: cd: test: Permission denied (即chongyi無權(quán)限進(jìn)入test目錄)chongyicentos1 $ chmod 777 testchmod: changing permissions of test: Operation not permitted (即chongyi無權(quán)修改test目錄的權(quán)限)chongyicentos1 $ su - (用戶切換成root)Password:rootcentos1 # cd /home/chongyirootcentos1 chongyi# ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 root root 4096 Jul 28 10:07 testrootcentos1 chongyi# chown -R chongyi:chongyi test (把test的賬號與用戶組都改為chongyi)rootcentos1 chongyi# ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 chongyi chongyi 4096 Jul 28 10:07 test (目錄test已經(jīng)屬于chongyi)rootcentos1 chongyi# su - chongyichongyicentos1 $ ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 chongyi chongyi 4096 Jul 28 10:07 testchongyicentos1 $ cd testchongyicentos1 test$ (chongyi可以進(jìn)入test目錄)chongyicentos1 test$ cd .chongyicentos1 $ ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 chongyi chongyi 4096 Jul 28 10:07 testchongyicentos1 $ chmod u-x test (test目錄去掉x的權(quán)限)chongyicentos1 $ ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrw-. 2 chongyi chongyi 4096 Jul 28 10:07 testchongyicentos1 $ mkdir ./test/test2mkdir: cannot create directory ./test/test2: Permission denied (無x權(quán)限后無法在test目錄下新建東西)chongyicentos1 $ chmod u+x test (test目錄加上x的權(quán)限)chongyicentos1 $ ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 chongyi chongyi 4096 Jul 28 10:07 testchongyicentos1 $ mkdir ./test/test2 (在test目錄下新建目錄test2)chongyicentos1 $ cd testchongyicentos1 test$ ls -aldrwxrwxr-x. 2 chongyi chongyi 4096 Jul 28 10:25 test2 (在test目錄下成功建立了目錄test2)分析下面的權(quán)限:drwxr-xr-. 2 cv complex 4096 Jul 28 10:25 test9d:代表test9是目錄test9屬于用戶cv的,test9屬于complex組的cv對test9的權(quán)限為rwxcomplex組的成員對test9的權(quán)限為r-x其它別的用戶,別的組的成員對test9的權(quán)限為r-3)安裝套件或者執(zhí)行過程中遇到問題時,首先檢查文件或者目錄的所有者以及所在的用戶組,看它們的權(quán)限是什么;其次,要檢查該文件或者目錄的權(quán)限是不是套件所允許的,比如上面的authorized_keys ,SSH只允許它的權(quán)限是600時,才可以使用SSH無密碼互訪;再次,要檢查該文件或者目錄的所有者以及所在的用戶組是不是套件所允許的,比如PBS作業(yè)管理系統(tǒng)就是不允許root提交作業(yè);當(dāng)然,還要檢查防火墻中是否開了套件需要的端口,以及套件之間相互依賴的套件是否有啟動等等。4)在添加新用戶時,要強(qiáng)制建立用戶home目錄,所以useradd命令要用-m參數(shù);另外在刪除用戶時,一定要連同用戶的家目錄一起刪除,如userdel r username ,不然的話,刪除一個用戶后,再添加一個新的用戶時,有的系統(tǒng)會把這個新用戶安排在被刪除用戶的家目錄中,這樣會產(chǎn)生一堆的權(quán)限問題。三建立NFS服務(wù)建立之前要明確幾件事:1) NFS服務(wù)器端與NFS客戶端的賬號關(guān)系a. 每個賬號都分配有UID與GID,這個可以通過/etc/passwd查看rootcentos1 # cat /etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologinchongyi:x:500:500:/home/chongyi:/bin/bashcv:x:501:501:/home/cv:/bin/bash賬號:密碼(x代表已經(jīng)轉(zhuǎn)移到/etc/shadow):UID:GID:用戶信息說明:家目錄:默認(rèn)使用的shell文件系統(tǒng)的inode記錄的是UID與GID,不是賬號與組名,即一個賬號能不能讀取文件,取決于它的UID與GID.b. 不同的主機(jī),即使建立了相同的賬號,但是主機(jī)分配給它們的UID與GID不一定是相同的.c. 客戶端進(jìn)入服務(wù)器端讀取文件時,客戶端無論以什么賬號登陸,最后都會映射成為服務(wù)器主機(jī)上面的一個賬號,如,客戶端以cv賬號,UID=501登錄服務(wù)器端,如果服務(wù)器端UID=501對應(yīng)的賬號為cv01,那么客戶端的身份變?yōu)閏v01,如果UID=501在服務(wù)器端不存在,則此時服務(wù)器端將把客戶端壓縮為匿名者,分配給它的賬號為nfsnobody ,而且UID=65534.d. 客戶端進(jìn)入服務(wù)器端讀取文件的權(quán)限,取決于兩個方面,一個方面是它被映射成為服務(wù)器端上賬號所能讀取的權(quán)限;另外一方面取決于服務(wù)器端/etc/exports中規(guī)定的客戶端的權(quán)限;一旦任何一方面給它限制說不能進(jìn)行什么樣的操作,則就不能進(jìn)行那方面操作.e. 為了讓客戶端的賬號與服務(wù)器端的賬號一一對應(yīng),就必須引進(jìn)NIS服務(wù)器了.2) 設(shè)置開機(jī)自啟動某項服務(wù)通常可以用chkconfig , ntsysv命令或者在/etc/rc.d/rc.local中寫入啟動某項服務(wù)的命令即可:a. 用chkconfig命令啟動某項服務(wù),它是有前提的,就是該服務(wù)的運(yùn)行腳本必須放在/etc/init.d/中,可以用如下命令查看chkconfig管理的服務(wù)中是否有你需要的,rootcentos1 # chkconfig -list |moreabrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:offabrt-oops 0:off 1:off 2:off 3:on 4:off 5:on 6:off.你也可以自己寫一個腳本,即某個服務(wù),先放入/etc/init.d/中,然后用相關(guān)的命令把它轉(zhuǎn)化為chkconfig管理開啟關(guān)閉服務(wù)的命令為rootcentos1 # chkconfig - -level 0123456 service_name on|off再用下面命令確認(rèn)是否已經(jīng)成功rootcentos1 # chkconfig - -list | grep service_name其中,等級0,1,2,3,4,5,6是系統(tǒng)的運(yùn)行等級,不同等級意味著系統(tǒng)開機(jī)初始化時開啟的服務(wù)是不一樣的,比如等級3對應(yīng)的是“完整的含有網(wǎng)絡(luò)功能的純文本模式”,等級5是“完整的含有網(wǎng)絡(luò)功能的X Window模式”.可以用下面的命令查看當(dāng)前你的主機(jī)運(yùn)行等級rootcentos1 # runlevelN 3實(shí)例:rootcentos1 #chkconfig -level 35 ypserv on它代表無論是系統(tǒng)運(yùn)行在等級3還是等級5,在開機(jī)初始化過程中自動開啟ypserv服務(wù).b. 由于/etc/rc.d/rc.local是一個腳本,它是系統(tǒng)開機(jī)初始化完成之后,去讀取其中的命令的,因此只需要把開啟某項服務(wù)的命令寫到里面去就可以了.例如,開機(jī)后自動關(guān)閉防火墻可以這樣子:rootcentos1 # vi /etc/rc.d/rc.local#!/bin/sh# This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff.touch /var/lock/subsys/localservice iptables stop (新加入的內(nèi)容) c. 用chkconfig命令啟動的服務(wù)先于用/etc/rc.d/rc.local 開啟的服務(wù) d. 有好多個服務(wù),如果有規(guī)定開啟的順序,則,如果用chkconfig命令,那么必須在/etc/init.d/中找到這些服務(wù)的腳本,然后打開它,找到下面那一行chkconfig: xx xx xx ,其中xx是數(shù)字修改第二組數(shù)字xx的值,就可以規(guī)定這些服務(wù)的順序了(修改之后必須用命令重新把這些服務(wù)加入chkconfig管理).如果是用/etc/rc.d/rc.local管理,由于它是一個腳本,因此放在前面的就首先開啟啦.e. 當(dāng)有多個服務(wù),要求規(guī)定開啟順序時,推薦使用/etc/rc.d/rc.local,因?yàn)橛胏hkconfig要修改各個服務(wù)的腳本,這會引起混亂(萬一一個服務(wù)還和別的服務(wù)有先后依賴關(guān)系,則混亂了).3) 開啟|關(guān)閉防火墻的命令有:rootcentos1 # /etc/init.d/iptables status (查看狀態(tài))rootcentos1 # /etc/init.d/iptables stop (關(guān)閉)rootcentos1 # /etc/init.d/iptables start (開啟)或者rootcentos1 # service iptables statusrootcentos1 # service iptables stoprootcentos1 # service iptables start (當(dāng)設(shè)置了開機(jī)自動關(guān)閉后,可以用這命令重新開啟防火墻)開機(jī)自動關(guān)閉可以:rootcentos1 # chkconfig -level 35 iptables off或者,在/etc/rc.d/rc.local中寫入/etc/init.d/iptables stop或者寫入service iptables stop4) 什么是命令?其實(shí)命令只是一個可執(zhí)行的腳本而已;什么是命令的參數(shù)?其實(shí)它們只是腳本的參數(shù)而已.例如,rootcentos1 # which man (對應(yīng) “腳本 腳本參數(shù)$0 $1 $2 ” )/usr/bin/man (腳本輸出值)命令行的which 其實(shí)就是一個可執(zhí)行腳本,而man 是第一個參數(shù)$0 . 之所以在任何目錄下都可以用which ,因?yàn)樗褀hich這個腳本的絕對路徑加入了PATH這個全局環(huán)境變量中;所以,當(dāng)你自己寫了一個可執(zhí)行腳本,為了讓它在所有目錄下都可以執(zhí)行,只需把該腳本所在的絕對路徑加入PATH中.5)安裝NFSa. 在centos1也就是主節(jié)點(diǎn),上安裝NFS Serverrootcentos1 # yum install rpcbind (centos6.3版本中,portmap變改名為rpcbind,是RPC主程序)rootcentos1 # yum install nfs-utils (是NFS的核心,主程序) rootcentos1 # mkdir -p /cluster/server (設(shè)置/disk1的掛載點(diǎn))rootcentos1 # vi /etc/exports (設(shè)置共享內(nèi)容)/home 08(rw,async,no_root_squash)/disk1 08(rw,async,no_root_squash) 07(rw,async,no_root_squash)rootcentos1 # /etc/init.d/rpcbind start (啟動RPC)rootcentos1 # vi /etc/rc.d/rc.local (設(shè)置成開機(jī)自啟動)#!/bin/sh# This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff.touch /var/lock/subsys/local/etc/init.d/rpcbind startrootcentos1 # exportfs rv (掛載/etc/exports的設(shè)置)exporting 08:/disk1exporting 07:/disk1exporting 08:/homerootcentos1 # /etc/init.d/nfslock start (開啟nfslock,并且設(shè)為開機(jī)自啟動)Starting NFS statd: OK rootcentos1 # /etc/init.d/nfs start (啟動NFS)Starting NFS services: OK Starting NFS quotas: OK Starting NFS mountd: OK Stopping RPC idmapd: OK Starting RPC idmapd: OK Starting NFS daemon: OK rootcentos1 # vi /etc/rc.d/rc.local (設(shè)置成開機(jī)自啟動).touch /var/lock/subsys/local/etc/init.d/rpcbind start/etc/init.d/nfslock stop /etc/init.d/nfslock start/etc/init.d/nfs stop (先關(guān)掉)/etc/init.d/nfs start (再開啟)注:為什么先關(guān)掉再開啟,因?yàn)榕虏恍⌒挠胏hkconfig設(shè)了nfs,這樣nfs會先于RPC啟動,可是RPC必須先于NFS啟動,這樣NFS才可以向RPC注冊.rootcentos1 cluster# mount -t nfs -o rw,bg,soft 07:/disk1 /cluster/server rootcentos1 disk1# ls al (查看/disk1的內(nèi)容)drwxr-xr-x. 2 root root 4096 Jul 30 11:10 hahadrwx-. 2 root root 16384 Jul 26 06:46 lost+foundrootcentos1 disk1# cd /cluster/serverrootcentos1 server# ls al (/cluster/server中的內(nèi)容和/disk1下的一樣,掛載成功)drwxr-xr-x. 2 root root 4096 Jul 30 11:10 hahadrwx-. 2 root root 16384 Jul 26 06:46 lost+found rootcentos1 server# vi /etc/rc.d/rc.local (加入開機(jī)自動掛載中)./etc/init.d/nfs startmount -t nfs -o rw,bg,soft 07:/disk1 /cluster/serverb. 在centos2也就是子節(jié)點(diǎn),上安裝NFS Clientrootcentos2 # yum install rpcbind (centos6.3版本中,portmap變改名為rpcbind,是RPC主程序)rootcentos2 # yum install nfs-utils (是NFS的核心,主程序) rootcentos2 # mkdir -p /cluster/server (設(shè)置/disk1的掛載點(diǎn))rootcentos2 # /etc/init.d/rpcbind startrootcentos2 # /etc/init.d/nfslock startrootcentos2 # /etc/init.d/nfs startrootcentos2 # showmount -e 07 (檢查是否連接成功)clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)以上說明出錯了,在于防火墻沒有設(shè)置,因此,在centos1和centos2上都關(guān)閉防火墻rootcentos1 # service iptables stoprootcentos2 # service iptables stoprootcentos2 # showmount -e 07 Export list for 07:/disk1 07,08/home 08rootcentos2 # mount -t nfs -o rw,bg,soft 07:/home /homerootcentos2 # mount -t nfs -o rw,bg,soft 07:/disk1 /cluster/serverrootcentos2 # cd /cluster/server (檢查是否掛載成功)rootcentos2 server# ls al (centos2中/cluster/server里面的內(nèi)容和centos1中/disk1下的內(nèi)容一樣,成功了)drwxr-xr-x. 2 root root 4096 Jul 30 11:10 hahadrwx-. 2 root root 16384 Jul 26 06:46 lost+foundrootcentos2 server# vi /etc/rc.d/rc.local (把以上內(nèi)容放入開機(jī)自啟動中)#!/bin/sh# This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff.touch /var/lock/subsys/localservice iptables stop/etc/init.d/rpcbind start/etc/init.d/nfslock stop/etc/init.d/nfslock start/etc/init.d/nfs stop/etc/init.d/nfs start mount -t nfs -o rw,bg,soft 07:/home /homemount -t nfs -o rw,bg,soft 07:/disk1 /cluster/server并且,一定要把service iptables stop 寫入centos1中/etc/rc.d/rc.local中開機(jī),重啟兩臺電腦,看能否創(chuàng)建文件rootcentos
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年中考?xì)v史中國近代史基礎(chǔ)知識測試題(選擇專項)
- 《神經(jīng)內(nèi)科疾病診療》課件
- 品質(zhì)部培訓(xùn)資料
- 訂民宿房間合同協(xié)議
- 郴電國際供用電合同協(xié)議
- 網(wǎng)絡(luò)安全設(shè)備銷售與安裝服務(wù)合同
- 支付定金手房地產(chǎn)轉(zhuǎn)讓合同
- 人才招聘居間服務(wù)合同
- 房地產(chǎn)銷售協(xié)議合同
- 服裝公司協(xié)議書
- 四下勞動實(shí)踐試題及答案
- 醫(yī)療機(jī)構(gòu)經(jīng)營情況說明范文
- 動物交換合同范本
- 月子中心產(chǎn)康部產(chǎn)后恢復(fù)流程解析
- GB/T 24628-2025醫(yī)療保健產(chǎn)品滅菌生物與化學(xué)指示物測試設(shè)備
- 熱電材料與器件-深度研究
- 輻照下金屬材料微觀損傷行為的分子動力學(xué)模擬研究
- 2024-2025學(xué)年統(tǒng)編版道德與法治八年級下冊第四單元檢測卷(含答案)
- 影視行業(yè)國際化發(fā)展的標(biāo)準(zhǔn)化研究-洞察分析
- 建筑裝飾工程材料供應(yīng)合同及質(zhì)量免責(zé)協(xié)議
- 2025新人教版英語七年級下不規(guī)則動詞表
評論
0/150
提交評論