集群并行文件系统Lustre部署 收藏
集群并行文件系统 Lustre 部署
刘爱贵
2006-10-11
一、 引言
Lustre 是一个开源的、基于对象存储技术的集群并行文件系统,它具有很高的可扩展性、可用性、性能、易用性等,在高性能计算系统中被广泛使用。它主要包括三个部分:元数据服务器 MDS (Metadata Server) 、对象存储服务器 OSS (Object Storage Server) 和客户端 Client 。
中科院高能所的 BESIII 实验将使用网格计算技术 (Grid Computing) 进行物理计算和分析,为此高能所计算中心正在基于 gLite 网格中间件搭建一个网格实验平台 BES-GRID 。传统的网络文件系统 NFS 在性能和可靠性等方面都存在问题,因此我们决定使用 Lustre 来替代 NFS 为网格环境提供共享存储空间。
下面我们在 BES-GRID 环境下进行 Lustre 部署。如果在其他计算环境下安装,请根据实际情况作相应改动。
二、 总体规划
BES-GRID 共有 8 台联想万全服务器 ( 双 CPU) 组成,安装的 gLite 服务如下:
Hostname | gLite Service | 备注 |
bg001.ihep.ac.cn | CE |
|
bg002.ihep.ac.cn | SE |
|
bg003.ihep.ac.cn | RB |
|
bg004.ihep.ac.cn | GridICE | Ganglia Server |
bg005.ihep.ac.cn | BDII + WN | Ganglia Client |
bg006.ihep.ac.cn | AMGA + MyProxy +WN | Ganglia Client |
bg007.ihep.ac.cn | UI + LFC |
|
bg008.ihep.ac.cn | R-GMA + WN | Ganglia Client |
SE 使用 bg001 ~ bg004 的 /data 盘组织存储空间, bg005 ~ bg008 的剩余磁盘空间由 Lustre 分配使用。 Lustre 组件分布如下:
Hostname | Components | Device | Space |
bg005.ihep.ac.cn | OST1 + MDS + CLIENT | /dev/sda4, /dev/sda3 | 10GB + 25GB |
bg006.ihep.ac.cn | OST2 + CLIENT | /dev/sda3 | 35GB |
bg007.ihep.ac.cn | OST3+ CLIENT | /dev/sda3 | 35GB |
bg008.ihep.ac.cn | OST4 + CLIENT | /dev/sda3 | 35GB |
三、 Lustre 安装
(1) 安装说明
Lustre 版本为 1.4.7.1, 使用 pre-patched 内核 (smp-2.4.21-40.EL) ,使用 RPM 安装, 32 位服务器, LINUX2.4 内核。
(2) 软件下载
Lustre 是开源的,从 http://www.clusterfs.com/download.html 下载 RPM 包。你也可以下载源码进行编译安装,但是比较麻烦,推荐从 RPM 包进行安装。必需的 RPM 包括:
kernel-smp-2.4.21-40.EL_lustre.1.4.7.i686.rpm
lustre-1.4.7-2.4.21_40.EL_lustre.1.4.7smp.i686.rpm
lustre-modules-1.4.7-2.4.21_40.EL_lustre.1.4.7smp.i686.rpm
(3) 磁盘空间分配
Lustre 可以使用文件系统和真实磁盘,考虑到性能,我们这里使用真实磁盘,将系统某些磁盘设备或分区分配给 Lustre 使用。这些设备和分区不能再进行 mount 操作,否则 Lustre 会出现错误。按照上面的规划将相应磁盘或分区进行处理, LINUX 下可以使用 FDISK 工具,并在 /etc/fstab 中删去对应项。
(4) 软件安装
(a) 安装 pre-patched kernel RPM
rpm –ivh kernel-smp-2.4.21-40.EL_lustre.1.4.7.i686.rpm
(b) 配置 lilo.conf 或 grub.conf 以启动新内核, 重启机器
(c) 安装 Lustre 内核模块和工具集
rpm –ivh lustre-modules-1.4.7-2.4.21_40.EL_lustre.1.4.7smp.i686.rpm
rpm –ivh lustre-1.4.7-2.4.21_40.EL_lustre.1.4.7smp.i686.rpm
(5) 配置
(a) 编写配置 Shell 脚本 config.sh ( 可以在任何一个 Lustre 结点上进行 )
#!/bin/sh
# config.sh
# Create nodes
rm -f config.xml
lmc -m config.xml --add net --node node-mds --nid node-mds --nettype tcp
lmc -m config.xml --add net --node node-ost1 --nid node-ost1 --nettype tcp
lmc -m config.xml --add net --node node-ost2 --nid node-ost2 --nettype tcp
lmc -m config.xml --add net --node node-ost3 --nid node-ost3 --nettype tcp
lmc -m config.xml --add net --node node-ost4 --nid node-ost4 --nettype tcp
lmc -m config.xml --add net --node client --nid '*' --nettype tcp
# Cofigure MDS
lmc -m config.xml --add mds --node node-mds --mds mds-scratch --fstype ext3 --dev /dev/sda3
# Create LOV
lmc -m config.xml --add lov --lov lov-scratch --mds mds-scratch --stripe_sz 1048576 --stripe_cnt 0 --stripe_pattern 0
# Configures OSTs
lmc -m config.xml --add ost --node node-ost1 --lov lov-scratch --ost ost1-scratch --fstype ext3 --dev /dev/sda4
lmc -m config.xml --add ost --node node-ost2 --lov lov-scratch --ost ost2-scratch --fstype ext3 --dev /dev/sda3
lmc -m config.xml --add ost --node node-ost3 --lov lov-scratch --ost ost3-scratch --fstype ext3 --dev /dev/sda3
lmc -m config.xml --add ost --node node-ost4 --lov lov-scratch --ost ost4-scratch --fstype ext3 --dev /dev/sda3
# Configure client (this is a 'generic' client used for all client mounts)
lmc -m config.xml --add mtpt --node client --path /scratch --mds mds-scratch --lov lov-scratch
(b) 生成 XML 配置文件 config.xml
sh config.sh
(c) 分发配置文件
Lustre 所有结点启动都需要上面生成的 config.xml 文件,分发方式有多种: NFS 、 LDAP 、 AFS 等,这些方式适合大规模安装。为了简单起见,我直接使用 SCP 将配置文件复制到各个结点。
(6) 名字定义
上面的 config.sh 中使用了服务器名字,可在 DNS 中定义或直接在 /etc/hosts 中定义,所以最好使用 DNS 定义。使用后者定义时,切记不要将名字映射到 127.0.0.1 ,这会造成客户端无法和 Servers 通信。我直接在 /etc/hosts 中定义名字,每个结点上都要定义:
xxx.xxx.xxx.xxx node-ost1 node-mds
xxx.xxx.xxx.xxx node-ost2
xxx.xxx.xxx.xxx node-ost3
xxx.xxx.xxx.xxx node-ost4
(7) 启动
按 OSTs -> MDSs -> CLIENTs 顺序启动服务:
# start OSTs , 首次启动需要加 –reformat 选项 ( 格式化,以前数据全部清除 )
lconf –reformat --node node-ost1 config.xml (bg005.ihep.ac.cn 上 )
lconf –reformat --node node-ost2 config.xml (bg006.ihep.ac.cn 上 )
lconf –reformat --node node-ost3 config.xml (bg007.ihep.ac.cn 上 )
lconf –reformat --node node-ost4 config.xml (bg008.ihep.ac.cn 上 )
# start MDSs ,首次启动需要加 –reformat 选项 ( 格式化,以前数据全部清除 )
lconf –reformat --node node-mds config.xml (bg005.ihep.ac.cn 上 )
# start CLIENTs
lconf --node client config.xml (bg005.ihep.ac.cn 上 )
lconf --node client config.xml (bg006.ihep.ac.cn 上 )
lconf --node client config.xml (bg007.ihep.ac.cn 上 )
lconf --node client config.xml (bg008.ihep.ac.cn 上 )
另外,还可以使用 0Config mount 命令方式启动 CLIENT :
mount –t luster node-mds:/mds-scratch/client /scratch
(8) 测试
OST 、 MDS 成功启动, CLIENT 成功加载后,可以使用 LINUX 相关命令检查安装情况,如:
[root@bg005 lustre]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext3 29G 3.6G 24G 13% /
none tmpfs 2.0G 0 2.0G 0% /dev/shm
config lustre_lite 128G 1.6G 120G 2% /scratch
四、相关问题
在 Lustre 安装测试过程中出现过一些问题,总结如下:
(1) 网卡无法驱动
联想的万全服务器,换上 Lustre prepatch kernel 后网卡无法驱动,在其他机器还没有遇到过这样的问题。从联想的驱动光盘上找到网卡驱动,重新编译、安装后网卡正常启动。
(2) 防火墙设置
Lustre 的 MDS 、 OST 、 CLIENT 之间需要使用端口进行相互通信,因此如果系统启动了 Iptables 服务,需要为 Lustre 打开端口 (988 , 1021 ~ 1023) 。这个问题花费了我好些时间, MDS 开始就是无法启动,后来我把 Iptables 服务停掉后才成功。
(3) 启动顺序
正常的启动顺序是: OST -> MDS -> CLIENT , MDS 启动时需要与所有的 OST 尝试连接,如果存在 OST 没有启动, MDS 将一直进行重试。当然不按这个顺序启动也可以,中间可能需要较长的等待时间,但 Lustre 仍是按照正常顺序启动,所有 OST 启动后才启动 MDS , 最后启动所有的 CLIENT 。
五、参考文献
[2] https://mail.clusterfs.com/wikis/lustre/LustreHowto
[3] https://mail.clusterfs.com/wikis/attachments/LustreManual.html