apt-get install slurm
slurm -i eth0 # 介面名稱以 ip link 查詢
# 互動熱鍵:l (流量燈) c (經典模式) r (刷新) q (退出)
apt-get install slurm-wlm slurm-wlm-basic-plugins munge
/usr/sbin/create-munge-key
# 將 /etc/munge/munge.key 複製至所有節點,權限 0600、擁有者 munge:munge
scp /etc/munge/munge.key node01:/etc/munge/
scp /etc/munge/munge.key node02:/etc/munge/
# 各節點修正權限並啟動
chown munge:munge /etc/munge/munge.key
systemctl enable --now munge
使用 Slurm Configuration Tool 產生,關鍵參數:
ClusterName=linux-cluster
ControlMachine=ctrl01
ControlAddr=10.0.0.1
SlurmctldPort=6817
SlurmdPort=6818
AuthType=auth/munge
StateSaveLocation=/var/spool/slurm/ctld
SlurmdSpoolDir=/var/spool/slurm/d
SwitchType=switch/none
TaskPlugin=task/affinity
# 節點定義範例
NodeName=node[01-02] CPUs=32 RealMemory=128000 State=UNKNOWN
PartitionName=debug Nodes=node[01-02] Default=YES MaxTime=INFINITE State=UP
將 slurm.conf 分發至所有節點 /etc/slurm-llnl/slurm.conf。
systemctl enable --now slurmctld
systemctl enable --now slurmd
sinfo
# PARTITION AVAIL TIMELIMIT NODES STATE NODELIST
# debug* up infinite 2 idle node[01-02]
srun -N1 hostname
# node01
sbatch --wrap="sleep 60"
squeue
# 觀察作業排程狀態
scontrol update nodename=node01 state=drain reason="maintenance"scontrol update nodename=node01 state=resumescontrol show job scancel PriorityFlags、PriorityWeight* 參數並 systemctl reload slurmctld。slurm_exporter 抓取叢集指標。