gluster peer probe node2
gluster peer stat
//查看状态
gluster pool list
gluster peer detach node1
gluster volume create v1 node1:/data/xx node2:/data/xx
gluster volume create v2 replica 2 node1:/data/xx node2:/data/xx force
gluster volume create v3 replica 2 node1:/data/xx node2:/data/xx node3:/data/xx node4:/data/xx
mount node1:/v1 /data
yum install glusterfs-fuse -y
mount.glusterfs node1:/v1 /data
yum install samba -y
useradd -s /sbin/nologin tom
chown .tom mountpoint
chmod 755 mountpoint
umount mountpoint
gluster volume set v1 stat-prefetch off
开启非安全访问模式
gluster volume set v1 server.allow-insecure on
gluster volume set v1 storage.batch-fsync-delay-usec 0
gluster volume stop v1
gluster volume start v1
使用NFS挂载的时候,默认是支持ACL的
使用glusterfs挂载的时候,默认是不启用ACL的
mount -t glusterfs -o acl node1:/v1 /mnt
gluster volume quota v1 enable //关闭为disable
gluster volume quota v1 list
gluster volume quota v1 limit-usage /mp4 256MB /mp4为卷内的目录
gluster volume add-brick v1 node3:/data/xx
gluster volume rebalance v1 start
gluster volume add-brick v2 replica 3 node3:/data/xx force //复制式
复制式卷不需要rebalance
gluster volume remove-brick v1 node3:/data/xx start
gluster volume remove-brick v1 node3:/data/xx commit
gluster volume remove-brick v2 replica 2 node3:/data/xx force //复制式
gluster volume remove-brick v2 replica 2 node3:/data/xx commit
安装ctdb
yum install ctdb* -y
在每个节点编辑/var/lib/glusterd/hooks/1/start/post/S29CTDBsetup.sh
,修改META为卷名;例如:META="V2"
在每个节点编辑/var/lib/glusterd/hooks/1/stop/pre/S29CTDB-teardown.sh
,修改META为卷名;例如:META="V2"
修改smb.conf
在[global]下添加clustering=yes
设置卷的属性
gluster volume set v2 stat-perfetch off
gluster volume set v2 server.allow-insecure on
gluster volume set v2 storage.batch-fsync-delay-usec 0
gluster volume start v2
touch /etc/ctdb/nodes
,内容为ip1
ip2
ip3
ip4
...
创建浮动IP
echo [ip] >> /etc/ctdb/public_addresses
将上述两文件拷贝到其他节点
启动ctdb服务(每个节点)
systemctl start ctdb
systemctl enable ctdb
检查
ctdb -v vip
在node5新建一个卷
lvcreate -L 10G -T vg0/pool1
lvcreate -V 7G -T vg0/pool1 -n lv1
mkfs.xfs /dev/vg0/lv1
mount /dev/vg0/lv1 /data
mkdir /data/xx
gluster volume create v5 node5:/data/xx
gluster volume start v5
useradd bob ; echo redhat | passwd --stdin bob
mkdir /var/root
chmod 711 /var/root
vim /etc/glusterfs/glusterd.vol
option mountbroker-root /var/root
option mountbroker-geo-replication.bob v5
option geo-replication-log-group bob
option rpc-auth-alllow-insecure on
systemctl restart glusterd
ssh-keygen
ssh-copy-id bob@node5
gluster system:: execute gsec_create
gluster volume geo-replication v1 bob@node5::v5 create push-pem //建立geo关系
gluster volume geo-replication v1 bob@node5::v5 stop
/usr/libexec/glusterfs/set_geo_rep_pem_keys.sh bob v1 v5
gluster volume geo-replication v1 bob@node5::v5 start
gluster volume geo-replication v1 bob@node5::v5 status //查看同步状态
gluster snapshot list //查看快照
gluster snapshot create v1_s1 v1 //创建快照
gluster snapshot restore v1_s1 //恢复快照,恢复之前先stop掉原来的卷
如果是复制式的卷,检查哪些文件需要修复gluster volume heal v1 info
gluster volume create v4 node3:/vol/yy node4:/vol/yy
gluster volume start v4
gluster volume tier v4 attach replica 2 node1:/vol/yy node2:/vol/yy
gluster volume tier v4 detach start //移除hot peer
gluster volume tier v4 detach commit