最近看了一下lustre,快速安装了一下,记录在这里。

首先去这里下载对应的服务器版本的包。系统版本是rhel5.4 x86_64。既然是服务器用的并行文件系统,以稳定为主,我这里使用lustre1.8.7,对应的文档在这里

server要可能要用到的包

e2fsprogs-1.41.12.2.ora1-0redhat.rhel5.x86_64.rpm
kernel-2.6.18-194.17.1.el5_lustre.1.8.7.x86_64-ext4.rpm
kernel-2.6.18-194.17.1.el5_lustre.1.8.7.x86_64.rpm
lustre-1.8.7-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64-ext4.rpm
lustre-1.8.7-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64.rpm
lustre-ldiskfs-3.1.6-2.6.18_194.17.1.el5_lustre.1.8.7-ext4.src.rpm
lustre-ldiskfs-3.1.6-2.6.18_194.17.1.el5_lustre.1.8.7.src.rpm
lustre-ldiskfs-3.1.6-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64-ext4.rpm
lustre-ldiskfs-3.1.6-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64.rpm
lustre-ldiskfs-debuginfo-3.1.6-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64-ext4.rpm
lustre-ldiskfs-debuginfo-3.1.6-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64.rpm
lustre-modules-1.8.7-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64-ext4.rpm
lustre-modules-1.8.7-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64.rpm

client可能要用到的包

kernel-2.6.18-194.17.1.el5_lustre.1.8.7.x86_64-ext4.rpm
kernel-2.6.18-194.17.1.el5_lustre.1.8.7.x86_64.rpm
lustre-1.8.7-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64-ext4.rpm
lustre-1.8.7-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64.rpm
lustre-modules-1.8.7-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64-ext4.rpm
lustre-modules-1.8.7-2.6.18_194.17.1.el5_lustre.1.8.7.x86_64.rpm

对于rhel5来说,服务器必须安装这几个包,关于内核的,kernel-*-lustre-<ver>,kernel-ib-<ver>,关于模块的,lustre-modules-<ver>,关于工具的lustre-<ver>,lustre-ldiskfs-<ver>,e2fsprogs-<ver>。对于客户端,要装的就少一些,只要安装kernel-lustre-<ver>,lustre-modules-<ver>和lustre-<ver>。由于是在虚拟机上测试,所以没有ib环境,kernel-ib-<ver>就不安装了。

注意由于rhel5已经预装了e2fspgros这个包,所以这里e2fsprogs-<ver>的安装需要用rpm -Uvh方法升级,其他包用rpm -ivh就能安装。

装好以后需要用新的内核重启。

这里,mds服务器是192.168.1.100

2台ost服务器是192.168.1.99和192.168.1.102

client是192.168.1.101

在mds服务器上执行操作

modprobe lustre
modprobe ldiskfs
modprobe lnet 'networks="tcp0(eth0)"'

 以指定使用的网络和网关。

然后格式化硬盘

mkfs.lustre --fsname=testfs --mdt --mgs /dev/sdb1

最后挂载

mkdir /media/mgs
mount.lustre /dev/sdb1 /media/mgs

然后在ost服务器上执行操作

modprobe lustre
modprobe ldiskfs
modprobe lnet 'networks="tcp0(eth0)"'

最后格式化对应磁盘

mkfs.lustre --fsname=testfs --ost --mgsnode=192.168.1.100@tcp0 /dev/sdb1

并且挂载

mkdir /media/ost
mount.lustre /dev/sdb1 /media/ost

然后在客户端挂载这个文件系统就行

mount.lustre 192.168.1.100@tcp0:/testfs /media/lustre

并且可以查看容量

[root@localhost lustre]# lfs df -h
UUID bytes Used Available Use% Mounted on
test-MDT0000_UUID 17.5G 444.5M 16.1G 3% /media/lustre[MDT:0]
test-OST0000_UUID 19.7G 447.0M 18.2G 2% /media/lustre[OST:0]
test-OST0001_UUID 19.7G 444.1M 18.2G 2% /media/lustre[OST:1]

filesystem summary: 39.4G 891.1M 36.5G 2% /media/lustre

但这里测试速度的结果还不如直接写入本地磁盘⊙﹏⊙b汗

[root@localhost lustre]# time dd if=/dev/zero of=/media/lustre/testfile bs=16k count=65536
65536+0 records in
65536+0 records out
1073741824 bytes (1.1 GB) copied, 9.14748 seconds, 117 MB/s

real 0m9.151s
user 0m0.027s
sys 0m5.765s

本地磁盘则是5倍速度

[root@localhost lustre]# time dd if=/dev/zero of=/media/testfile bs=16k count=65536
65536+0 records in
65536+0 records out
1073741824 bytes (1.1 GB) copied, 2.16648 seconds, 496 MB/s

real 0m2.169s
user 0m0.011s
sys 0m1.505s

这可能是由于所有服务器都在虚拟机上的关系。本地磁盘被缓存了,反而效率高,而lustre则还要走一遍网络,所以效率低下。但搜了一遍也没发现这里使用的vmware 8的网络速度上限是多少。

然后是用户配额的设置

lfs setquota -u 用户名 -g 组名 -b 总容量(软) -B 总容量(硬) /media/lustre

以后再测试从源码编译安装的方法。