1. 程式人生 > 其它 >GFS分散式檔案系統

GFS分散式檔案系統

技術標籤:Linux

GFS 分散式檔案系統

GlusterFS概述

一:GlusterFS簡介

1:開源的分散式檔案系統

2:由儲存伺服器、客戶端以及 NFS/Sabma 儲存閘道器組成

3:無元資料伺服器

二:GlusterFS特點

  • 擴充套件性和高效能
  • 高可用性
  • 全域性統一名稱空間
  • 彈性卷管理
  • 基於標準協議

三:GlusterFS術語

  • Brick
  • Volume
  • FUSE
  • VFS
  • Glusterd

註釋

  • Brick(儲存塊):指可信主機池中由主機提供的用於物理儲存的專用分割槽,是GlusterFS 中的基本儲存單元,同時也是可信儲存池中伺服器上對外提供的儲存目錄。
  • Volume(邏輯卷):一個邏輯卷是一組 Brick的集合。卷是資料儲存的邏輯裝置,類似於LVM中的邏輯卷。大部分Gluster 管理操作是在捲上進行的。
  • FUSE (Filesystem inUserspace):是一個核心模組,允許使用者建立自己的檔案系統,無須修改核心程式碼。
  • VFS:核心空間對使用者空間提供的訪問磁碟的介面。
  • Glusterd(後臺管理程序):在儲存群集中的每個節點上都要執行。

四:模組化堆疊式架構

  • 模組化、堆疊式的架構
  • 通過對模組的組合,實現複雜的功能

GlusterFS工作原理

一:GlusterFS工作流程

  1. Application:客戶端或應用程式通過GlusterFS的掛載點訪問資料
  2. linux系統核心通過VFSAPI收到請求並處理
  3. VFS 將資料遞交給 FUSE 核心檔案系統,fuse檔案系統則是將資料通過/dev/fuse裝置檔案遞交給了GlusterFS
    client端
  4. GlusterFS client收到資料後,client根據配置檔案的配置對資料進行處理
  5. 通過網路將資料傳送至遠端的 GlusterFS Server,並且將資料寫入到伺服器儲存裝置上

.

二:彈性HASH演算法

1:通過HASH演算法得到一個32位的整數

2:劃分為N個連續的子空間,每個空間對應一個Brick

3:彈性HASH演算法的優點

  • 保證資料平均分佈在每一個Brick中
  • 解決了對元資料伺服器的依賴,進而解決了單點故障以及訪問瓶頸

四個Brick節點的GlusterFS卷,平均分配232次方的區間的範圍空間

GlusterFS的卷型別

1:分散式卷

2:條帶卷

3:複製卷

4:分散式條帶卷

5:分散式複製卷

6:條帶複製卷

7:分散式條帶複製卷

一:分散式卷

1:分散式卷介紹

  • 沒有對檔案進行分塊處理
  • 通過擴充套件檔案屬性儲存HASH值
  • 支援的底層檔案系統有EXT3、EXT4、ZFS、XFS等

2:分散式卷的特點

  • 檔案分佈在不同的伺服器,不具備冗餘性
  • 更容易和廉價地擴展卷的大小
  • 單點故障會造成資料丟失
  • 依賴底層的資料保護

3:建立分散式卷

  • 建立一個名為dis-volume的分散式卷,檔案將根據HASH分佈在server1:/dir1、server2:/dir2和server3:/dir3中
#gluster volume create dis-volume server1:/dir1 server2:/dir2 server3:/dir3

二:條帶卷

1:條帶卷介紹

  • 根據偏移量將檔案分成N塊(N個條帶節點),輪詢的儲存在每個Brick Server節點
  • 儲存大檔案時,效能尤為突出
  • 不具備冗餘性,類似以Raid0

2:條帶卷的特點

  • 資料被分割成更小塊分佈到塊伺服器群中的不同條帶區
  • 分佈減少了負載且更小的檔案加速了存取的速度
  • 沒有資料冗餘

3:建立條帶卷

  • 建立了一個名為Stripe-volume的條帶卷,檔案將被分塊輪詢的儲存在Server1:/dir1和Server2:/dir2兩個Brick中
# gluster volume create stripe-volume stripe 2 transport tcp server1:/dir1 server2:/dir2

三:複製卷

1:複製卷介紹

  • 同一檔案儲存一份或多分副本
  • 因為要儲存副本,所以磁碟利用率較低
  • 若多個節點上的儲存空間不一致,將按照木桶效應取最低節點的容量作為該卷的總容量

2:複製卷特點

  • 卷中所有的伺服器均儲存一個完整的副本
  • 卷的副本數量可由客戶建立的時候決定
  • 至少有兩個塊伺服器或更多伺服器
  • 具備冗餘性

3:建立複製卷

  • 建立名為rep-volume的複製卷,檔案將同時儲存兩個副本,分別在Server1:/dir1和Server2:/dir2兩個Brick中
# gluster volume create rep-volume replica 2 transport tcp server1:ldir1 server2:/dir2

四:分散式條帶卷

1:分散式條帶卷介紹

  • 兼顧分散式卷和條帶卷的功能
  • 主要用於大檔案訪問處理
  • 至少最少需要4臺伺服器

2:建立分散式條帶卷

  • 建立名為dis-stripe的分散式條帶卷,配置分散式的條帶卷時,卷中Brick所包含的儲存伺服器數必須是條帶數的倍數(>=2倍)
# gluster volume create dis-stripe stripe 2 transport tcp server1:/dir1server2:/dir2 server3:/dir3 server4:/dir4

五:分散式複製卷

1:分散式複製卷介紹

  • 兼顧分散式卷和複製卷的功能
  • 用於需要冗餘的情況

2:建立分散式複製卷

  • 建立名為dis-rep的分散式條帶卷,配置分散式複製卷時,卷中Brick所包含的儲存伺服器數必須是複製卷數的倍數(>=2倍)
# gluster volume create dis-rep replica 2 transport tcp server1:/dir1 server2:/dir2 server3:/dir3 server4:/dir4

總結

  • 分散式卷:儲存brick不在一個區域範圍,某一個區域內brick壞了,不影響另一個區域的brick
  • 條帶卷:多個brick形成一個整體,這整體內的任意一塊brick壞了,整個條帶卷不可用
  • 複製卷:多個brick形成一個整體,這整體內的每塊brick內都有完整檔案的複本,因此,複製卷內任意一塊brick壞了,不影響複製卷使用

GlusterFS部署

一:環境

在這裡插入圖片描述

作業系統IP主機名硬碟數量(四塊)
CentOS 7.4192.168.1.10node1sdb:5G sdc:5G sdd:5G sde:5G
CentOS 7.4192.168.1.11node2sdb:5G sdc:5G sdd:5G sde:5G
CentOS 7.4192.168.1.12node3sdb:5G sdc:5G sdd:5G sde:5G
CentOS 7.4192.168.1.13node4sdb:5G sdc:5G sdd:5G sde:5G
CentOS 7.4192.168.1.14Clientsdb:5G sdc:5G sdd:5G sde:5G

二:具體操作步驟

1:地址對映

(1):在 node1 上對映本機和其他 node 地址

[[email protected] ~]# vi /etc/hosts
192.168.1.10   node1
192.168.1.11   node2
192.168.1.12   node3
192.168.1.13   node4

(2)將 node1 節點上的 hosts 檔案傳送給其它3個 node 節點

  • node1 節點生成金鑰
[[email protected] ~]# ssh-keygen -t rsa
  • 將金鑰傳送給其他3個 node 節點
[[email protected] ~]# ssh-copy-id 192.168.1.11
[[email protected] ~]# ssh-copy-id 192.168.1.12
[[email protected] ~]# ssh-copy-id 192.168.1.13
  • 拷貝檔案併發送
[[email protected] ~]# scp /etc/hosts [email protected]192.168.1.11:/etc/
hosts                                                    100%  230   144.2KB/s   00:00    
[[email protected] ~]# scp /etc/hosts [email protected]192.168.1.12:/etc/
hosts                                                    100%  230   137.7KB/s   00:00    
[[email protected] ~]# scp /etc/hosts [email protected]192.168.1.13:/etc/
hosts                                                    100%  230   119.3KB/s   00:00

(3)客戶機需要對映所有 node 節點

[[email protected] ~]# vi /etc/hosts
192.168.1.10   node1
192.168.1.11   node2
192.168.1.12   node3
192.168.1.13   node4

2:關閉防火牆

  • 5臺同步操作
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# setenforce 0

3:匯入檔案修改 yum 源

[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# vi gfs.repo
[gfs]
name=gfs
baseurl=file:///root/gfsrepo
gpgcheck=0
enabled=1

2:修改完後清除快取,5臺同步操作

[[email protected] ~]# cd
[[email protected] ~]# yum clean all
[[email protected] ~]# yum makecache

4:安裝 node 需要的軟體

4臺 node 節點同步操作

[[email protected] ~]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma

5:開啟服務

4臺 node 節點同步操作

[[email protected] ~]# systemctl start glusterd.service 
[[email protected] ~]# systemctl status glusterd.service 
● glusterd.service - GlusterFS, a clustered file-system server
   Loaded: loaded (/usr/lib/systemd/system/glusterd.service; disabled; vendor preset: disabled)
   Active: active (running) since 五 2021-01-01 20:38:33 CST; 6s ago
  Process: 55756 ExecStart=/usr/sbin/glusterd -p /var/run/glusterd.pid --log-level $LOG_LEVEL $GLUSTERD_OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 55757 (glusterd)
   CGroup: /system.slice/glusterd.service
           └─55757 /usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO


101 20:38:33 node1 systemd[1]: Starting GlusterFS, a clustered file-system server...
101 20:38:33 node1 systemd[1]: Started GlusterFS, a clustered file-system server.

6:時間同步

1:同步阿里雲時間,4臺 node 節點同步操作

[[email protected] ~]# ntpdate ntp.aliyun.com

2:建立計劃任務,4臺 node 節點同步操作

[[email protected] ~]# crontab -e
*/30 *  *  *  *  /usr/sbin/ntpdate ntp.aliyun.com

7:node 節點新增磁碟

(1)每個 node 節點新新增4塊5G硬碟
在這裡插入圖片描述
(2)新增完之後需要重啟系統識別硬碟

8:格式化磁碟

1:格式化磁碟為 ext4 格式,4臺 node 節點同步操作

[[email protected] ~]# mkfs.ext4 /dev/sdb
[[email protected] ~]# mkfs.ext4 /dev/sdc
[[email protected] ~]# mkfs.ext4 /dev/sdd
[[email protected] ~]# mkfs.ext4 /dev/sde

2:建立掛載點,4臺 node 節點同步操作

[[email protected] ~]# mkdir {/b1,/c1,/d1,/e1}

3:掛載磁碟,4臺 node 節點同步操作

[[email protected] ~]# mount /dev/sdb /b1
[[email protected] ~]# mount /dev/sdc /c1
[[email protected] ~]# mount /dev/sdd /d1
[[email protected] ~]# mount /dev/sde /e1

4:檢視掛載

[[email protected] ~]# df -Th
檔案系統                型別      容量  已用  可用 已用% 掛載點
/dev/mapper/centos-root xfs        51G  4.5G   47G    9% /
devtmpfs                devtmpfs  897M     0  897M    0% /dev
tmpfs                   tmpfs     912M     0  912M    0% /dev/shm
tmpfs                   tmpfs     912M  9.0M  903M    1% /run
tmpfs                   tmpfs     912M     0  912M    0% /sys/fs/cgroup
/dev/sda2               xfs       5.0G   33M  5.0G    1% /home
/dev/sr0                iso9660   4.3G  4.3G     0  100% /mnt
/dev/sda1               xfs      1014M  179M  836M   18% /boot
tmpfs                   tmpfs     183M   12K  183M    1% /run/user/42
tmpfs                   tmpfs     183M     0  183M    0% /run/user/0
/dev/sdb                ext4      4.8G   20M  4.6G    1% /b1
/dev/sdc                ext4      4.8G   20M  4.6G    1% /c1
/dev/sdd                ext4      4.8G   20M  4.6G    1% /d1
/dev/sde                ext4      4.8G   20M  4.6G    1% /e1

5:開啟服務,4臺 node 節點同步操作

[[email protected] ~]# systemctl start glusterfsd.service 
[[email protected] ~]# systemctl status glusterfsd.service 

9:新增入儲存信任池

只要在一臺主機上新增其他節點即可

1:開啟服務

[[email protected] ~]# systemctl start glusterd.service

2:新增儲存信任池

[[email protected] ~]# gluster peer probe node2
peer probe: success. 
[[email protected] ~]# gluster peer probe node3
peer probe: success. 
[[email protected] ~]# gluster peer probe node4
peer probe: success. 
[[email protected] ~]# gluster peer status
Number of Peers: 3

3:進入每個 node 節點檢視狀態

[[email protected] ~]# gluster peer status
Number of Peers: 3

Hostname: node2
Uuid: be2c4781-e24f-4256-ab1e-0hk1ccf00f1d6
State: Peer in Cluster (Connected)

Hostname: node3
Uuid: 2df5ac0c-adfd-4343-874a-cfabbf2escdf
State: Peer in Cluster (Connected)

Hostname: node4
Uuid: 661c54c0-aa5f-4721-bc3s-d3d4681a6c88
State: Peer in Cluster (Connected)

10:建立卷

(1)建立分散式卷

  • 選擇 node1、2 節點建立分散式卷
[[email protected] ~]# gluster volume create dis-vol node1:/b1 node2:/b1 force
volume create: dis-vol: success: please start the volume to access data
  • 檢視資訊
[[email protected] ~]# gluster volume info dis-vol

Volume Name: dis-vol
Type: Distribute
Volume ID: d65f328d-ea7a-4d49-9ffd-a09857e2bfda
Status: Created
Snapshot Count: 0
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: node1:/b1
Brick2: node2:/b1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
  • 開啟分散式卷
[[email protected] ~]# gluster volume start dis-vol
volume start: dis-vol: success
  • 檢視狀態
[[email protected] ~]# gluster volume status dis-vol
Status of volume: dis-vol
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/b1                             49152     0          Y       25586
Brick node2:/b1                             49152     0          Y       24674

Task Status of Volume dis-vol
------------------------------------------------------------------------------
There are no active volume tasks

(2)建立條帶卷

  • 選擇node1、2 節點建立條帶卷
[[email protected] ~]# gluster volume create stripe-vol stripe 2 node1:/c1 node2:/c1 force
volume create: stripe-vol: success: please start the volume to access data
  • 檢視狀態
[[email protected] ~]# gluster volume info stripe-vol

Volume Name: stripe-vol
Type: Stripe
Volume ID: b339b134-49af-41ee-9123-22f09f95c9f9
Status: Created
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: node1:/c1
Brick2: node2:/c1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
  • 開啟條帶卷
[[email protected] ~]# gluster volume start stripe-vol
volume start: stripe-vol: success
  • 檢視狀態
[[email protected] ~]# gluster volume status stripe-vol
Status of volume: stripe-vol
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/c1                             49153     0          Y       25742
Brick node2:/c1                             49153     0          Y       24816

Task Status of Volume stripe-vol
------------------------------------------------------------------------------
There are no active volume tasks

(3)建立複製卷

  • 選擇node3、4 節點建立複製卷
[[email protected] ~]# gluster volume create rep-vol replica 2 node3:/b1 node4:/b1 force
volume create: rep-vol: success: please start the volume to access data
  • 檢視狀態
[[email protected] ~]# gluster volume info rep-vol

Volume Name: rep-vol
Type: Replicate
Volume ID: 17ca502c-d003-4938-93b5-f02514e8a498
Status: Created
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: node3:/b1
Brick2: node4:/b1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
  • 開啟複製卷
[[email protected] ~]# gluster volume start rep-vol
volume start: rep-vol: success
  • 檢視狀態
[[email protected] ~]# gluster volume status rep-vol
Status of volume: rep-vol
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node3:/b1                             49152     0          Y       24743
Brick node4:/b1                             49152     0          Y       26824
Self-heal Daemon on localhost               N/A       N/A        Y       25862
Self-heal Daemon on node2                   N/A       N/A        Y       24917
Self-heal Daemon on node3                   N/A       N/A        Y       24771
Self-heal Daemon on node4                   N/A       N/A        Y       26844

Task Status of Volume rep-vol
------------------------------------------------------------------------------
There are no active volume tasks

(4)建立分散式條帶卷

  • 選擇node1、2、3、4 節點建立分散式條帶卷
[[email protected] ~]# gluster volume create dis-stripe stripe 2 node1:/d1 node2:/d1 node3:/d1 node4:/d1 force
volume create: dis-stripe: success: please start the volume to access data
  • 檢視狀態
[[email protected] ~]# gluster volume info dis-stripe

Volume Name: dis-stripe
Type: Distributed-Stripe
Volume ID: 435b279f-7b02-4a9e-8d3e-d309d645d605
Status: Created
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: node1:/d1
Brick2: node2:/d1
Brick3: node3:/d1
Brick4: node4:/d1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
  • 開啟分散式條帶卷
[[email protected] ~]# gluster volume start dis-stripe 
volume start: dis-stripe: success
  • 檢視狀態
[[email protected] ~]# gluster volume status dis-stripe 
Status of volume: dis-stripe
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/d1                             49154     0          Y       26007
Brick node2:/d1                             49154     0          Y       24996
Brick node3:/d1                             49153     0          Y       24850
Brick node4:/d1                             49153     0          Y       26932

Task Status of Volume dis-stripe
------------------------------------------------------------------------------
There are no active volume tasks

(5)建立分散式複製卷

  • 選擇node1、2、3、4 節點建立分散式複製卷
[[email protected] ~]# gluster volume create dis-repl replica 2 node1:/e1 node2:/e1 node3:/e1 node4:/e1 force
volume create: dis-repl: success: please start the volume to access data
  • 檢視狀態
[[email protected] ~]# gluster volume info dis-repl 

Volume Name: dis-repl
Type: Distributed-Replicate
Volume ID: e2fc1fc9-e600-44d6-8953-715d00e5c0cc
Status: Created
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: node1:/e1
Brick2: node2:/e1
Brick3: node3:/e1
Brick4: node4:/e1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
  • 開啟分散式複製卷
[[email protected] ~]# gluster volume start dis-repl 
volume start: dis-repl: success
  • 檢視狀態
[[email protected] ~]# gluster volume status dis-repl 
Status of volume: dis-repl
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/e1                             49155     0          Y       26102
Brick node2:/e1                             49155     0          Y       25073
Brick node3:/e1                             49154     0          Y       24925
Brick node4:/e1                             49154     0          Y       27006
Self-heal Daemon on localhost               N/A       N/A        Y       26122
Self-heal Daemon on node2                   N/A       N/A        Y       25093
Self-heal Daemon on node3                   N/A       N/A        Y       24945
Self-heal Daemon on node4                   N/A       N/A        Y       27026

Task Status of Volume dis-repl
------------------------------------------------------------------------------
There are no active volume tasks

(6)檢視在 node1 節點建立卷的列表

[[email protected] ~]# gluster volume list
dis-repl
dis-stripe
dis-vol
rep-vol
stripe-vol

11:客戶機安裝 gluster 軟體

[[email protected] ~]# yum -y install glusterfs glusterfs-fuse

12:客戶機臨時掛載

1:建立掛載點

[[email protected] ~]# mkdir /dis
[[email protected] ~]# mkdir /strip
[[email protected] ~]# mkdir /replica
[[email protected] ~]# mkdir /dis-replica
[[email protected] ~]# mkdir /dis-strip

2:掛載

[[email protected] ~]# mount.glusterfs node1:dis-vol /dis
[[email protected] ~]# mount.glusterfs node1:rep-vol /replica
[[email protected] ~]# mount.glusterfs node1:stripe-vol /strip
[[email protected] ~]# mount.glusterfs node1:dis-repl /dis-replica
[[email protected] ~]# mount.glusterfs node1:dis-stripe /dis-strip

3:檢視掛載情況

[[email protected] ~]# df -Th
檔案系統                型別            容量  已用  可用 已用% 掛載點
/dev/mapper/centos-root xfs              51G  4.5G   46G    9% /
devtmpfs                devtmpfs        1.9G     0  1.9G    0% /dev
tmpfs                   tmpfs           1.9G     0  1.9G    0% /dev/shm
tmpfs                   tmpfs           1.9G  9.0M  1.9G    1% /run
tmpfs                   tmpfs           1.9G     0  1.9G    0% /sys/fs/cgroup
/dev/sda1               xfs            1014M  179M  836M   18% /boot
/dev/mapper/centos-home xfs             5.0G   33M  5.0G    1% /home
tmpfs                   tmpfs           378M   48K  378M    1% /run/user/0
/dev/sr0                iso9660         4.3G  4.3G     0  100% /mnt
node1:dis-vol           fuse.glusterfs  9.6G   41M  9.1G    1% /dis
node1:rep-vol           fuse.glusterfs  4.8G   21M  4.6G    1% /replica
node1:stripe-vol        fuse.glusterfs  9.6G   41M  9.1G    1% /strip
node1:dis-repl          fuse.glusterfs  9.6G   41M  9.1G    1% /dis-replica
node1:dis-stripe        fuse.glusterfs   20G   81M   19G    1% /dis-strip

13:準備測試

(1)客戶機建立5個 40M 的檔案

[[email protected] ~]# dd if=/dev/zero of=/demo1.log bs=40M count=1
記錄了1+0 的讀入
記錄了1+0 的寫出
41943040位元組(42 MB)已複製,0.0514027 秒,816 MB/[[email protected] ~]# dd if=/dev/zero of=/demo2.log bs=40M count=1
記錄了1+0 的讀入
記錄了1+0 的寫出
41943040位元組(42 MB)已複製,0.0858635 秒,488 MB/[[email protected] ~]# dd if=/dev/zero of=/demo3.log bs=40M count=1
記錄了1+0 的讀入
記錄了1+0 的寫出
41943040位元組(42 MB)已複製,0.0902197 秒,465 MB/[[email protected] ~]# dd if=/dev/zero of=/demo4.log bs=40M count=1
記錄了1+0 的讀入
記錄了1+0 的寫出
41943040位元組(42 MB)已複製,0.0907591 秒,462 MB/[[email protected] ~]# dd if=/dev/zero of=/demo5.log bs=40M count=1
記錄了1+0 的讀入
記錄了1+0 的寫出
41943040位元組(42 MB)已複製,0.0921329 秒,455 MB/

(2)複製5個檔案到不同的捲上

[[email protected] ~]# cd /
[[email protected] /]# cp demo* /dis
[[email protected] /]# cp demo* /dis-replica/
[[email protected] /]# cp demo* /dis-strip/
[[email protected] /]# cp demo* /replica/
[[email protected] /]# cp demo* /strip/

14:到每個 node 節點檢視結果

(1)分散式卷 node1、2節點

一個節點分了4個檔案,一個節點分了1個檔案

[[email protected] ~]# cd /b1
[[email protected] b1]# ls -lh
總用量 161M
-rw-r--r-- 2 root root 40M 12 19:43 demo1.log
-rw-r--r-- 2 root root 40M 12 19:43 demo2.log
-rw-r--r-- 2 root root 40M 12 19:43 demo3.log
-rw-r--r-- 2 root root 40M 12 19:43 demo4.log
drwx------ 2 root root 16K 11 20:59 lost+found

[[email protected] b1]# ls -lh
總用量 41M
-rw-r--r-- 2 root root 40M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found

(2)條帶式卷 node1、2節點

檔案全都有,但檔案大小都只有一半,檔案大小被兩個節點平分

[[email protected] ~]# cd /c1
[[email protected] c1]# ls -lh
總用量 101M
-rw-r--r-- 2 root root 20M 12 19:43 demo1.log
-rw-r--r-- 2 root root 20M 12 19:43 demo2.log
-rw-r--r-- 2 root root 20M 12 19:43 demo3.log
-rw-r--r-- 2 root root 20M 12 19:43 demo4.log
-rw-r--r-- 2 root root 20M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found
[[email protected] ~]# cd /c1
[[email protected] c1]# ls -lh
總用量 101M
-rw-r--r-- 2 root root 20M 12 19:43 demo1.log
-rw-r--r-- 2 root root 20M 12 19:43 demo2.log
-rw-r--r-- 2 root root 20M 12 19:43 demo3.log
-rw-r--r-- 2 root root 20M 12 19:43 demo4.log
-rw-r--r-- 2 root root 20M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found

(3)複製卷 node3、4節點

檔案每個節點都有

[[email protected] ~]# cd /b1
[[email protected] b1]# ls -lh
總用量 201M
-rw-r--r-- 2 root root 40M 12 19:43 demo1.log
-rw-r--r-- 2 root root 40M 12 19:43 demo2.log
-rw-r--r-- 2 root root 40M 12 19:43 demo3.log
-rw-r--r-- 2 root root 40M 12 19:43 demo4.log
-rw-r--r-- 2 root root 40M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found
[[email protected] ~]# cd /b1
[[email protected] b1]# ls -lh
總用量 201M
-rw-r--r-- 2 root root 40M 12 19:43 demo1.log
-rw-r--r-- 2 root root 40M 12 19:43 demo2.log
-rw-r--r-- 2 root root 40M 12 19:43 demo3.log
-rw-r--r-- 2 root root 40M 12 19:43 demo4.log
-rw-r--r-- 2 root root 40M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found

(4)分散式條帶卷 node1、2、3、4節點

5個檔案node1、2 分4個,node3、4 分1個,且檔案大小都只有一半

[[email protected] ~]# cd /d1
[[email protected] d1]# ls -lh
總用量 81M
-rw-r--r-- 2 root root 20M 12 19:43 demo1.log
-rw-r--r-- 2 root root 20M 12 19:43 demo2.log
-rw-r--r-- 2 root root 20M 12 19:43 demo3.log
-rw-r--r-- 2 root root 20M 12 19:43 demo4.log
drwx------ 2 root root 16K 11 20:59 lost+found
[[email protected] ~]# cd /d1
[[email protected] d1]# ls -lh
總用量 81M
-rw-r--r-- 2 root root 20M 12 19:43 demo1.log
-rw-r--r-- 2 root root 20M 12 19:43 demo2.log
-rw-r--r-- 2 root root 20M 12 19:43 demo3.log
-rw-r--r-- 2 root root 20M 12 19:43 demo4.log
drwx------ 2 root root 16K 11 20:59 lost+found
[[email protected] ~]# cd /d1
[[email protected] d1]# ls -lh
總用量 21M
-rw-r--r-- 2 root root 20M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found
[[email protected] ~]# cd /d1
[[email protected] d1]# ls -lh
總用量 21M
-rw-r--r-- 2 root root 20M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found

(5)分散式複製卷 node1、2、3、4節點

5個檔案node1、2 分4個,node3、4 分1個,但檔案大小沒有變

[[email protected] e1]# ls -lh
總用量 161M
-rw-r--r-- 2 root root 40M 12 19:43 demo1.log
-rw-r--r-- 2 root root 40M 12 19:43 demo2.log
-rw-r--r-- 2 root root 40M 12 19:43 demo3.log
-rw-r--r-- 2 root root 40M 12 19:43 demo4.log
drwx------ 2 root root 16K 11 20:59 lost+found
[[email protected] ~]# cd /e1
[[email protected] e1]# ls -lh
總用量 161M
-rw-r--r-- 2 root root 40M 12 19:43 demo1.log
-rw-r--r-- 2 root root 40M 12 19:43 demo2.log
-rw-r--r-- 2 root root 40M 12 19:43 demo3.log
-rw-r--r-- 2 root root 40M 12 19:43 demo4.log
drwx------ 2 root root 16K 11 20:59 lost+found
[[email protected] ~]# cd /e1
[[email protected] e1]# ls -lh
總用量 41M
-rw-r--r-- 2 root root 40M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found
[[email protected] ~]# cd /e1
[[email protected] e1]# ls -lh
總用量 41M
-rw-r--r-- 2 root root 40M 12 19:43 demo5.log
drwx------ 2 root root 16K 11 20:59 lost+found