无盘(diskless)集群,指的是计算节点没有本地硬盘或本地硬盘没有安装操作系统,优点是管理维护方便,可省却计算节点硬盘投资;缺点是对服务节点的存储IO性能及之间的网络稳定性和性能要求高。
以下仅仅基于CentOS 7.6针对无盘集群系统与普通集群系统不同之处写的,常见的PXE和NIS服务等并不牵扯,请参考相应资料。
add_dracutmodules+="nfs"
修改/etc/selinux/config,设置SELINUX=disabled:
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
必要时需要重启系统,以便使其生效。
service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot #-s 表示用/var/lib/tftpboot作为tftp服务的根目录 disable = no #要修改成no,以便启动 per_source = 11 cps = 100 2 flags = IPv4 }
/diskless 192.168.10.0/24(rw,async,no_root_squash)
default-lease-time 600; max-lease-time 7200; allow booting; allow bootp; option time-offset -18000; # Eastern Standard Tim subnet 192.168.10.0 netmask 255.255.255.0 { option routers 192.168.10.254; option subnet-mask 255.255.255.0; option domain-search "scc.ustc.edu.cn"; option domain-name-servers 202.38.64.7; option time-offset -18000; # Eastern Standard Time range 192.168.10.1 192.168.10.100; } host dlclient1 { option host-name "dlclient1"; #设定系统名 hardware ethernet 00:50:56:89:96:d1; fixed-address 192.168.10.1; } host dlclient2 { option host-name "dlclient2"; hardware ethernet 00:50:56:89:bb:5f; fixed-address 192.168.10.2; } class "pxeclients" { #PXE启动设置 match if substring(option vendor-class-identifier, 0, 9) = "PXEClient"; next-server 192.168.10.254; if option architecture-type = 00:07 { filename "uefi/shim.efi"; #x86_64 UEFI引导 # } else if option architecture-type = 00:06 { # filename "bootia32.efi"; #ia32 UEFI引导,本文后面未涉及 } else { filename "pxelinux.0"; #传统LEGACY引导 } }
客户节点需要一个完整的操作系统安装后的文件系统,可以采用某个现有的系统复制下或用yum新装一个系统:
yum的--installroot=/diskless/root指明了安装目录、--releasever=/参数指明了安装的系统版本等,详见yum说明。
default CentOS7.6 label CentOS7.6 kernel vmlinuz-3.10.0-957.5.1.el7.x86_64 append initrd=initramfs-3.10.0-957.5.1.el7.x86_64.img root=nfs:192.168.10.254:/diskless/root rw
set timeout=0 menuentry 'CentOS 7.6' { linuxefi vmlinuz-3.10.0-957.5.1.el7.x86_64 root=nfs:192.168.10.254:/diskless/root rw initrdefi initramfs-3.10.0-957.5.1.el7.x86_64.img }
除/var与/tmp目录外,基本都可以共享,因此这里仅设置/var与/tmp私有。另外设定/tmp使用客户节点的本地硬盘(无盘客户节点可以不用本地硬盘,这里有的原因是为了Gaussian大IO应用采用本地硬盘,避免主存储IO压力太大)。
生成/diskless/nodes目录,该目录下生成以节点名命名的子目录,如dlclient1和dlclient2,以便存放各自的私有文件:
#!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. touch /var/lock/subsys/local for DIR in var #利用客户节点启动时获取的节点名$HOSTNAME不同对应不同的服务节点上的客户节点私有目录 do mount -o rw dlserver:/diskless/nodes/$HOSTNAME/$DIR /$DIR done mount /dev/sda /tmp if [ $? != 0 ]; then #如果加载未成功,认为该节点第一次启动,该硬盘没格式化,因此做格式化 mkfs.xfs /dev/sda mount /dev/sda /tmp fi nisdomainname mydiskless.org #为了NIS服务 dhclient & #为了客户节点启动dhclient守护进程,自动更新IP,否则过10分钟左右网络会断掉
在BIOS等设置为PXE网络启动,并启动,根据客户节点启动时屏幕信息以及服务节点/var/log/messages文件等信息对系统诊断,排除错误。
无盘节点启动后,运行df命令应显示类似下面信息: