Difference between revisions of "Slurm Install"

From CMU ITSC Network
Line 148: Line 148:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== ติดตั้ง Slurm (ต่อ) ====
+
=== ติดตั้ง Slurm (ต่อ) ===
 
[https://www.schedmd.com/downloads.php Download] ไฟล์ติดตั้งมาไว้ที่เครื่อง Headnode ใน Path /var/nfsshare (ในที่นี้เป็นเวอร์ชัน 20.08.4)<syntaxhighlight lang="linux-config">
 
[https://www.schedmd.com/downloads.php Download] ไฟล์ติดตั้งมาไว้ที่เครื่อง Headnode ใน Path /var/nfsshare (ในที่นี้เป็นเวอร์ชัน 20.08.4)<syntaxhighlight lang="linux-config">
 
cd /var/nfsshare
 
cd /var/nfsshare
Line 170: Line 170:
 
</syntaxhighlight>ไปยัง Shared folder ที่เครื่องอื่น ๆ เพื่อลงเหมือนกัน
 
</syntaxhighlight>ไปยัง Shared folder ที่เครื่องอื่น ๆ เพื่อลงเหมือนกัน
  
===== Config Slurm =====
+
==== Config Slurm ====

Revision as of 10:13, 26 November 2021

การติดตั้ง

ทรัพยากรที่ใช้ในการติดตั้ง ประกอบไปด้วยเครื่องทั้งหมด 3 เครื่องโดยให้เครื่องแรกเป็น Headnode จะลง slurmctld, slurmdbd, slurmd ส่วนเครื่องที่เหลือเป็นเครื่อง computenode ลงแค่ตัว slurmd ทั้งหมดเป็น CentOS7

Hostname ip address
slurm-test-01 10.98.6.51
slurm-test-02 10.98.6.52
slurm-test-03 10.98.6.53

แนะนำให้ Login ด้วย Root ในการติดตั้ง เพราะบางคำสั่งจะติด Permission

เปลี่ยน Hostname และเพิ่ม Hosts

hostnamectl set-hostname slurm-test-01

เพิ่ม ip ลงในบรรทัดสุดท้าย

vi /etc/hosts

..
..
10.98.6.51  slurm-test01

Restart network แล้ว Login ใหม่

sudo systemctl restart network
hostnamectl status
exit

สร้าง Global users ให้กับทุก Node

export MUNGEUSER=991
groupadd -g $MUNGEUSER munge
useradd  -m -c "MUNGE Uid 'N' Gid Emporium" -d /var/lib/munge -u $MUNGEUSER -g munge  -s /sbin/nologin munge
export SLURMUSER=992
groupadd -g $SLURMUSER slurm
useradd  -m -c "SLURM workload manager" -d /var/lib/slurm -u $SLURMUSER -g slurm  -s /bin/bash slurm

ตรวจสอบว่าสร้าง user แล้ว

cat /etc/group | grep -e munge -e slurm
และ
cat /etc/passwd | grep -e munge -e slurm

ติดตั้ง Munge

Install REPL repository

yum install epel-release -y

Install Munge

yum install munge munge-libs munge-devel -y

สร้าง Secret key จากเครื่อง Headnode

dd if=/dev/urandom bs=1 count=1024 > /etc/munge/munge.key
chown munge: /etc/munge/munge.key
chmod 400 /etc/munge/munge.key

ก็อป key ไปยังเครื่องที่เหลือ

scp /etc/munge/munge.key root@10.98.6.52:/etc/munge/munge.key
scp /etc/munge/munge.key root@10.98.6.53:/etc/munge/munge.key

SSH ไปยังทุก Node เปลี่ยน Permission แล้วเริ่ม Munge service

chown -R munge: /etc/munge/ /var/log/munge/
chmod 0700 /etc/munge/ /var/log/munge/
systemctl enable munge
systemctl start munge

ทดสอบ Munge ว่าติดต่อไปยังเครื่องอื่นได้หรือไม่ โดยเข้าจาก Headnode

munge -n
munge -n | munge
munge -n | ssh 10.98.6.52 unmunge
remunge

ถ้าไม่เจอ error แสดงว่า Munge ทำงานได้ปกติ

ติดตั้ง Slurm

ติดตั้ง service ต่าง ๆ ที่ Slurm ต้องใช้งาน

yum install openssl openssl-devel pam-devel numactl numactl-devel hwloc hwloc-devel lua lua-devel readline-devel rrdtool-devel ncurses-devel man2html libibmad libibumad -y

ติดตั้ง NFS Server เพื่อ Share folder

NFS Server (Headnode)

สร้างโฟล์เดอร์ที่ต้องการแชร์ที่ไหนก็ได้ โดยในที่นี้จะสร้างไว้ใน /var/nfsshare

yum install nfs-utils -y
systemctl start nfs-server rpcbind
systemctl enable nfs-server rpcbind
mkdir /var/nfsshare
chmod -R 755 /var/nfsshare

ตั้งค่าให้ NFS ทำงานทุกครั้งเมื่อเปิดเครื่อง

systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap

Config ไฟล์สำหรับการแชร์

vi /etc/exports
/var/nfsshare    10.98.6.0/24(rw,sync,no_root_squash,no_all_squash)
exportfs -r
systemctl restart nfs-server

เพิ่ม NFS Service เข้าไปใน Firewall

firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --permanent --zone=public --add-service=mountd
firewall-cmd --permanent --zone=public --add-service=rpc-bind
firewall-cmd --reload
NFS Client (Compute node)

ไปยังเครื่องที่หลือแล้วลง NFS Client

yum install nfs-utils -y

เช็คโฟล์ดอร์ที่มีแชร์จากเครื่องหลัก

showmount -e 10.98.6.51

สร้าง Folder ที่ต้องการให้เห็นไฟล์ที่แชร์มา โดยในที่นี้จะให้เป็น Path เดียวกันกับเครื่อง Headnode พร้อม Mount เข้ามา

mkdir -p /var/nfsshare
mount -t nfs 10.98.6.51:/var/nfsshare /var/nfsshare
วิธี Mount แบบถาวร

ถ้าไม่ทำการ Mount แบบถาวร เมื่อปิดเครื่องแล้วเปิดใหม่ขึ้นมาตัว Folder ที่ Mount จะหายไป ทำให้ต้อง mount ใหม่ถ้าจะใช้งาน

vi /etc/fstab
10.98.6.51:/var/nfsshare /var/nfsshare nfs defaults 0 0
วิธีการ Unmount
umount 10.98.6.51:/var/nfsshare

ติดตั้ง Slurm (ต่อ)

Download ไฟล์ติดตั้งมาไว้ที่เครื่อง Headnode ใน Path /var/nfsshare (ในที่นี้เป็นเวอร์ชัน 20.08.4)

cd /var/nfsshare
yum install wget -y
wget https://download.schedmd.com/slurm/slurm-21.08.4.tar.bz2

ลง rpmbuild

yum install rpm-build
yum install python3 readline-devel 
yum install perl pam-devel perl-ExtUtils\* 
yum install mariadb-server mariadb-devel
yum install gcc gcc-c++ make

Build ไฟล์ที่โหลดมา

rpmbuild -ta slurm-21.8.4.tar.bz2

เมื่อ Build เสร็จจะมี Folder rmbuild ขึ้นมา เข้าไปยังไฟล์ที่ได้จากการ Build

cd rpmbuild/RPMS/x86_64

ลงทุกตัวด้วยคำสั่ง

yum --nogpgcheck localinstall *

ไปยัง Shared folder ที่เครื่องอื่น ๆ เพื่อลงเหมือนกัน

Config Slurm