關於GlusterFS分佈式文件系統工作原理及相關概述請參考博文:GlusterFS分佈式文件系統概述
一、搭建GlusterFS分佈式文件系統羣集
此案例相關軟件包請訪問:https://pan.baidu.com/s/1xazQAkR2Lm31njwu88Z9qA
提取碼:qdiy
環境如下:
服務器相關信息:
磁盤相關信息:
部署前準備工作:
在所有節點上執行以下操作,添加30G新硬盤,通過fdisk分區、mkfs格式化,創建相應的掛載目錄,並將格式化的磁盤掛載到相應的目錄中。最後根據實際情況,可以選擇修改/etc/fstab配合文件,使其永久生效。具體配置可以參考博文:centos7磁盤文件系統管理(一)
1、所有節點基礎配置
[root@centos01 ~]# fdisk /dev/sdb <!--新添加硬盤分區-->
命令(輸入 m 獲取幫助):n <!--創建分區類型-->
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p <!--主分區-->
分區號 (1-4,默認 1):
起始 扇區 (2048-62914559,默認爲 2048):
將使用默認值 2048
Last 扇區, +扇區 or +size{K,M,G} (2048-62914559,默認爲 62914559):+5G <!--5GB-->
分區 1 已設置爲 Linux 類型,大小設爲 5 GiB
命令(輸入 m 獲取幫助):n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
分區號 (2-4,默認 2):
起始 扇區 (10487808-62914559,默認爲 10487808):
將使用默認值 10487808
Last 扇區, +扇區 or +size{K,M,G} (10487808-62914559,默認爲 62914559):+5G
分區 2 已設置爲 Linux 類型,大小設爲 5 GiB
命令(輸入 m 獲取幫助):n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
分區號 (3,4,默認 3):
起始 扇區 (20973568-62914559,默認爲 20973568):
將使用默認值 20973568
Last 扇區, +扇區 or +size{K,M,G} (20973568-62914559,默認爲 62914559):+5G
分區 3 已設置爲 Linux 類型,大小設爲 5 GiB
命令(輸入 m 獲取幫助):n
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): e <!--擴展分區-->
已選擇分區 4
起始 扇區 (31459328-62914559,默認爲 31459328):
將使用默認值 31459328
Last 扇區, +扇區 or +size{K,M,G} (31459328-62914559,默認爲 62914559):
將使用默認值 62914559
分區 4 已設置爲 Extended 類型,大小設爲 15 GiB
命令(輸入 m 獲取幫助):n <!--創建分區類型-->
All primary partitions are in use
添加邏輯分區 5
起始 扇區 (31461376-62914559,默認爲 31461376):
將使用默認值 31461376
Last 扇區, +扇區 or +size{K,M,G} (31461376-62914559,默認爲 62914559):+5G<!--5GB-->
分區 5 已設置爲 Linux 類型,大小設爲 5 GiB
命令(輸入 m 獲取幫助):n
All primary partitions are in use
添加邏輯分區 6
起始 扇區 (41949184-62914559,默認爲 41949184):
將使用默認值 41949184
Last 扇區, +扇區 or +size{K,M,G} (41949184-62914559,默認爲 62914559):+5G
分區 6 已設置爲 Linux 類型,大小設爲 5 GiB
命令(輸入 m 獲取幫助):n
All primary partitions are in use
添加邏輯分區 7
起始 扇區 (52436992-62914559,默認爲 52436992):
將使用默認值 52436992
Last 扇區, +扇區 or +size{K,M,G} (52436992-62914559,默認爲 62914559):
將使用默認值 62914559
分區 7 已設置爲 Linux 類型,大小設爲 5 GiB
命令(輸入 m 獲取幫助):p <!--顯示磁盤信息-->
磁盤 /dev/sdb:32.2 GB, 32212254720 字節,62914560 個扇區
Units = 扇區 of 1 * 512 = 512 bytes
扇區大小(邏輯/物理):512 字節 / 512 字節
I/O 大小(最小/最佳):512 字節 / 512 字節
磁盤標籤類型:dos
磁盤標識符:0x0d5bf394
設備 Boot Start End Blocks Id System
/dev/sdb1 2048 10487807 5242880 83 Linux
/dev/sdb2 10487808 20973567 5242880 83 Linux
/dev/sdb3 20973568 31459327 5242880 83 Linux
/dev/sdb4 31459328 62914559 15727616 5 Extended
/dev/sdb5 31461376 41947135 5242880 83 Linux
/dev/sdb6 41949184 52434943 5242880 83 Linux
/dev/sdb7 52436992 62914559 5238784 83 Linux
命令(輸入 m 獲取幫助):w <!--保存並退出-->
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盤。
[root@centos01 ~]# fdisk -l <!--查看磁盤分區信息-->
磁盤 /dev/sda:85.9 GB, 85899345920 字節,167772160 個扇區
Units = 扇區 of 1 * 512 = 512 bytes
扇區大小(邏輯/物理):512 字節 / 512 字節
I/O 大小(最小/最佳):512 字節 / 512 字節
磁盤標籤類型:dos
磁盤標識符:0x000ab7bb
設備 Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 8800255 4194304 82 Linux swap / Solaris
/dev/sda3 8800256 167772159 79485952 83 Linux
磁盤 /dev/sdb:32.2 GB, 32212254720 字節,62914560 個扇區
Units = 扇區 of 1 * 512 = 512 bytes
扇區大小(邏輯/物理):512 字節 / 512 字節
I/O 大小(最小/最佳):512 字節 / 512 字節
磁盤標籤類型:dos
磁盤標識符:0x0d5bf394
設備 Boot Start End Blocks Id System
/dev/sdb1 2048 10487807 5242880 83 Linux
/dev/sdb2 10487808 20973567 5242880 83 Linux
/dev/sdb3 20973568 31459327 5242880 83 Linux
/dev/sdb4 31459328 62914559 15727616 5 Extended
/dev/sdb5 31461376 41947135 5242880 83 Linux
/dev/sdb6 41949184 52434943 5242880 83 Linux
/dev/sdb7 52436992 62914559 5238784 83 Linux
[root@centos01 ~]# mkfs.xfs /dev/sdb1 <!--初始化新建分區-->
[root@centos01 ~]# mkfs.xfs /dev/sdb2 <!--初始化新建分區-->
[root@centos01 ~]# mkfs.xfs /dev/sdb3 <!--初始化新建分區-->
[root@centos01 ~]# mkfs.xfs /dev/sdb5 <!--初始化新建分區-->
[root@centos01 ~]# mkfs.xfs /dev/sdb6 <!--初始化新建分區-->
[root@centos01 ~]# mkfs.xfs /dev/sdb7 <!--初始化新建分區-->
[root@centos01 ~]# mkdir /sdb{1..7} <!--創建掛載點在根目錄-->
[root@centos01 ~]# echo "/dev/sdb1 /sdb1 xfs defaults 0 0" >> /etc/fstab
<!--設置自動掛載掛載新創建的分區-->
[root@centos01 ~]# echo "/dev/sdb2 /sdb2 xfs defaults 0 0" >> /etc/fstab
<!--設置自動掛載掛載新創建的分區-->
[root@centos01 ~]# echo "/dev/sdb3 /sdb3 xfs defaults 0 0" >> /etc/fstab
<!--設置自動掛載掛載新創建的分區-->
[root@centos01 ~]# echo "/dev/sdb5 /sdb5 xfs defaults 0 0" >> /etc/fstab
<!--設置自動掛載掛載新創建的分區-->
[root@centos01 ~]# echo "/dev/sdb6 /sdb6 xfs defaults 0 0" >> /etc/fstab
<!--設置自動掛載掛載新創建的分區-->
[root@centos01 ~]# echo "/dev/sdb7 /sdb7 xfs defaults 0 0" >> /etc/fstab
<!--設置自動掛載掛載新創建的分區-->
<!--以上配置將自行在其他三個節點自行做相同配置-->
[root@centos01 ~]# scp /etc/fstab [email protected]:/etc/
<!--將 /etc/fstab目錄遠程複製到第二節點上-->
[root@centos01 ~]# scp /etc/fstab [email protected]:/etc/
<!--將 /etc/fstab目錄遠程複製到第三節點上-->
[root@centos01 ~]# scp /etc/fstab [email protected]:/etc/
<!--將 /etc/fstab目錄遠程複製到第四節點上-->
[root@centos01 ~]# vim /etc/hosts <!--修改hosts文件解析所有節點-->
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.10 centos01
192.168.100.20 centos02
192.168.100.30 centos03
192.168.100.40 centos04
[root@centos01 ~]# scp /etc/hosts [email protected]:/etc/<!--遠程複製到第二個節點-->
[root@centos01 ~]# scp /etc/hosts [email protected]:/etc/<!--遠程複製到第三個節點-->
[root@centos01 ~]# scp /etc/hosts [email protected]:/etc/<!--遠程複製到第四個節點-->
[root@centos01 ~]# scp /etc/hosts [email protected]:/etc/<!--遠程複製到第五個節點-->
[root@centos01 ~]# df -Th <!--將所有節點服務器重啓,查看磁盤分區是否掛載成功-->
文件系統 類型 容量 已用 可用 已用% 掛載點
/dev/sda3 xfs 76G 3.6G 73G 5% /
devtmpfs devtmpfs 474M 0 474M 0% /dev
tmpfs tmpfs 489M 0 489M 0% /dev/shm
tmpfs tmpfs 489M 7.0M 482M 2% /run
tmpfs tmpfs 489M 0 489M 0% /sys/fs/cgroup
/dev/sdb7 xfs 5.0G 33M 5.0G 1% /sdb7
/dev/sdb2 xfs 5.0G 33M 5.0G 1% /sdb2
/dev/sdb5 xfs 5.0G 33M 5.0G 1% /sdb5
/dev/sdb6 xfs 5.0G 33M 5.0G 1% /sdb6
/dev/sdb1 xfs 5.0G 33M 5.0G 1% /sdb1
/dev/sdb3 xfs 5.0G 33M 5.0G 1% /sdb3
/dev/sda1 xfs 197M 136M 61M 70% /boot
tmpfs tmpfs 98M 0 98M 0% /run/user/0
2、centos01安裝glusterFS
[root@centos01 ~]# mount /dev/cdrom /mnt/ <!--掛載Glusterfs光盤-->
mount: /dev/sr0 寫保護,將以只讀方式掛載
[root@centos01 ~]# rm -rf /etc/yum.repos.d/CentOS-* <!--刪除系統自帶yum源-->
[root@centos01 ~]# cd /mnt/ <!--進入mnt目錄-->
[root@centos01 mnt]# ls <!--查看當前目錄下文件-->
gfsrepo
[root@centos01 mnt]# vim /etc/yum.repos.d/local.repo <!--修改yum配置文件的掛載點-->
[local]
name=centos
baseurl=file:///mnt/gfsrepo <!--修改爲///mnt/gfsrepo -->
enabled=1
gpgcheck=0
[root@centos01 ~]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma
<!--安裝gluster服務器端和客戶端-->
[root@centos01 ~]# systemctl start glusterd <!--啓動服務-->
[root@centos01 ~]# systemctl enable glusterd <!--設置服務開機自動啓動-->
<!--以下將yum配置文件遠程複製到其他四臺服務器-->
[root@centos01 ~]# scp /etc/yum.repos.d/local.repo [email protected]:/etc/yum.repos.d/
[root@centos01 ~]# scp /etc/yum.repos.d/local.repo [email protected]:/etc/yum.repos.d/
[root@centos01 ~]# scp /etc/yum.repos.d/local.repo [email protected]:/etc/yum.repos.d/
[root@centos01 ~]# scp /etc/yum.repos.d/local.repo [email protected]:/etc/yum.repos.d/
<!---->
至此,centos01配置完成了,centos02~04重複centos01的配置即可,自行配置。centos05只需要按照客戶端依賴程序即可
3、創建glusterFS羣集
(接下來的所有配置,在任意一臺節點上執行即可,我這裏在centos01上執行)
[root@centos01 ~]# gluster peer probe centos02 <!--創建GlusterFS節點2-->
[root@centos01 ~]# gluster peer probe centos03 <!--創建GlusterFS節點3-->
[root@centos01 ~]# gluster peer probe centos04 <!--創建GlusterFS節點4-->
[root@centos01 ~]# gluster peer status <!--查看羣集節點-->
Number of Peers: 3
Hostname: centos02
Uuid: 4cc7469c-9d8b-4fce-9d5c-f0132f4faab9
State: Peer in Cluster (Connected)
Hostname: centos03
Uuid: 200c060d-9ad6-4e61-9065-2637599f3865
State: Peer in Cluster (Connected)
Hostname: centos04
Uuid: e548bbe0-5796-4ef2-a990-017379f96e08
State: Peer in Cluster (Connected)
二、創建各種類型的卷
1、創建分佈式卷
[root@centos01 ~]# gluster volume create FBS-Volume centos01:/sdb1 centos02:/sdb1 force
<!--創建分佈式卷,其中“FBS-Volume”爲卷名,沒有指定類型,默認創建的是分佈式卷-->
[root@centos01 ~]# gluster volume info FBS-Volume <!--查看分佈式卷的狀態-->
Volume Name: FBS-Volume
Type: Distribute <!--卷類型爲分佈式卷-->
Volume ID: e57ab3d2-ab2a-43fe-b035-1a5b0e290db2
Status: Created
Snapshot Count: 0
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb1
Brick2: centos02:/sdb1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
[root@centos01 ~]# gluster volume start FBS-Volume <!--啓動分佈式卷-->
[root@centos05 ~]# mkdir /FBS-Volume <!--客戶端創建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:FBS-Volume /FBS-Volume
<!--客戶端掛載分佈式卷-->
[root@centos05 ~]# df -Th <!--客戶端驗證是否掛載成功-->
文件系統 類型 容量 已用 可用 已用% 掛載點
192.168.100.10:FBS-Volume fuse.glusterfs 10G 65M 10G 1% /FBS-Volume
2、創建條帶卷
[root@centos01 ~]# gluster volume create TD-Volume stripe 2 centos01:/sdb2 centos02:/sdb2 force
<!--創建條帶卷,指定條帶卷的個數爲2個。“TD-Volume”爲卷名-->
[root@centos01 ~]# gluster volume info TD-Volume <!--查看條帶卷狀態-->
Volume Name: TD-Volume
Type: Stripe <!--卷類型爲條帶-->
Volume ID: c39cb0ee-ae37-4e87-9847-e331cdac2b14
Status: Created
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb2
Brick2: centos02:/sdb2
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
[root@centos01 ~]# gluster volume start TD-Volume <!--啓動條帶卷-->
[root@centos05 ~]# mkdir /TD-Volume <!--客戶端創建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:TD-Volume /TD-Volume
<!--客戶端掛載條帶卷-->
[root@centos05 ~]# df -Th <!--客戶端驗證是否掛載成功-->
文件系統 類型 容量 已用 可用 已用% 掛載點
192.168.100.10:FBS-Volume fuse.glusterfs 10G 65M 10G 1% /FBS-Volume
192.168.100.10:TD-Volume fuse.glusterfs 10G 65M 10G 1% /TD-Volume
3、創建複製卷
[root@centos01 ~]# gluster volume create FZ-Volume replica 2 centos01:/sdb3 centos02:/sdb3 force
<!--指定類型爲“replica”,數值爲“2”,而且後面跟了兩個brick server,所以創建的是複製卷-->
[root@centos01 ~]# gluster volume info FZ-Volume <!--查看複製卷狀態-->
Volume Name: FZ-Volume
Type: Replicate <!--卷類型爲複製卷-->
Volume ID: bd1059ef-8822-428e-9e00-1da97f54411a
Status: Created
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb3
Brick2: centos02:/sdb3
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
[root@centos01 ~]# gluster volume start FZ-Volume <!--啓動複製卷-->
[root@centos05 ~]# mkdir /FZ-Volume <!--客戶端創建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:FZ-Volume /FZ-Volume
<!--客戶端掛載複製卷-->
[root@centos05 ~]# df -Th <!--客戶端驗證是否掛載成功-->
文件系統 類型 容量 已用 可用 已用% 掛載點
192.168.100.10:FBS-Volume fuse.glusterfs 10G 65M 10G 1% /FBS-Volume
192.168.100.10:TD-Volume fuse.glusterfs 10G 65M 10G 1% /TD-Volume
192.168.100.10:FZ-Volume fuse.glusterfs 5.0G 33M 5.0G 1% /FZ-Volume
4、創建分佈式條帶卷
[root@centos01 ~]# gluster volume create FBSTD-Volume stripe 2 transport tcp
centos01:/sdb5 centos02:/sdb05 centos01:/sdb6 centos02:/sdb6 force
<!--指定類型爲stripe,數值爲2,而且後面跟了4個brick server,所以創建的是分佈式條帶卷-->
[root@centos01 ~]# gluster volume info FBSTD-Volume <!--查看分佈式條帶卷狀態-->
Volume Name: FBSTD-Volume
Type: Distributed-Stripe <!--卷類型爲分佈式條帶卷-->
Volume ID: c6fd3205-bc95-4d22-bfab-15442b367587
Status: Created
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb5
Brick2: centos02:/sdb05
Brick3: centos01:/sdb6
Brick4: centos02:/sdb6
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
[root@centos01 ~]# gluster volume start FBSTD-Volume <!--啓動分佈式條帶卷-->
[root@centos05 ~]# mkdir /FBSTD-Volume <!--客戶端創建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:FBSTD-Volume /FBSTD-Volume/
<!--客戶端掛載分佈式條帶卷-->
[root@centos05 ~]# df -Th <!--客戶端驗證是否掛載成功-->
文件系統 類型 容量 已用 可用 已用% 掛載點
192.168.100.10:FBS-Volume fuse.glusterfs 10G 65M 10G 1% /FBS-Volume
192.168.100.10:TD-Volume fuse.glusterfs 10G 65M 10G 1% /TD-Volume
192.168.100.10:FZ-Volume fuse.glusterfs 5.0G 33M 5.0G 1% /FZ-Volume
192.168.100.10:FBSTD-Volume fuse.glusterfs 91G 3.7G 88G 5% /FBSTD-Volume
5、創建分佈式複製卷
[root@centos01 ~]# gluster volume create FBSFZ-Volume replica 2 transport tcp
centos01:/sdb7 centos02:/sdb7 centos03:/sdb1 centos04:/sdb1 force
<!--指定類型爲replica,數值爲2,而且後面跟了4個brick server,是2的兩倍,
所以創建的是分佈式複製卷-->
[root@centos01 ~]# gluster volume info FBSFZ-Volume <!--查看分佈式複製卷狀態-->
Volume Name: FBSFZ-Volume
Type: Distributed-Replicate <!--卷類型爲分佈式複製卷-->
Volume ID: 4be9bc3a-e91b-46ae-b2c8-f80251b8a001
Status: Created
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb7
Brick2: centos02:/sdb7
Brick3: centos03:/sdb1
Brick4: centos04:/sdb1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
[root@centos01 ~]# gluster volume start FBSFZ-Volume <!--啓動分佈式複製卷-->
[root@centos05 ~]# mkdir /FBSFZ-Volume <!--客戶端創建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:FBSFZ-Volume /FBSFZ-Volume
<!--客戶端掛載分佈式複製卷-->
[root@centos05 ~]# df -Th <!--客戶端驗證是否掛載成功-->
文件系統 類型 容量 已用 可用 已用% 掛載點
192.168.100.10:FBS-Volume fuse.glusterfs 10G 65M 10G 1% /FBS-Volume
192.168.100.10:TD-Volume fuse.glusterfs 10G 65M 10G 1% /TD-Volume
192.168.100.10:FZ-Volume fuse.glusterfs 5.0G 33M 5.0G 1% /FZ-Volume
192.168.100.10:FBSTD-Volume fuse.glusterfs 91G 3.7G 88G 5% /FBSTD-Volume
192.168.100.10:FBSFZ-Volume fuse.glusterfs 10G 65M 10G 1% /FBSFZ-Volume
三、設置自動掛載glusterFS文件系統
[root@centos05 ~]# vim /etc/fstab <!--設置自動掛載glusterFS文件系統-->
192.168.100.10:FBS-Volume /FBS-Volume glusterfs defaults,_netdev 0 0
192.168.100.10:TD-Volume /TD-Volume glusterfs defaults,_netdev 0 0
192.168.100.10:FZ-Volume /FZ-Volume glusterfs defaults,_netdev 0 0
192.168.100.10:FBSTD-Volume /FBSTD-Volume glusterfs defaults,_netdev 0 0
192.168.100.10:FBSFZ-Volume /FBSFZ-Volume glusterfs defaults,_netdev 0 0
[root@centos05 ~]# df -Th <!--重啓客戶端查看是否自動掛載-->
文件系統 類型 容量 已用 可用 已用% 掛載點
192.168.100.10:FZ-Volume fuse.glusterfs 5.0G 33M 5.0G 1% /FZ-Volume
192.168.100.10:FBS-Volume fuse.glusterfs 10G 65M 10G 1% /FBS-Volume
192.168.100.10:FBSTD-Volume fuse.glusterfs 91G 3.7G 88G 5% /FBSTD-Volume
192.168.100.10:TD-Volume fuse.glusterfs 10G 65M 10G 1% /TD-Volume
192.168.100.10:FBSFZ-Volume fuse.glusterfs 10G 65M 10G 1% /FBSFZ-Volume
四、glusterFS相關命令
[root@centos01 ~]# gluster volume list <!--查看創建glusterfs卷-->
FBS-Volume
FBSFZ-Volume
FBSTD-Volume
FZ-Volume
TD-Volume
[root@centos01 ~]# gluster volume status <!--查看卷的狀態-->
Status of volume: FBS-Volume
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick centos01:/sdb1 49152 0 Y 2413
Brick centos02:/sdb1 49152 0 Y 2231
Task Status of Volume FBS-Volume
------------------------------------------------------------------------------
There are no active volume tasks
Status of volume: FBSFZ-Volume
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick centos01:/sdb7 49157 0 Y 3585
Brick centos02:/sdb7 49157 0 Y 3119
Brick centos03:/sdb1 49152 0 Y 2877
Brick centos04:/sdb1 49152 0 Y 2746
Self-heal Daemon on localhost N/A N/A Y 3605
Self-heal Daemon on centos03 N/A N/A Y 2897
Self-heal Daemon on centos02 N/A N/A Y 3139
Self-heal Daemon on centos04 N/A N/A Y 2766
Task Status of Volume FBSFZ-Volume
------------------------------------------------------------------------------
There are no active volume tasks
Status of volume: FBSTD-Volume
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick centos01:/sdb5 49155 0 Y 3393
Brick centos02:/sdb05 49155 0 Y 2889
Brick centos01:/sdb6 49156 0 Y 3412
Brick centos02:/sdb6 49156 0 Y 2908
Task Status of Volume FBSTD-Volume
------------------------------------------------------------------------------
There are no active volume tasks
Status of volume: FZ-Volume
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick centos01:/sdb3 49154 0 Y 3214
Brick centos02:/sdb3 49154 0 Y 2787
Self-heal Daemon on localhost N/A N/A Y 3605
Self-heal Daemon on centos03 N/A N/A Y 2897
Self-heal Daemon on centos02 N/A N/A Y 3139
Self-heal Daemon on centos04 N/A N/A Y 2766
Task Status of Volume FZ-Volume
------------------------------------------------------------------------------
There are no active volume tasks
Status of volume: TD-Volume
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick centos01:/sdb2 49153 0 Y 3003
Brick centos02:/sdb2 49153 0 Y 2667
Task Status of Volume TD-Volume
------------------------------------------------------------------------------
There are no active volume tasks
[root@centos01 ~]# gluster volume info <!--查看所有卷的信息-->
Volume Name: FBS-Volume
Type: Distribute
Volume ID: e57ab3d2-ab2a-43fe-b035-1a5b0e290db2
Status: Started
Snapshot Count: 0
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb1
Brick2: centos02:/sdb1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
Volume Name: FBSTD-Volume
Type: Distributed-Stripe
Volume ID: c6fd3205-bc95-4d22-bfab-15442b367587
Status: Started
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb5
Brick2: centos02:/sdb05
Brick3: centos01:/sdb6
Brick4: centos02:/sdb6
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
Volume Name: FZ-Volume
Type: Replicate
Volume ID: bd1059ef-8822-428e-9e00-1da97f54411a
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb3
Brick2: centos02:/sdb3
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
Volume Name: TD-Volume
Type: Stripe
Volume ID: c39cb0ee-ae37-4e87-9847-e331cdac2b14
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: centos01:/sdb2
Brick2: centos02:/sdb2
Options Reconfigured:
auth.allow: 192.168.100.10,192.168.100.20,192.168.100.50
transport.address-family: inet
nfs.disable: on
[root@centos01 ~]# gluster volume stop FBSFZ-Volume
<!--刪除FBSFZ-Volume卷前停止此卷-->
[root@centos01 ~]# gluster volume delete FBSFZ-Volume <!--刪除FBSFZ-Volume卷-->
[root@centos01 ~]# gluster volume set TD-Volume auth.allow
192.168.100.10,192.168.100.20,192.168.100.50
<!--針對條帶卷設置訪問控制列表(允許100.10、100.20、100.50掛載,其他拒絕掛載)-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:TD-Volume /TD-Volume
<!--客戶端掛載條帶卷-->
[root@centos05 ~]# df -Th <!--查看是否掛載成功-->
文件系統 類型 容量 已用 可用 已用% 掛載點
192.168.100.10:FZ-Volume fuse.glusterfs 5.0G 33M 5.0G 1% /FZ-Volume
192.168.100.10:FBS-Volume fuse.glusterfs 10G 65M 10G 1% /FBS-Volume
192.168.100.10:FBSTD-Volume fuse.glusterfs 91G 3.7G 88G 5% /FBSTD-Volume
192.168.100.10:FBSFZ-Volume fuse.glusterfs 10G 65M 10G 1% /FBSFZ-Volume
tmpfs tmpfs 98M 0 98M 0% /run/user/0
192.168.100.10:TD-Volume fuse.glusterfs 10G 65M 10G 1% /TD-Volume
———————— 本文至此結束,感謝閱讀 ————————