GlusterFS—新手陷阱

原文链接:https://blog.51cto.com/u_10950710/600402

更多精彩内容请…微…信…搜…索:“SRE成长记” 查看

在这里插入图片描述

在学习GlusterFS时,有些服务器因只有内部yum源,只能编译安装;有些服务器的yum仓库没有更新,都踩了很多坑,如下:

一、服务端的坑

1.1 tcmalloc library 缺失

问题:

安装GlusterFS10.3版本时,直接执行./configure 编译失败,报错:

......  #前面省略若干
checking for malloc in -ltcmalloc_minimal... no
configure: error: tcmalloc library needs to be present
[root@test65 glusterfs-10.3]#
原因和解决:

如提示,缺少依赖tcmalloc库,安装后重新编译报错消失。

yum install gperftools gperftools-devel -y

1.2 编译时,关于liburing报错

问题:

解决掉问题01后,重新执行./configure 编译时,到末尾报了另一个错:

......  #前面省略若干
checking liburing.h presence... no
checking for liburing.h... no
configure: error: Install liburing library and headers or use --disable-linux-io_uring
[root@test64 glusterfs-9.4]#
原因和解决:

官方解释:
io_uring is introduced on Linux kernel version 5.1. GlusterFS also needs the user space liburing helper library. If these are not available for your machine or if you wish to build GlusterFS without io_uring support, use --disable-linux-io_uring option

io_uring在 Linux 内核版本 5.1 上引入。GlusterFS还需要用户空间库。如果这些不适用于您的计算机,或者您希望在没有io_uring支持的情况下构建GloutsterFS,请使用 --disable-linux-io_uring 选项

解决方法一:加上官方指定的参数
./configure --disable-linux-io_uring
解决方法二:安装liburing

步骤:
1)升级gcc
centos7默认的gcc版本是:gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36),升级gcc版本:

sudo yum install centos-release-scl
sudo yum install devtoolset-9-gcc*
scl enable devtoolset-9 bash

2)安装liburing
代码包下载地址:
https://github.com/axboe/liburing/archive/refs/tags/liburing-2.2.zip
步骤:

unzui libruring-2.2.zip
cd liburing-liburing-2.2/
./configure --libdir=/usr/lib64
make CFLAGS=-std=gnu99 && make install

3)然后再重新编译安装gluster
注:在center7系统3.10.0-957.el7.x86_64版本上实验时,安装了libruring后,虽然./configure 这一步过了,但是后面make会失败报错。

1.3 volume目录不存在

问题:

创建volume时,volume所在目录不存在,导致volume创建失败:

[root@test64 root]# gluster volume create data replica 4 gfs-1:/data/gfs gfs-2:/data/gfs gfs-3:/data/gfs gfs-4:/data/gfs
volume create: data: failed: Failed to create brick directory for brick gfs-1:/data/gfs. Reason : No such file or directory
[root@test64 root]#
原因和解决:

/data目录不存在,先创建/data目录才可以

1.4 Host not in ‘Peer in Cluster’ state

问题:

创建volume时,volume节点不在资源池,volume创建失败:

[root@test64 root]# gluster volume create data replica 4 gfs-1:/home/gfsdata gfs-2:/home/gfsdata gfs-3:/home/gfsdata gfs4:/home/gfsdata
volume create: data: failed: Host gfs4 is not in 'Peer in Cluster' state
[root@test64 root]#
原因和解决:

查看集群信任池,gfs-4还未加入集群信任池里,将该节点加入即可,命令:gluster peer probe gfs-4

1.5 xx is already part of a volume

问题:

删除Replicate卷data,重建Distribute类型卷gfs-data时失败,报错:

[root@test64 gfsdata]# gluster volume create gfs-data gfs-1:/home/gfsdata gfs-2:/home/gfsdata gfs-3:/home/gfsdata gfs-4:/home/gfsdata
volume create: gfs-data: failed: /home/gfsdata is already part of a volume
[root@test64 gfsdata]#
原因和解决:

在原数据目录/home/gfsdata下还有原来的卷的数据残留,在每一台gfs节点执行如下命令;

[root@test64 gfsdata]# rm -rf /home/gfsdata/.glusterfs
[root@test64 gfsdata]# setfattr -x trusted.glusterfs.volume-id /home/gfsdata/
[root@test64 gfsdata]# setfattr -x trusted.gfid /home/gfsdata/

注:如volume下的文件未删除,直接stop和delete了volume,该volume下的文件不会被删除,要一台一台清理.在删除volume之前,现在挂载客户端将volume下的测试数据清理干净。

二、客户端的坑

2.1 未装客户端应用,挂载失败

问题:

第一次挂载客户端时,挂载失败,才反应过来没有安装客户端:

[root@test-77 root]# mount -t glusterfs -o backup-volfile-servers=gfs-2:gfs-3:gfs-4,log-level=WARNING gfs-1:/data /gfsdata
mount: unknown filesystem type 'glusterfs'
原因和解决:

没有安装客户端相关服务,安装即可,注意版本和服务器端版本的对应:

yum -y install glusterfs-client

2.2 Mount point does not exist

问题:

挂载的时候,没有先在客户端上创建挂载点,导致挂载失败:

[root@test-77 home]# mount -t glusterfs -o backup-volfile-servers=gfs-2:gfs-3:gfs-4,log-level=WARNING gfs-1:/data /home/gfsdata
ERROR: Mount point does not exist
Please specify a mount point
Usage:
man 8 /sbin/mount.glusterfs
[root@test-77 home]#
原因和解决:

挂载时,客户端的挂载点/home/gfsdata目录不存在,要提前创建客户端挂载点/home/gfsdata

2.3 Mounting glusterfs on xxx failed

问题:

挂载前,要先在客户端服务器/etc/hosts添加gfs集群节点的hosts解析,因客户端没有配置gfs集群主机的hosts解析,导致挂载失败:

[root@test-77 home]# mount -t glusterfs -o backup-volfile-servers=gfs-2:gfs-3:gfs-4,log-level=WARNING gfs-1:/data /home/gfsdata
Mounting glusterfs on /home/gfsdata failed.
[root@test-77 home]#

2.4 客户端版本太低,挂载失败

问题:

安装客户端服务后,挂载失败:

[root@test-77 home]# mount -t glusterfs -o backup-volfile-servers=gfs-002:gfs-003,log-level=WARNING gfs-001:/data /home/gfsdata
Mount failed. Please check the log file for more details.
[root@test-77 home]#
原因和解决:

看/var/log/gluster目录下的日志,有如下报错内容:

[2022-10-14 06:48:06.042692] W [MSGID: 101002] [options.c:995:xl_opt_validate] 0-glusterfs: option 'address-family' is deprecated, preferred is 'transport.address-family', continuing with correction
[2022-10-14 06:48:06.053152] W [MSGID: 101095] [xlator.c:213:xlator_dynload] 0-xlator: /usr/lib64/glusterfs/3.12.2/xlator/features/utime.so: cannot open shared object file: No such file or directory
[2022-10-14 06:48:06.053166] E [MSGID: 101002] [graph.y:213:volume_type] 0-parser: Volume 'data-utime', line 58: type 'features/utime' is not valid or not found on this machine
[2022-10-14 06:48:06.053176] E [MSGID: 101019] [graph.y:321:volume_end] 0-parser: "type" not specified for volume data-utime
[2022-10-14 06:48:06.053259] E [MSGID: 100026] [glusterfsd.c:2473:glusterfs_process_volfp] 0-: failed to construct the graph
[2022-10-14 06:48:06.053437] W [glusterfsd.c:1462:cleanup_and_exit] (-->/usr/sbin/glusterfs(mgmt_getspec_cbk+0x532) [0x557345c98b02] -->/usr/sbin/glusterfs(glusterfs_process_volfp+0x193) [0x557345c92633] -->/usr/sbin/glusterfs(cleanup_and_exit+0x6b) [0x557345c91b2b] ) 0-: received signum (-1), shutting down
[2022-10-14 06:48:06.067599] W [glusterfsd.c:1462:cleanup_and_exit] (-->/lib64/libpthread.so.0(+0x7ea5) [0x7f14d39f1ea5] -->/usr/sbin/glusterfs(glusterfs_sigwaiter+0xe5) [0x557345c91cc5] -->/usr/sbin/glusterfs(cleanup_and_exit+0x6b) [0x557345c91b2b] ) 0-: received signum (15), shutting down
[2022-10-14 06:48:45.720854] W [MSGID: 101002] [options.c:995:xl_opt_validate] 0-glusterfs: option 'address-family' is deprecated, preferred is 'transport.address-family', continuing with correction
[2022-10-14 06:48:45.725788] W [MSGID: 101095] [xlator.c:213:xlator_dynload] 0-xlator: /usr/lib64/glusterfs/3.12.2/xlator/features/utime.so: cannot open shared object file: No such file or directory
[2022-10-14 06:48:45.725804] E [MSGID: 101002] [graph.y:213:volume_type] 0-parser: Volume 'data-utime', line 58: type 'features/utime' is not valid or not found on this machine
[2022-10-14 06:48:45.725815] E [MSGID: 101019] [graph.y:321:volume_end] 0-parser: "type" not specified for volume data-utime
[2022-10-14 06:48:45.725872] E [MSGID: 100026] [glusterfsd.c:2473:glusterfs_process_volfp] 0-: failed to construct the graph

客户端的版本,是3.12版本;gfs集群是9.6版本,版本差太多:

[root@test-77 home]# rpm -qa|grep gluster
glusterfs-libs-3.12.2-47.2.el7.x86_64
glusterfs-client-xlators-3.12.2-47.2.el7.x86_64
glusterfs-fuse-3.12.2-47.2.el7.x86_64
glusterfs-3.12.2-47.2.el7.x86_64
[root@test-77 home]#

卸载当前安装的客户端。将源换成华为源,重新安装客户端

[root@test-77 home]# yum -y remove glusterfs-client
[root@test-77 home]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
[root@test-77 home]# yum clean all && yum makecache
[root@test-77 home]# yum -y install glusterfs-client

检查客户端版本

[root@test-77 home]# rpm -qa|grep gluster
glusterfs-client-xlators-6.0-61.el7.x86_64
glusterfs-libs-6.0-61.el7.x86_64
glusterfs-6.0-61.el7.x86_64
glusterfs-fuse-6.0-61.el7.x86_64
[root@test-77 log]#

再重新挂载,就成功了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值