安装源 // lustre-2.14.0 内核刚好匹配 kernel 3.10.0-1062.el7.x86_64 [root@CentOS1 lustre]# pwd /root/lustre [root @CentOS1 lustre]# ls repo.conf [root@CentOS1 lustre]# cat lustre.repo [lustre-server] name=lustre-server \ lustre-osd-zfs-mount \ lustre lustre-debuginfo \ lustre-resource-agents \ zfs zfs-debuginfo [root /mdt /dev/sdg mount.lustre mdspool/mdt /lustre/mdt/ //节点3 wipefs -a /dev/sdg mkdir -p /lustre/mdt mkfs.lustre install \ kmod-lustre-client \ lustre-client modprobe -v lustre mount -t lustre 172.16.84.43@tcp
Quota设计思路 lustre整体分为master和slave,其中master是负责全局的quota分配和追踪运行在MDT上;slave负责后端mdt和ost后端文件系统的hard quota MDT端启用inode限制 // 查看quota参数 [root@CentOS-Lustre-MDS ~]$ lctl list_param *.*.*.* |grep quota|grep -v dt ~]$ lctl conf_param bigfs.quota.mdt=ugp [root@CentOS-Lustre-MDS ~]$ sync [root@CentOS-Lustre-MDS ~]$ ~]$ lctl conf_param bigfs.quota.ost=ugp [root@CentOS-Lustre-MDS ~]$ sync // 查看启用后的参数值 [root@CentOS-Lustre-OSS ~]$ lctl conf_param bigfs.quota.ost=none [root@CentOS-Lustre-MDS ~]$ lctl conf_param bigfs.quota.mdt
设置和查看lustre参数 创建文件系统时,使用mkfs.lustre。 当服务器停止运行时,使用use trnefs.lustre。 当文件系统正在运行时,使用lctl设置或者查看参数。 1.1 mkfs.lustre设置参数 当文件系统第一次格式化时,参数可以通过在mkfs.lustre命令中添加--param选项进行设置。 # 设置超时时间为50 mkfs.lustre --mdt --param="sys.timeout=50" /dev/sda 1.2 tunefs.lustre设置参数 当服务器(OSS或MDS)停止运行时 #tunefs.lustre命令添加的为新的参数,而不会替代参数。 可用于设置/proc/fs/lustre文件中所有可设置的参数。
什么是Lustre PCC? Lustre PCC 是Lustre Persistent Cache on Client技术,借助客户端的挂载节点提供的HDD或者SSD来根据策略来在SSD或者HDD 和lustre文本系统之间数据缓存的技术 基于这样的场景,Lustre PCC就可以派上用场,它的作用就是在计算节点使用一块磁盘然后初始化为某个文件系统,然后充当lustre 挂载客户端持久化缓存,至于本地磁盘缓存数据是听过lustre一个用户态工具同步到 lustre后端的ost中。 Lustre PCC 架构是什么样的? Lustre PCC 策略有那些?
安装源 // lustre-2.14.0 内核刚好匹配 kernel 3.10.0-1062.el7.x86_64 [root@CentOS1 lustre]# pwd /root/lustre [root @CentOS1 lustre]# ls repo.conf [root@CentOS1 lustre]# cat lustre.repo [lustre-server] name=lustre-server ]# cp lustre.repo /etc/yum.repo/lustre.repo 预安装 [root@CentOS1 ~]# cd ~/lustre [root@CentOS1 ~]# yum ]# yum --nogpgcheck --enablerepo=lustre-server install \ kmod-lustre-osd-ldiskfs \ lustre-dkms \ lustre-osd-ldiskfs-mount \ lustre-osd-zfs-mount \ lustre lustre-debuginfo \ lustre-resource-agents \ zfs zfs-debuginfo [root
1.lustre架构 1.1 lustre是什么? lustre 基于GNU GPL‘协议开源的分布式并行文件系统,目前主要是DDN维护。 lustre由于非常容易扩展和极致的性能,常被用在超算、AI领域、视频存储等领域。lustre是通过内核的lustre客户端来访问文件对象。 lustre的官网参考 https://www.lustre.org/.lustre的官方的代码仓库 git clone git://git.whamcloud.com/fs/lustre-release.git lustre设计中最重要的是扩展性和性能。提高lustre的容量和文件系统带宽可以通过扩展更多的服务器到文件系统,通过增加lustre客户端增加并行访问lustre文件系统的性能。 lustre文件系统提供如下的功能: 标准的POSIX语义实现,lustre文件系统实现了标准的POSI语义 支持多个后端文件系统,目前lustre分布式文件系统支持ldiskfs和zfs两种文件系统,
开源存储问题解答社区:https://github.com/perrynzhou/deep-dive-storage-in-china
lustre调优思路概览 lustre调优目前有两个方向,一个是Linux内核方向的调整;另外一个是Lustre内部的参数调整。 Lustre参数是按照层级划分,至少有3层。 *这样方式进行查询 lustre的参数设置分为临时性和永久性设置,永久性的设置参数可以通过lctl set_param -P {lustre_param} {value for luster_param }这样的方式 如下是整理lustre调优的方向和策略,想要查看pdf版本可以参见(https://github.com/perrynzhou/deep-dive-storage-in-china/blob /master/slideshare/perrynzhou/lustre/Lustre%E6%80%A7%E8%83%BD%E8%B0%83%E4%BC%98-%E4%B8%8A%E7%AF%87.pdf
lustre的环境 版本: lustre 2.14.0 [client ~]$ lfs --version lfs 2.14.0 组件:1个mds,mgs和mds共享一个磁盘,后端采用ldiskfs.2 // lustre默认的stripe_count和stripe_size [client ~]$ lfs getstripe /mnt/lustre /mnt/lustre stripe_count: 目录的的stripe的属性,目前是设置为3个分片 [root@CentOS-Lustre-Client ~/temp_data]$ lfs getstripe /mnt/lustre/stripe_dir 目前整个环境 [client ~]$ lfs getstripe /mnt/lustre/stripe_dir/2.data /mnt/lustre/stripe_dir/2.data lmm_stripe_count ~]$ cp 2.data /mnt/lustre/stripe_dir/ // 查看对应的对象分片的信息 [client ~]$ lfs getstripe /mnt/lustre/stripe_dir
[lustre-server] name=lustre-server baseurl=https://downloads.whamcloud.com/public/lustre/lustre-2.15.2 [root@Lustre-OS ~]cd lustre-release && git checkout 2.15.2 [root@Lustre-OS ~]mv lustre-release lustre -2.15.2 && cd ~/Source/lustre-2.15.2 [root@Lustre-OS ~/Source/lustre-2.15.2]$ sh autogen.sh [root@Lustre-OS modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/lustre.ko 安装Lustre Client 编译阶段 /**************lustre client ******/ [root@Lustre-OS ~]$ cd && cd lustre-2.15.2 [root@Lustre-OS ~/Source/lustre-2.15.2]$
客户端中每个osc对应后端lustre的ost.MGC管理客户端是作为整个lustre vfs和MGS(lustre management server)之间的接口.lustre通过MGT后端设备注册MGS 1.lustre_init :lustre客户端进行mount时候初始化函数,这里涉及到的是lustre文件系统的注册(lustre_fs_type) 2.lustre_mount:当用户态执行mount 时候,会调用lustre_mount来做 mount的过程 3.lustre_fill_super:客户端挂载点的mount执行 4.lustre_start_mgc:设置MGC的OBD设备处理启动的日志 lustre提供llog_reader工具来解析lustre中的日志。 lustre_process_log会在lustre client和lustre server端调用。
环境 1.1 创建临时的yum源 cat >/tmp/lustre-repo.conf <<\__EOF [lustre-server] name=lustre-server baseurl=https [lustre-client] name=lustre-client baseurl=https://downloads.whamcloud.com/public/lustre/latest-release 安装ldiskfs kmod和lustre包 yum --nogpgcheck --enablerepo=lustre-server install \ kmod-lustre \ kmod-lustre-osd-ldiskfs \ lustre-osd-ldiskfs-mount \ lustre \ lustre-resource-agents 2.1.5 加载lustre到内核 modprobe -v lustre modprobe install \ kmod-lustre-client \ lustre-client 2.2.4 加载lustre到内核 modprobe -v lustre 3.创建lustre文件系统 配置说明
制作一个本地镜像 reposync configfile: [root@localhost html]# cat lustre-repo.conf [lustre-server] name=lustre-server * gpgcheck=0 [lustre-client] name=lustre-client baseurl=https://downloads.whamcloud.com/public/lustre 继续完成安装;通过 modprobe -v lustre 检测lustre 模块是否能够加载; 3. 安装 lustre client a. 启动lustre 服务器 systemctl restart lustre; g. 客户端挂在 lustre: mount.lustre 192.168.83.128@tcp:/lustrefs /mnt/lustre h. mkfs.lustre --fsname=lustrefs
lustre选择ost策略和参数 lustre有2种算法来选择ost进行数据的写入,分别是Round Robin(RR)和Qos. 0.2%)会在这个ost上开始写入对象分片 基于权重的ost参数的设置qos_threshold_rr和qos_prio_free需要在mds上进行 // 在mds节点上查看 [root@CentOS-Lustre-MDS_MGS .qos_prio_free lod.bigfs-MDT0000-mdtlov.qos_prio_free=91% // 在mds节点上查看设置qos_prio_free [root@CentOS-Lustre-MDS_MGS osp.bigfs-OST0000-osc-MDT0000.reserved_mb_high=40 osp.bigfs-OST0001-osc-MDT0000.reserved_mb_high=40 lustre 选择ost策略算法实现 基于权重算法选择ost实现,核心的函数是lod_ost_alloc_qos,计算每个后端存储的容量相关的元数据,选择合适的ost. // lustre由于可以配置多个mdt和多个
lustre中inode的operations 不论是本地文件系统还是分布式文件系统,每个inode会有一些operations.针对上层的posix语义的实现。 . // lustre客户端的file_oepration的函数 const struct file_operations *ll_select_file_operations(struct ll_sb_info 在vfs层,用户传入文件路径,在vfs解析文件父目录的路径,完成后在最最后文件的创建,具体的文件创建是由lustre文件系统决定。 文件系统的open函数 error = open(inode, f); } } } } } } } 文件创建核心函数流程 在lustre 中客户端测,我使用touch touch /mnt/lustre/file_aaaa来创建文件,在查找期间会先解析file_aaaa父目录,然后在进行file_aaaa的创建。
lustre集群环境 角色 节点 版本 磁盘 MGS/MDS 10.211.55.16 lustre 2.15 /dev/sdb OSS 10.211.55.17 lustre 2.15 /dev/sdb /dev/sdc Client 10.211.55.18 lustre 2.15 nil 核心参数说明 checksum_pages解说 参数说明:为了保护数据在网络中的传输,客户端内置两种数据校验的策略 llite.*.* |grep checksum_pages llite.bigfs-ffff8aac839ed800.checksum_pages // 查看参数默认值 [root@CentOS-Lustre-Client ~]$ lctl set_param -P mdc.bigfs-MDT0000-mdc-ffff9a8f9c67c000.max_dirty_mb=1024 [root@CentOS-Lustre-MDS // 查看mdc/osc能发送的最大pages数 [root@CentOS-Lustre-Client ~]$ lctl list_param *.*.* |grep max_pages_per_rpc
IO访问流程概览 lustre 客户端提供linux kernel中的vfs和lustre server质检的接口层。lustre客户端是由不同的服务组成,每个服务层提供特定的lustre服务。 FID是lustre客户端用来文件的唯一标识。 每个OST上文件分片对象都是有唯一的FID于此同时每个数据分片在MDT上都会对应该这个文件的FID 当执行挂载lustre客户端的时候,发起mount命令,lustre客户端内部的MGC服务连接到MGS 为了标识整个lustre文件系统中每个对象的唯一性,lustre为每个对象提供一个FID作为唯一标识。FID是128位长度长度,包括了三个部分64位的序列号、32位的对象ID、32位的版本号。 lustre中定义sequence服务端和客户端类型。
测试环境 // 目前使用的是lustre 2.15.0[root@CentOS-Lustre-Client ~]$ lfs --version lfs 2.15.0 // 人为设置/bigfs/pg ~]$ cp pg.log /bigfs/pg/ 查看lustre扩展本信息 获取扩展属性 [root@CentOS-Lustre-Client ~]$ getfattr -d -m - /bigfs 在lustre内核中定义XATTR_LUSTRE_LOV为lustre.lov。 通过我们自己定制的代码解析这个扩展属性验证和上述保持一致 // lustre源码中定义了lustre.lov的扩展属性#define XATTR_LUSTRE_PREFIX "lustre." // lustre内核中定义的trusted.lma#define XATTR_NAME_LMA "trusted.lma" // 自解析lustre的属性,然后读取出来[root@CentOS-Lustre-Client
基本概念阐述 FID:在lustre文件系统中每个分片对象都会有唯一的fid,这也是lustre文件系统用来表示每个对象唯一性的。 LMA:lustre metadata attributes,记录lustre中特殊的属性,比如HSM状态,自身的fid信息,这些信息都会存储在文件被strip后的对象属性上。 -v /mnt/lustre/database.dat /mnt/lustre/database.dat lmm_magic: 0x0BD10BD0 lmm_seq: .oi_scrub lustre查看LFSCK状态 查看OI Scrub // 使用说明 /proc/fs/lustre/osd-ldiskfs/${FSNAME}-MDTxxxx/oi_scrub on the device bigfs-OST0000. // 使用例子 [root@CentOS-Lustre-OSS-1 /proc/fs/lustre]$cat /proc/fs/lustre
lustre介绍 lustre是一个开源、分布式、高性能的分布式存储。lustre广泛被HPC领域使用。lustre目前仅仅支持本地数据容错,在未来版本2.16推出会支持EC,做到数据容错。 lustre组件介绍 MGS+MGT:MGS提供注册lustre server、lustre client以及lustre文件系统的配置信息。MGT是为MGS提供存储的storage target. Clients:lustre client使用lnet挂在lustre文件系统。 Network:lustre是基于network的文件系统,所有的IO事务都是发送到网络后端处理。 lustre server如果选择了zfs,lustre客户端就不需要linux 内核的patch. lustre处理IO处理流程 lustre 客户端提供虚拟文件系统和lustre server之间的接口 Lustre Client介绍 lustre客户端把元数据、对象存储合并为单一的POSIX 文件系统对外提供服务,以挂载lustre文件系统的形式存在。