当前位置:首页 > Web开发 > 正文

附009.Kubernetes永久存储之GlusterFS独立部署

2024-03-31 Web开发

标签:

一 前期准备 1.1 基础知识

Heketi提供了一个RESTful管理界面,可以用来管理GlusterFS卷的生命周期。Heketi会动态在集群内选择bricks构建所需的volumes,从而确保数据的副本会分散到集群不同的故障域内。同时Heketi还支持任意数量的ClusterFS集群。

提示:本实验基于glusterfs和Kubernetes分开部署,heketi管理glusterfs,Kubernetes使用heketi提供的API,从而实现glusterfs的永久存储,,而非Kubernetes部署glusterfs。

1.2 架构示意


技术图片

提示:本实验Heketi仅管理单zone的glusterfs集群。

1.3 相关规划

主机

 

IP

 

磁盘

 

备注

 

servera

 

172.24.8.41

 

sdb

 

glusterfs节点

 

serverb

 

172.24.8.42

 

sdb

 

glusterfs节点

 

serverc

 

172.24.8.43

 

sdb

 

glusterfs节点

 

heketi

 

172.24.8.44

   

Heketi主机

 


 

servera

 

serverb

 

serverc

 

PV

 

sdb1

 

sdb1

 

sdb1

 

VG

 

vg0

 

vg0

 

vg0

 

LV

 

datalv

 

datalv

 

datalv

 

bricks目录

 

/bricks/data

 

/bricks/data

 

/bricks/data

 

1.4 其他准备

所有节点NTP配置;

所有节点添加相应主机名解析:

172.24.8.41 servera

172.24.8.42 serverb

172.24.8.43 serverc

172.24.8.44 heketi

注意:若非必要,建议关闭防火墙和SELinux。

二 规划相应存储卷 2.1 划分LVM

1 [[email protected] ~]# fdisk /dev/sdb #创建lvm的sdb1,过程略 2 [[email protected] ~]# pvcreate /dev/sdb1 #使用/dev/vdb1创建PV 3 [[email protected] ~]# vgcreate vg0 /dev/sdb1 #创建vg 4 [[email protected] ~]# lvcreate -L 15G -T vg0/thinpool #创建支持thin的lv池 5 [[email protected] ~]# lvcreate -V 10G -T vg0/thinpool -n datalv #创建相应brick的lv 6 [[email protected] ~]# vgdisplay #验证确认vg信息 7 [[email protected] ~]# pvdisplay #验证确认pv信息 8 [[email protected] ~]# lvdisplay #验证确认lv信息

提示:serverb、serverc类似操作,根据规划需求创建完所有基于LVM的brick。

三 安装glusterfs 3.1 安装相应RPM源

1 [[email protected] ~]# yum -y install centos-release-gluster

提示:serverb、serverc、client类似操作,安装相应glusterfs源;

安装相应源之后,会在/etc/yum.repos.d/目录多出文件CentOS-Storage-common.repo,内容如下:

1 # CentOS-Storage.repo 2 # 3 # Please see http://wiki.centos.org/SpecialInterestGroup/Storage for more 4 # information 5 6 [centos-storage-debuginfo] 7 name=CentOS-$releasever - Storage SIG - debuginfo 8 baseurl=http://debuginfo.centos.org/$contentdir/$releasever/storage/$basearch/ 9 gpgcheck=1 10 enabled=0 11 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Storage

3.2 安装glusterfs

1 [[email protected] ~]# yum -y install glusterfs-server

提示:serverb、serverc类似操作,安装glusterfs服务端。

3.3 启动glusterfs

1 [[email protected] ~]# systemctl start glusterd 2 [[email protected] ~]# systemctl enable glusterd

提示:serverb、serverc类似操作,所有节点启动glusterfs服务端;

安装完glusterfs之后建议exit退出终端重新登录,从而可以补全glusterfs相关命令。

3.4 添加信任池

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/43012.html