1) 安装服务
yum install -y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma
2) 启动服务
systemctl start glusterd.service
systemctl enable glusterd.service
gluster peer probe 192.168.10.112
gluster peer probe 192.168.10.113
…
查看信任池
gluster peer status
只要在任意一个节点执行
gluster volume create ${volume_name} replica 3 transport tcp \
192.168.10.112:/home/gfs/data/fs1 \
192.168.10.113:/home/gfs/data/fs1 \
192.168.10.114:/home/gfs/data/fs1 \
192.168.10.115:/home/gfs/data/fs1 \
192.168.10.116:/home/gfs/data/fs1 \
192.168.10.117:/home/gfs/data/fs1 \
192.168.10.118:/home/gfs/data/fs1 \
192.168.10.132:/home/gfs/data/fs1 \
192.168.10.133:/home/gfs/data/fs1 \
192.168.10.134:/home/gfs/data/fs1 \
192.168.10.135:/home/gfs/data/fs1 \
192.168.10.136:/home/gfs/data/fs1 \
192.168.10.137:/home/gfs/data/fs1 \
192.168.10.138:/home/gfs/data/fs1 \
192.168.10.138:/home/gfs/data/fs2 force
挂载卷的名字为: ${volume_name}(可随意命名,后面需要用到)
此处采用3备份,brick数量必须是备份数的整数倍,本次只有14台服务器, 故在192.168.10.138添加两个brick (同一个节点添加两个brick需要在末尾添加force参数)
3) 启动挂载卷
gluster volume start ${volume_name}
查看挂载卷:
gluster volume info
gluster volume status
4) 在GlusterFS集群的所有机器上挂载目录
创建目录:mkdir /export/data
mount -t glusterfs 192.168.10.112:/ ${volume_name} /export/data
mount -t glusterfs 192.168.10.113:/ ${volume_name} /export/data
…
暂时采用节点只需挂载本节点。
5) GlusterFS常用配置
gluster volume set ${volume_name} performance.read-ahead on
gluster volume set ${volume_name} performance.quick-read on
gluster volume set ${volume_name} performance.write-behind on
# 1.开启指定volume的配额
# gluster volume quota ${volume_name} enable
# 2.限制指定volume的配额
# gluster volume quota ${volume_name} limit-usage / 5GB
# 3.设置cache大小, 默认32MB
gluster volume set ${volume_name} performance.cache-size 1024MB
# 4.设置io线程, 太大会导致进程崩溃
gluster volume set ${volume_name} performance.io-thread-count 16
# 5.设置网络检测时间, 默认42s
gluster volume set ${volume_name} network.ping-timeout 10
# 6.设置写缓冲区的大小, 默认1M
gluster volume set ${volume_name} performance.write-behind-window-size 512MB