Lustre部署文档
文档说明
本文档是用于lustre文件系统的部署,及其简单管理手册。
目录
1 Lustre介绍 (5)
2 基础环境配置 (5)
2.1 基础环境各组成部分的版本列表,以及安装目录 (5)
2.2 服务器角色列表并按如下信息自行修改主机名及hosts文件 (5)
2.2.1 Redhat as 4 update4.iso安装(完全安装,各个服务器相同) (6)
2.2.1.1 分区规划 (6)
3 设置network模块 (6)
4 应用软件安装 (6)
4.1 安装e2fsprogs (6)
4.2 安装lustre内核包 (6)
4.3 安装lustre软件 (6)
5 设置network模块 (6)
6 修改系统启动的内核并重启 (6)
7 创建文件系统 (7)
7.1 Mds服务器 (7)
7.2 Ost1服务器 (7)
7.3 Ost2服务器 (7)
7.4 client服务器 (7)
7.5 查看服务是否正常 (8)
7.6 服务器启动顺序 (8)
8 lustre文件系统的管理 (8)
8.1 动态增加ost (8)
8.2 动态增加ost后的数据分步问题解决 (8)
8.3 删除ost(在mds服务器删除) (9)
8.4 多个ost做stripe (9)
9 相关命令的介绍 (9)
9.1 Lfs (9)
9.2 Lfsck (9)
9.2.1 e2fsck (10)
10 系统配置手册 (10)
10.1 Mkfs.lustre (10)
10.2 Tunefs.lustre (10)
10.3 Lctl (10)
10.4 mount.lustre (10)
11 lustre系统的限制 (10)
11.1 Maximum Stripe Count (10)
11.2 Maximum Stripe Size (10)
11.3 Minimum Stripe Size (10)
11.4 Maximum Number of OSTs and MDSs (10)
11.5 Maximum Number of Clients (10)
11.6 Maximum Size of a Filesystem (11)
11.7 Maximum File Size (11)
11.8 Maximum Number of Files or Subdirectories in a Single Directory (11)
11.9 MDS空间消费 (11)
11.10 Maximum Length of a Filename and Pathname (11)
11.11 Maximum Number of Open Files for Lustre Filesystems (11)
11.12 OSS RAM Size for a Single OST (11)
12 如何替换mds或ost (11)
13 Lustre Failover (mds为例使用共享磁盘) (11)
13.1配置authkeys (11)
13.2.配置ha.cf (12)
13.3.配置haresources (12)
13.3.验证 (12)
1Lustre介绍
Lustre是一个开源的、基于对象存储技术的集群并行分布式文件系统,它具有很高的可扩展性、可用性、性能、易用性等,在高性能计算系统中被广泛使用。它主要包括三个部分:元数据服务器MDS (Metadata Server)、对象存储服务器OSS (Object Storage Server)和客户端Client。更详细的介绍请查看https://www.doczj.com/doc/1715178647.html,/
2基础环境配置
2.1 基础环境各组成部分的版本列表,以及安装目录
名称版本号软件包名称安装路径
Redhat as 4
update4
Redhat as 4 update4 Redhat as 4 update4.iso /
e2fsprogs e2fsprogs-1.40.2.cfs5 e2fsprogs-1.40.2.cfs5-0redhat.i386.
rpm
e2fsprogs-d
evel e2fsprogs-devel-1.40.2
.cfs5
e2fsprogs-devel-1.40.2.cfs5-0
redhat.i386.rpm
kernel-lustre-
smp kernel-lustre-smp-2.6.9-55.
0.9.EL_lustre.1.6.4.1
kernel-lustre-smp-2.6.9-55.0.9.EL_l
ustre.1.6.4.1.i686.rpm
kernel-lustre-
source kernel-lustre-source-2.6.9-
55.0.9.EL_lustre.1.6.4.1
kernel-lustre-source-2.6.9-55.0.9.E
L_lustre.1.6.4.1.i686.rpm
lustre lustre-1.6.4.1-2.6.9_55.
0.9.EL_lustre.1.6.4.1sm
p
lustre-1.6.4.1-2.6.9_55.0.9.EL_
lustre.1.6.4.1smp.i686.rpm
lustre-debugi
nfo lustre-debuginfo-1.6.4.1-2.
6.9_55.0.9.EL_lustre.1.6.4.
1smp
lustre-debuginfo-1.6.4.1-2.6.9_55.0.
9.EL_lustre.1.6.4.1smp.i686.rpm
lustre-ldiskfs lustre-ldiskfs-3.0.3-2.6.9_5
5.0.9.EL_lustre.1.
6.4.1smp
lustre-ldiskfs-3.0.3-2.6.9_55.0.9.EL
_lustre.1.6.4.1smp.i686.rpm
lustre-ldiskfs-debuginfo lustre-ldiskfs-debuginfo-3.
0.3-2.6.9_55.0.9.EL_lustre.
1.6.4.1smp
lustre-ldiskfs-debuginfo-3.0.3-2.6.9
_55.0.9.EL_lustre.1.6.4.1smp.i686.r
pm
lustre-module
s
lustre-modules-1.6.4.
1-2.6.9_55.0.9.EL_lustre.1.
6.4.1smp
lustre-modules-1.6.4.1-2.6.9_
55.0.9.EL_lustre.1.6.4.1smp.i686.rp
m
lustre-source
lustre-source-1.6.4.1-
2.6.9_55.0.9.EL_lustre.1.6.
4.1smp
lustre-source-1.6.4.1-2.6.9_55
.0.9.EL_lustre.1.6.4.1smp.i686.rpm
2.2 服务器角色列表并按如下信息自行修改主机名及hosts文件
服务器IP地址及主
机名
承载应用操作系统基础软件环境
172.20.20.161
mds Mgs,mdt Redhat
e2fsprogs, kernel-lustre-smp, luster,
lustre-debuginfo, lustre-ldiskfs,
172.20.20.152
Ost1 ost Redhat
e2fsprogs, kernel-lustre-smp, luster,
lustre-debuginfo, lustre-ldiskfs,
172.20.20.224
Ost2 ost Redhat
e2fsprogs, kernel-lustre-smp, luster,
lustre-debuginfo, lustre-ldiskfs,
172.20.21.29 client client Redhat
e2fsprogs, kernel-lustre-smp, luster,
lustre-debuginfo, lustre-ldiskfs,
2.2.1Redhat as 4 update4.iso安装(完全安装,各个服务器相同)
2.2.1.1 分区规划
/boot 100M
/ 5G
/usr 10G
/var 10G
/tmp 2G
swap 4G
(除了client服务器以外,别的服务器分别有两块磁盘sdb来做lustre文件系统)3设置network模块
# vi /etc/modprobe.conf(增加如下内容)
options lnet networks=tcp
4应用软件安装
4.1 安装e2fsprogs
# rpm -Uhv e2fsprogs* --force
4.2 安装lustre内核包
# rpm -ihv kernel-lustre*
4.3 安装lustre软件
# rpm -ihv lustre-*
5设置network模块
# vi /etc/modprobe.conf(增加如下内容)
options lnet networks=tcp
6修改系统启动的内核并重启
# vi /boot/grub/grub.conf(红色为修改部分)
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.9-55.0.9.EL_lustre.1.6.4.1smp)
root (hd0,0)
kernel /vmlinuz-2.6.9-55.0.9.EL_lustre.1.6.4.1smp ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-55.0.9.EL_lustre.1.6.4.1smp.img
title CentOS-4 i386 (2.6.9-42.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.ELsmp ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-42.ELsmp.img
title CentOS-4 i386-up (2.6.9-42.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.EL ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-42.EL.img
# init 6
7创建文件系统
7.1 Mds服务器
# mkfs.lustre --fsname=zds --mdt --mgs /dev/sdb
# mkdir -p /mnt/mds
# mount -t lustre /dev/sdb /mnt/mds/
# vi /etc/fstab(增加如下内容)
/dev/sdb /mnt/mds lustre defaults 0 0 7.2 Ost1服务器
# mkfs.lustre --fsname=zds --ost --mgsnode=mds@tcp0 /dev/sdb
# mkdir -p /mnt/ost1
# mount -t lustre /dev/sdb /mnt/ost1/
# vi /etc/fstab(增加如下内容)
/dev/sdb /mnt/ost1 lustre defaults 0 0 7.3 Ost2服务器
# mkfs.lustre --fsname=zds --ost --mgsnode=mds@tcp0 /dev/sdb
# mkdir -p /mnt/ost2
# mount -t lustre /dev/sdb /mnt/ost2/
# vi /etc/fstab(增加如下内容)
/dev/sdb /mnt/ost2 lustre defaults 0 0 7.4 client服务器
# mkdir -p /mnt/zds
# mount -t lustre mds@tcp0:/zds /mnt/zds/
# vi /etc/rc.local(增加如下内容)
mount -t lustre mds@tcp0:/zds /mnt/zds/
7.5 查看服务是否正常
在client节点运行
# lfs check servers
zds-MDT0000-mdc-c1222a00 active.
zds-OST0000-osc-c1222a00 active.
zds-OST0001-osc-c1222a00 active.
如出现上述信息,并且查看每个节点的系统日志,如果没的报错,说明正常启动。
7.6 服务器启动顺序
MDS-------OST---------CLIENT
8lustre文件系统的管理
8.1 动态增加ost
# mkfs.lustre --fsname=zds --ost --mgsnode=mds@tcp0 /dev/sdb
# mkdir -p /mnt/ost1
# mount -t lustre /dev/sdb /mnt/ost1/
# vi /etc/fstab(增加如下内容)
/dev/sdb /mnt/ost1 lustre defaults 0 0
(这时在client上查看挂的zds文件系统的空间会增大)
8.2 动态增加ost后的数据分步问题解决
说明:当文件做了stripe时,会分部在不同的OST服务器,所以当增加了一个ost服务器后,数据并没有存在新增的ost,应用以下shell脚本可以解决此问题。
#!/bin/bash
CKSUM=${CKSUM:-md5sum}
MVDIR=$1
if [ $# -ne 1 ]; then
echo "Usage: $0
exit 1
fi
cd $MVDIR
for i in `find . -print`
do
if [ -d $i ]; then
echo "dir $i"
else
if [ ! -w $i ]; then
echo "No write permission for $i, skipping"
continue
fi
OLDCHK=$($CKSUM $i | awk '{print $1}')
NEWNAME=$(mktemp $i.tmp.XXXXXX)
cp $i $NEWNAME
RES=$?
if [ $RES -ne 0 ];then
echo "$i copy error - exiting"
rm -f $NEWNAME
exit 1
fi
NEWCHK=$($CKSUM $NEWNAME | awk '{print $1}')
if [ $OLDCHK != $NEWCHK ]; then
echo "$NEWNAME bad checksum - $i not
moved, \ exiting"
rm -f $NEWNAME
exit 1
else
mv $NEWNAME $i
if [ $RES -ne 0 ];then
echo "$i move error - exiting"
rm -f $NEWNAME
exit 1
fi
fi
fi
done
8.3 删除ost(在mds服务器删除)
说明:动态删除ost时存在该ost上的相应文件会丢失
# lctl conf_param zds-OST0000.osc.active=0
删除后的激活
# lctl conf_param zds-OST0000.osc.active=1
(这时在client上查看挂的zds文件系统的空间会减少)
8.4 多个ost做stripe
# lfs setstripe /mnt/zds/test/ 0 -1 -1
(设置test目录存储文件时做stripe)
9相关命令的介绍
9.1 Lfs
Use lfs, a Lustre client filesystem utility, to display striping information for existing files and to create a file with a specific striping pattern
详细的参数请man lfs
9.2 Lfsck
The e2fsprogs package contains an lfsck tool which does distributed coherency checking for the Lustre filesystem, after e2fsck has been run. In most cases, e2fsck is sufficient to repair any filesystem issues and lfsck is not required (at the small
chance of having some leaked space in the filesystem). To avoid lengthy downtime,
you can also run lfsck once Lustre is already started (with care).
详细请man lfsck
9.2.1e2fsck
当mds或ost文件系统被损坏时,可以利用该工具进行修复。修复时请先umount文件系统。详细请man e2fsck
10系统配置手册
10.1 Mkfs.lustre
它是用来格式化磁盘提供lustre服务器工具
详细请man mkfs.lustre
10.2 Tunefs.lustre
它是用来重新机式化lustre修改磁盘配置的信息的工具。
详细请man tunefs.lustre
10.3 Lctl
lctl is a Lustre utility used for low level configurations of Lustre filesystem. It also
provides low-level testing and manages Lustre network (LNET) information.
详细请man lctl
10.4 mount.lustre
它是用来为lustre客户端挂载存储设备的。
11lustre系统的限制
11.1 Maximum Stripe Count
160
11.2 Maximum Stripe Size
2T
11.3 Minimum Stripe Size
64位机时为64K
11.4 Maximum Number of OSTs and MDSs Lustre1.4.6限制最多支持512个OST,lustre1.4.7以后限制最多支持1020个OST。
MDS将在以后的版本里做成群集
11.5 Maximum Number of Clients
32768个client节点
11.6 Maximum Size of a Filesystem
i386 systems in 2.6 kernels支持16T,每个ost不超过8T。
11.7 Maximum File Size
32位系统16T
11.8 Maximum Number of Files or
Subdirectories in a Single Directory
25 million files
11.9 MDS空间消费
4 billion inodes
每个inodes占4 KB
11.10 Maximum Length of a Filename and
Pathname
limit is 255 bytes for a single filename
11.11 Maximum Number of Open Files for
Lustre Filesystems
由服务器的内存决定
11.12 OSS RAM Size for a Single OST
内存1G
12如何替换mds或ost
待续
13Lustre Failover (mds为例使用共享磁盘)
Ha配置文件样例在/usr/share/doc/heartbeat-2.0.5目录里,将文件ha.cf,haresource,authkey文件复制到/etc/ha.d/。ldirectord样例文件在/usr/share/doc/heartbeat-ldirectord-2.0.4目录,将ldirectord.cf复制到/etc/ha.d/.
13.1配置authkeys
这个配置文件非常简单,就是在auth选择一个值。每个值对应一种算法,这个算法是在主节点和从节点间数据校验用的。这个配置文件权限必须是0600。
Chmod 0600 authkeys
自己选一种算法。我选md5。
配置文件的值如下:
auth 3
#1 crc
#2 sha1 HI!
3 md5 Hello!
13.2.配置ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 1
deadtime 10
warntime 5
udpport 694
ucast eth1 192.168.0.2
auto_failback off
node director1
node director2
use_logd yes
13.3.配置haresources
Mds IPaddr2::172.20.67.237/21/eth0:1/172.20.71.255
Mds Filesystem::/dev/sdc::/mnt/mds::luster
13.3.验证
1.在每一个mds节点进行下列操作:
mkfs.lustre --fsname=ssx --ost --mgsnode=mds@tcp0 /dev/sdc
mount -t lustre /dev/sdc /mnt/mds
2. 用df查看磁盘是否挂载成功
3. 停掉主mds后,可以看到资源已经转到另一台mds上.lustre的client端经过片刻后就可以
正常使用.在client上正在运行的程序不会因为mds的更改而中断.