分布式文件系统-LizardFS
2016-02-25 14:51:16 阿炯

LizardFS 是一个开源的分布式文件系统,具备可靠性、可伸缩以及高效的特点。可在大量的物理服务器中分发数据,并对最终使用者来说是一个单一的文件系统。LizardFS 可以被认为是 MooseFS 的一个衍生版本,有比较完整的参考文档,支持Windows客户端。采用C/C++开发并在GPLv3协议下授权。


LizardFS is a distributed, scalable, fault-tolerant and highly available file system. It allows users to combine disk space located on many servers into a single name space which is visible on Unix-like and Windows systems in the same way as other file systems. LizardFS makes files secure by keeping all the data in many replicas spread over available servers. It can be used also to build an affordable storage, because it runs without any problems on commodity hardware.


Disk and server failures are handled transparently without any downtime or loss of data. If storage requirements grow, it’s possible to scale an existing LizardFS installation just by adding new servers – at any time, without any downtime. The system will automatically move some data to newly added servers, because it continuously takes care of balancing disk usage across all connected nodes. Removing servers is as easy as adding a new one.


Features

support for many data centers and media types
fast snapshots
transparent trash bin
QoS mechanisms
quotas and a comprehensive set of monitoring tools make it suitable for a range of enterprise-class applications


LizardFS使用介绍

MooseFS v2.0的社区版本中加入的一些特性,其实在LizardFS里也有得到了支持,Github源镜像

主要增加了以下这些功能:

High availability(更加高可用) //提供shadow master功能
Quotas //磁盘配额管理
POSIX Access Control Lists and Extended Attributes(更好的支持文件的posix属性)
I/O bandwidth limiting //限制带宽
Command line monitoring tool //命令行的监控查询方式
High performance CRC checksum implementation(crc校验和实现更高效)
Reduced overhead of hourly metadata backups //减少了每小时元数据备份的开销


最主要的HA方面是通过提供shadow master功能,可以在线手动切换成master,与MooseFS的结构相比,大致就是多了Shadow master的这个新角色。Shadow master可以定期自动从master那获取changelog、metadata和sessions等数据,很可惜不是实时的完全一致的。

准备工作
升级gcc到v4.8.1(需要支持c++11)。

注意:如果只使用正常的fuse功能挂载,就可以忽略这里缺少Polonaise和Thrift等的提示。可以直接下一步make看能否通过。为了能够运行lizardfs,需要使用到libstdc++.so.6的高版本。从MooseFS升级到了LizardFS,完全可以按照以前的MooseFS的使用方式操作。

LizardFS新功能使用

1、Shadow master
先对/etc/mfs/mfsmaster.cfg进行配置
设置PERSONALITY = shadow //指定master属性为shadow master
从master服务器那获得现有mfsexports.cfg
然后启动mfsmaster

注意:可以有多个shadow master服务器运行,同时可以与metalogger server,chunk server都部署在同一台物理服务器上。在监控页面上可以看到shadow master与metalogger server都是列在Metadata Backup列表上。

Master出故障掉线后的处理:
a)将shadow master上的IP改为master的IP
b)修改mfsmaster.cfg中的PERSONALITY为master
c)mfsmaster reload重载配置
d)修复master的工作:
 修改mfsmaster.cfg中的PERSONALITY为shadow
 mfsmetarestore -a 用于清除metadata.mfs.lock
 启动mfsmaster作为shadow

2、磁盘配额管理
提供工具:mfssetquota, mfsrepquota

3、带宽限制
增加了master上的配置文件(/etc/mfs/)用于限制全局和本地节点的流量带宽,似乎是通过cgroups来实现的。
功能启用,需要在mfsmaster.cfg中加入GLOBALIOLIMITS_*方面的设置,例如:
GLOBALIOLIMITS_FILENAME = /etc/mfs/globaliolimits.cfg
GLOBALIOLIMITS_RENEGOTIATION_PERIOD_SECONDS = 0.1
GLOBALIOLIMITS_ACCUMULATE_MS = 250
然后分别设置设置全局和本地的配置文件globaliolimits和iolimits.cfg

4、监控工具lizardfs-probe
通过在终端下运行命令行,从master获取信息,包括整个系统的统计信息,chunk server的信息。比较简单,直接看帮助即可。


从源码编译安装 LizardFS

useradd -r -s /bin/false -u 9420 -g daemon mfs
yum install gcc gcc-c++ make rpm-build fuse-devel cmake asciidoc

cd lizardfs-3.11.3 && mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/lizardfs
...
-- ISAL(Intel Storage Acceleration) LIBRARY: ISAL_LIBRARY-NOTFOUND
CMake Error at CMakeLists.txt:214 (message):
  Boost headers are required
-- Could NOT find JUDY (missing:  JUDY_LIBRARY JUDY_INCLUDE_DIR)
-- Could NOT find PAM (missing:  PAM_LIBRARY PAM_MISC_LIBRARY PAM_INCLUDE_DIR)

server
yum install pam-devel boost boost-devel fuse-devel cmake asciidoc -y

client
yum install boost boost-devel cmake fuse-devel pam-devel -y


最新版本:3.12


官方主页:https://lizardfs.com/
该文章最后由 阿炯 于 2019-08-11 17:10:32 更新,目前是第 2 版。