安装:
yum install -y glusterfs{,-server,-fuse,-geo-replication}
如不使用主从复制,可以不装glusterfs-geo-replication
操作:
gluster peer command
gluster peer status
gluster peer probe server //添加机器
gluster peer detach server //踢出机器
gluster volume create NEW-VOLNAME [stripe COUNT | replica COUNT] [transport [tcp | rdma | tcp,rdma]] NEW-BRICK1 NEW-BRICK2 NEW-BRICK3 //创建volume
gluster volume create vol1 replica 2 transport tcp gluster-node01:/gluster/brick1 gluster-node02:/gluster/brick1
gluster volume start VOLNAME //启用某一volume
gluster volume delete VOLNAME //删除volume
mount -t glusterfs HOSTNAME-OR-IPADDRESS:/VOLNAME MOUNTDIR //挂载volume
mount -t glusterfs -o backupvolfile-server=volfile_server2,fetch- attempts=2,log-level=WARNING,log-file=/var/log/gluster.log server1:/test-volume /mnt/glusterfs
gluster volume rebalance VOLNAME start //均衡负载
gluster volume rebalance VOLNAME start force //强制均衡
gluster volume rebalance VOLNAME status //查看均衡状态
gluster volume rebalance VOLNAME stop //停止均衡
gluster volume heal VOLNAME //修复损坏的文件
gluster volume heal VOLNAME full //修复所有的文件(检查健康文件是否损坏,如果损坏进行修复)
gluster volume heal VOLNAME info //查看需要修复的文件信息
gluster volume heal VOLNAME info healed //查看修复的文件信息
gluster volume heal VOLNAME info failed //查看没有修复的文件信息
gluster volume heal VOLNAME info split-brain //查看脑裂文件信息(如果有脑裂文件,直接把坏的脑裂文件删除进行文件修复即可,据说3.3以后的版本有个赢链接,在修复时仍然会把脑裂文件恢复,可以把链接文件找到一并删除或是直接把目录下所有文件删除)
查找硬链接流程:
cd到brick所在目录下面进入.glusterfs目录下对应的hash目录中找到硬链接文件
磁盘操作:
gluster peer probe HOSTNAME //添加主机
gluster volume add-brick VOLNAME NEW-BRICK //添加brack
gluster volume info //查看状态
gluster volume remove-brick VOLNAME BRICK start //删除brick
gluster volume remove-brick VOLNAME BRICK status //删除状态
gluster volume remove-brick VOLNAME BRICK commit //直接提交删除(不用输入yes)
gluster volume replace-brick VOLNAME BRICKOLD-BRICK BRICKNEW-BRICK start //迁移brick数据
gluster volume replace-brick VOLNAME BRICK NEW-BRICK pause //停止迁移
gluster volume replace-brick VOLNAME BRICK NEW-BRICK abort //中断迁移
gluster volume replace-brick VOLNAME BRICK NEW-BRICK status //迁移状态
gluster volume replace-brick VOLNAME BRICK NEW-BRICK commit //直接提交迁移
gluster volume info VOLNAME //整体状态查看
磁盘或者数据迁移操作后进行负载操作(系统默认启动了负载程序,可以不做操作,如果设置中停了此程序或者想立马见到效果可以做如下操作):
gluster volume rebalance VOLNAME fix-layout start //开始负载均衡
gluster volume rebalance VOLNAME start
gluster volume rebalance VOLNAME start force
gluster volume rebalance VOLNAME status
gluster volume rebalance VOLNAME stop
性能查看:
gluster volume profile VOLNAME start
gluster volume profile VOLNAME info
gluster volume profile VOLNAME stop
gluster volume top VOLNAME open [brick BRICK-NAME] [list-cnt cnt]
gluster volume top vol1 open
gluster volume top vol1 open brick gluster-node01:/gluster/brick1
gluster volume top vol1 open brick gluster-node01:/gluster/brick1 list-cnt 10
gluster volume top VOLNAME read [brick BRICK-NAME] [list-cnt cnt]
gluster volume top vol1 read brick gluster-node01:/gluster/brick1 list-cnt 10
gluster volume top vol1 write brick gluster-node01:/gluster/brick1 list-cnt 10
gluster volume top vol1 opendir brick gluster-node01:/gluster/brick1 list-cnt 10
gluster volume top vol1 readdir brick gluster-node01:/gluster/brick1 list-cnt 10
gluster volume top VOLNAME read-perf [bs blk-size count count] [brick BRICK-NAME] [list-cnt cnt]
gluster volume top VOLNAME write-perf [bs blk-size count count] [brick BRICK-NAME] [list-cnt cnt]
gluster volume top vol1 read-perf bs 256 count 1
gluster volume top vol1 read-perf bs 256 count 1 brick gluster-node02:/gluster/brick1
参数设置:
gluster volume set VOLNAME OPTION PARAMETER
(详细参数查看官方手册Chapter 7. Managing GlusterFS Volume下面的7.1 Tuning Volume Options )
状态查看:
gluster volume status all
gluster volume status vol1 details
gluster volume status vol1 clients
gluster volume status vol1 mem
gluster volume status vol1 inode
gluster volume status vol1 callpool