About ACL:

[root@workstation ~]# lab acls setup
[root@servera ~]# gluster volume list
[root@workstation ~]# mkdir /mnt/groupdata
[root@workstation ~]# yum install -y glusterfs-fuse
[root@workstation ~]# vim /etc/fstab

servera:/groupdata /mnt/groupdata glusterfs defaults,acl,_netdev 0 0

[root@workstation ~]# mount -a
[root@workstation ~]# df -h
[root@workstation ~]# cd /mnt/groupdata/
[root@workstation groupdata]# mkdir admindocs
[root@workstation groupdata]# chown :admins admindocs/
[root@workstation groupdata]# chmod 2755 admindocs/
[root@workstation groupdata]# chmod 2775 admindocs/
[root@workstation groupdata]# chmod 2770 admindocs/
[root@workstation groupdata]# setfacl -Rm g:managers:r-X admindocs/
[root@workstation groupdata]# setfacl -Rm d:g:managers:r-X admindocs/
[root@workstation groupdata]# getfacl admindocs/
root@workstation ~]# lab acls grade

reset directory's ACL

[root@workstation ~]# setfacl -b /mnt/groupdata/admindocs/
[root@workstation ~]# lab quotas setup

[root@workstation ~]# umount /mnt/graphics/
[root@workstation graphics]# mkdir raw

[root@servera ~]# gluster volume quota graphics enable
[root@servera ~]# gluster volume quota graphics limit-usage /raw 1GB 50%
[root@servera ~]# gluster volume quota graphics soft-timeout 5s
[root@servera ~]# gluster volume quota graphics hard-timeout 1s
[root@servera ~]# gluster volume quota graphics list
[root@servera ~]# gluster volume set graphics quota-deem-statfs on
[root@workstation graphics]# df -h /mnt/graphics/raw/

[root@workstation graphics]# dd if=/dev/zero of=/mnt/graphics/raw/testfile bs=1M
[root@workstation raw]# ll -h

[root@workstation raw]# lab quotas grade

异地灾备

[root@workstation ~]# lab georeplication setup

允许被共享

[root@servera ~]# gluster volume set all cluster.enable-shared-storage enable

[root@servera ~]# gluster volume list

gluster_shared_storage
mastervol

[root@servere ~]# gluster volume list

slavevol

[root@servera ~]# ssh-copy-id geoaccount@servere

[root@servere ~]# mkdir /var/mountbroker-root
[root@servere ~]# chmod 711 /var/mountbroker-root/ #高速缓存目录
[root@servere ~]# semanage fcontext -a -e /home /var/mountbroker-root
[root@servere ~]# restorecon -Rv /var/mountbroker-root/

将mountbroker-root指向/var/mountbroker-root

[root@servere ~]# gluster system:: execute mountbroker opt mountbroker-root /var/mountbroker-root

让用户geoaccount访问

[root@servere ~]# gluster system:: execute mountbroker user geoaccount slavevol

允许geogroup组访问日志

[root@servere ~]# gluster system:: execute mountbroker opt geo-replication-log-group geogroup

允许访问1024以上的端口

[root@servere ~]# gluster system:: execute mountbroker opt rpc-auth-allow-insecure on
[root@servere ~]# systemctl restart glusterd

以上设置可以在这里看见

[root@servere ~]# cd /etc/glusterfs/
[root@servere glusterfs]# vim glusterd.vol

上面是用户的同步,下面是数据的同步
创建gsec_create

[root@servera ~]# gluster system:: execute gsec_create

将创建的gsec_create推送到servere上去

[root@servera ~]# gluster volume geo-replication mastervol geoaccount@servere::slavevol create push-pem
[root@servere glusterfs]# /usr/libexec/glusterfs/set_geo_rep_pem_keys.sh geoaccount mastervol slavevol

同步卷

[root@servera ~]# gluster volume geo-replication mastervol geoaccount@servere::slavevol config use_meta_volume true
[root@servera ~]# gluster volume geo-replication mastervol geoaccount@servere::slavevol start
[root@servera ~]# gluster volume geo-replication mastervol geoaccount@servere::slavevol status

servera的数据已经同步到servere上

[root@servera ~]# cd /bricks/brick-a1/brick/
[root@servere glusterfs]# cd /bricks/brick-e1/brick/
[root@servere brick]# ls

[root@workstation ~]# cd /mnt/mastervol/
[root@workstation mastervol]# touch file1000

rsync的差异化备份
rsync -av --delete dourcedir targetdir

灾备管理

[root@servera brick]# gluster volume geo-replication mastervol geoaccount@servere::slavevol config

ignore-delete:false差异化备份  true增量备份

master volume损坏,slave volume接替master的工作

[root@workstation ~]# lab geomanage setup
[root@workstation ~]# umount /mnt/mastervol/

5秒做增量备份

[root@servera brick]# gluster volume set mastervol changelog.rollover-time 5
[root@servera brick]# gluster volume geo-replication mastervol geoaccount@servere::slavevol config ignore-deletes true
[root@servera brick]# gluster volume geo-replication mastervol geoaccount@servere::slavevol config checkpoint now
[root@servera brick]# gluster volume geo-replication mastervol geoaccount@servere::slavevol status

[root@workstation ~]# mount -a
[root@workstation ~]# cd /mnt/mastervol/
[root@workstation mastervol]# rm -f importantfile

[root@workstation mastervol]# lab geomanage grade

数据自我愈合

[root@workstation ~]# lab selfheal setup
[root@serverb ~]# gluster volume info replvol

servera没启动

[root@serverb ~]# ping servera
[root@serverb ~]# gluster volume heal replvol info

启动servera

[kiosk@foundation0 ~]$ rht-vmctl start servera
[root@serverb ~]# gluster volume heal replvol info

替换卷

[root@serverb ~]# gluster volume replace-brick replvol servera:/bricks/brick-a1/brick servera:/bricks/brick-a2/brick commit force
[root@serverb ~]# gluster volume info replvol