Centos7 torque+maui安装
准备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 -同步使用信息到磁盘的时间