在SLES 15 sp4中部署GlusterFS 11客户端

部署方案

SUSE Linux 作为主要的企业级Linux发行版,不仅在欧洲应用广泛,也在中国的金融、运营商和电力等关键领域得到采用。本文采用模拟多磁盘服务器构建GlusterFS集群:

在生产系统中,需要平衡不同操作系统的服务端和客户端搭配:

准备

  • 安装 glusterfs 客户端时候会安装操作系统依赖软件包,所以挂载安装光盘镜像:

安装 glusterfs 客户端需要安装操作系统依然软件包,所以挂载SLES 15 SP4光盘镜像
zypper ar -c -t yast2 "iso:/?iso=/root/SLE-15-SP4-Full-x86_64-QU2-Media1.iso" "SLES-15-SP4"

使用 wget 镜像下载rpm包:

使用 wget 镜像网站方式下载GlusterFS 11 for SLES 15SP4
wget -mkEpnp http://download.opensuse.org/repositories/home:/glusterfs:/SLES15SP4-11/15.4/x86_64/

将下载后的 GlusterFS 11 for SLES 15SP4 RPM包全部移动到 gluster11/glusterfs/11.0/SLES/15SP4/ 目录下,然后执行 createrepo 创建仓库 :

使用 createrepo 创建仓库 为 下载GlusterFS 11 for SLES 15SP4 rpm包创建仓库
createrepo gluster11/glusterfs/11.0/SLES/15SP4/
  • 将构建好的 gluster11 软件仓库加入到SUSE的YaST中, 配置 /etc/zypp/repos.d/glusterfs-11_sles15sp4.repo :

/etc/zypp/repos.d/glusterfs-11_sles15sp4.repo 配置
[sels15sp4-gluster11]
name=SELS-15.4 - Gluster 11
baseurl=http://33.188.24.141:8080/glusterfs/11.0/SLES/15SP4/
enabled=1

安装

  • SUSE Linux 安装GlusterFS客户端和服务器都使用相同软件包 glusterfs :

在 SLES 15 sp4中安装GlusterFS软件包
 zypper -n install glusterfs

如果解决了依赖问题,则正确的安装提示如下:

在 SLES 15 sp4中安装GlusterFS软件包以及依赖软件包
Repository 'SLES 15 SP4' is up to date.
Retrieving repository 'SELS-15.4 - Gluster 11' metadata ................................[done]
Building repository 'SELS-15.4 - Gluster 11' cache .....................................[done]
All repositories have been refreshed.
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 20 NEW packages are going to be installed:
  glusterfs libgfapi0 libgfchangelog0 libgfrpc0 libgfxdr0 libglusterfs0 libtcmalloc4 libunwind python3-asn1crypto 
  python3-certifi python3-cffi python3-chardet python3-cryptography python3-idna python3-py
  python3-pyasn1 python3-pycparser python3-pyOpenSSL python3-requests python3-urllib3

The following 20 packages have no support information from their vendor:
  glusterfs libgfapi0 libgfchangelog0 libgfrpc0 libgfxdr0 libglusterfs0 libtcmalloc4 libunwind python3-asn1crypto 
  python3-certifi python3-cffi python3-chardet python3-cryptography python3-idna python3-py
  python3-pyasn1 python3-pycparser python3-pyOpenSSL python3-requests python3-urllib3

20 new packages to install.
Overall download size: 5.7 MiB. Already cached: 0 B. After the operation, additional 29.1 MiB will be used.
Continue? [y/n/v/...? shows all options] (y):

备注

对于直接从 openSUSE Oss x86_64 Repository 下载的rpm软件包,这些软件包是有签名的,如果没有导入对应Oss仓库的公钥,则会提示错误:

Repository SELS-15.4 - Gluster 11 does not define additional 'gpgkey=' URLs.
glusterfs-11.0-150400.105.2.x86_64 (SELS-15.4 - Gluster 11): Signature verification failed [4-Signatures public key is not available]
Abort, retry, ignore? [a/r/i] (a):

这输入 i 忽略,以便继续安装

  • 安装完成后执行 gluster --version 检查安装版本,确认已经安装成功

异常排查

备注

GlusterFS for SUSE Linux 的依赖软件包是由 openSUSE Oss x86_64 Repository 提供。所以如果服务器能够联网,最好直接添加这个仓库以便进行安装。我的实践是因为服务器无法联网,所以采用手工下载软件包方式添加到 createrepo 创建仓库 仓库。

  • 首先遇到的依赖报错:

在 SLES 15 sp4中安装GlusterFS软件包缺少 ‘libtcmalloc_minimal.so.4()(64bit)’
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: nothing provides 'libtcmalloc_minimal.so.4()(64bit)' needed by the to be installed glusterfs-11.0-150400.105.2.x86_64
 Solution 1: do not install glusterfs-11.0-150400.105.2.x86_64
 Solution 2: break glusterfs-11.0-150400.105.2.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/c/d/?] (c):

需要安装 libtcmalloc4 ,在 pkgs.org libtcmalloc_minimal.so.4()(64bit) 可以找到位于 openSUSE Oss x86_64 Repository (是由 openSUSE Leap 15.4 发行版提供) 。下载链接是 libtcmalloc4-2.5-4.12.x86_64.rpm.html

依赖清单:

libtcmalloc_minimal.so.4()(64bit)  libtcmalloc4
python3-requests
python3-py
python3-certifi
python3-idna
python3-urllib3
libunwind.so.8()(64bit)  libunwind
python3-pyOpenSSL
python3-cryptography
python3-cffi
python3-asn1crypto
python3-pyasn1
python3-pycparser

都可以从 openSUSE Oss x86_64 Repository 搜索下载

完整处理脚本:

下载安装 SLES 15 sp4中安装GlusterFS 所需依赖包
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/x86_64/libtcmalloc4-2.5-4.12.x86_64.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/python3-requests-2.24.0-1.24.noarch.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/ports/aarch64/distribution/leap/15.4/repo/oss/noarch/python3-py-1.8.1-5.6.1.noarch.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/python3-certifi-2018.1.18-1.18.noarch.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/python3-idna-2.6-1.20.noarch.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/python3-urllib3-1.25.10-4.3.1.noarch.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/x86_64/libunwind-1.5.0-4.5.1.x86_64.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/python3-pyOpenSSL-20.0.1-150400.1.4.noarch.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/x86_64/python3-cryptography-2.8-10.1.x86_64.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/x86_64/python3-cffi-1.13.2-3.2.5.x86_64.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/python3-asn1crypto-0.24.0-3.2.1.noarch.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/python3-pyasn1-0.4.2-3.2.1.noarch.rpm
wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.4/repo/oss/noarch/python3-pycparser-2.17-3.2.1.noarch.rpm

配置

SUSE平台的GlusterFS客户端配置和 CentOS 7 部署Gluster 11 完全一致,只需要配置 /etc/fstab 挂载点即可( 服务器端采用 CentOS 7 部署Gluster 11 )

  • 配置 /etc/fstab :

GlusterFS客户端的 /etc/fstab
192.168.1.1:/backup  /data/backup  glusterfs    defaults,_netdev,direct-io-mode=enable,backupvolfile-server=192.168.1.2    0    0
  • 挂载存储卷:

挂载GlusterFS卷
mkdir -p /data/backup
mount /data/backup

参考