Note
CentOS 7.2作为GlusterFS服务器
build_glusterfs_11_for_centos_7
gluster11_rpm_createrepo
- 安装方法同
deploy_centos7_gluster6
:
deploy_centos7_gluster11/yum_install_glusterfs-server
输出显示将安装如下软件包:
deploy_centos7_gluster11/yum_install_glusterfs-server_output
- 启动GlusterFS管理服务:
deploy_centos7_gluster11/systemctl_enable_glusterd
- 检查
glusterd
服务状态:
deploy_centos7_gluster11/systemctl_status_glusterd
输出显示服务运行正常:
deploy_centos7_gluster11/systemctl_status_glusterd_output
- 在所有需要的CentOS 7.2服务器节点都安装好上述
gluster-server
软件包( 使用pssh
):
deploy_centos7_gluster11/pssh_install_glusterfs-server
如果简单ssh执行通过如下方式完成:
deploy_centos7_gluster11/ssh_install_glusterfs-server
- CentOS 7 默认启用了防火墙(视具体部署),确保服务器打开正确通讯端口:
deploy_centos7_gluster11/centos7_open_ports_glusterfs
Note
- 在采用分布式卷的配置时,需要确保
brick
数量是replica
数量的整数倍。举例,配置replica 3
,则对应bricks
必须是3
/6
/9
依次类推 - 部署案例中,采用了
6
台服务器,每个服务器12
块NVME磁盘:12*6
(3的整数倍)
- 配置gluster配对 只需要在一台服务器上执行一次 :
deploy_centos7_gluster11/gluster_peer_probe
- 完成后检查
gluster peer
状态:
deploy_centos7_gluster11/gluster_peer_status
deploy_centos7_gluster11/gluster_peer_status_output
- 创建一个简单的脚本
create_gluster
,方便构建replica 3
的分布式卷:
deploy_centos7_gluster11/create_gluster
Note
当 brick
数量是 replica
的整数倍(2倍或更多倍)时, distributed_replicated_glusterfs_volume
自动创建,能够同时获得高可用和高性能。但是对 brick
的排列有要求: 先 replica
后 distribute
。
所以为了能将数据分布到不同服务器上,我这里采用了特定的排列顺序: A:0,B:0,C:0,A:1,B:1,C:1,A:2,B2,C2...
以便让 replicas 3
能够精确分布到不同服务器上。
这种部署方式有利有弊: best_practices_for_gluster
我会详细探讨
将脚本加上执行权限:
chmod 755 create_gluster
- 创建卷,举例是
backup
:
deploy_centos7_gluster11/create_gluster_backup_vol
- 如果创建卷错误,通过以下方式删除:
deploy_centos7_gluster11/delete_gluster_backup_vol
Note
这里在执行 gluster volume
的 stop
和 delete
命令时,都添加了参数 --mode=script
是为了避免交互,方便脚本命令执行。日常运维则可以不用这个参数,方便交互确认。
- 完成后检查卷状态:
deploy_centos7_gluster11/gluster_volume_status
- 在客户端服务器只需要安装
gluster-fuse
软件包:
deploy_centos7_gluster11/install_gluster-fuse
- 修改
/etc/fstab
添加如下内容:
deploy_centos7_gluster11/gluster_fuse_fstab
- 挂载存储卷:
deploy_centos7_gluster11/mount_gluster