您的位置:首页 > 理论基础 > 计算机网络

集群并行文件系统Lustre部署

2008-03-21 23:57 477 查看
集群并行文件系统Lustre部署

刘爱贵
Aigui.LIU@ihep.ac.cn
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。

五、参考文献

[1] http://www.lustre.org
[2] https://mail.clusterfs.com/wikis/lustre/LustreHowto
[3] https://mail.clusterfs.com/wikis/attachments/LustreManual.html

创建日期: 2006年10月11日
最近更新:
返回
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息