前言
近些年, 分布式存储因具有高性能, 高可用的特性而进入存储市场. 除商业产品外, 开源分布式存储软件更受欢迎, 其中以 Lustre,CephFS,GlusterFS 为典型代表.
1. 简介
Lustre 是一个开源, 分布式并行文件系统软件平台, 具有高可扩展, 高性能, 高可用等特点. Lustre 的构造目标是为大规模高性能计算系统提供一个全局一致的 POSIX 兼容的命名空间, 它支持数百 PB 数据存储空间, 支持数百 GB/s 乃至数 TB/s 并发聚合带宽.
1.1 环境架构
MGS(Management Server, 管理服务端),MGS 存储集群中的所有 Lustre 文件的配置信息, 并为其它 Lustre 组件提供信息.
MDS(Metadata Servers, 元数据服务端),MDS 使得元数据对客户端有效, 每个 MDS 管理 Lustre 文件系统中的名称和目录.
OSS(Object Storage Servers, 对象存储服务端),OSS 用于存放客户端业务访问数据.
1.2 网络规划
2. 环境准备
注: 在所有主机执行如下操作
1. 设置主机名
hostnamectl set-hostname node1
2. 关闭 firewalld 及 selinux
- systemctl stop firewalld && systemctl disable firewalld
- sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
3. 创建临时 yum 源
- cat>/tmp/lustre-repo.conf <<EOF
- [lustre-server]
- name=lustre-server
- baseurl=https://downloads.whamcloud.com/public/lustre/latest-release/el7/server
- gpgcheck=0
- [lustre-client]
- name=lustre-client
- baseurl=https://downloads.whamcloud.com/public/lustre/latest-release/el7/client
- gpgcheck=0
- [e2fsprogs-wc]
- name=e2fsprogs-wc
- baseurl=https://downloads.whamcloud.com/public/e2fsprogs/latest/el7
- gpgcheck=0
- EOF
4. 安装相关工具包
yum install yum-utils createrepo perl Linux-firmware -y
5. 提前将软件包下载到本地
- mkdir -p /var/www/html/repo
- cd /var/www/HTML/repo
- reposync -c /tmp/lustre-repo.conf -n -r lustre-server -r lustre-client -r e2fsprogs-wc
6. 创建本地 lustre 的 yum 源
- cd /var/www/HTML/repo
- for i in e2fsprogs-wc lustre-client lustre-server; do
- (cd $i && createrepo .)
- done
7. 创建本地 lustre 源配置文件
- cat> /etc/yum.repos.d/CentOS-lustre.repo <<EOF
- [lustre-server]
- name=lustre-server
- baseurl=file:///var/www/HTML/repo/lustre-server/
- enabled=0
- gpgcheck=0
- [lustre-client]
- name=lustre-client
- baseurl=file:///var/www/HTML/repo/lustre-client/
- enabled=0
- gpgcheck=0
- [e2fsprogs-wc]
- name=e2fsprogs-wc
- baseurl=file:///var/www/HTML/repo/e2fsprogs-wc/
- enabled=0
- gpgcheck=0
- EOF
8. 查看 repo
yum repolist all
2. 服务端配置
注: 在所有服务端主机执行如下操作
1. 安装 efs2progs
yum --nogpgcheck --disablerepo=* --enablerepo=e2fsprogs-wc install e2fsprogs -y
2. 卸载内核冲突包
yum remove selinux-policy-targeted -y
3. 安装并升级内核
yum --nogpgcheck --disablerepo=base,extras,updates --enablerepo=lustre-server install kernel kernel-devel kernel-headers kernel-tools kernel-tools-libs
4. 重启机器
reboot
5. 安装 ldiskfs kmod 和 lustre 包
yum --nogpgcheck --enablerepo=lustre-server install kmod-lustre kmod-lustre-osd-ldiskfs lustre-osd-ldiskfs-mount lustre lustre-resource-agents
6. 加载 lustre 到内核
- modprobe -v lustre
- modprobe -v ldiskfs
- echo 'options lnet networks=tcp0(ens1f1)'> /etc/modprobe.d/lustre.conf
- depmod -a
3. 客户端配置
注: 只在客户端主机上操作
客户端主机安装 lustre 客户端软件, 无需升级带有 lustre 的内核, 直接安装 lustre-client 即可
1. 安装 kmod
yum --nogpgcheck --enablerepo=lustre-client install kmod-lustre-client lustre-client
2. 加载 lustre 参数
- echo 'options lnet networks=tcp0(ens1f1)'> /etc/modprobe.d/lustre.conf
- depmod -a
- modprobe lustre
4. 创建 Lustre 文件系统
配置说明:
--fsname: 指定生成后的 lustre 文件系统名, 如 sgfs, 将来客户端采用 mount -t [email protected]:[email protected]:/sgfs /home 进行挂载. br/>--mgs: 指定为 MGS 分区
--mgt: 指定为 MGT 分区
--ost: 指定为 OST 分区
[email protected]: 指定本节点失效时, 接手提供服务的节点, 如为 InfiniBand 网络, 那么 tcp0 需要换成 o2ib
--index: 指定索引, 不能相同
建立 MGS 和 MGT(注: 在服务端 MGS 主机 node1 上执行)
- mkdir -p /data/mdt
- mkfs.lustre --fsname=lufs --mgs --mdt --index=0 [email protected] --reformat /dev/sdb
- mount -t lustre /dev/sdb /data/mdt/
建立 OST1(注: 在服务端 OSS 主机 node2 上执行)
- mkdir /data/ost1 -p
- mkfs.lustre --fsname=sgfs [email protected] [email protected] [email protected]tcp0 --ost --reformat --index=1 /dev/sdb
- mount -t lustre /dev/sdb /data/ost1/
建立 OST2(注: 在服务端 OSS 主机 node3 上执行)
- mkdir /data/ost2 -p
- mkfs.lustre --fsname=sgfs [email protected] [email protected] [email protected] --ost --reformat --index=2 /dev/sdb
- mount -t lustre /dev/sdb /data/ost2/
5. 客户端挂载访问
客户端创建挂载目录并进行挂载访问.(注: 在客户端主机 node4 上执行)
- mkdir /lustre/sgfs/
- mount.lustre [email protected]:/sgfs /lustre/sgfs/
如果挂载失败, 可用 lctl 命令检查网络连接, 并查看系统日志排查.
lctl ping [email protected]
查看是否挂载成功
df -ht lustre
6. 常见问题处理
报错 1:
- [[email protected] ~]# modprobe -v lustre
- insmod /lib/modules/3.10.0-957.10.1.el7_lustre.x86_64/extra/lustre.NET/libcfs.ko
- insmod /lib/modules/3.10.0-957.10.1.el7_lustre.x86_64/extra/lustre.NET/.NET.ko
- insmod /lib/modules/3.10.0-957.10.1.el7_lustre.x86_64/extra/lustre/fs/obdclass.ko
- insmod /lib/modules/3.10.0-957.10.1.el7_lustre.x86_64/extra/lustre/fs/ptlrpc.ko
- modprobe: ERROR: could not insert 'lustre': Cannot allocate memory
错误原因: 服务器有 2 颗 CPU, 一颗 CPU 没有插内存条, 表现如下
- [[email protected] ~]# numactl -H
- available: 2 nodes (0-1)
- node 0 cpus: 0 1 2 3 4 5 6 7 8 9 20 21 22 23 24 25 26 27 28 29
- node 0 size: 0 MB
- node 0 free: 0 MB
- node 1 cpus: 10 11 12 13 14 15 16 17 18 19 30 31 32 33 34 35 36 37 38 39
- node 1 size: 32654 MB
- node 1 free: 30680 MB
- node distances:
- node 0 1
- 0: 10 20
- 1: 20 10
重新插拔内存后调整状态
- [[email protected] ~]# numactl -H
- available: 2 nodes (0-1)
- node 0 cpus: 0 1 2 3 4 5 6 7 8 9 20 21 22 23 24 25 26 27 28 29
- node 0 size: 16270 MB
- node 0 free: 15480 MB
- node 1 cpus: 10 11 12 13 14 15 16 17 18 19 30 31 32 33 34 35 36 37 38 39
- node 1 size: 16384 MB
- node 1 free: 15504 MB
- node distances:
- node 0 1
- 0: 10 21
- 1: 21 10
参考解决办法:
https://jira.whamcloud.com/browse/LU-11163
欢迎扫码提问, 可在线解答. 会定期分享虚拟化, 容器, DevOps 等相关内容
来源: http://www.bubuko.com/infodetail-3262488.html