Appearance
6. 个性化配置
6.1 使用 Infiniband 部署
TIP
当管理节点和待安装节点都支持 Infiniband 网卡时,受益于其高带宽可以使用 Infiniband 部署。
PODsys支持通过IB卡部署Ubuntu系统。
- 修改config.yaml文件,将网卡等设置为IB卡。
- 修改 iplist.txt文件,将第3-5列的以太网卡信息改为IB卡信息。第3列IP地址与第6列一致。
- 在待安装节点现存的OS下执行如下脚本
脚本内容
shell
#!/bin/bash
# Function to enable PXE and UEFI using mlxconfig tool
configure_infiniband_with_mlx() {
INFINIBAND_SYS_PATH="/sys/class/infiniband/"
# Iterate through all InfiniBand devices
for device in $(ls ${INFINIBAND_SYS_PATH}); do
echo "Enabling PXE and UEFI on InfiniBand device: $device"
# Enable PXE
mlxconfig -y -d $device set EXP_ROM_PXE_ENABLE=1
# Enable UEFI for x86 architecture
mlxconfig -y -d $device set EXP_ROM_UEFI_x86_ENABLE=1
done
}
# Function to enable PXE and UEFI using mstconfig tool
configure_infiniband_with_mst() {
PCI_DEVICES_PATH="/sys/bus/pci/devices"
# Loop through all PCI devices
for bus_dev_func in $(ls "${PCI_DEVICES_PATH}"); do
# Check if the device is an InfiniBand device
if [[ -e "${PCI_DEVICES_PATH}/${bus_dev_func}/infiniband" ]]; then
echo "Enabling PXE and UEFI on PCI device: $bus_dev_func"
# Enable PXE
mstconfig -y -d "$bus_dev_func" set EXP_ROM_PXE_ENABLE=1
# Enable UEFI for x86 architecture
mstconfig -y -d "$bus_dev_func" set EXP_ROM_UEFI_x86_ENABLE=1
fi
done
}
# Main function to enable PXE and UEFI on Mellanox InfiniBand devices
enable_mellanox_pxe() {
if which mlxconfig > /dev/null 2>&1; then
configure_infiniband_with_mlx
elif which mstconfig > /dev/null 2>&1; then
configure_infiniband_with_mst
else
echo "Error: Neither mlxconfig nor mstconfig is available on this system."
exit 1
fi
}
# Check if the script is run as root user
if [ "$(id -u)" != "0" ]; then
echo "This script must be run with root privileges. Please use sudo or switch to the root user."
exit 1
fi
# Execute the function to enable PXE and UEFI
enable_mellanox_pxe执行脚本原因
有些 IB 卡需要先执行脚本才能使 PXE 和 UEFI 启动。
所以,对于全新的机器,Infiniband 部署可能无法直接实现。
6.2 使用网口聚合加速部署
使用网口聚合增加管理节点的上传带宽,可以增加部署速度。
- 在管理节点上,安装 ifenslave 模块。
shell
sudo apt install ifenslave- 加载 bonding 模块。
shell
# 载入模块
sudo modprobe bonding
# 查看模块是否载入成功
sudo lsmod | grep bonding- 配置网口聚合。 以 bond6 模式为例,配置双网口的bond,要聚合的网口名字为et0 和 eth1。 修改/etc/netplan/00-installer-config.yaml 文件如下:
配置文件
yaml
network:
version: 2
ethernets:
eth1:
dhcp4: false
eth2:
dhcp4: false
bonds:
bond0:
addresses: [192.168.1.88/24]
gateway4: 192.168.1.1
nameservers:
addresses:
- 114.114.114.114
interfaces:
- eth0
- eth1
parameters: # 参数
mode: balance-alb # bond模式修改配置文件后,执行如下命令,使之生效
bash
sudo netplan apply- 查看状态
bash
# 查看bonding状态
cat /proc/net/bonding/bond0
sudo ethtool bond0查看bond后的网口bond0的配置和状态信息,包括速度、双工模式、连接状态和硬件特性等。
- 删除bond
先注释掉/etc/netplan/00-installer-config.yaml文件中添加的内容
bash
sudo ifconfig bond0 down
sudo rmmod bonding检查bond是否删除成功
bash
ifconfig bond0