一、 软件架构
MGS(管理服务器)
MGS用于管理Lustre文件系统中的配置信息,并为其他组件提供信息。每个Lustre target通过MGS来提供信息,Lustre客户端通过MGS来获取信息
MGS负责维护集群信息,当不涉及集群变更时,MGS服务异常不会影响到已有业务读写,当配置多个MGS时,同一时刻只能有一个MGS处于活动状态(其余MGS处于备用状态),使用同一个底层数据(同一MDT)
注:MGS和OSS可以放在一起共享存储空间
MGT(管理目标)
MGT为MGS提供存储空间,仅存储管理信息,所需空间极小(通常<100MB)
由于MGT上的数据仅在服务器或客户端安装时被载入访问,因此不需要考虑磁盘性能;考虑其数据对于文件系统访问非常重要,通常建议使用RAID1
MDS(元数据服务器)
MDS用于管理Lustre文件系统的配置信息
MDT(元数据目标)
MDT为MDS提供存储空间,用于存储元数据信息(如文件名、目录、权限、文件布局等)。MDT可以是共享存储设备(如同一磁盘阵列映射给多个节点),虽然同一MDT可对多个MDS可见,但同一时刻只能被一个MDS访问,当活跃的MDS节点出现故障,另外一个MDS节点可以接管该MDT对外提供服务。通常使用SSD高性能磁盘,建议配置RAID1或RAID10
注:MDT0000含有Lustre文件系统根目录,如出现MDT00000无法使用情况,则会导致整个文件系统无法使用
OSS(对象存储服务器)
OSS为一个或多个本地OST(支持1~32个OST)提供文件I/O服务并处理网络请求
OST(对象存储目标)
OST为OSS提供存储空间,用于存储文件数据,用户的文件数据存储在一个或多个对象中,每个对象存放在Lustre文件系统单独一个OST上,每个文件的对象数可根据特定工作负载调整以获得最佳性能。通常使用RAID5或RAID6
Lustre客户端
运行Lustre客户端软件的节点,挂载Lustre文件系统,提供集群存储读写入口
LNet
LNet(Lustre Network)是一种定制化网络API,提供了通讯基础,用于处理Lustre文件系统服务器和客户端之间的元数据和文件I/O数据通信
二、软件安装
系统版本:CentOS Linux release 7.9.2009
内核版本:3.10.0-957.10.1.el7_lustre.x86_64
软件版本:lfs 2.12.1
1、配置yum源
- 添加国内镜像yum源及epel源
yum install wget -y
mv /etc/yum.repos.d/ /etc/yum.repos.d-bak/
mkdir /etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/Centos-7.repo -P /etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/epel-7.repo -P /etc/yum.repos.d/
- 添加Lustre软件源
[root@node93 ~]# cat /etc/yum.repos.d/lustre.repo
[e2fsprogs]
name=e2fsprogs
baseurl=https://downloads.whamcloud.com/public/e2fsprogs/latest/el7/
gpgcheck=0
enable=1
[lustre-server]
name=lustre-server
baseurl=https://downloads.whamcloud.com/public/lustre/lustre-2.12.9/el7.9.2009/server/
gpgcheck=0
enable=1
[lustre-client]
name=lustre-client
baseurl=https://downloads.whamcloud.com/public/lustre/lustre-2.12.9/el7.9.2009/client/
gpgcheck=0
enable=1
[root@node93 ~]# yum makecache
2、安装E2fsprogs包
下载OSS服务器所需要的包
mkdir ~/e2fsprogs && cd ~/e2fsprogs
wget -c -r -nd https://downloads.whamcloud.com/public/e2fsprogs/1.44.5.wc1/el7/RPMS/x86_64/
rm -rf index.html* unknown.gif *.gif sha256sum
全部rpm安装
[root@slave1 e2fsprogs]# cd ~/e2fsprogs && rpm -Uvh *
准备中... ################################# [100%]
正在升级/安装...
1:libcom_err-1.42.12.wc1-4.el7.cent################################# [ 8%]
2:e2fsprogs-libs-1.42.12.wc1-4.el7.################################# [ 15%]
3:libcom_err-devel-1.42.12.wc1-4.el################################# [ 23%]
4:libss-1.42.12.wc1-4.el7.centos ################################# [ 31%]
5:e2fsprogs-1.42.12.wc1-4.el7.cento################################# [ 38%]
6:libss-devel-1.42.12.wc1-4.el7.cen################################# [ 46%]
7:e2fsprogs-devel-1.42.12.wc1-4.el7################################# [ 54%]
8:e2fsprogs-static-1.42.12.wc1-4.el################################# [ 62%]
9:e2fsprogs-debuginfo-1.42.12.wc1-4################################# [ 69%]
正在清理/删除...
10:e2fsprogs-1.42.9-19.el7 ################################# [ 77%]
11:e2fsprogs-libs-1.42.9-19.el7 ################################# [ 85%]
12:libss-1.42.9-19.el7 ################################# [ 92%]
13:libcom_err-1.42.9-19.el7 ################################# [100%]
3、安装lustre包
下载MDS服务器所需要的包
mkdir ~/lustre2.12.1 && cd ~/lustre2.12.1
yum install -y wget
wget \
https://downloads.whamcloud.com/public/lustre/lustre-2.12.1/el7/server/RPMS/x86_64/kernel-3.10.0-957.10.1.el7_lustre.x86_64.rpm \
https://downloads.whamcloud.com/public/lustre/lustre-2.12.1/el7/server/RPMS/x86_64/kmod-lustre-2.12.1-1.el7.x86_64.rpm \
https://downloads.whamcloud.com/public/lustre/lustre-2.12.1/el7/server/RPMS/x86_64/kmod-lustre-osd-ldiskfs-2.12.1-1.el7.x86_64.rpm \
https://downloads.whamcloud.com/public/lustre/lustre-2.12.1/el7/server/RPMS/x86_64/lustre-2.12.1-1.el7.x86_64.rpm \
https://downloads.whamcloud.com/public/lustre/lustre-2.12.1/el7/server/RPMS/x86_64/lustre-osd-ldiskfs-mount-2.12.1-1.el7.x86_64.rpm
安装依赖
yum install -y linux-firmware dracut selinux-policy-targeted kexec-tools libyaml perl
全部rpm安装:(如果无法安装就强行安装)
cd ~/lustre2.12.1 && rpm -ivh *.rpm --force
重启服务器
reboot
检查内核
[root@master ~]# uname -r
3.10.0-957.el7_lustre.x86_64
加载Lustre模块:lustre_rmmod卸载模块
[root@master ~]# modprobe lustre
[root@master ~]# lsmod | grep lustre
lustre 758679 0
lmv 177987 1 lustre
mdc 232938 1 lustre
lov 314581 1 lustre
ptlrpc 2264705 7 fid,fld,lmv,mdc,lov,osc,lustre
obdclass 1962422 8 fid,fld,lmv,mdc,lov,osc,lustre,ptlrpc
lnet 595941 6 lmv,osc,lustre,obdclass,ptlrpc,ksocklnd
libcfs 421295 11 fid,fld,lmv,mdc,lov,osc,lnet,lustre,obdclass,ptlrpc,ksocklnd
如果插入模块时发生网络错误,去下面的网址找对应问题
https://blog.51cto.com/u_16175452/6597577
最后重启服务
sudo service lustre restart
modprobe lustre
4、硬盘格式化和挂载
在虚拟机中添加一块硬盘(我添加的硬盘是vdb)
对硬盘进行分区
- 使用fdisk命令中的帮助查看可以操作的指令,其中m查看帮助、n创建分区、p查看分区情况、t修改分区类型、w保存退出。
[root@master ~]# fdisk /dev/vdb
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0xa44e96c5 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):
[root@test1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 100G 0 disk
└─vda1 253:1 0 100G 0 part /
vdb 253:16 0 20G 0 disk
├─vdb1 253:17 0 5G 0 part
├─vdb2 253:18 0 5G 0 part
└─vdb3 253:19 0 5G 0 part
三、Lustre挂载
主机名 | IP地址 | 内存 | 添加的共享磁盘大小 |
---|---|---|---|
Centos7.9-test机 | 192.168.0.12/16 | 1G | 20G |
1、Lnet配置
参考示例如下,指定当前节点Lustre专用网络接口为ens192(自己的网卡)
echo “options lnet networks=tcp0(ens192)” > /etc/modprobe.d/lustre.conf
vi /etc/hosts
192.168.0.12(自己的主机IP)+主机名
Is the MGS specification correct?或Is the MGS running? lustre文件系统挂载(mount)失败
若出现上述问题,则去下面的网址查找对应解决方法
https://blog.csdn.net/qq_57973134/article/details/138033401
2、建立MGS和MGT
Lustre格式化参数 | 说明 |
---|---|
–fsname | 设置Lustre集群的名称,Lustre文件系统的标识,必须唯一 |
–mgsnode | mgs节点的IP地址 |
–mgs | 将分区格式化为MGS,MGS(ManaGe Server)是⽤来记录整个Lustre状态的服务 |
–mdt | 将分区格式化为MDT,MDT(MetaData Target)是存放Lustre元数据服务的设备 |
–ost | 将分区格式化为OST,OST(Object Storage Target)则是存储Lustre数据的设备 |
–reformat | 跳过检查,防止格式化操作清除已有的数据 |
mkdir /mnt/vdb1
mkfs.lustre --fsname=lustrefs --mgsnode=192.168.0.12@tcp0 --mdt --mgs --index=0 --reformat /dev/vdb1
mount -o rw -o loop -t lustre /dev/vdb1 /mnt/vdb1
3、建立OSS
mkdir /mnt/vdb2
mkfs.lustre --fsname=lustrefs --mgsnode=192.168.0.12@tcp0 --ost --index=0 --reformat /dev/vdb2
mount -o rw -o loop -t lustre /dev/vdb1 /mnt/vdb2
4、Client部署
mount -t lustre 192.168.0.12@tcp:/lustrefs /mnt/lustre
最后,可以在MGS上运行,获取所有OST节点的名称和状态
[root@test1 mnt]# lctl get_param lov.*-mdtlov.target_obd
lov.lustrefs-MDT0000-mdtlov.target_obd=0: lustrefs-OST0000_UUID ACTIVE
在客户端(Client节点)查询所有OST挂载情况及使用量
[root@test1 lustre]# lfs df -h
UUID bytes Used Available Use% Mounted on
lustrefs-MDT0000_UUID 2.8G 19.6M 2.5G 1% /mnt/lustre[MDT:0]
lustrefs-OST0000_UUID 4.6G 33.1M 4.3G 1% /mnt/lustre[OST:0]
filesystem_summary: 4.6G 33.1M 4.3G 1% /mnt/lustre