在linux上配置Gluster集群

Gluster集群安装准备

1 修改主机名
2 添加hosts文件实现集群主机之间能相互解析
3 关闭selinux和防火墙
4 安装epel源 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
5 安装Gluster源
https://download.gluster.org/pub/gluster/glusterfs/4.0/4.0.0/
https://buildlogs.centos.org/centos/7/storage/x86_64/gluster-4.0/
6 在4台机子上配置时间同步 chronyd (node1为时间同步服务器)

192.168.23.195 node1.example.com node1
192.168.23.196 node2.example.com node2
192.168.23.197 node3.example.com node3
192.168.23.198 node4.example.com node4

在linux上配置Gluster集群

6 配置chronyd

在linux上配置Gluster集群
在linux上配置Gluster集群

客户端配置
在linux上配置Gluster集群

服务端防火墙放行 ntp

7 所有机子安装安装包glusterfs-server

在linux上配置Gluster集群

启动
在linux上配置Gluster集群

配置gluster 信任存储池

1 确保glusterd服务启动
2 所有节点防火墙放行 glusterfs服务
3 添加信任节点进入信任存储池

1 确保glusterd服务启动
在linux上配置Gluster集群
2 所有节点防火墙放行 glusterfs服务
在linux上配置Gluster集群
3
添加
在linux上配置Gluster集群
查看状态
在linux上配置Gluster集群
在linux上配置Gluster集群

查看版本

glusterfs -V
在linux上配置Gluster集群
配置gluster卷

首先配置好逻辑卷并挂载
在linux上配置Gluster集群

在linux上配置Gluster集群

在linux上配置Gluster集群

在linux上配置Gluster集群
在linux上配置Gluster集群

准备完毕之后创建glusterfs卷

创建brick
在linux上配置Gluster集群

设置selinux
semanage fcontext -a -t glusterd_brick_t /storage/brick1/brick1
restorecon -Rv /storage

创建普通卷
gluster volume create firstvol node1:/storage/brick1/brick1 node2:/storage/brick1/brick1

在linux上配置Gluster集群
查看卷的状态
gluster volume status firstvol

在linux上配置Gluster集群

查看卷的详细信息
gluster volume info firstvol
在linux上配置Gluster集群
启动卷

在linux上配置Gluster集群

挂载gluster卷

客户端安装glusterfs-fuse包
server2 客户端

在linux上配置Gluster集群

挂载成功
在linux上配置Gluster集群
在/a创建文件
可以看到是平分到卷内的逻辑卷的

在linux上配置Gluster集群
在linux上配置Gluster集群

停止运行gluster卷 并 删除
在linux上配置Gluster集群