CentOS-7 安装Lustre-2.10.1文件系统

xiaoxiao2021-02-28  22

注:原创文章,转载请注明出处 一、文档说明 Lustre 是一种强大的平行 分布式文件系统 ,通常用于HPC行业。 主要组建包括:元数据服务器(Metadataservers, MDSs)、对象存储服务器(objectstorage servers, OSSs)和客户端。其中MDSs提供元数据服务,MGS管理服务器提供Lustre文件系统配置信息,OSS对象存储服务器expose块设备提供数据。 目前网上关于lustre的搭建文档比较少,且大多数文档是1.×版本或者是英文的文档,本篇文档基于centos7.4和最新的lustre2.10.1进行搭建整理,希望对大家有帮助 二、环境准备 1. 准备4台虚拟机,内存>=2G,硬盘>=20G,配置主机名和IP地址 centos1 192.168.11.148 (MDT) centos2 192.168.11.149 (OST) centos3 192.168.11.150 (OST) centos4 192.168.11.151 (client) 2. 每台机器都需要关闭selinux和防火墙(如果会配置防火墙, 4台都要开启防火墙:988,1021,1022,1023端口) [root@centos1 ~]# systemctl stop firewalld [root@centos1 ~]# systemctl disable firewalld [root@centos1 ~]# sed -i -e "s/enabled/disabled/" /etc/sysconfig/selinux && reboot 3. 配置4台机器免密登录(这里不再赘述,以下是我的配置) [root@centos1 ~]# cat /etc/hosts 192.168.11.148 centos1 192.168.11.149 centos2 192.168.11.150 centos3 192.168.11.151 centos4 [root@centos1 ~]# cat .ssh/authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCns/OqLy8ISef8eg9MAbLU8ic0zAvmoCYe5vAuiMj2HmtOjpA3zKqxGuoj3Uklrn+4mqmKWBiPq0q6NDwdPJD2c2sV+2Fd3HUIiz7POH+Co13VClBb9hH/v4Y69Qx3tOOuAxakaBfZu0QrBSi2X4xy2fNlECAcUR4M8s4DANNq8Pl2GN1kG2zIA3bQH1bjqZkKNEk0zOvEX5RIeCzIZ7cVPhqZSz6BBo+bJ1+Ct5w8yjzw1uBAqsTHAg4fhyf7uQ54j7qOB4crLA3T9djDNqQHq4tCG2wFN+GO+cTZAb7m1boQZUh+kbyZmeg5eof9zkyB93LY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Y98RQ6M2Z07JQ8mplql9zutI8OwIdM/1cvkpQpY6AYY62e7XstGz5Ws8JS+gESpirmJRnDybPY2clEoRrC9PpSSV+tbOrzuUt03Cz root@centos4 以上配置,每台机器都一样,才能主机互信 4. 每台机器都配置yum源并升级 [root@centos1 ~]# cd /etc/yum.repos.d/ [root@centos1 yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo [root@centos1 yum.repos.d]# wget http://mirrors.aliyun.com/repo/epel-7.repo [root@centos1 yum.repos.d]# curl -O https://www.watters.ws/rpms/lustre/lustre-2.10.1/server/e2fsprogs.repo [root@centos1 yum.repos.d]# curl -O https://www.watters.ws/rpms/lustre/lustre-2.10.1/server/lustre.repo [root@centos1 yum.repos.d]# curl -O https://www.watters.ws/rpms/lustre/lustre-2.10.1/client/lustre-client.repo (此源是为配置lustre客户端使用) [root@centos1 yum.repos.d]# yum clean all && yum repolist && yum update 5. lustre软件包下载 lustre的软件包可以直接从官网下载( http://downloads.whamcloud.com/public/lustre/)。官网提供的包非常多非常乱,但是版本、角色还是分的挺清楚的,需要根据不同的服务器角色去下载相应的源码包。配合yum一起使用,就能很快的安装。 MDT 需要下载的源码包 kernel-3.10.0-693.2.2.el7_lustre.x86_64.rpm kernel-debuginfo-3.10.0-693.2.2.el7_lustre.x86_64.rpm kernel-debuginfo-common-x86_64-3.10.0-693.2.2.el7_lustre.x86_64.rpm kernel-devel-3.10.0-693.2.2.el7_lustre.x86_64.rpm kernel-headers-3.10.0-693.2.2.el7_lustre.x86_64.rpm kernel-tools-3.10.0-693.2.2.el7_lustre.x86_64.rpm kernel-tools-debuginfo-3.10.0-693.2.2.el7_lustre.x86_64.rpm kernel-tools-libs-3.10.0-693.2.2.el7_lustre.x86_64.rpm kernel-tools-libs-devel-3.10.0-693.2.2.el7_lustre.x86_64.rpm kmod-lustre-2.10.1-1.el7.x86_64.rpm kmod-lustre-osd-ldiskfs-2.10.1-1.el7.x86_64.rpm kmod-lustre-osd-zfs-2.10.1-1.el7.x86_64.rpm kmod-lustre-tests-2.10.1-1.el7.x86_64.rpm libnvpair1-0.7.1-1.el7.x86_64.rpm libuutil1-0.7.1-1.el7.x86_64.rpm libzfs2-0.7.1-1.el7.x86_64.rpm libzfs2-devel-0.7.1-1.el7.x86_64.rpm libzpool2-0.7.1-1.el7.x86_64.rpm lustre-2.10.1-1.el7.x86_64.rpm lustre-debuginfo-2.10.1-1.el7.x86_64.rpm lustre-dkms-2.10.1-1.el7.noarch.rpm lustre-iokit-2.10.1-1.el7.x86_64.rpm lustre-osd-ldiskfs-mount-2.10.1-1.el7.x86_64.rpm lustre-osd-zfs-mount-2.10.1-1.el7.x86_64.rpm lustre-resource-agents-2.10.1-1.el7.x86_64.rpm lustre-tests-2.10.1-1.el7.x86_64.rpm perf-3.10.0-693.2.2.el7_lustre.x86_64.rpm perf-debuginfo-3.10.0-693.2.2.el7_lustre.x86_64.rpm python-perf-3.10.0-693.2.2.el7_lustre.x86_64.rpm python-perf-debuginfo-3.10.0-693.2.2.el7_lustre.x86_64.rpm sha256sum spl-0.7.1-1.el7.x86_64.rpm spl-dkms-0.7.1-1.el7.noarch.rpm zfs-0.7.1-1.el7.x86_64.rpm zfs-dkms-0.7.1-1.el7.noarch.rpm

zfs-test-0.7.1-1.el7.x86_64.rpm

OST需要下载的源码包

kmod-lustre-2.10.1-1.el7.x86_64.rpmkmod-lustre-osd-ldiskfs-2.10.1-1.el7.x86_64.rpmkmod-lustre-osd-zfs-2.10.1-1.el7.x86_64.rpmkmod-lustre-tests-2.10.1-1.el7.x86_64.rpmlibnvpair1-0.7.1-1.el7.x86_64.rpmlibuutil1-0.7.1-1.el7.x86_64.rpmlibzfs2-0.7.1-1.el7.x86_64.rpmlibzfs2-devel-0.7.1-1.el7.x86_64.rpmlibzpool2-0.7.1-1.el7.x86_64.rpmlustre-2.10.1-1.el7.x86_64.rpmlustre-debuginfo-2.10.1-1.el7.x86_64.rpmlustre-dkms-2.10.1-1.el7.noarch.rpmlustre-iokit-2.10.1-1.el7.x86_64.rpmlustre-osd-ldiskfs-mount-2.10.1-1.el7.x86_64.rpmlustre-osd-zfs-mount-2.10.1-1.el7.x86_64.rpmlustre-resource-agents-2.10.1-1.el7.x86_64.rpmlustre-tests-2.10.1-1.el7.x86_64.rpmsha256sumspl-0.7.1-1.el7.x86_64.rpmspl-dkms-0.7.1-1.el7.noarch.rpmzfs-0.7.1-1.el7.x86_64.rpmzfs-dkms-0.7.1-1.el7.noarch.rpm

client需要下载的源码包 kmod-lustre-client-2.10.1-1.el7.x86_64.rpm kmod-lustre-client-tests-2.10.1-1.el7.x86_64.rpm lustre-client-2.10.1-1.el7.x86_64.rpm lustre-client-debuginfo-2.10.1-1.el7.x86_64.rpm lustre-client-dkms-2.10.1-1.el7.noarch.rpm lustre-client-tests-2.10.1-1.el7.x86_64.rpm lustre-iokit-2.10.1-1.el7.x86_64.rpm 三、lustre安装 服务端安装(1台MDT和2台OST) [root@centos1 ~]# mkdir /opt/lustre [root@centos1 ~]# cd /opt/lustre/ 下载上述源码包 [root@centos1 lustre]# ls kmod-lustre-2.10.1-1.el7.x86_64.rpm lustre-osd-ldiskfs-mount-2.10.1-1.el7.x86_64.rpm kmod-lustre-osd-ldiskfs-2.10.1-1.el7.x86_64.rpm lustre-dkms-2.10.1-1.el7.noarch.rpm ........ 使用yum安装源码包及其相关依赖 [root@centos1 lustre]# yum -y install kernel-3.10.0-693.2.2.el7_lustre.x86_64.rpm ........ 注:每个角色下的源码包都要全部安装 安装完毕重启一下 [root@centos1 lustre]# reboot 加载lustre和ldiskfs模块 [root@centos1 lustre]# modprobe lustre [root@centos1 lustre]# modprobe ldiskfs 安装客户端(client) [root@centos4 ~]# mkdir /opt/lustre [root@centos4 ~]# cd /opt/lustre/ 下载上述源码包 [root@centos4 lustre]# yum -y install lustre-client-2.10.1-1.el7.x86_64.rpm

........

注:每个角色下的源码包要全部安装

安装完毕重启一下 [root@centos4 lustre]# reboot 加载lustre模块 [root@centos6 lustre]# modprobe lustre 四、lustre配置 Lustre是基于内核的分布式文件系统,而不是像其它一些用户态的分布式文件系统那样直接建立在ext3或者是ext4之上。Lustre需要对磁盘进行格式化,并且在格式化的过程中进行参数配置。这里分别给前3台机器添加一块20G硬盘作为测试用,添加的硬盘显示为/dev/sdb ,最后一台机器作为客户端 1. 在MDS服务器(192.168.11.148)上执行以下操作 [root@centos1 lustre]# mkfs.lustre --fsname=lustrefs --mgs --mdt --index=0 /dev/sdb 参数解释: fsname指定的是创建lustre时的文件系统名 mgs指定该机器为元数据服务器,即该机器为mds mdt指定/dev/sdb为元数据实际数据存储位置 至于index则指定该mgs的索引号,mgs可以设置主备模式,但mdt需要在主备mds之间共享 [root@centos1 lustre]# mount.lustre /dev/sdb /mnt/mdt 2. 在两台OST服务器(192.168.11.149/150)上执行以下操作 [root@centos2 lustre]# mkfs.lustre --fsname=lustrefs --mgsnode=192.168.11.148@tcp --ost --index=0 /dev/sdb 参数解释: fsname不多说 mgsnode指定oss请求元数据节点,并指明访问协议tcp ost指定/dev/sdb为存储数据的实际位置 index这个参数可以看到两个节点是不一样的 //整个系统的实际容量是两台OST的/dev/sdb的容量 [root@centos2 lustre]# mount.lustre /dev/sdb /mnt/ost0 [root@centos3 lustre]# mount.lustre /dev/sdb /mnt/ost1 查看一下容量 [root@centos2 ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/cl-root 37G 4.1G 33G 11% / devtmpfs 907M 0 907M 0% /dev tmpfs 920M 0 920M 0% /dev/shm tmpfs 920M 8.4M 912M 1% /run tmpfs 920M 0 920M 0% /sys/fs/cgroup /dev/sda1 1014M 235M 780M 24% /boot /dev/sdb 20G 46M 19G 1% /mnt/ost0 tmpfs 184M 0 184M 0% /run/user/0 3.客户端(192.168.11.151)挂载 [root@centos4 lustre]# mount.lustre 192.168.11.148@tcp:/lustrefs /mnt/lustre 查看系统容量 [root@centos4 lustre]# df -hT 文件系统 类型 容量 已用 可用 已用% 挂载点 /dev/mapper/cl-root xfs 37G 4.2G 33G 12% / devtmpfs devtmpfs 910M 0 910M 0% /dev tmpfs tmpfs 920M 0 920M 0% /dev/shm tmpfs tmpfs 920M 8.4M 912M 1% /run tmpfs tmpfs 920M 0 920M 0% /sys/fs/cgroup /dev/sda1 xfs 1014M 186M 829M 19% /boot 192.168.11.148@tcp:/lustrefs lustre 39G 91M 37G 1% /mnt/lustre tmpfs tmpfs 184M 0 184M 0% /run/user/0 可以看到客户端挂载后,可用容量为两台OST的/dev/sdb的总容量 4. 测试 客户端测试: [root@centos4 lustre]# dd if=/dev/zero of=/mnt/test.img bs=1M count=4500 记录了4500+0 的读入 记录了4500+0 的写出 4718592000字节(4.7 GB)已复制,7.40257 秒,637 MB/秒 其中一台OST服务器测试 [root@centos2 lustre]# dd if=/dev/zero of=/tmp/test.img bs=1M count=4500 记录了4500+0 的读入 记录了4500+0 的写出 4718592000字节(4.7 GB)已复制,6.74598 秒,699 MB/秒 MDT上测试 [root@centos1 lustre]# dd if=/dev/zero of=/tmp/test.img bs=1M count=4500 记录了4500+0 的读入 记录了4500+0 的写出 4718592000字节(4.7 GB)已复制,7.06079 秒,668 MB/秒 一台普通电脑PC测试 shown@localhost ~ $ dd if=/dev/zero of=/tmp/test.img bs=1M count=4500 记录了4500+0 的读入 记录了4500+0 的写出 4718592000 bytes (4.7 GB, 4.4 GiB) copied, 43.889 s, 108 MB/s 可以看出lustre是相当的快 五、番外篇 lustre文件系统非常快,但它没有很好的数据冗余保护机制,部分节点宕机的话很容易造成数据丢失。 推荐一个提高lustre系统数据安全性的架构,即底层直接配置两个lustre系统,数据一式两份,这样子的架构是一个成本比较低的提高lustre数据安全性的方案。并且我所知道的是已经有不少朋友都是这么设计的。不过这样做需要花费成本的地方在于数据如何正确的同步(此方案未经论证) 六、参考资料 http://www.blogchong.com/?mod=pad&act=view&id=27 https://www.watters.ws/mediawiki/index.php/Lustre_Install_Notes http://www.weiruoyu.cn/?p=524 https://jira.hpdd.intel.com/browse/LU-9801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&showAll=true https://dev.uabgrid.uab.edu/wiki/LustreQuickStart
转载请注明原文地址: https://www.6miu.com/read-2450309.html

最新回复(0)