天天看點

GFS分布式檔案系統的搭建GFS分布式檔案系統的搭建

GFS分布式檔案系統的搭建

文章目錄

  • GFS分布式檔案系統的搭建
    • 前言
    • 1.GFS的卷類型有哪些
      • 1.1分布式卷
      • 1.2條帶卷
      • 1.3複制卷
      • 1.4分布式條帶卷
      • 1.5分布式複制卷
    • 2.GFS部署
      • 2.1環境準備
      • 2.2添加磁盤格式化并挂載
      • 2.3防火牆和GFS叢集設定
    • 3.client用戶端的部署及測試gfs
    • 4.其他GFS常用指令

前言

GFS:由存儲伺服器(brick server)、用戶端以及NFS/Samba存儲網關組成

特點:

  • 擴充性和高性能
  • 高可用性
  • 全局統一命名空間
  • 彈性卷管理
  • 基于标準協定

常用術語:

  • brick: GFS中的存儲單元,通過是一個受信存儲池中的伺服器的一個導出目錄。可以通過主機名和目錄名來辨別,如’SERVER:EXPORT’
  • volume:卷
  • FUSE: 核心檔案系統,Filesystem Userspace是一個可加載的核心子產品,其支援非特權使用者建立自己的檔案系統而不需要修改核心代碼。通過在使用者空間運作檔案系統的代碼通過FUSE代碼與核心進行橋接。
  • VFS:虛拟檔案系統
  • Glusterd: Gluster management daemon,要在trusted storage pool中所有的伺服器上運作。

GFS結構:

  • 子產品化堆棧式架構
  • 通過對子產品的整合,實作複雜的功能

彈性HASH算法:

  • 通過hash算法得到一個32位的整數
  • 劃分為N個連續的子控件,每個空間對應一個brick
  • 彈性hash算法的優點
  • 保證資料平均分布在每一個brick中
  • 解決了對中繼資料伺服器的依賴,進而解決了單點故障以及通路瓶頸

1.GFS的卷類型有哪些

  • 分布式卷
  • 條帶卷
  • 複制卷
  • 分布式條帶卷
  • 分布式複制卷
  • 條帶複制卷
  • 分布式條帶複制卷

1.1分布式卷

  • 沒有檔案進行分塊處理
  • 通過擴充檔案屬性儲存hash值
  • 支援的底層檔案系統有ext3、ext4、ZFS、XFS等
  • 特點
    • 檔案分布在不同的伺服器,不具備備援性
    • 更容易和廉價的擴充卷的大小
    • 單點故障會造成資料丢失
    • 依賴底層的資料保護
  • 建立指令
gluster volume create dis-volume server1:/dir1 server2:/dir2
           

1.2條帶卷

  • 根據偏移量将檔案分成N塊(N個條帶節點),輪詢的存儲在每個brick server節點
  • 存儲大檔案時,性能尤為突出
  • 不具備備援性,類似raid 0
GFS分布式檔案系統的搭建GFS分布式檔案系統的搭建
  • 特點:
    • 資料被分割成更小塊分不到快伺服器叢集中的不同條帶區
    • 分布減少了負載且更小的檔案加速了存取的速度
    • 沒有資料備援
  • 建立指令
gluster volume create stripe-volume stripe 2 transport tcp server1:/dir1 server2:/dir2
           

1.3複制卷

  • 同一個檔案儲存一份或者多份副本
  • 複制模式因為要儲存副本,是以磁盤使用率低
  • 多個節點上的存儲空間不一緻,那麼将按照木桶效應取最低節點的容量作為總容量
GFS分布式檔案系統的搭建GFS分布式檔案系統的搭建
  • 特點:
    • 卷中所有的伺服器均儲存一個完整的副本
    • 卷的副本數量可由客戶建立的時候決定
    • 至少有兩個塊伺服器或者風度哦的伺服器
    • 具備備援性
  • 建立指令
gluster volume create rep-volume replica 2 transport tcp server1:/dir1 server2:/dir2
           

1.4分布式條帶卷

  • 兼顧分布式卷和條帶卷的功能
  • 主要用于大檔案的通路處理
  • 至少最少需要4台伺服器
GFS分布式檔案系統的搭建GFS分布式檔案系統的搭建
  • 建立指令
gluster volume create rep-volume replica 2 transport tcp server1:/dir1 server2:/dir2
           

1.5分布式複制卷

  • 兼顧分布式卷和複制卷的功能
  • 用于需要備援的情況下
GFS分布式檔案系統的搭建GFS分布式檔案系統的搭建
  • 建立指令
gluster volume create rep-volume replica 2 transport tcp server1:/dir1 server2:/dir2
           

2.GFS部署

2.1環境準備

VMware Workstation

centos7,IP位址:192.168.73.100,主機名 node1,添加四塊硬碟,分别為3G、4G、5G、6G

centos7,IP位址:192.168.73.101,主機名 node2,添加四塊硬碟,分别為3G、4G、5G、6G

centos7,IP位址:192.168.73.102,主機名 node3,添加四塊硬碟,分别為3G、4G、5G、6G

centos7,IP位址:192.168.73.103,主機名 node4,添加四塊硬碟,分别為3G、4G、5G、6G

centos7,IP位址:192.168.73.104,主機名client,測試用

  • 将使用到的卷名和資訊
卷名稱 卷類型 空間大小/GB brick
dis 分布式卷 12 node1(/e6)node2(/e6)
stripe-volume 條帶卷 10 node1(/d5)node2(/d5)
rep-volume 複制卷 5 node3(/d5)node4(/d5)
dis-stripe 分布式條帶卷 12 node1(/b3)node2(/b3)node3(/b3)node4(/b3)
dis-rep 分布式複制卷 8 node1(/c4)node2(/c4)node3(/c4)node4(/c4)

2.2添加磁盤格式化并挂載

  • 虛拟機設定----添加----硬碟,下一步----SCSI(推薦),下一步----建立新的虛拟磁盤,下一步----最大磁盤大小(自定義),勾選将虛拟磁盤拆分成多個檔案,下一步----完成,相同方法添加其他的磁盤(除了client客戶機),磁盤添加後需要重新開機一下才能識别到磁盤
  • 建立磁盤分區,僅以node1為例,相同方法格式化其他主機新添加的磁盤
[[email protected] ~]# fdisk -l	'//檢視磁盤是否添加成功'
[[email protected] ~]# fdisk /dev/sdb
歡迎使用 fdisk (util-linux 2.23.2)。

更改将停留在記憶體中,直到您決定将更改寫入磁盤。
使用寫入指令前請三思。

Device does not contain a recognized partition table
使用磁盤辨別符 0x5fae534e 建立新的 DOS 磁盤标簽。

指令(輸入 m 擷取幫助):n	'//建立分區'
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p	'//建立主分區'
分區号 (1-4,預設 1):	'//回車,預設分區号'
起始 扇區 (2048-6291455,預設為 2048):	'//回車,預設扇區大小'
将使用預設值 2048
Last 扇區, +扇區 or +size{K,M,G} (2048-6291455,預設為 6291455):	'//回車,預設主分區大小'
将使用預設值 6291455
分區 1 已設定為 Linux 類型,大小設為 3 GiB

指令(輸入 m 擷取幫助):w	'//儲存分區資訊'
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盤。
[[email protected] ~]# ll /dev/ | grep sd	'//檢視剛剛格式化的磁盤是否成功/dev/sdb1,/dev/sdc1,/dev/sdd1,/dev/sde1'
'//剛剛fdisk -l檢視,有/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde四個磁盤,用相同方法格式化其他的磁盤和其他node主機的磁盤'
           
  • 格式化磁盤,每個節點都做
[[email protected] ~]# mkfs -t ext4 /dev/sdb1	'//格式化分區'
[[email protected] ~]# mkfs -t ext4 /dev/sdc1
[[email protected] ~]# mkfs -t ext4 /dev/sdd1
[[email protected] ~]# mkfs -t ext4 /dev/sde1
           
  • 建立挂載點并進行挂載
[[email protected] ~]# mkdir /b3 /c4 /d5 /e6
[[email protected] ~]# vim /etc/fstab 	'//末行添加下方四個自動挂載資訊'
/dev/sdb1       /b3                             ext4    defaults        0 0
/dev/sdc1       /c4                             ext4    defaults        0 0
/dev/sdd1       /d5                             ext4    defaults        0 0
/dev/sde1       /e6                             ext4    defaults        0 0
           
  • 重新開機伺服器
[[email protected] ~]# reboot
[[email protected] ~]# df -Th	'//重新開機後檢視自動挂載情況,會産生如下資訊'
    。。。省略内容
/dev/sdc1               ext4      3.9G   16M  3.7G    1% /c4
/dev/sde1               ext4      5.8G   24M  5.5G    1% /e6
/dev/sdd1               ext4      4.8G   20M  4.6G    1% /d5
/dev/sdb1               ext4      2.9G  9.0M  2.8G    1% /b3
。。。省略内容
           

2.3防火牆和GFS叢集設定

  • 防火牆設定,四台節點伺服器都設定
[[email protected] ~]# systemctl stop firewalld.service 	'//關閉防火牆'
[[email protected] ~]# systemctl disable firewalld.service 	'//取消開啟自啟'
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[[email protected] ~]# setenforce 0	'//關閉核心防護'
[[email protected] ~]# vim /etc/selinux/config 
SELINUX=disabled	'//修改為disabled'
           
  • 修改本地域名解析檔案,四台node都設定
[[email protected] ~]# vi /etc/hosts
192.168.73.100   node1	'//尾行添加如下内容'
192.168.73.101   node2
192.168.73.102   node3
192.168.73.103   node4
           
  • 搭建本地yum倉庫
[[email protected] opt]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# mkdir bak	'//建立備份目錄'
[[email protected] yum.repos.d]# mv * bak	'//将所有檔案移動到備份目錄'
mv: 無法将目錄"bak" 移動至自身的子目錄"bak/bak" 下
[[email protected] yum.repos.d]# vim abc.repo	'//編輯本地yumrepo檔案'
[abc]
name=abc
baseurl=file:///mnt
gpgcheck=0
enabled=1

[glfs]
name=glfs
baseurl=file:///opt/gfsrepo
gpgcheck=0
enabled=1
[[email protected] yum.repos.d]# mount /dev/sr0 /mnt	'//将CD光牒挂載到/mnt'
[[email protected] yum.repos.d]# yum clean all	'//清除yum緩存'
[[email protected] yum.repos.d]# yum makecache	'//建立緩存資料'
[[email protected] yum.repos.d]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma	'//安裝安裝GLFS軟體'
[[email protected] yum.repos.d]# systemctl start glusterd.service	'//啟動GLFS軟體'
[[email protected] yum.repos.d]# systemctl enable glusterd.service 	'//設定開機自啟'
Created symlink from /etc/systemd/system/multi-user.target.wants/glusterd.service to /usr/lib/systemd/system/glusterd.service.
           
  • GFS叢集建立
[[email protected] yum.repos.d]# gluster peer probe node1
peer probe: success. Probe on localhost not needed
[[email protected] yum.repos.d]# gluster peer probe node2
peer probe: success. 
[[email protected] yum.repos.d]# gluster peer probe node3
peer probe: success. 
[[email protected] yum.repos.d]# gluster peer probe node4
peer probe: success. 
[[email protected] yum.repos.d]# gluster peer status
'//其他三台node節點相同操作,不在贅述'
           
  • 建立分布式卷,一下隻在一個node節點上操作
[[email protected] yum.repos.d]# gluster volume create dis-volume node1:/e6 node2:/e6 force	'//建立分布式卷'
volume create: dis-volume: success: please start the volume to access data
[[email protected] yum.repos.d]# gluster volume info dis-volume	'//檢視分布式卷資訊'
[[email protected] yum.repos.d]# gluster volume start dis-volume	'//開啟分布式卷'
volume start: dis-volume: success
'//下面的操作大同小異,不在解釋'
           
  • 建立條帶卷
[[email protected] yum.repos.d]# gluster volume create stripe-volume stripe 2 node1:/d5 node2:/d5 force
volume create: stripe-volume: success: please start the volume to access data
[[email protected] yum.repos.d]# gluster volume info stripe-volume
[roo[email protected] yum.repos.d]# gluster volume start stripe-volume
volume start: stripe-volume: success
           
  • 建立複制卷
[root@node1 yum.repos.d]# gluster volume create rep-volume replica 2 node3:/d5 node4:/d5 force
volume create: rep-volume: success: please start the volume to access data
[[email protected] yum.repos.d]# gluster volume info rep-volume
[[email protected] yum.repos.d]# gluster volume start rep-volume
volume start: rep-volume: success
           
  • 建立分布式條帶卷
[roo[email protected] yum.repos.d]# gluster volume create dis-stripe stripe 2 node1:/b3 node2:/b3 node3:/b3 node4:/b3 force
volume create: dis-stripe: success: please start the volume to access data
[[email protected] yum.repos.d]# gluster volume info dis-stripe
[[email protected] yum.repos.d]# gluster volume start dis-stripe
           
  • 建立分布式複制卷
[r[email protected] yum.repos.d]# gluster volume create dis-rep replica 2 node1:/c4 node2:/c4 node3:/c4 node4:/c4 force
volume create: dis-rep: success: please start the volume to access data
[[email protected] yum.repos.d]# gluster volume info dis-rep
[[email protected] yum.repos.d]# gluster volume start dis-rep
volume start: dis-rep: success
           

3.client用戶端的部署及測試gfs

  • 配置gfs的yum源
[[email protected] ~]# cd /opt
[[email protected] opt]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[[email protected] yum.repos.d]# mkdir bak
[[email protected] yum.repos.d]# mv * bak
mv: 無法将目錄"bak" 移動至自身的子目錄"bak/bak" 下
[[email protected] yum.repos.d]# vim local.repo
[[email protected] yum.repos.d]# yum clean all
[[email protected] yum.repos.d]# yum makecache
[ro[email protected] yum.repos.d]# yum -y install glusterfs glusterfs-fuse
           
  • 建立挂載點,修改本地解析檔案
[root@client yum.repos.d]# mkdir -p /text/{dis,stripe,rep,dis_and_stripe,dis_and_rep}	'//建立挂載點目錄'
[[email protected] yum.repos.d]# vim /etc/hosts
'//尾行添加'
192.168.73.100   node1
192.168.73.101   node2
192.168.73.102   node3
192.168.73.103   node4
           
  • 臨時挂載gluster檔案系統
[[email protected] yum.repos.d]# mount -t glusterfs node1:dis-volume /text/dis
[[email protected] yum.repos.d]# mount -t glusterfs node1:stripe-volume /text/stripe
[[email protected] yum.repos.d]# mount -t glusterfs node1:rep-volume /text/rep
[[email protected] yum.repos.d]# mount -t glusterfs node1:dis-stripe /text/dis_and_stripe
[[email protected] yum.repos.d]# mount -t glusterfs node1:dis-rep /text/dis_and_rep
'//如果要永久挂載需要修改fstab檔案'
[[email protected] yum.repos.d]# vim /etc/fstab
    '//尾行添加'
node1:dis-volume        /text/dis               glusterfs defaults,_netdev      0 0
node1:stripe-volume     /text/stripe            glusterfs defaults,_netdev      0 0
node1:rep-volume        /text/rep               glusterfs defaults,_netdev      0 0
node1:dis-stripe        /text/dis_and_stripe    glusterfs defaults,_netdev      0 0
node1:dis-rep           /text/dis_and_rep       glusterfs defaults,_netdev      0 0
           
  • 建立測試檔案
[[email protected] yum.repos.d]# dd if=/dev/zero of=/demo1.log bs=1M count=40
記錄了40+0 的讀入
記錄了40+0 的寫出
41943040位元組(42 MB)已複制,0.103023 秒,407 MB/秒
[[email protected] yum.repos.d]# dd if=/dev/zero of=/demo2.log bs=1M count=40
記錄了40+0 的讀入
記錄了40+0 的寫出
41943040位元組(42 MB)已複制,0.434207 秒,96.6 MB/秒
[[email protected] yum.repos.d]# dd if=/dev/zero of=/demo3.log bs=1M count=40
記錄了40+0 的讀入
記錄了40+0 的寫出
41943040位元組(42 MB)已複制,0.388875 秒,108 MB/秒
[[email protected] yum.repos.d]# dd if=/dev/zero of=/demo4.log bs=1M count=40
記錄了40+0 的讀入
記錄了40+0 的寫出
41943040位元組(42 MB)已複制,0.465817 秒,90.0 MB/秒
[[email protected] yum.repos.d]# dd if=/dev/zero of=/demo5.log bs=1M count=40
記錄了40+0 的讀入
記錄了40+0 的寫出
41943040位元組(42 MB)已複制,0.437829 秒,95.8 MB/秒
[[email protected] ~]# cd /
[[email protected] /]# ll	'//檢視剛建立的測試檔案'
總用量 204828
lrwxrwxrwx.   1 root root        7 12月 30 04:29 bin -> usr/bin
dr-xr-xr-x.   5 root root     4096 12月 30 04:43 boot
-rw-r--r--.   1 root root 41943040 2月  17 22:53 demo1.log
-rw-r--r--.   1 root root 41943040 2月  17 22:53 demo2.log
-rw-r--r--.   1 root root 41943040 2月  17 22:53 demo3.log
-rw-r--r--.   1 root root 41943040 2月  17 22:53 demo4.log
-rw-r--r--.   1 root root 41943040 2月  17 22:53 demo5.log
           
  • 普通測試
  • 檢視分布式檔案分布
[[email protected] yum.repos.d]# ll -h /e6	'//node1檢視e6檔案夾(分布式檔案存儲位置)'
總用量 161M
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo4.log
[[email protected] yum.repos.d]# ll -h /e6	
總用量 41M
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:59 lost+found
'//發現5個檔案被分布式存儲到了兩個節點,且沒有被切片,都是40M原本大小'
           
  • 檢視條帶卷檔案分布
[[email protected] yum.repos.d]# ll -h /d5
總用量 101M
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo4.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:52 lost+found
[[email protected] yum.repos.d]# ll -h /d5
總用量 101M
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo4.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:52 lost+found
'//發現資料已經被分片的分不到node1和node2節點上'
           
  • 檢視複制卷分布
[[email protected] yum.repos.d]# ll -h /d5
總用量 201M
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo4.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:59 lost+found
[[email protected] yum.repos.d]# ll -h /d5
總用量 201M
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo4.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:59 lost+found
'//資料沒有被分片 有副本 有備援  '
           
  • 分布式條帶卷檢視
[[email protected] yum.repos.d]# ll -h /b3
總用量 81M
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo4.log
drwx------. 2 root root 16K 2月  17 20:51 lost+found
[[email protected] yum.repos.d]# ll -h /b3
總用量 81M
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo4.log
drwx------. 2 root root 16K 2月  17 20:59 lost+found
[[email protected] yum.repos.d]# ll -h /b3
總用量 21M
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:59 lost+found
[[email protected] yum.repos.d]# ll -h /b3
總用量 21M
-rw-r--r--. 2 root root 20M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:59 lost+found
           
  • 分布式複制卷檢視
[[email protected] yum.repos.d]# ll -h /c4
總用量 161M
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo4.log
drwx------. 2 root root 16K 2月  17 20:52 lost+found
[[email protected] yum.repos.d]# ll -h /c4
總用量 161M
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo1.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo2.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo3.log
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo4.log
drwx------. 2 root root 16K 2月  17 20:52 lost+found
[[email protected] yum.repos.d]# ll -h /c4
總用量 41M
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:59 lost+found
[[email protected] yum.repos.d]# ll -h /c4
總用量 41M
-rw-r--r--. 2 root root 40M 2月  17 22:55 demo5.log
drwx------. 2 root root 16K 2月  17 20:59 lost+found
           
  • 當機測試,關閉node2在用戶端上檢視檔案是否正常
  • 分布式卷資料檢視
[[email protected] /]# cd /text/dis
[[email protected] dis]# ll
總用量 163844
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo1.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo2.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo3.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo4.log
drwx------. 2 root root     4096 2月  17 20:52 lost+found
'//原本存儲在node2上的demo5.log檔案消失了'
           
  • 條帶卷檢視
[ro[email protected] dis]# cd /text/stripe/
[[email protected] stripe]# ll
總用量 0
'//因為資料分片的,是以node2關機後,資料都消失了'
           
  • 分布式條帶卷檢視
[[email protected] stripe]# cd /text/dis_and_stripe/
[[email protected] dis_and_stripe]# ll
總用量 40964
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo5.log
'//發現分布式的方式存儲的demo5沒有消失(存儲在node3和node4上的)'
           
  • 分布式複制卷檢視
[[email protected] dis_and_stripe]# cd /text/dis_and_rep/
[[email protected] dis_and_rep]# ll
總用量 204804
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo1.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo2.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo3.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo4.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo5.log
drwx------. 2 root root     4096 2月  17 20:59 lost+found
'//發現斷點測試對于分布式複制卷沒有影響'
           
  • 将node4關閉,檢視結果
  • 測試分布式複制卷是否正常
[[email protected] dis_and_rep]# ll
總用量 204804
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo1.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo2.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo3.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo4.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo5.log
drwx------. 2 root root     4096 2月  17 20:59 lost+found
    '//正常,所有資料都沒有消失'
           
  • 測試分布式條帶卷是否正常
[[email protected] dis_and_rep]# cd /text/dis_and_stripe/
[[email protected] dis_and_stripe]# ll
總用量 0
'//發現在node4關機後,原本存在的demo5.log檔案也消失了'
           
  • 測試複制卷是否正常
[[email protected] rep]# ll
總用量 204800
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo1.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo2.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo3.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo4.log
-rw-r--r--. 1 root root 41943040 2月  17 22:55 demo5.log
'//資料都在,測試正常'
           

4.其他GFS常用指令

檢視GlusterFS卷:gluster volume list 
檢視所有卷的資訊:gluster volume info
檢視所有卷的狀态:gluster volume status
停止/删除卷:gluster volume stop dis-stripe                ####停止一個卷
		   gluster volume delete dis-stripe              ####删除一個卷
設定卷的通路控制:gluster volume set dis-rep auth.allow 192.168.32.*     ##設定192.168.30.0網段的所有IP位址 都能通路dis-rep卷(分布式複制卷)
           

繼續閱讀