准備4台centos7主機
調度節點:
10.1.16.30 hmu01
計算節點:
10.1.16.31 hcu01
10.1.16.32 hcu02
10.1.16.33 hcu03
一.修改主機名、/etc/hosts和ip設置
# hostnamectl set-hostname # vim /etc/hosts # vim /etc/sysconfig/network-scripts/ifcfg-ens33
二、ssh 認證
在master上生成id-rsa公鑰
# ssh-kengen
將公鑰傳給其第二台
# ssh-copy-id -i id_rsa.pub root@10.1.16.30
PS:節點多可以寫腳本去做免密
三、NIS服務
調度節點配置
1.安裝NIS服務軟件包
# yum -y install ypserv ypbind yp-tool
2.安裝NFS服務軟件包
# yum -y install nfs-utils rpcbind
3.設置NIS域名
# nisdomainname hpc
4.設定NIS的網域名稱
# echo NISDOMAIN=hpc >> /etc/sysconfig/network
5.增加開機自動加入NIS域
# echo "/bin/nisdomainname hpc" >> /etc/rc.d/rc.local
6.啟動服務
# systemctl start rpcbind
# systemctl start ypserv
7.建立數據庫
# /usr/lib64/yp/ypinit -m
輸入命令后 按鍵 ctrl + D y
8.重啟服務
# systemctl restart ypserv
客戶端
1.安裝NIS相關軟件包
# yum -y install ypbind yp-tool
2.在網絡項加入NIS域
# echo NISDOMAIN=hpc >> /etc/sysconfig/network
3.開機自動加入NIS域
# echo "/bin/nisdomainname hpc" >> /etc/rc.d/rc.local
4.修改用戶密碼的認證順序文件
/etc/nsswitch.conf 文件是用於管理系統中多個配置文件查找的順序,。每一個關鍵字是在/etc/目錄可以被/etc /nsswitch.conf 控制的/etc 文件的,名字搜索順序(從左至右)
Files:搜索本地文件
nis:搜索nis數據庫
dns:查詢DNS
# vim /etc/nsswitch.conf passwd: files nis shadow: files nis group: files nis hosts: files dns nis
5.修改客戶端配置文件
# echo "domain hpc server 10.1.16.30" >> /etc/yp.conf
6.修改系統認證文件
# vim /etc/sysconfig/authconfig 修改USENIS=yes # vim /etc/pam.d/system-auth 修改password sufficient pam_unix.so sha512 shadow nis nullok try_first_pass use_authtok
修改完成以上6項之后,需要啟動服務
systemctl start rpcbind
systemctl start ypbind
若重啟ypbind服務失敗,可能是防火牆與selinux權限問題,若關閉仍然失敗,應該是配置出現錯誤。
7.客戶端檢測
在NIS client 輸入yptest檢測相關測試資料,看能否出現nis服務器端的用戶資料信息。
四、下載軟件包
torque鏈接http://wpfilebase.s3.amazonaws.com/torque/torque-4.1.2.tar.gz(正常)
# wget -c http://wpfilebase.s3.amazonaws.com/torque/torque-4.2.9.tar.gz # tar -zxvf torque-4.2.9.tar.gz # cd torque-4.2.9
五、調度節點的配置
# yum -y install libxml2-devel openssl-devel gcc gcc-c++ boost-devel libtool
編譯安裝
# ./configure --prefix=/software/torque-4.2.9 --with-server-home=/software/torque && make && make packages&& make install #卸載的話是make uninstall server-home是配置文件和log
3.將啟動文件拷貝到/etc/init.d:
# cp contrib/init.d/{pbs_{server,sched,mom},trqauthd} /etc/init.d/
4.服務開機自啟:
# for i in pbs_server pbs_mom trqauthd; do chkconfig --add $i; chkconfig $i on; done
5.設置環境變量,運行./torque.setup root時
# TORQUE=/software/torque-4.2.9 # echo "TORQUE=$TORQUE">>/etc/profile # echo "export PATH=$PATH:$TORQUE/bin:$TORQUE/sbin">>/etc/profile # source /etc/profile # ./torque.setup root
6.啟動pbs_server、pbs_sched、pbs_mom、trqauthd幾個服務
# qterm -tquick # for i in pbs_server pbs_sched pbs_mom trqauthd; do service $i start; done
pbs_server PBS服務守護進程,負責接收作業提交,位於服務節點上
pbs_sched PBS調度守護進程,負責調度作業,位於服務節點上
pbs_mom PBS MOM守護進程, 負責監控本機並執行作業,位於所有計算節點上
7.調度節點配置計算節點的主機名和CPU核數
# vim /software/torque-conf/server_priv/nodes hmu01 np=4 cu #注:此處可以設置每個節點的cpu個數,cu為隊列 hcu01 np=4 hcu02 np=4 hcu03 np=4
六、計算節點配置
1.修改主機名、/etc/hosts和ip設置
# hostnamectl set-hostname # vim /etc/hosts # vim /etc/sysconfig/network-scripts/ifcfg-ens33
2.在調度節點運行下面代碼,將下面文件拷貝到計算節點scp torque-package-{mom,clients}-linux-x86_64.sh hcu01:/root/
# scp contrib/init.d/{pbs_mom,trqauthd} hcu01:/etc/init.d/
# scp torque-package-{mom,clients}-linux-x86_64.sh hcu01:/root/
3.node節點安裝拷貝過來的兩個文件
# ./torque-package-clients-linux-x86_64.sh --install # ./torque-package-mom-linux-x86_64.sh --install
4.配置環境
# vim /software/torque/mom_priv/config $pbsserver hmu01 $logevent 225
5.啟動pbs_mom
# for i in pbs_mom trqauthd; do service $i start; done
八、調度節點
1.重啟服務
# for i in pbs_server pbs_sched pbs_mom trqauthd; do service $i restart; done
2.查看節點是否正常
# qnodes #或者是pbsnodes -a
狀態為free則正常
3.測試:
傳建一個用戶test,切換到該用戶上,然后提交一個任務,重復提交多次,然后回到root用戶,檢測qstat
maui安裝
# tar -zxvf maui-3.3.1.tar.gz # cd maui-3.3.1 # ./configure --prefix=/software/maui-3.3.1 --with-spooldir=/software/maui --with-pbs=/software/torque-4.2.9 # make && make install
# vim /software/maui-conf/maui.cfg
# maui.cfg 3.3.1 SERVERHOST hmu01 # primary admin must be first in list ADMIN1 root # Resource Manager Definition #RMCFG[HMU01] TYPE=PBS RMCFG[HMU01] TYPE=PBS@RMNMHOST@RMTYPE[0] PBS # Allocation Manager Definition AMCFG[bank] TYPE=NONE
MAUI=/software/maui-3.3.1/bin echo "MAUI=$MAUI" >> /etc/profile echo "export PATH=$PATH:$MAUI/bin:$MAUI/sbin" >>/etc/profile source /etc/profile
# cp /software/maui-3.3.1/sbin/maui /etc/init.d/
# vim /software/torque-conf/server_priv/nodes hmu01 np=4 cu hcu01 np=4 cu fat hcu02 np=4 fat hcu03 np=4 cu
# qmgr -c 'p s' #查看隊列及配置
創建新的隊列
create queue cu set queue cu queue_type = Execution set queue cu resources_default.neednodes = cu set queue cu resources_default.walltime = 1200:00:00 set queue cu enabled = True set queue cu started = True
# service pbs_server restart
# service maui restart
注意關閉一個服務
# service pbs_sched stop
# chkconfig pbs_sched off
計算節點
# service pbs_mom restart
安裝總結:
主機名提前設置好,並填寫在/etc/hosts中 ,安裝過程中不能修改。
如果修改了主機名,
如果中途修改控制節點的名字,計算節點還是找之前的pbs_server
第一步:我們需要修改計算節點的/var/spool/torque/server_name成新的名字
第二步:修改控制節點的解壓縮路徑,./torqure.setup root 如下圖所示
第三步:重啟服務
for i in pbs_server pbs_sched pbs_mom trqauthd; do service $i start; done
計算節點:重啟for i in pbs_mom trqauthd; do service $i start; done
如果任務無法提交,我們需要配置nis環境
注意:hmu01上的服務要開啟 chkconfig ypserv on
10/10/2017 19:08:22;0008;PBS_Server.87491;Job;req_commit;job_id: 131581.nb01
10/10/2017 19:08:30;0001;PBS_Server.87491;Svr;PBS_Server;LOG_ERROR::chk_job_torun, attempt to start job in non-started queue
10/10/2017 19:08:30;0080;PBS_Server.87491;Req;req_reject;Reject reply code=15004(Invalid request MSG=attempt to start job in non-started queue), aux=0, type=RunJob, from test@nb01
(1)Job id 是任務的標識符,Name 是任務名稱,User是任務所有者,Time Use 是CPU使用時間,S 是任務當前狀態(本例中 R表示正在運行),Queue表示任務所在隊列。任務的狀態如下:
* B 只用於任務向量,表示任務向量已經開始執行
* E 任務在運行后退出
* H 任務被服務器或用戶或者管理員阻塞
* Q 任務正在排隊中,等待被調度運行
* R 任務正在運行
* S 任務被服務器掛起,由於一個更高優先級的任務需要當前任務的資源
* T 任務被轉移到其它執行節點了
* U 由於服務器繁忙,任務被掛起
* W 任務在等待它所請求的執行時間的到來(qsub -a)
* X 只用於子任務,表示子任務完成
(2) qstat 命令—用於查詢作業狀態信息 命令格式:qatat [-f][-a][-i] [-n][-s] [-R] [-Q][-q][-B][-u] 參數說明:
-f jobid 列出指定作業的信息
-a 列出系統所有作業
-i 列出不在運行的作業
-n 列出分配給此作業的結點
-s 列出隊列管理員與scheduler所提供的建議
-R 列出磁盤預留信息
-Q 操作符是destination id,指明請求的是隊列狀態
-q 列出隊列狀態,並以alternative形式顯示
-au userid 列出指定用戶的所有作業
-B 列出PBS Server信息
-r 列出所有正在運行的作業
-Qf queue 列出指定隊列的信息
-u 若操作符為作業號,則列出其狀態。
若操作符為destination id,則列出運行在其上的屬於user_list中用戶的作業狀態
配置調度策略--------根據具體的業務推薦相應的調度算法。
調度策略的配置文件的路徑:/var/spool/torque/sched_priv/sched_config
vi sched_config
1. Round Robin -
# run a job from each queue before running second job from the
# first queue.
round_robin: False all ##########輪訓的調度方式
2.By Queue
by_queue: True prime
by_queue: True non_prime 由隊列進行調度,如果沒有配置,服務器就像個大的隊列,就忽略隊列。 True
3.Strict Fifo 先到優先
strict_fifo: false ALL
4 fair_share 公平的調度策略
5 help_starving_jobs 飢餓優先 true
6 sort_queues 按優先級進行調度 true
7 load_balancing 分時的負載均衡調度
8 sort_by: 關鍵性排序 multi_sort和sory_by
如果有了round_robin和by_queue調度的話就按他們的調度算法
9 # different sorts - defined in globals.c
# no_sort shortest_job_first longest_job_first smallest_memory_first
# largest_memory_first high_priority_first low_priority_first multi_sort
# fair_share large_walltime_first short_walltime_first
#
# PRIME OPTION
sort_by: shortest_job_first ALL
10 ignored queues
# you can specify up to 16 queues to be ignored by the scheduler
#ignore_queue: queue_name 忽略隊列,您可以指定要被調度程序忽略的16個隊列
*****this defines how long before a job is considered starving. If a job has
# been queued for this long, it will be considered starving
# NO PRIME OPTION
max_starve: 24:00:00
這定義了一個工作被認為是飢餓之前多久。如果一份工作
等待了這么久,它會被認為是飢餓的
# The following three config values are meaningless with fair share turned off 以下三個配置值是沒有意義的公平共享關閉
1 # half_life - the half life of usage for fair share
# NO PRIME OPTION
half_life: 24:00:00 公平共享使用的半衰期為24個小時
2 # unknown_shares - the number of shares for the "unknown" group
# NO PRIME OPTION
unknown_shares: 10
3# sync_time - the amount of time between syncing the usage information to disk
# NO PRIME OPTION
sync_time: 1:00:00 # sync_time -同步使用信息到磁盤的時間