MPICH 完整配置存档
MPICH? 完整配置存檔
提問:chkconfig time on
???? /etc/sysconfig/network-scripts
?????? netconfig -d eth0 --ip=192.168.1.33 --netmask=255.255.255.0 --gateway=192.168.1.253
???? 網(wǎng)關(guān)是DHCP代理服務(wù)器的IP
???? 網(wǎng)關(guān)設(shè)置為…….253? #關(guān)聯(lián)到 arp – a| awk
???? 不能與網(wǎng)段相同
后面可能 要涉及 ,rlogin,telnet,rsh,time等服務(wù) ntsysv
自動配置腳本:
先配ssh,再nfs,再nis
/etc 包含大多數(shù)系統(tǒng)配置文件和初始化腳本
默認(rèn)mpich2安裝位置: /home/cluster/mpich2
?
參考:redhat enterprise linux 服務(wù)器配置與應(yīng)用 實(shí)戰(zhàn)指南
北京:人民郵電出版社 :2007.10
?
?
環(huán)境:
注:心跳線,即為內(nèi)網(wǎng)
主機(jī)0:? 外部聯(lián)網(wǎng):10.10.10.2,192.168.1.1(心跳線) node1-9
客戶端1:外部聯(lián)網(wǎng):10.10.10.3,192.168.1.10(心跳線) node10
客戶端2:外部聯(lián)網(wǎng):10.10.10.4,192.168.1.11(心跳線) node11
NFS:? 共享目錄 /home/cluster
NIS域名: cluster
無主機(jī)域名:
NIS安裝:默認(rèn)
NFS安裝:默認(rèn)
MPICH: /home/cluster/mpich2
log:make.log
運(yùn)行程序: /home/cluster/code
?
Vmware可選改變配置:
1:
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/VMnetDHCP/Parameters/VirtualEthernetSegments/1
192.168.0.16
2:
vmnetdhcp.conf??? 改網(wǎng)段與ip
3:
宿主機(jī)服務(wù) vmware dhcp service 重啟
網(wǎng)卡也重啟
4,配置雙網(wǎng)卡:
?
主從服務(wù)器時的配置:
1,創(chuàng)建共享磁盤:
?? *一塊已有的系統(tǒng)盤;
?? 一塊仲裁盤:分兩個相同的分區(qū),做成裸設(shè)備--存放群集信息;取名為: arbitrate.vmdk
?? 一塊數(shù)據(jù)盤:用于存放apache群集數(shù)據(jù);取名為: share.vmdk
??
?? 添加新磁盤時,必須更改磁盤總線接口為SCSI2:0和SCSI2:1總線(可自定義),但必須與系統(tǒng)盤總線不在同一條線上;
?? 虛擬機(jī)配置文件的修改,禁用磁盤鎖定功能;
? ?在各個虛擬機(jī)配置文件名是:Red Hat Linux.vmx
? ?是一個configuration配置文件(看文件類型),用記事本打開在其中最后加入:
? ?disk.locking="false"
2,在主結(jié)點(diǎn)配置共享磁盤:
1,Fdisk –l 查看
? 2, raw 設(shè)備
在兩臺服務(wù)器上分別編輯/etc/sysconfig/rawdevices文件,將分區(qū)綁定到裸設(shè)備。
#vi /etc/sysconfig/rawdevices
加入
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
重啟服務(wù)
#service rawdevices restart
啟動完成后執(zhí)行
#raw –qa
3,<4.4>格式化數(shù)據(jù)分區(qū):
? ?? ?#mkfs.ext3??/dev/sdc1
?
?
主結(jié)點(diǎn)配置:
一,準(zhǔn)備:
提示: 可以使用命令 ntsysv 一次設(shè)置好相應(yīng)項目的開機(jī)啟動,與chkconfig on? 原理相同
?
1,查看防火墻狀態(tài):service iptables status
關(guān)閉防火墻: service iptables stop
設(shè)置開機(jī)不啟動防火墻: chkconfig iptables off
2,hostname node1
3,/etc/hosts文件:至少需要有個 NIS 服務(wù)器的 IP 與主機(jī)名對應(yīng)
192.168.1.1? node1
192.168.1.10? node10
192.168.1.11? node11
#192.168.1.12? node12
127.0.0.1 ? localhost.localdomain localhost
4,network文件
修改主機(jī)名:
? ?#vi??/etc/sysconfig/network
? ?HOSTNAME=hostname
?
5,創(chuàng)建/etc/hosts.equiv
???? 以上這步放在 配置mpich2處
node1? #給自己放權(quán),這樣在只有一臺機(jī)器時也可以模擬并行計算環(huán)境
node10
node11
?
6,掛載文件系統(tǒng)
?
二,配置NFS
1,安裝nfs軟件包:
Nfs-utils?? 光盤2
Portmap? 光盤2
rpm –qa |grep nfs
rpa –qa |grep portmap
rpm? –ivh? nfs-utils
2, Showmount?? -e? 127.0.0.1? 查看當(dāng)前目錄下發(fā)布多少共享目錄
Showmount?? -e? 192.168.1.10? 查看當(dāng)前目錄下共享了服務(wù)的目錄
2.5 ?chmod 755 /home
???? chmod? 777 /home/cluster
說明:必須注意home/目錄的訪問權(quán)限,必須設(shè)置成777權(quán)限;父目錄/home權(quán)限無要求,普通的755即可;
3,? /etc/exports 文件
加入: 如:共享目錄 [客戶端1 參數(shù)] [客戶端2 參數(shù)]
例1: /home/cluster ?192.168.1.0/24(rw,sync)?? sync 表示同步? rwx
/temp? 192.168.1.0/24(ro)??? 允許這個網(wǎng)段,只讀
或如 :/temp?? *(ro)?? 192.168.1.78(rw)
例2:exportfs –a? 查看所有
?
4,啟動服務(wù)進(jìn)程
chkconfig nfs on
????? chkconfig portmap on
????? #chkconfig nfslock on
????? service portmap start
????? #service nfslock start? ?
????? service nfs start
?
三,配置NIS
0,主要流程:
(1)? 設(shè)置 nis 域名
(2)? ?主配置文件
(3)? 創(chuàng)建nis 數(shù)據(jù)庫
(4)? ?建立信任群
(5)? ?更新加載配置文件或重新啟動nfs服務(wù),使配置生效
1,安裝
ypserv? 光盤3
- ?? ypbind? 1
- ?? portmap 2
- ?? yp-tools? 1
Rpm –qa |grep yp? 查詢
Rpm? –ivh? ypserv 安裝
df
mount? /dev/cdrom/media/
cd /media/Server/
ls |grep ypserv
rpm –ivh ypserv-2.19-3.1386.rpm
2, nisdomainname “domain-name”? #即時生效
3,?? /etc/sysconfig/network?? 加入:
NISDOMAIN=”DOMAIN-NAME”???????? #等號兩邊不能有空格? 這里為cluster
HOSTNAME=” HOSTNAME”?????????????????????? node0 -9
4,?? Vi /etc/rc.d/rc.local?? #加入命令語句:
/bin/nisdomainname “域名“?? ?????????#cluster??????????????
5, vi /etc/ypserv.conf
dns:no, #使用DNS服務(wù)要相應(yīng)有設(shè)置 /etc/hosts文件,讓客戶端找nis服務(wù)器
files:30 #讀入cache的賬號數(shù), 預(yù)設(shè)會有30個數(shù)據(jù)庫被讀入, 如果集群規(guī)模比較大的話就必須設(shè)大一點(diǎn)了, 還有一臺機(jī)可能不止一個賬戶,而且通常都不止
slp:?? no? #使用 spf則yes ,SPF: Shortest Path First,最短路徑優(yōu)先還是
#Servie Port Function,業(yè)務(wù)端口功能。是接入網(wǎng)功能之一。
slp_timeout: 3600 #設(shè)置相關(guān)spf的
#xfr requests are only allowed from ports < 1024?
?xfr_check_port:yes?? #主nis與從nis服務(wù)同步時采用1024以下端口
#Host : Domain : Map : Security
Map:#可以查詢的數(shù)據(jù)庫名稱,*代表所有都可
#Security:?? none 任意,port >1024端口的都不行,deny完全拒絕
127.0.0.1/255.0.0.0:*:*:none?? 允許來自本機(jī)的????????????????
192.168.1.0/255.255.255.0:*:*:none 來自內(nèi)網(wǎng)段的
# * : * : * :deny
6, vi /etc/passwd
#add:?? 密碼為空
7,vi /etc/yp.conf
add: domain “nis域名” server?? “master hostname”
???? ypserver “master hostname”
例:
???? domain cluster server node0
???? ypserver node0
8, touch /etc/netgroup #組允許
空表示:信任所有客戶端
添加只信任的客戶端:
Host:user:zdomain
9,注:在服務(wù)器端,端口111需要打開. 可以在我們的知識庫中得到更到的信息關(guān)于NIS服務(wù)器的安全。
關(guān)閉防火墻或添加規(guī)則
iptables -A INPUT -p tcp --dport 111 -d xxx.xxx.xxx.xxx -j ACCEPT
iptables -A INPUT -p udp -m udp --dport 111 -j ACCEPT
iptables -A OUTPUT -p tcp -? m tcp --dport 111 -j ACCEPT
iptables -A OUTPUT -p udp -m udp --dport 111 -j ACCEPT
10,vi /var/yp/Makefile?????????????? #主從同步
change: NOPUSH=true to? NOPUSH=false
11,/usr/lib/yp/ypinit –m???? #建立數(shù)據(jù)庫
???? ctrl + d? y???????? ?
12,啟動服務(wù)
?? ? service? portmap? restart
service? yppasswdd? restart
service? ypserv? restart
chkconfig portmap?? on
chkconfig yppasswdd? on
chkconfig ypserv? on
13, 測試:
ypwhich
四,配置SSH
1, 安裝Openssh軟件包
Rpm? -qa? |grep? openssh
Rpm? -ivh? /media/cdrom./RedHat/RPMS/openssh-server-3.9.rpm
Rpm? -ivh? /media/cdrom./RedHat/RPMS/openssh……rpm
Rpm? -ivh? /media/cdrom./RedHat/RPMS/openssh……rpm
…..???? 共5個
?
2, /etc/ssh/ssh_config
設(shè)置ssh端口
Port 22
設(shè)置ssh協(xié)議順序
Protocol 2,1??? 表示先用ssh2協(xié)議
設(shè)置ssh綁定ip
ListenAddress 0.0.0.0. 默認(rèn)綁定所有
是否允許root用戶登錄
PermitRootLogin yes
是否允許空密碼用戶登錄
PermitEmptyPasswords? yes???????????? #涉及mpd.conf
是否使用公鑰認(rèn)證
PasswordAuthentication no?? yes表示不使用,而是用密碼驗證
3, 關(guān)閉防火墻或讓防火墻通過,添加規(guī)則:/etc/sysconfig/iptables
iptables ?-I ?INPUT? -p? tcp? --dport? 22? -j? ACCEPT
注: netstat –apn 可查看端口號
4,ssh-keygen –t rsa
5,cp? ~/.ssh/id_rsa.pub?? ~/.ssh/authorized_keys2????????????? # ~表示home目錄
chmod ?go-rwx? ~/.ssh/authorized_keys2
7,ssh-agent? $SHELL
附注:
???? #ssh-agent 的輸出是一系列 bash 命令;如果這些命令被執(zhí)行,則將設(shè)置兩個環(huán)境變量:SSH_AUTH_SOCK 和 SSH_AGENT_PID。內(nèi)含的 export 命令使這些環(huán)境變量對之后運(yùn)行的任何附加命令都可用。
???? #啟動 ssh-agent 的最佳方式就是把上面這行添加到您的 ~/.bash_profile 中
#SSH_AUTH_SOCK 包含有 ssh 和 scp 可以用來同 ssh-agent 建立對話的 UNIX 域套接字的路徑。
8,ssh-add
?
9, 啟動ssh服務(wù)
?/etc/init.d/sshd start? 或用 service sshd start?? 或在“服務(wù)配置” 啟動ssh
自動啟動:? ntsysv?? chkconfig sshd on
?
從結(jié)點(diǎn)配置:node1
一, 準(zhǔn)備
與主結(jié)點(diǎn)相同,hostname 不同而已
二, 配置NFS
1,Showmount?? -e? 127.0.0.1? 查看當(dāng)前目錄下發(fā)布多少共享目錄
Showmount?? -e? 192.168.1.11? 查看當(dāng)前目錄下共享了服務(wù)的目錄
?
2, 創(chuàng)建目錄 mkdir ?-p? /home/cluster
3,mount ?-t? nfs? 192.168.1.1:/home/cluster? /home/cluster
4, df? -lh??? #查看掛載了沒有
5,要卸載可用 umount /home
6,要永久生效:
在文件/etc/fstab 中加入下面一行:#這里/home 是共享目錄
<node0>:/home/cluster ?/home/cluster ?nfs ?defaults ?0 ?0
???? 7,重啟服務(wù):
?chkconfig nfs on
#chkconfig nfslock on
chkconfig portmap on
?service nfs restart
?service portmap ?restart
?#service nfslock ?restart
三, 配置NIS
1,安裝:
?? ypbind
?? yp-tools
1,執(zhí)行命令:
authconfig
這個命令來指定NIS域和NIS服務(wù)器
或
?vi /etc/sysconfig/authconfig
change:
USENIS=yes
USEMD5=yes
USESHADOW=yes
2, vi /etc/passwd
#add:?? 密碼為空
3,vi /etc/yp.conf
add: domain “nis域名” server?? “master hostname”
例:
???? domain cluster server node0
???? ypserver node0
4,vi /etc/nsswitch.conf
change:? passwd: files nis
shadow: files nis
group: files nis
hosts: files nis dns
# vi /etc/pam.d/system-auth ??change : password sufficient …… shadow 后加入 nis
# 上面這步等同于? vi /etc/sysconfig/authconfig 所以不用做
5,通過下面的命令啟動ypbind 和 ypxfrd
service <service- name> start
chkconfig ?<service- name> on
6 同時修改運(yùn)行級別
rpcinfo -p localhost? 查看
7,測試
? ?ypwhich
yptest? 2>&1 | tee file.log?? #結(jié)果到file文件里
?
四, 配置SSH
?
3,ssh-keygen –t rsa
4,scp node1:~/.ssh/*?? ~/.ssh
5,ssh-agent $SHELL?????????????? 干嗎的?
6,ssh-add
7, service sshd restart
? chkconfig sshd on
?
五,MPICH2 安裝配置:只在主服務(wù)器上裝,從服務(wù)器不用 ,但要在客戶端設(shè)置
1, 解壓安裝文件到 /tmp下
2,configure the install distributes
? # cd /tmp/mpich2-1.0.6pl
#./configure? --prefix=/home/cluster/mpich2? 2>&1 | tee configure .log
3,make 2>&1 | tee make.log
4,test the program??? #可選
?cd? tmp/mpich2-1.0.6/examples
?make cpi
/tmp/mpich2-1.0.6/bin/mpirun –np 4 ./cpi
5,install
make install 2>&1 | tee makeinstall.log
將被裝到共享目錄下
10,vi ~/.bash_profile????????? 也可修改 /etc/bashrc? 它是 ~/.bash_profile的子程序
格式如下():
# 軟件名-版本號
PATH=$PATH:路徑1:路徑2:...:路徑n
???? OTHERPATH=$OTHERPATH:……
?
add: ??? export PATH=$PATH:/home/cluster/mpich2/bin
export MANPATH=$MANPATH:/home/cluster/mpich2/man
???????? export MPI_USEP4SSPORT=yes
???????? export MPI_P4SSPORT=22
???????? export P4_RSHCOMMAND=ssh
執(zhí)行 source ~/.bash_profile
要對所有用戶有效則修改:/etc/profile
參見: http://lemeen.blog.163.com/blog/static/14262342006619325320/
7,CHECK THE PATHS
which mpd
which mpicc
which mpiexec
which mpirun
8, new mpd.conf????? #在SSH時 改過? ?
#非root 用戶可以建 在自己的主目錄下 但要加 . 隱藏確保安全 ,即 ~/.mpd.conf
touch /etc/mpd.conf
vi /etc/mpd.conf
add:
MPD_USE_ROOT_MPD=yes
?MPD_SECRETWORD=123456
chmod 600 /etc/.mpd.conf
# MPD_USE_ROOT_MPD=yes
MPD_SECRET_WORD can be unique to each user, but doesn't have to be
MPD_USE_ROOT_MPD specifies that users will not start up their own mpd daemons, but will rely upon attaching to one already running under the root account
?
9 vi /etc/hosts.equiv
?add: node0
???????? node1
???? ??? node2
12,vi ~/.mpd.hosts
???????? add: node0
node1
?node2
13, test
?mpd &
mpdtrace
mpdallexit
mpd &
mpiexec –n 1 /bin/hostname
mpiexec –n 2? 某個程序
mpdboot –n 3? -f mpd.hosts
?
****客戶端和從服務(wù)器: ****
8, new .mpd.conf????? #在SSH處改過
touch /etc/.mpd.conf
vi /etc/.mpd.conf
add:? ??????? MPD_USE_ROOT_MPD=1
MPD_SELRETWORD=123456
chmod 600 /etc/.mpd.conf
9 vi /etc/hosts.equiv
#填node0是給自己放權(quán),這樣在只有一臺機(jī)器時也可以模擬并行計算環(huán)境
?add:??? node0
???????? node1
???? ??? node2
10,vi ~/.bash_profile??????????????? #這步客戶端應(yīng)該不用吧
add: ??? export PATH=$PATH:/home/cluster/mpich2/bin:$PATH?? ?
???????? export MANPATH=$MANPATH:/home/cluster/mpich2/man:$MANPATH??????? ?
???????? export MPI_USEP4SSPORT=yes
???????? export MPI_P4SSPORT=22
???????? export P4_RSHCOMMAND=ssh
執(zhí)行 source ~/.bash_profile
要對所有用戶有效則修改:/etc/profile
12,vi ~/.mpd.hosts
???????? add: node0
node1
?node2
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的MPICH 完整配置存档的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 去除cpp中注释的小程序
- 下一篇: 破解RSA的一些技术