Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集

這篇文章主要講解了“Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集”吧!

創(chuàng)新互聯(lián)專注于企業(yè)營銷型網(wǎng)站、網(wǎng)站重做改版、佛坪網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、HTML5建站、購物商城網(wǎng)站建設(shè)、集團公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為佛坪等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

一、搭建GlusterFS分布式文件系統(tǒng)群集

此案例相關(guān)軟件包請訪問:https://pan.baidu.com/s/1xazQAkR2Lm31njwu88Z9qA
提取碼:qdiy

環(huán)境如下:
Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集

服務(wù)器相關(guān)信息:
Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集

磁盤相關(guān)信息:
Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集

部署前準備工作:
在所有節(jié)點上執(zhí)行以下操作,添加30G新硬盤,通過fdisk分區(qū)、mkfs格式化,創(chuàng)建相應(yīng)的掛載目錄,并將格式化的磁盤掛載到相應(yīng)的目錄中。最后根據(jù)實際情況,可以選擇修改/etc/fstab配合文件,使其永久生效。具體配置可以參考博文:centos7磁盤文件系統(tǒng)管理(一)

1、所有節(jié)點基礎(chǔ)配置

[root@centos01 ~]# fdisk /dev/sdb   <!--新添加硬盤分區(qū)-->
命令(輸入 m 獲取幫助):n       <!--創(chuàng)建分區(qū)類型-->
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p     <!--主分區(qū)-->
分區(qū)號 (1-4,默認 1):
起始 扇區(qū) (2048-62914559,默認為 2048):
將使用默認值 2048
Last 扇區(qū), +扇區(qū) or +size{K,M,G} (2048-62914559,默認為 62914559):+5G   <!--5GB-->
分區(qū) 1 已設(shè)置為 Linux 類型,大小設(shè)為 5 GiB
命令(輸入 m 獲取幫助):n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
分區(qū)號 (2-4,默認 2):
起始 扇區(qū) (10487808-62914559,默認為 10487808):
將使用默認值 10487808
Last 扇區(qū), +扇區(qū) or +size{K,M,G} (10487808-62914559,默認為 62914559):+5G
分區(qū) 2 已設(shè)置為 Linux 類型,大小設(shè)為 5 GiB

命令(輸入 m 獲取幫助):n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
分區(qū)號 (3,4,默認 3):
起始 扇區(qū) (20973568-62914559,默認為 20973568):
將使用默認值 20973568
Last 扇區(qū), +扇區(qū) or +size{K,M,G} (20973568-62914559,默認為 62914559):+5G
分區(qū) 3 已設(shè)置為 Linux 類型,大小設(shè)為 5 GiB

命令(輸入 m 獲取幫助):n
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e): e      <!--擴展分區(qū)-->
已選擇分區(qū) 4 
起始 扇區(qū) (31459328-62914559,默認為 31459328):
將使用默認值 31459328
Last 扇區(qū), +扇區(qū) or +size{K,M,G} (31459328-62914559,默認為 62914559):
將使用默認值 62914559
分區(qū) 4 已設(shè)置為 Extended 類型,大小設(shè)為 15 GiB
命令(輸入 m 獲取幫助):n      <!--創(chuàng)建分區(qū)類型-->
All primary partitions are in use
添加邏輯分區(qū) 5
起始 扇區(qū) (31461376-62914559,默認為 31461376):
將使用默認值 31461376
Last 扇區(qū), +扇區(qū) or +size{K,M,G} (31461376-62914559,默認為 62914559):+5G<!--5GB-->
分區(qū) 5 已設(shè)置為 Linux 類型,大小設(shè)為 5 GiB

命令(輸入 m 獲取幫助):n
All primary partitions are in use
添加邏輯分區(qū) 6
起始 扇區(qū) (41949184-62914559,默認為 41949184):
將使用默認值 41949184
Last 扇區(qū), +扇區(qū) or +size{K,M,G} (41949184-62914559,默認為 62914559):+5G
分區(qū) 6 已設(shè)置為 Linux 類型,大小設(shè)為 5 GiB

命令(輸入 m 獲取幫助):n
All primary partitions are in use
添加邏輯分區(qū) 7
起始 扇區(qū) (52436992-62914559,默認為 52436992):
將使用默認值 52436992
Last 扇區(qū), +扇區(qū) or +size{K,M,G} (52436992-62914559,默認為 62914559):
將使用默認值 62914559
分區(qū) 7 已設(shè)置為 Linux 類型,大小設(shè)為 5 GiB

命令(輸入 m 獲取幫助):p  <!--顯示磁盤信息-->

磁盤 /dev/sdb:32.2 GB, 32212254720 字節(jié),62914560 個扇區(qū)
Units = 扇區(qū) of 1 * 512 = 512 bytes
扇區(qū)大小(邏輯/物理):512 字節(jié) / 512 字節(jié)
I/O 大小(最小/最佳):512 字節(jié) / 512 字節(jié)
磁盤標簽類型:dos
磁盤標識符:0x0d5bf394

   設(shè)備 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    <!--查看磁盤分區(qū)信息-->
磁盤 /dev/sda:85.9 GB, 85899345920 字節(jié),167772160 個扇區(qū)
Units = 扇區(qū) of 1 * 512 = 512 bytes
扇區(qū)大小(邏輯/物理):512 字節(jié) / 512 字節(jié)
I/O 大小(最小/最佳):512 字節(jié) / 512 字節(jié)
磁盤標簽類型:dos
磁盤標識符:0x000ab7bb

   設(shè)備 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 字節(jié),62914560 個扇區(qū)
Units = 扇區(qū) of 1 * 512 = 512 bytes
扇區(qū)大小(邏輯/物理):512 字節(jié) / 512 字節(jié)
I/O 大小(最小/最佳):512 字節(jié) / 512 字節(jié)
磁盤標簽類型:dos
磁盤標識符:0x0d5bf394

   設(shè)備 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      <!--初始化新建分區(qū)-->
[root@centos01 ~]# mkfs.xfs /dev/sdb2      <!--初始化新建分區(qū)-->
[root@centos01 ~]# mkfs.xfs /dev/sdb3      <!--初始化新建分區(qū)-->
[root@centos01 ~]# mkfs.xfs /dev/sdb5      <!--初始化新建分區(qū)-->
[root@centos01 ~]# mkfs.xfs /dev/sdb6      <!--初始化新建分區(qū)-->
[root@centos01 ~]# mkfs.xfs /dev/sdb7      <!--初始化新建分區(qū)-->
[root@centos01 ~]# mkdir /sdb{1..7}   <!--創(chuàng)建掛載點在根目錄-->
[root@centos01 ~]# echo "/dev/sdb1 /sdb1 xfs defaults 0 0" >> /etc/fstab
                           <!--設(shè)置自動掛載掛載新創(chuàng)建的分區(qū)-->
[root@centos01 ~]# echo "/dev/sdb2 /sdb2 xfs defaults 0 0" >> /etc/fstab 
                           <!--設(shè)置自動掛載掛載新創(chuàng)建的分區(qū)-->
[root@centos01 ~]# echo "/dev/sdb3 /sdb3 xfs defaults 0 0" >> /etc/fstab 
                           <!--設(shè)置自動掛載掛載新創(chuàng)建的分區(qū)-->
[root@centos01 ~]# echo "/dev/sdb5 /sdb5 xfs defaults 0 0" >> /etc/fstab 
                           <!--設(shè)置自動掛載掛載新創(chuàng)建的分區(qū)-->
[root@centos01 ~]# echo "/dev/sdb6 /sdb6 xfs defaults 0 0" >> /etc/fstab 
                           <!--設(shè)置自動掛載掛載新創(chuàng)建的分區(qū)-->
[root@centos01 ~]# echo "/dev/sdb7 /sdb7 xfs defaults 0 0" >> /etc/fstab
                           <!--設(shè)置自動掛載掛載新創(chuàng)建的分區(qū)-->
        <!--以上配置將自行在其他三個節(jié)點自行做相同配置-->
[root@centos01 ~]# scp /etc/fstab root@192.168.100.20:/etc/  
            <!--將 /etc/fstab目錄遠程復(fù)制到第二節(jié)點上-->
[root@centos01 ~]# scp /etc/fstab root@192.168.100.30:/etc/
            <!--將 /etc/fstab目錄遠程復(fù)制到第三節(jié)點上-->
[root@centos01 ~]# scp /etc/fstab root@192.168.100.40:/etc/
            <!--將 /etc/fstab目錄遠程復(fù)制到第四節(jié)點上-->
[root@centos01 ~]# vim /etc/hosts       <!--修改hosts文件解析所有節(jié)點-->
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 root@192.168.100.20:/etc/<!--遠程復(fù)制到第二個節(jié)點-->
[root@centos01 ~]# scp /etc/hosts root@192.168.100.30:/etc/<!--遠程復(fù)制到第三個節(jié)點-->
[root@centos01 ~]# scp /etc/hosts root@192.168.100.40:/etc/<!--遠程復(fù)制到第四個節(jié)點-->
[root@centos01 ~]# scp /etc/hosts root@192.168.100.50:/etc/<!--遠程復(fù)制到第五個節(jié)點-->
[root@centos01 ~]# df -Th <!--將所有節(jié)點服務(wù)器重啟,查看磁盤分區(qū)是否掛載成功-->
文件系統(tǒng)       類型      容量  已用  可用 已用% 掛載點
/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-*    <!--刪除系統(tǒng)自帶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服務(wù)器端和客戶端-->
[root@centos01 ~]# systemctl start glusterd    <!--啟動服務(wù)-->
[root@centos01 ~]# systemctl enable glusterd   <!--設(shè)置服務(wù)開機自動啟動-->
      <!--以下將yum配置文件遠程復(fù)制到其他四臺服務(wù)器-->
[root@centos01 ~]# scp /etc/yum.repos.d/local.repo  root@192.168.100.20:/etc/yum.repos.d/
[root@centos01 ~]# scp /etc/yum.repos.d/local.repo  root@192.168.100.30:/etc/yum.repos.d/
[root@centos01 ~]# scp /etc/yum.repos.d/local.repo root@192.168.100.40:/etc/yum.repos.d/
[root@centos01 ~]# scp /etc/yum.repos.d/local.repo root@192.168.100.50:/etc/yum.repos.d/
<!---->

至此,centos01配置完成了,centos02~04重復(fù)centos01的配置即可,自行配置。centos05只需要按照客戶端依賴程序即可

3、創(chuàng)建glusterFS群集

(接下來的所有配置,在任意一臺節(jié)點上執(zhí)行即可,我這里在centos01上執(zhí)行)

[root@centos01 ~]# gluster peer probe centos02     <!--創(chuàng)建GlusterFS節(jié)點2-->
[root@centos01 ~]# gluster peer probe centos03     <!--創(chuàng)建GlusterFS節(jié)點3-->
[root@centos01 ~]# gluster peer probe centos04     <!--創(chuàng)建GlusterFS節(jié)點4-->
[root@centos01 ~]# gluster peer status   <!--查看群集節(jié)點-->
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)

二、創(chuàng)建各種類型的卷

1、創(chuàng)建分布式卷

[root@centos01 ~]# gluster volume create FBS-Volume centos01:/sdb1 centos02:/sdb1 force    
<!--創(chuàng)建分布式卷,其中“FBS-Volume”為卷名,沒有指定類型,默認創(chuàng)建的是分布式卷-->
[root@centos01 ~]# gluster volume info FBS-Volume   <!--查看分布式卷的狀態(tài)-->
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   <!--客戶端創(chuàng)建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:FBS-Volume /FBS-Volume 
                           <!--客戶端掛載分布式卷-->
[root@centos05 ~]# df -Th  <!--客戶端驗證是否掛載成功-->
文件系統(tǒng)                  類型            容量  已用  可用 已用% 掛載點
192.168.100.10:FBS-Volume fuse.glusterfs   10G   65M   10G    1% /FBS-Volume

2、創(chuàng)建條帶卷

[root@centos01 ~]# gluster volume create TD-Volume stripe 2 centos01:/sdb2 centos02:/sdb2 force
    <!--創(chuàng)建條帶卷,指定條帶卷的個數(shù)為2個?!癟D-Volume”為卷名-->
[root@centos01 ~]# gluster volume info TD-Volume   <!--查看條帶卷狀態(tài)-->
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   <!--客戶端創(chuàng)建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:TD-Volume /TD-Volume
                                  <!--客戶端掛載條帶卷-->
[root@centos05 ~]# df -Th   <!--客戶端驗證是否掛載成功-->
文件系統(tǒng)                  類型            容量  已用  可用 已用% 掛載點
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、創(chuàng)建復(fù)制卷

[root@centos01 ~]# gluster volume create FZ-Volume replica 2 centos01:/sdb3 centos02:/sdb3 force   
<!--指定類型為“replica”,數(shù)值為“2”,而且后面跟了兩個brick server,所以創(chuàng)建的是復(fù)制卷-->
[root@centos01 ~]# gluster volume info FZ-Volume   <!--查看復(fù)制卷狀態(tài)-->
Volume Name: FZ-Volume
Type: Replicate   <!--卷類型為復(fù)制卷-->
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   <!--啟動復(fù)制卷-->

[root@centos05 ~]# mkdir /FZ-Volume   <!--客戶端創(chuàng)建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:FZ-Volume /FZ-Volume  
                   <!--客戶端掛載復(fù)制卷-->
[root@centos05 ~]# df -Th   <!--客戶端驗證是否掛載成功-->
文件系統(tǒng)                  類型            容量  已用  可用 已用% 掛載點
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、創(chuàng)建分布式條帶卷

[root@centos01 ~]# gluster volume create FBSTD-Volume stripe 2 transport tcp
centos01:/sdb5 centos02:/sdb05 centos01:/sdb6 centos02:/sdb6 force  
<!--指定類型為stripe,數(shù)值為2,而且后面跟了4個brick server,所以創(chuàng)建的是分布式條帶卷-->
[root@centos01 ~]# gluster volume info FBSTD-Volume   <!--查看分布式條帶卷狀態(tài)-->
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    <!--客戶端創(chuàng)建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:FBSTD-Volume /FBSTD-Volume/
                                 <!--客戶端掛載分布式條帶卷-->
[root@centos05 ~]# df -Th    <!--客戶端驗證是否掛載成功-->
文件系統(tǒng)                    類型            容量  已用  可用 已用% 掛載點
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、創(chuàng)建分布式復(fù)制卷

[root@centos01 ~]# gluster volume create FBSFZ-Volume replica 2 transport tcp
centos01:/sdb7 centos02:/sdb7 centos03:/sdb1 centos04:/sdb1 force   
  <!--指定類型為replica,數(shù)值為2,而且后面跟了4個brick  server,是2的兩倍,
    所以創(chuàng)建的是分布式復(fù)制卷-->
[root@centos01 ~]# gluster volume info FBSFZ-Volume    <!--查看分布式復(fù)制卷狀態(tài)-->
Volume Name: FBSFZ-Volume
Type: Distributed-Replicate      <!--卷類型為分布式復(fù)制卷-->
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   <!--啟動分布式復(fù)制卷-->

[root@centos05 ~]# mkdir /FBSFZ-Volume    <!--客戶端創(chuàng)建掛載目錄-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:FBSFZ-Volume /FBSFZ-Volume 
                      <!--客戶端掛載分布式復(fù)制卷-->
[root@centos05 ~]# df -Th    <!--客戶端驗證是否掛載成功-->
文件系統(tǒng)                    類型            容量  已用  可用 已用% 掛載點
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

三、設(shè)置自動掛載glusterFS文件系統(tǒng)

[root@centos05 ~]# vim /etc/fstab    <!--設(shè)置自動掛載glusterFS文件系統(tǒng)-->
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    <!--重啟客戶端查看是否自動掛載-->
文件系統(tǒng)                    類型            容量  已用  可用 已用% 掛載點
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相關(guān)命令

[root@centos01 ~]# gluster volume list    <!--查看創(chuàng)建glusterfs卷-->
FBS-Volume
FBSFZ-Volume
FBSTD-Volume
FZ-Volume
TD-Volume
[root@centos01 ~]# gluster volume status   <!--查看卷的狀態(tài)-->
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   
 <!--針對條帶卷設(shè)置訪問控制列表(允許100.10、100.20、100.50掛載,其他拒絕掛載)-->
[root@centos05 ~]# mount -t glusterfs 192.168.100.10:TD-Volume /TD-Volume  
                <!--客戶端掛載條帶卷-->
[root@centos05 ~]# df -Th   <!--查看是否掛載成功-->
文件系統(tǒng)                    類型            容量  已用  可用 已用% 掛載點
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

感謝各位的閱讀,以上就是“Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!

網(wǎng)頁名稱:Centos7怎么搭建GlusterFS分布式文件系統(tǒng)群集
標題鏈接:http://bm7419.com/article34/isgise.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、動態(tài)網(wǎng)站、網(wǎng)站排名網(wǎng)站設(shè)計、企業(yè)網(wǎng)站制作網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計公司