最后檢驗 xCAT 是否安裝成功,xCAT daemon(xcatd)是否已經(jīng)成功地運行起來。 -bash-3.2# lsdef -t site -l Setting the name of the site definition to 'clustersite'. Object name: clustersite consoleondemand=yes installdir=/install master=192.168.186.1 tftpdir=/tftpboot useSSHonAIX=no xcatdport=3001 xcatiport=3002 -bash-3.2# ps -aef |grep xcat|grep -v grep root 483400 507916 0 02:19:50 - 0:00 xcatd: install monitor root 504060 507916 0 02:19:50 - 0:00 xcatd: UDP listener root 507916 1 0 02:19:50 - 0:00 xcatd: SSL listener root 516350 507916 0 02:19:50 - 0:00 xcatd: DB Access
配置 xCAT 參數(shù)
定義集群網(wǎng)絡(luò)對象:包括配置集群中所有網(wǎng)絡(luò)的網(wǎng)絡(luò)地址、掩碼和網(wǎng)關(guān)等等。在這里,我們使用 mkdef 命令定義一個名為 net1 的 network 對象, 網(wǎng)絡(luò)地址是 192.168.186.0,子網(wǎng)掩碼是 255.255.255.0,網(wǎng)關(guān)是 192.168.186.1: -bash-3.2# mkdef -t network -o net1 net=192.168.186.0 mask=255.255.255.0 gateway=192.168.186.1 Object definitions have been created or modified.
選擇遠程命令執(zhí)行(Remote Command Execution)。xCAT 默認是在 AIX 集群節(jié)點上建立 Secure Shell(SSH),如果要改用的 Remote Shell(RSH)話,可以 chdef 命令來修改: -bash-3.2# lsdef -t site -l Setting the name of the site definition to 'clustersite'. Object name: clustersite consoleondemand=yes installdir=/install master=192.168.186.1 tftpdir=/tftpboot useSSHonAIX=yes xcatdport=3001 xcatiport=3002 -bash-3.2# chdef -t site -o clustersite useSSHonAIX=no Object definitions have been created or modified.
配置網(wǎng)絡(luò)名稱解析。可以選擇同步各個節(jié)點的 /etc/hosts,或者也可以直接采用一個 DNS 域名服務(wù)器。 如果采用 /etc/hosts 的機制,則可以在創(chuàng)建 xCAT 各個節(jié)點定義后再運行 makehosts 腳本,從而自動生成得到 /etc/hosts 文件。 我們采用直接建立一個 DNS 域名服務(wù)器的方法(例如 DNS 服務(wù)器 IP 地址是“9.181.2.1”,管理節(jié)點的 IP 地址是“192.168.186.1”時): -bash-3.2# chdef -t site domain= mycluster.com nameservers= 192.168.186.1
forwarders=9.181.2.1 Object definitions have been created or modified. -bash-3.2# cat /etc/resolv.conf search mycluster.com nameserver 192.168.186.1 -bash-3.2# mkdef -t network -o net1 net=192.168.186.0 mask=255.255.255.0 gateway=192.168.186.1 Object definitions have been created or modified. -bash-3.2# makedns Setup of DNS complete. -bash-3.2# startsrc -s named 0513-059 The named Subsystem has been started. Subsystem PID is 372810.
檢查 xCAT 所依賴的系統(tǒng)服務(wù)是否正常運行。查看 /etc/inetd.conf 文件,檢查 inetd 服務(wù)是否已經(jīng)包含 telnet, ftp, bootp/dhcp 等等服務(wù),還要檢查用于給各個集群節(jié)點安裝系統(tǒng)時候需要的 NFS 和 TFTP 服務(wù)是否正常運行。可以使用 lssrc 命令查看各個服務(wù)是否處于 active 狀態(tài): -bash-3.2# lssrc -ls inetd Subsystem Group PID Status inetd tcpip 229540 active Debug Not active Signal Purpose SIGALRM Establishes socket connections for failed services. SIGHUP Rereads the configuration database and reconfigures services. SIGCHLD Restarts the service in case the service ends abnormally. Service Command Description Status pmv5 /etc/pmdv5 pmdv5 active xmquery /usr/bin/xmtopas xmtopas -p3 active wsmserver /usr/websm/bin/wsmserver wsmserver -start active time internal active daytime internal active time internal active daytime internal active ntalk /usr/sbin/talkd talkd active tftp /usr/sbin/tftpd tftpd -n active bootps /usr/sbin/bootpd bootpd /etc/bootptab active exec /usr/sbin/rexecd rexecd active login /usr/sbin/rlogind rlogind active shell /usr/sbin/rshd rshd active telnet /usr/sbin/telnetd telnetd -a active ftp /usr/sbin/ftpd ftpd active -bash-3.2# lssrc -s nfsd Subsystem Group PID Status nfsd nfs 307350 active -bash-3.2# lssrc -s tftpd Subsystem Group PID Status tftpd tcpip 315546 active
將我們的 HMC 服務(wù)器的定義加入 xCAT 數(shù)據(jù)庫中:使用 mkdef 命令創(chuàng)建名為 myhmc 的 node 類型對象,其中該對象的屬性采用 groups 為 all 的對象的默認屬性, nodetype 節(jié)點類型為 hmc,mgt 硬件管理采用 hmc,并指定用戶名及密碼。然后就可以運行 xCAT 腳本 rscan 收集得到由該 HMC 服務(wù)器管理的所有 LPAR 節(jié)點的硬件信息了。 將得到的所有節(jié)點的硬件信息同樣使用 mkdef 命令定義到 xCAT 數(shù)據(jù)庫的節(jié)點對象中。最后,可以使用 nodels 命令列出已經(jīng)定義成功的節(jié)點名。 -bash-3.2# mkdef -t node -o myhmc groups="all" nodetype=hmc mgt=hmc username=hscroot password=abc1234 Object definitions have been created or modified. -bash-3.2# lsdef -t node -o myhmc -l Object name: myhmc groups=all mgt=hmc nodetype=hmc password=abc1234 username=hscroot -bash-3.2# rscan myhmc -z > /tmp/mystanzafile -bash-3.2# cat /tmp/mystanzafile | mkdef -z Object definitions have been created or modified. -bash-3.2# nodels myhmc IBMPServer-8203-E4A-SN0681864 lparp520s1 lparp520s2 lparp520s3 lparp520s4
獲取主機 MAC 地址 所有等待著被安裝操作系統(tǒng)的目標節(jié)點,它們的適配器 MAC 地址也是必須獲取后添加到 xCAT 數(shù)據(jù)庫中的,這些地址之后還將被加到 NIM 資源定義中。 通過運行 xCAT 的 getmacs 腳本從節(jié)點獲取 MAC 地址。這個腳本可以獲取到目標節(jié)點的以太網(wǎng)適配器的 MAC 地址。在調(diào)用這個腳本之前有必要先調(diào)用 makeconservercf 腳本(該腳本用來生成一個新的 conserver 配置文件并且重新啟動 conserver daemon,所以每次集群的節(jié)點變化后都有必要運行該腳本。) -bash-3.2# makeconservercf -bash-3.2# getmacs all
初始化 NIM 資源的定義 通過調(diào)用 xCAT 的 xcat2nim 腳本并以 xCAT 數(shù)據(jù)庫里的信息為依據(jù)創(chuàng)建出 NIM 節(jié)點和組的定義。例如,我們?nèi)绻蛩阍?lparp520s1 節(jié)點上安裝 AIX 獨立系統(tǒng), 先用 xcat2nim 命令根據(jù) xcat 中的 node 類型對象 lparp520s1 生成 nim 對象,接著可以使用 lsnim 來查看新創(chuàng)建對象的屬性,最后使用 nimnodeset 命令初始化該節(jié)點對象。 -bash-3.2# xcat2nim -t node lparp520s1 NIM operations have completed successfully. -bash-3.2# lsnim -l lparp520s1 lparp520s1: class = machines type = standalone connect = shell platform = chrp netboot_kernel = 64 if1 = net1 lparp520s1 00215E7AF9E2 ent cable_type1 = N/A Cstate = ready for a NIM operation prev_state = ready for a NIM operation Mstate = not running -bash-3.2# nimnodeset -i 610BaseImage lparp520s1 AIX/NIM nodes were initialized.
第一步同樣是制作 diskless 無盤系統(tǒng)啟動鏡像文件。 diskless 無盤計算節(jié)點在啟動時候是從 NIM 主機獲取操作系統(tǒng)文件并加載的。NIM 主機通過 NFS 給無盤節(jié)點提供網(wǎng)絡(luò)啟動鏡像、root 文件目錄以及 /usr 文件目錄,也就是 Shared Product Object Tree (SPOT)。下面我們通過前面已經(jīng)創(chuàng)建出的 diskfull 有盤節(jié)點 610BaseImage 系統(tǒng)鏡像的 lpp_source 資源來創(chuàng)建 diskless 無盤計算節(jié)點的 Shared Product Object Tree (SPOT)。 同樣使用的是 mknimimage 命令:-t 參數(shù)指明鏡像類型,默認是 diskfull 的,所以這里要指定為 diskless;-s 指定源目標文件位置,創(chuàng)建命名為 610_diskless 的無盤系統(tǒng)鏡像。 -bash-3.2# mknimimage -t diskless -s 610BaseImage_lpp_source 610_diskless Creating a NIM SPOT resource. This could take a while. The following xCAT osimage definition was created. Use the xCAT lsdef command to view the xCAT definition and the AIX lsnim command to view the individual NIM resources that are included in this definition. Object name: 610_diskless dump=610_diskless_dump imagetype=NIM lpp_source=610BaseImage_lpp_source nimtype=diskless osname=AIX paging=610_diskless_paging root=610_diskless_root spot=610_diskless
獲取主機 MAC 地址 與 diskfull 有盤計算節(jié)點的該步安裝步驟相同,所以這里不再描述。
初始化 NIM 資源的定義 與 diskfull 有盤計算節(jié)點的該步安裝不同的是,這里我們使用 mkdsklsnode 命令來初始化 NIM 資源的定義,其中 -i 參數(shù)用來指定將用于初始化目標節(jié)點 lparp520s4 的鏡像名稱: -bash-3.2# mkdsklsnode -i 610_diskless lparp520s4 Copying NIM resources to the xCAT service nodes. This could take a while. Creating a SPOT resource on lparp520s4. This could take a while. lparp520s4: Initializing NIM machine 'lparp520s4'. This could take a while. Fri Apr 16 05:07:18 CDT 2010 lparp520s4: AIX/NIM diskless nodes were initialized.
遠程硬件控制(rpower 等腳本命令):啟動、關(guān)閉、重啟、狀態(tài)查詢等等。例如可以使用 rpower 命令關(guān)閉 off 或是啟動 on 某個節(jié)點: -bash-3.2# rpower lparp520s1 off -bash-3.2# rpower lparp520s1 on
遠程終端管理(rcons、wcons 等腳本命令)。例如可以使用 rcons 來控制管理 lparp520s1 目標節(jié)點: -bash-3.2# rcons lparp520s1 [Enter `^Ec?' for help] u [hosts] lparp520s1 * up root@localhost [disconnect]
可以將需要安裝的軟件文件集更新到 lpp_source 文件夾下,從而通過重建 NIM 鏡像和操作系統(tǒng)鏡像文件(nimnodecust 腳本命令)的辦法達到安裝軟件的目的: 例如首先使用 nim 的 update 操作來更新 610BaseImage_lpp_source 資源:屬性參數(shù) source 指定將增加的軟件源文件目錄的位置,gencopy_flags 指定 gencopy 操作時的屬性, packages=ALL 表明增加源文件目錄下的所有文件集。接著使用 mknimimage 命令重建出名為 610BaseImage_update 的操作系統(tǒng)鏡像文件:-m 參數(shù)指定 nim 安裝方式,-s 指定資源源文件; -bash-3.2# nim -o update -a source=/tmp/openssh -a gencopy_flags=X -a packages=ALL 610BaseImage_lpp_source -bash-3.2# mknimimage -m rte -s 610BaseImage_lpp_source 610BaseImage_update Creating a NIM SPOT resource. This could take a while. The following xCAT osimage definition was created. Use the xCAT lsdef command to view the xCAT definition and the AIX lsnim command to view the individual NIM resources that are included in this definition. Object name: 610BaseImage_update bosinst_data=update_bosinst_data imagetype=NIM lpp_source=610BaseImage_lpp_source nimmethod=rte nimtype=standalone osname=AIX spot=update -bash-3.2# nimnodecust -s 610BaseImage_lpp_source -b xCATaixSSL,xCATaixSSH lparp520s1
也可以采用修改 xCAT 軟件的 postscripts 配置腳本,使得所需軟件將在節(jié)點安裝操作系統(tǒng)后接著執(zhí)行軟件的安裝: 例如通過 chdef 命令增加 setupntp 系統(tǒng)服務(wù)啟動到 postscripts。也可以將自行創(chuàng)建 aixOpensslinstall 配置文件, 接著同樣使用 chdef 將該啟動腳本加入到目標節(jié)點 lparp520s1 的 postscripts 中; -bash-3.2# tabdump postscripts #node,postscripts,comments,disable
"xcatdefaults","syslog,aixremoteshell,otherpkgs,syncfiles",,
"service","servicenode",, -bash-3.2# chdef -t node -o xcatdefaults postscripts="syslog,aixremoteshell,otherpkgs,syncfiles,setupntp"Object definitions have been created or modified. New object definitions 'xcatdefaults' have been created. -bash-3.2# cat /install/postscripts/aixOpensslinstall #!/bin/ksh echo "start aixOpensslinstall script" >>/tmp/aixOpensslinstall.log logger -t xcat "start aixOpensslinstall script"RESNAME=$NODE NFSSERVER=$MASTER POSTDIR=/post POST_DIR=${INSTALLDIR}${POSTDIR} logger -t xcat "Install: mounting /post"mkdir $POSTDIR >>/tmp/aixOpensslinstall.log mount $NFSSERVER:$POST_DIR $POSTDIR >>/tmp/aixOpensslinstall.log sleep 2 installp -aXg -Y -d$POSTDIR/otherpkgs/AIX openssl.man.en_US openssl.license openssl.base >>/tmp/aixOpensslinstall.log installp -aXg -Y -d$POSTDIR/otherpkgs/AIX openssh.msg.en_US openssh.license openssh.base openssh.base.server openssh.base.client >>/tmp/aixOpensslinstall.log unmount $POSTDIR -bash-3.2# chdef -t node -o lparp520s1 postscripts="aixOpensslinstall"Object definitions have been created or modified.