Selepas mini HPC cluster siap (Slurm, Munge, NFS dan OpenMPI — lihat Membina Mini HPC Cluster dengan Slurm), langkah seterusnya ialah storan selari. Catatan ini merekod cara saya membina Lustre di atas lab yang sama.

Skop: untuk lab dan belajar. NFS /home dan /scratch sedia ada tidak diusik.

Versi: Rocky Linux 9 (9.6, kemudian naik taraf ke 9.7) dan Lustre 2.17.0 (repo Whamcloud untuk el9.7, server dan client). Rangkaian: VLAN30 (10.10.30.0/24). LNet berjalan atas TCP kerana tiada InfiniBand dalam lab.


Reka bentuk

10.10.30.10  hpc-head    client (sedia ada)
10.10.30.11  hpc-cpu1    client (sedia ada)
10.10.30.12  hpc-cpu2    client (sedia ada)
10.10.30.13  lustre-mds  BARU: MGS + MDS  (disk MGT 2G + MDT 10G)
10.10.30.14  lustre-oss  BARU: OSS        (OST0000 30G + OST0001 30G)

Filesystem tunggal bernama "lustre"
  dimount pada semua node di /lustre
  /lustre/home     → pengguna dan direktori home
  /lustre/scratch  → scratch (stripe merentas 2 OST)

Fasa 1 — Cipta VM (di host Proxmox)

Guna image Rocky 9 GenericCloud yang sama seperti hpc-head. Tetapan scsihw virtio-scsi-single wajib; tanpanya cloud image akan terhenti di emergency shell semasa boot.

IMG=/var/lib/vz/template/iso/Rocky-9-GenericCloud-Base.latest.x86_64.qcow2

# lustre-mds (VMID 123): OS 20G + MGT 2G + MDT 10G
qm create 123 --name lustre-mds --memory 2048 --cores 2 --cpu host \
  --net0 virtio,bridge=vlan30 --scsihw virtio-scsi-single \
  --ostype l26 --agent enabled=1 --serial0 socket --vga serial0 \
  --ide2 local-lvm:cloudinit --boot order=scsi0 \
  --ciuser root --cipassword '<ROOT_PASS>' \
  --ipconfig0 ip=10.10.30.13/24,gw=10.10.30.1 --nameserver 10.10.10.1
qm importdisk 123 $IMG local-lvm
qm set 123 --scsi0 local-lvm:vm-123-disk-0
qm set 123 --scsi1 local-lvm:2      # MGT
qm set 123 --scsi2 local-lvm:10     # MDT
qm start 123

# lustre-oss (VMID 124): OS 20G + OST0000 30G + OST0001 30G
qm create 124 --name lustre-oss --memory 2048 --cores 2 --cpu host \
  --net0 virtio,bridge=vlan30 --scsihw virtio-scsi-single \
  --ostype l26 --agent enabled=1 --serial0 socket --vga serial0 \
  --ide2 local-lvm:cloudinit --boot order=scsi0 \
  --ciuser root --cipassword '<ROOT_PASS>' \
  --ipconfig0 ip=10.10.30.14/24,gw=10.10.30.1 --nameserver 10.10.10.1
qm importdisk 124 $IMG local-lvm
qm set 124 --scsi0 local-lvm:vm-124-disk-0
qm set 124 --scsi1 local-lvm:30     # OST0000
qm set 124 --scsi2 local-lvm:30     # OST0001
qm start 124

Selepas boot, tetapkan manage_etc_hosts: false dalam /etc/cloud/cloud.cfg. Kalau tidak, cloud-init menimpa /etc/hosts pada setiap boot. Kemudian isi /etc/hosts pada kelima-lima node:

cat >> /etc/hosts <<'EOF'
10.10.30.10 hpc-head
10.10.30.11 hpc-cpu1
10.10.30.12 hpc-cpu2
10.10.30.13 lustre-mds
10.10.30.14 lustre-oss
EOF

Fasa 2 — Persediaan server (kedua-dua VM server)

dnf update -y
dnf install -y chrony && systemctl enable --now chronyd
systemctl disable --now firewalld
setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config

Firewall dimatikan dan SELinux dijadikan permissive hanya kerana ini lab. Jangan tiru tetapan ini di production.

Tambah repo Whamcloud untuk server:

cat > /etc/yum.repos.d/lustre-server.repo <<'EOF'
[lustre-server]
name=Lustre 2.17.0 el9.7 server
baseurl=https://downloads.whamcloud.com/public/lustre/lustre-2.17.0/el9.7/server
enabled=1
gpgcheck=0
EOF

gpgcheck=0 mudah untuk lab tetapi bermakna pakej tidak disahkan tandatangannya. Di luar lab, import kunci GPG dan hidupkan semula.

Pasang kernel yang telah di-patch oleh Whamcloud serta pakej server:

dnf install -y kernel kernel-devel lustre lustre-ldiskfs e2fsprogs

Server mesti boot kernel Whamcloud, bukan kernel stock. Tetapkan sebagai lalai, reboot, kemudian sahkan:

grub2-mkconfig -o /boot/grub2/grub.cfg
grubby --set-default-index=0
grubby --default-kernel     # mesti menunjuk ke kernel lustre (2.17.0)
reboot
uname -r                    # selepas reboot: mesti ada 'lustre' / 2.17.0

Konfigurasi LNet atas TCP:

echo "options lnet networks=tcp(eth0)" > /etc/modprobe.d/lustre.conf
modprobe lnet && lctl network up 2>/dev/null; lctl list_nids   # NID mesti muncul

Fasa 3 — Format dan mount target

Pada lustre-mds (10.10.30.13): MGT dan MDT

mkfs.lustre --fsname=lustre --mgs /dev/sdb                          # MGT
mkfs.lustre --fsname=lustre --mgs --mdt --index=0 /dev/sdc          # MDT (MGS co-located)
mkdir -p /mnt/mgt /mnt/mdt
mount -t lustre /dev/sdb /mnt/mgt
mount -t lustre /dev/sdc /mnt/mdt
cat >> /etc/fstab <<'EOF'
/dev/sdb /mnt/mgt lustre _netdev,defaults 0 0
/dev/sdc /mnt/mdt lustre _netdev,defaults 0 0
EOF

Pada lustre-oss (10.10.30.14): OST0000 dan OST0001

mkfs.lustre --fsname=lustre --ost --index=0 --mgsnode=10.10.30.13@tcp /dev/sdb
mkfs.lustre --fsname=lustre --ost --index=1 --mgsnode=10.10.30.13@tcp /dev/sdc
mkdir -p /mnt/ost0 /mnt/ost1
mount -t lustre /dev/sdb /mnt/ost0
mount -t lustre /dev/sdc /mnt/ost1
cat >> /etc/fstab <<'EOF'
/dev/sdb /mnt/ost0 lustre _netdev,defaults 0 0
/dev/sdc /mnt/ost1 lustre _netdev,defaults 0 0
EOF

OST akan mendaftar sendiri dengan MGS ketika mount pertama. Sahkan di lustre-mds:

lctl dl | grep -E 'MGT|MDT|OST'     # semua mesti UP

Fasa 4 — Client (hpc-head, hpc-cpu1, hpc-cpu2)

Penting: modul kernel (kmod) client mesti sepadan dengan kernel yang sedang berjalan. Pastikan cluster idle (squeue kosong) sebelum naik taraf kernel dan reboot.

squeue                  # pastikan idle dahulu
dnf update -y
reboot
uname -r                # mesti 5.14.0-545 (el9.7) atau lebih baru

Repo client dan pemasangan:

cat > /etc/yum.repos.d/lustre-client.repo <<'EOF'
[lustre-client]
name=Lustre 2.17.0 el9.7 client
baseurl=https://downloads.whamcloud.com/public/lustre/lustre-2.17.0/el9.7/client
enabled=1
gpgcheck=0
EOF
dnf install -y lustre-client kmod-lustre-client

LNet dan mount:

echo "options lnet networks=tcp(eth0)" > /etc/modprobe.d/lustre.conf
modprobe lnet && modprobe lustre
mkdir -p /lustre
mount -t lustre 10.10.30.13@tcp:/lustre /lustre
cat >> /etc/fstab <<'EOF'
10.10.30.13@tcp:/lustre /lustre lustre _netdev,defaults 0 0
EOF
lfs df -h               # OST mesti kelihatan
df -h /lustre

Fasa 5 — Guna sebenar

# struktur direktori; scratch di-stripe merentas 2 OST untuk penulisan selari
mkdir -p /lustre/home /lustre/scratch
lfs setstripe -c 2 /lustre/scratch
lfs getstripe /lustre/scratch

# pengguna contoh
useradd -m -d /lustre/home/alya alya
passwd alya

# ujian tulis selari
dd if=/dev/zero of=/lustre/scratch/test.bin bs=1M count=2048 conv=fdatasync
lfs getstripe /lustre/scratch/test.bin      # mesti nampak 2 OST (0 dan 1)

Untuk ujian MPI, jalankan job Slurm yang bekerja dan menulis output di /lustre/scratch.

Ujian striping (pilihan, untuk faham konsep)

mkdir -p /lustre/scratch/stripe1 /lustre/scratch/stripe2
lfs setstripe -c 1 /lustre/scratch/stripe1
lfs setstripe -c 2 /lustre/scratch/stripe2
dd if=/dev/urandom of=/lustre/scratch/stripe1/a.bin bs=1M count=512
dd if=/dev/urandom of=/lustre/scratch/stripe2/b.bin bs=1M count=512
lfs getstripe /lustre/scratch/stripe1/a.bin   # 1 OST
lfs getstripe /lustre/scratch/stripe2/b.bin   # 2 OST (selari)

Troubleshooting pantas

SimptomPuncaPenyelesaian
mount: Invalid argumentVersi tidak sepadan, atau LNet tidak aktiflctl list_nids pada semua node; pastikan semuanya 2.17.0
Modul client tidak load (vermagic)Kernel tidak sepadan dengan kmoddnf update, reboot, semak uname -r
Server boot kernel stockGRUB lalai salahgrubby --set-default-index=0, reboot
OST tidak muncul di lfs dfOST tidak daftar, atau MGS tidak dapat dicapailctl dl di MDS; ping 10.10.30.13@tcp
LNet mati selepas rebootmodprobe.d tidak dibacamodprobe lnet; lctl network up
Ralat time skewchronyd tidak berjalansystemctl enable --now chronyd pada semua node

Nota

  • Disk thin-provision sesuai untuk lab. Lustre production menggunakan disk fizikal khusus.
  • MDT patut berada pada disk paling pantas (SSD/NVMe). Nisbah saiz MDT:OST yang lazim ialah antara 1:10 hingga 1:100.
  • Kuota (lfs quota) belum disediakan dan boleh ditambah kemudian.
  • NFS /home kekal. Jika mahu pindahkan pengguna ke /lustre/home, salin dahulu dengan cp -a.