glusterfs 分佈式(複製模式) https://docs.gluster.org/en/latest/Quick-Start-Guide/Quickstart/
yum -y install centos-release-gluster
yum -y install glusterfs glusterfs-fuse glusterfs-server
#yum 安裝
glusterfs -V
# 查看版本
systemctl enable glusterd
systemctl start glusterd
cat /etc/hosts
127.0.0.1 glusterfs-1
10.0.1.13 glusterfs-1
10.0.1.14 glusterfs-2
gluster peer probe glusterfs-1
gluster peer probe glusterfs-2
k8s 存儲 persitent/Volumes pv (持久卷)抽象存儲如 nfs cephfs,glusterd,支持權限控制 pvc (持久卷申請)會消耗 pv 的資源 pod 申請 pvc 作爲捲來使用,這樣集羣只認 pv,不要管後端是什麼存儲 ip 和類型,管理更加簡單。
數據盤
創建數據盤
mkfs.xfs -i size=512 /dev/sdb -f
mkdir -p /data/gfs
echo '/dev/sdb /data/gfs xfs defaults 1 2' >> /etc/fstab
mount -a && mount
mkdir /data/gfs/gv0
# 2臺server建立子目錄
gluster volume create gfs replica 2 glusterfs-1:/data/gfs/gv0 glusterfs-2:/data/gfs/gv0
# 創建網絡磁盤
gluster volume info
gluster volume status
# 查看信息
gluster volume start gfs
# 啓用gluster服務
客戶端
yum install glusterfs-fuse
# 客戶端安裝
mount -t glusterfs glusterfs-1:gfs /mnt/
# 掛載
維護
移除節點:
gluster peer detach 10.0.21.242
啓/停/刪除卷
gluster volume start mamm-volume
gluster volume stop mamm-volume
gluster volume delete mamm-volume
GlusterFS卷類型及數據分佈
基本卷:
(1) distribute volume:分佈式卷
文件通過hash算法分佈到所有brick server上,這種卷是glusterfs的基礎和最大特點;實只是擴大的磁盤空間,如果有一個磁盤壞了,對應的數據也丟失,文件級RAID 0,不具有容錯能力。
(2) stripe volume:條帶卷
類似RAID0,文件分成數據塊以Round Robin方式分佈到brick server上,併發粒度是數據塊,支持超大文件,大文件性能高;
(3) replica volume:複製卷
文件同步複製到多個brick上,文件級RAID 1,具有容錯能力,寫性能下降,讀性能提升。
複合卷:
(4) distribute stripe volume:分佈式條帶卷
brickserver數量是條帶數的倍數,兼具distribute和stripe卷的特點;
(5) distribute replica volume:分佈式複製卷
brickserver數量是鏡像數的倍數,兼具distribute和replica卷的特點,可以在2個或多個節點之間複製數據。
(6) stripe replica volume:條帶複製卷
類似RAID 10
同時具有條帶卷和複製卷的特點
(7) distribute stripe replicavolume:分佈式條帶複製卷
三種基本卷的複合卷
通常用於類Map Reduce應用