Fedora中文社区
https://www.fdzh.org/
存储官网
https://www.gluster.org/
Google repo
[root@serverb ~]# vi /etc/yum.repos.d/google-chrome-mirrors.repo
[google-chrome-mirrors]
name=Google Chrome mirrors
#baseurl=https://dl.google.com/linux/chrome/rpm/stable/$basearch
#gpgkey=https://dl.google.com/linux/linux_signing_key.pub
baseurl=https://repo.fdzh.org/chrome/rpm/$basearch
gpgkey=https://repo.fdzh.org/chrome/linux_signing_key.pub
gpgcheck=1
enabled=1
skip_if_unavailable=1
Fedora repo
[root@serverb ~]# vi /etc/yum.repos.d/FZUG.repo
[fzug-free]
name=FZUG fc$releasever - Free
baseurl=https://repo.fdzh.org/FZUG/free/$releasever/$basearch/
skip_if_unavailable=True
metadata_expire=1d
gpgcheck=0
enabled=1
[fzug-nonfree]
name=FZUG fc$releasever - Nonfree
baseurl=https://repo.fdzh.org/FZUG/nonfree/$releasever/$basearch/
skip_if_unavailable=True
metadata_expire=1d
gpgcheck=0
enabled=1
[fzug-testing]
name=FZUG fc$releasever - Testing
baseurl=https://repo.fdzh.org/FZUG/testing/$releasever/$basearch/
skip_if_unavailable=True
metadata_expire=1d
gpgcheck=0
enabled=1
[fzug-free-source]
name=FZUG fc$releasever - Free - Source
baseurl=https://repo.fdzh.org/FZUG/free/$releasever/source/SRPMS/
skip_if_unavailable=True
metadata_expire=1d
gpgcheck=0
enabled=0
[fzug-nonfree-source]
name=FZUG fc$releasever - Nonfree - Source
baseurl=https://repo.fdzh.org/FZUG/nonfree/$releasever/source/SRPMS/
skip_if_unavailable=True
metadata_expire=1d
gpgcheck=0
enabled=0
[root@servera&serverb ~]# dnf install -y glusterfs-server [root@servera&serverb ~]# systemctl start glusterd [root@servera&serverb ~]# systemctl enable glusterd
[root@servera ~]# systemctl status tuned [root@servera ~]# cd /usr/lib/tuned/ [root@servera tuned]# tuned-adm list [root@servera tuned]# tuned-adm profile rhgs-random-io [root@servera throughput-performance]# pwd /usr/lib/tuned/throughput-performance [root@servera throughput-performance]# vim tuned.conf
[root@servera&serverb ~]# firewall-cmd --permanent --add-service=glusterfs [root@servera&serverb ~]# firewall-cmd --reload
[root@servera ~]# gluster peer probe serverb [root@servera ~]# gluster peer status [root@servera ~]# gluster pool list
[root@serverb ~]# gluster peer detach servera [root@serverb ~]# gluster peer probe servera [root@serverb ~]# gluster pool list
[root@servera ~]# cd /var/log/glusterfs/ [root@servera glusterfs]# tail -n 20 cli.log [root@servera glusterfs]# tail -n 20 etc-glusterfs-glusterd.vol.log
servera
[root@servera glusterfs]# vgs [root@servera glusterfs]# lvcreate -L 10G -T vg_bricks/thinpool [root@servera glusterfs]# vgs [root@servera glusterfs]# lvs
create brick
[root@servera glusterfs]# lvcreate -V 2G -T vg_bricks/thinpool -n brick-a1 [root@servera glusterfs]# lvs [root@servera glusterfs]# mkfs.xfs -i size=512 /dev/vg_bricks/brick-a1 [root@servera glusterfs]# mkdir -p /bricks/brick-a1 [root@servera glusterfs]# vim /etc/fstab /dev/vg_bricks/brick-a1 /bricks/brick-a1 xfs defaults 1 2 [root@servera glusterfs]# mount -a [root@servera glusterfs]# mkdir /bricks/brick-a1/brick
serverb
[root@serverb glusterfs]# lvcreate -L 10G -T vg_bricks/thinpool [root@serverb ~]# lvcreate -V 2G -T vg_bricks/thinpool -n brick-b1 [root@serverb ~]# mkfs.xfs -i size=512 /dev/vg_bricks/brick-b1 [root@serverb ~]# mkdir -p /bricks/brick-b1 [root@serverb ~]# vim /etc/fstab /dev/vg_bricks/brick-b1 /bricks/brick-b1 xfs defaults 1 2 [root@serverb glusterfs]# mount -a [root@serverb ~]# mkdir /bricks/brick-b1/brick
selinux
[root@servera&serverb glusterfs]# df -Th [root@servera&serverb ~]# chcon -Rt glusterd_brick_t /bricks/
[root@serverb ~]# cd /bricks/brick-b1/brick/ [root@serverb brick]# touch a [root@serverb brick]# ls -Z a
check lab
[root@workstation ~]# lab setup-bricks grade
create volume
[root@servera ~]# gluster volume create replvol serverb:/bricks/brick-b1/brick servera:/bricks/brick-a1/brick [root@servera ~]# gluster volume list [root@servera ~]# gluster volume info replvol [root@servera ~]# gluster volume start replvol [root@servera ~]# gluster volume info replvol
workstation
[root@workstation ~]# yum install -y glusterfs-fuse [root@workstation ~]# mount -t glusterfs servera:/replvol /mnt [root@workstation ~]# cd /mnt/ [root@workstation mnt]# touch file{00..99}
view servera and servera
[root@servera ~]# cd /bricks/brick-a1/brick/ [root@servera brick]# ls | wc -l [root@serverb brick]# cd /bricks/brick-b1/brick/ [root@serverb brick]# ls | wc -l
chapter 4
[kiosk@foundation0 ~]$ rht-vmctl reset all [root@workstation ~]# lab createvolumes setup
create 1*2
[root@serverd ~]# gluster volume create replvol replica 2 servera:/bricks/brick-a1/brick serverb:/bricks/brick-b1/brick
[root@serverd ~]# gluster volume start replvol [root@serverd ~]# gluster volume status replvol [root@serverd ~]# gluster volume info replvol
Test and mount volume
[root@workstation ~]# yum install -y glusterfs-fuse [root@workstation ~]# mkdir /mnt/replvol [root@workstation ~]# mount -t glusterfs servera:/replvol /mnt/replvol/ [root@workstation ~]# cd /mnt/replvol/ [root@workstation replvol]# touch file{00..09}
create 1*(4+2)
[root@servera brick]# gluster volume create dispersevol disperse-data 4 redundancy 2
serverc:/bricks/brick-c1/brick/
> serverd:/bricks/brick-d1/brick/
> servera:/bricks/brick-a2/brick/
> serverb:/bricks/brick-b2/brick/
> serverc:/bricks/brick-c2/brick/
> serverd:/bricks/brick-d2/brick/ force
start volume
[root@servera brick]# gluster volume start dispersevol [root@servera brick]# gluster volume info dispersevol
Test and mount volume
[root@workstation mnt]# mkdir dispersevol [root@workstation mnt]# mount -t glusterfs servera:/dispersevol /mnt/dispersevol/ [root@workstation mnt]# cp -a /boot/ /mnt/dispersevol/ [root@workstation dispersevol]# du -sh boot
[root@serverb brick]# pwd /bricks/brick-b2/brick [root@serverb brick]# du -sh boot
Check and reset lab
[root@workstation boot]# lab createvolumes grade [kiosk@foundation0 ~]$ rht-vmctl reset all
chapter 5
[root@workstation ~]# lab native-client setup
[root@servera ~]# gluster volume list
[root@servera ~]# gluster volume info custdata [root@servera ~]# gluster volume info mediadata
Test and mount volume
[root@workstation ~]# yum install -y glusterfs-fuse [root@workstation ~]# mkdir /mnt/custdata [root@workstation ~]# vim /etc/fstab
servera:/custdata /mnt/custdata glusterfs defaults,_netdev,acl,backup-volfile-servers=serverb:serverc:serverd 0 0
[root@workstation ~]# mount -a [root@workstation ~]# cd /mnt/custdata/ [root@workstation custdata]# touch file{00..39}
[root@servera ~]# gluster volume list [root@servera ~]# gluster volume info custdata
Close servera view data
[root@servera brick]# init 0 [root@workstation custdata]# df -Th
[root@workstation ~]# lab native-client grade
NFS mount:
[root@serverb brick]# showmount -e localhost
[root@workstation ~]# lab nfs-client setup [root@servera brick]# gluster volume list
[root@servera brick]# firewall-cmd --permanent --add-service=rpc-bind --add-service=nfs [root@servera brick]# firewall-cmd --reload
Test and mount nfs
[root@workstation ~]# showmount -e servera
[root@workstation ~]# mkdir /mnt/mediadata [root@workstation ~]# vim /etc/fstab
servera:/mediadata /mnt/mediadata nfs defaults,rw,vers=3
[root@workstation mediadata]# touch file{000..100}
[root@workstation ~]# lab nfs-client grade
samba mount:
1.cancel mount
[root@workstation ~]# lab smb-client setup [root@workstation ~]# umount /mnt/mediadata/ [root@workstation ~]# vim /etc/fstab
#servera:/mediadata /mnt/mediadata nfs defaults,rw,vers=3
2.allow firewall and install soft pack
[root@servera brick]# firewall-cmd --permanent --add-service=samba [root@servera brick]# firewall-cmd --reload
[root@servera brick]# yum -y install samba [root@servera brick]# systemctl start smb.service [root@servera brick]# systemctl enable smb.service
3.add samba user . the same of adduser and useradd
[root@servera brick]# which adduser [root@servera brick]# which useradd [root@servera brick]# rpm -qf /usr/sbin/adduser [root@servera brick]# rpm -qf /usr/sbin/useradd
[root@servera brick]# useradd smbuser [root@servera brick]# smbpasswd -a smbuser [root@servera brick]# pdbedit -L smbuser
[root@servera brick]# gluster volume set mediadata stat-prefetch off [root@servera brick]# gluster volume set mediadata server.allow-insecure on [root@servera brick]# gluster volume set mediadata storage.batch-fsync-delay-usec 0
[root@servera brick]# vim /etc/glusterfs/glusterd.vol
option rpc-auth-allow-insecure on
4.restart gluster and volume
[root@servera brick]# systemctl restart glusterd [root@servera brick]# gluster volume stop mediadata [root@servera brick]# gluster volume start mediadata
[root@servera brick]# yum -y install samba-client [root@servera brick]# smbclient -L servera -U smbuser [root@servera brick]# vim /etc/samba/smb.conf
5.mount gluster volume on the workstation client
[root@workstation ~]# mkdir /mnt/smbdata [root@workstation ~]# vim /etc/fstab
//servera/gluster-mediadata /mnt/mediadata cifs defaults,username=smbuser,password=redhat 0 0
[root@workstation ~]# yum install cifs-utils [root@workstation ~]# id smbuser [root@workstation ~]# useradd smbuser [root@workstation ~]# mount -a [root@workstation ~]# df -Th
6.If not set ACL,workstation don't write file
[root@servera brick]# setfacl -Rm u:smbuser:rwX /bricks/brick-a1 [root@servera brick]# setfacl -Rm d:u:smbuser:rwX /bricks/brick-a1 [root@server]# useradd smbuser [root@serverb brick]# setfacl -Rm u:smbuser:rwX /bricks/brick-b1/ [root@serverb brick]# setfacl -Rm d:u:smbuser:rwX /bricks/brick-b1/ [root@serverc brick]# setfacl -Rm u:smbuser:rwX /bricks/brick-c1 [root@serverc brick]# setfacl -Rm d:u:smbuser:rwX /bricks/brick-c1 [root@serverd brick]# setfacl -Rm u:smbuser:rwX /bricks/brick-d1/ [root@serverd brick]# setfacl -Rm d:u:smbuser:rwX /bricks/brick-d1/ [root@servera brick]# gluster volume info mediadata
chapter 6
[root@workstation ~]# lab volopts setup [root@servera brick]# gluster volume list [root@servera brick]# gluster volume info galactica [root@servera brick]# gluster volume set galactica server.root-squash on [root@servera brick]# gluster volume info galactica
[root@workstation mnt]# mkdir galactica [root@workstation mnt]# vim /etc/fstab
servera:/galactica /mnt/galactica nfs defaults,rw,vers=3
[root@workstation mnt]# mount -a
[root@servera brick]# setfacl -Rm u:nfsnobody:rwX /bricks/brick-a4 [root@servera brick]# setfacl -Rm d:u:nfsnobody:rwX /bricks/brick-a4 [root@serverb brick]# setfacl -Rm u:nobody:rwX /bricks/brick-b4/ [root@serverb brick]# setfacl -Rm d:u:nobody:rwX /bricks/brick-b4/ [root@serverc brick]# setfacl -Rm u:nobody:rwX /bricks/brick-c4 [root@serverc brick]# setfacl -Rm d:u:nobody:rwX /bricks/brick-c4 [root@serverd brick]# setfacl -Rm u:nobody:rwX /bricks/brick-d4/ [root@serverd brick]# setfacl -Rm d:u:nobody:rwX /bricks/brick-d4/
[root@workstation galactica]# touch test
[root@servera brick]# gluster volume list [root@servera brick]# gluster volume stop galactica [root@servera brick]# gluster volume start galactica