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工作流程
- Application:客户端或应用程序通过GlusterFS的挂载点访问数据
- linux系统内核通过VFSAPI收到请求并处理
- VFS 将数据递交给 FUSE 内核文件系统,fuse文件系统则是将数据通过/dev/fuse设备文件递交给了GlusterFS
client端 - GlusterFS client收到数据后,client根据配置文件的配置对数据进行处理
- 通过网络将数据传送至远端的 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.4 | 192.168.1.10 | node1 | sdb:5G sdc:5G sdd:5G sde:5G |
CentOS 7.4 | 192.168.1.11 | node2 | sdb:5G sdc:5G sdd:5G sde:5G |
CentOS 7.4 | 192.168.1.12 | node3 | sdb:5G sdc:5G sdd:5G sde:5G |
CentOS 7.4 | 192.168.1.13 | node4 | sdb:5G sdc:5G sdd:5G sde:5G |
CentOS 7.4 | 192.168.1.14 | Client | sdb:5G sdc:5G sdd:5G sde:5G |
二:具体操作步骤
1:地址映射
(1):在 node1 上映射本机和其他 node 地址
[root@node1 ~]# 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 节点生成密钥
[root@node1 ~]# ssh-keygen -t rsa
- 将密钥发送给其他3个 node 节点
[root@node1 ~]# ssh-copy-id 192.168.1.11
[root@node1 ~]# ssh-copy-id 192.168.1.12
[root@node1 ~]# ssh-copy-id 192.168.1.13
- 拷贝文件并发送
[root@node1 ~]# scp /etc/hosts root@192.168.1.11:/etc/
hosts 100% 230 144.2KB/s 00:00
[root@node1 ~]# scp /etc/hosts root@192.168.1.12:/etc/
hosts 100% 230 137.7KB/s 00:00
[root@node1 ~]# scp /etc/hosts root@192.168.1.13:/etc/
hosts 100% 230 119.3KB/s 00:00
(3)客户机需要映射所有 node 节点
[root@client ~]# 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台同步操作
[root@node1 ~]# systemctl stop firewalld
[root@node1 ~]# setenforce 0
3:导入文件修改 yum 源
[root@node1 ~]# cd /etc/yum.repos.d/
[root@node1 yum.repos.d]# vi gfs.repo
[gfs]
name=gfs
baseurl=file:///root/gfsrepo
gpgcheck=0
enabled=1
2:修改完后清除缓存,5台同步操作
[root@node1 ~]# cd
[root@node1 ~]# yum clean all
[root@node1 ~]# yum makecache
4:安装 node 需要的软件
4台 node 节点同步操作
[root@node1 ~]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma
5:开启服务
4台 node 节点同步操作
[root@node1 ~]# systemctl start glusterd.service
[root@node1 ~]# 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
1月 01 20:38:33 node1 systemd[1]: Starting GlusterFS, a clustered file-system server...
1月 01 20:38:33 node1 systemd[1]: Started GlusterFS, a clustered file-system server.
6:时间同步
1:同步阿里云时间,4台 node 节点同步操作
[root@node1 ~]# ntpdate ntp.aliyun.com
2:创建计划任务,4台 node 节点同步操作
[root@node1 ~]# crontab -e
*/30 * * * * /usr/sbin/ntpdate ntp.aliyun.com
7:node 节点添加磁盘
每个 node 节点新添加4块5G硬盘
8:格式化磁盘
1:格式化磁盘为 ext4 格式,4台 node 节点同步操作
[root@node1 ~]# mkfs.ext4 /dev/sdb
[root@node1 ~]# mkfs.ext4 /dev/sdc
[root@node1 ~]# mkfs.ext4 /dev/sdd
[root@node1 ~]# mkfs.ext4 /dev/sde
2:创建挂载点,4台 node 节点同步操作
[root@node1 ~]# mkdir {/b1,/c1,/d1,/e1}
3:挂载磁盘,4台 node 节点同步操作
[root@node1 ~]# mount /dev/sdb /b1
[root@node1 ~]# mount /dev/sdc /c1
[root@node1 ~]# mount /dev/sdd /d1
[root@node1 ~]# mount /dev/sde /e1
4:查看挂载
[root@node1 ~]# 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 节点同步操作
[root@node1 ~]# systemctl start glusterfsd.service
[root@node1 ~]# systemctl status glusterfsd.service
9:添加入存储信任池
只要在一台主机上添加其他节点即可
1:开启服务
[root@node1 ~]# systemctl start glusterd.service
2:添加存储信任池
[root@node1 ~]# gluster peer probe node2
peer probe: success.
[root@node1 ~]# gluster peer probe node3
peer probe: success.
[root@node1 ~]# gluster peer probe node4
peer probe: success.
[root@node1 ~]# gluster peer status
Number of Peers: 3
3:进入每个 node 节点查看状态
[root@node1 ~]# 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 节点创建分布式卷
[root@node1 ~]# gluster volume create dis-vol node1:/b1 node2:/b1 force
volume create: dis-vol: success: please start the volume to access data
- 查看信息
[root@node1 ~]# 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
- 开启分布式卷
[root@node1 ~]# gluster volume start dis-vol
volume start: dis-vol: success
- 查看状态
[root@node1 ~]# 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 节点创建条带卷
[root@node1 ~]# gluster volume create stripe-vol stripe 2 node1:/c1 node2:/c1 force
volume create: stripe-vol: success: please start the volume to access data
- 查看状态
[root@node1 ~]# 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
- 开启条带卷
[root@node1 ~]# gluster volume start stripe-vol
volume start: stripe-vol: success
- 查看状态
[root@node1 ~]# 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 节点创建复制卷
[root@node1 ~]# gluster volume create rep-vol replica 2 node3:/b1 node4:/b1 force
volume create: rep-vol: success: please start the volume to access data
- 查看状态
[root@node1 ~]# 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
- 开启复制卷
[root@node1 ~]# gluster volume start rep-vol
volume start: rep-vol: success
- 查看状态
[root@node1 ~]# 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 节点创建分布式条带卷
[root@node1 ~]# 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
- 查看状态
[root@node1 ~]# 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
- 开启分布式条带卷
[root@node1 ~]# gluster volume start dis-stripe
volume start: dis-stripe: success
- 查看状态
[root@node1 ~]# 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 节点创建分布式复制卷
[root@node1 ~]# 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
- 查看状态
[root@node1 ~]# 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
- 开启分布式复制卷
[root@node1 ~]# gluster volume start dis-repl
volume start: dis-repl: success
- 查看状态
[root@node1 ~]# 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 节点创建卷的列表
[root@node1 ~]# gluster volume list
dis-repl
dis-stripe
dis-vol
rep-vol
stripe-vol
11:客户机安装 gluster 软件
[root@client ~]# yum -y install glusterfs glusterfs-fuse
12:客户机临时挂载
1:创建挂载点
[root@client ~]# mkdir /dis
[root@client ~]# mkdir /strip
[root@client ~]# mkdir /replica
[root@client ~]# mkdir /dis-replica
[root@client ~]# mkdir /dis-strip
2:挂载
[root@client ~]# mount.glusterfs node1:dis-vol /dis
[root@client ~]# mount.glusterfs node1:rep-vol /replica
[root@client ~]# mount.glusterfs node1:stripe-vol /strip
[root@client ~]# mount.glusterfs node1:dis-repl /dis-replica
[root@client ~]# mount.glusterfs node1:dis-stripe /dis-strip
3:查看挂载情况
[root@client ~]# 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 的文件
[root@client ~]# dd if=/dev/zero of=/demo1.log bs=40M count=1
记录了1+0 的读入
记录了1+0 的写出
41943040字节(42 MB)已复制,0.0514027 秒,816 MB/秒
[root@client ~]# dd if=/dev/zero of=/demo2.log bs=40M count=1
记录了1+0 的读入
记录了1+0 的写出
41943040字节(42 MB)已复制,0.0858635 秒,488 MB/秒
[root@client ~]# dd if=/dev/zero of=/demo3.log bs=40M count=1
记录了1+0 的读入
记录了1+0 的写出
41943040字节(42 MB)已复制,0.0902197 秒,465 MB/秒
[root@client ~]# dd if=/dev/zero of=/demo4.log bs=40M count=1
记录了1+0 的读入
记录了1+0 的写出
41943040字节(42 MB)已复制,0.0907591 秒,462 MB/秒
[root@client ~]# dd if=/dev/zero of=/demo5.log bs=40M count=1
记录了1+0 的读入
记录了1+0 的写出
41943040字节(42 MB)已复制,0.0921329 秒,455 MB/秒
(2)复制5个文件到不同的卷上
[root@client ~]# cd /
[root@client /]# cp demo* /dis
[root@client /]# cp demo* /dis-replica/
[root@client /]# cp demo* /dis-strip/
[root@client /]# cp demo* /replica/
[root@client /]# cp demo* /strip/
14:到每个 node 节点查看结果
(1)分布式卷 node1、2节点
一个节点分了4个文件,一个节点分了1个文件
[root@node1 ~]# cd /b1
[root@node1 b1]# ls -lh
总用量 161M
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo4.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node2 b1]# ls -lh
总用量 41M
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
(2)条带式卷 node1、2节点
文件全都有,但文件大小都只有一半,文件大小被两个节点平分
[root@node1 ~]# cd /c1
[root@node1 c1]# ls -lh
总用量 101M
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo4.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node2 ~]# cd /c1
[root@node2 c1]# ls -lh
总用量 101M
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo4.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
(3)复制卷 node3、4节点
文件每个节点都有
[root@node3 ~]# cd /b1
[root@node3 b1]# ls -lh
总用量 201M
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo4.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node4 ~]# cd /b1
[root@node4 b1]# ls -lh
总用量 201M
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo4.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
(4)分布式条带卷 node1、2、3、4节点
5个文件node1、2 分4个,node3、4 分1个,且文件大小都只有一半
[root@node1 ~]# cd /d1
[root@node1 d1]# ls -lh
总用量 81M
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo4.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node2 ~]# cd /d1
[root@node2 d1]# ls -lh
总用量 81M
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo4.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node3 ~]# cd /d1
[root@node3 d1]# ls -lh
总用量 21M
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node4 ~]# cd /d1
[root@node4 d1]# ls -lh
总用量 21M
-rw-r--r-- 2 root root 20M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
(5)分布式复制卷 node1、2、3、4节点
5个文件node1、2 分4个,node3、4 分1个,但文件大小没有变
[root@node1 e1]# ls -lh
总用量 161M
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo4.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node2 ~]# cd /e1
[root@node2 e1]# ls -lh
总用量 161M
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo1.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo2.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo3.log
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo4.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node3 ~]# cd /e1
[root@node3 e1]# ls -lh
总用量 41M
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found
[root@node4 ~]# cd /e1
[root@node4 e1]# ls -lh
总用量 41M
-rw-r--r-- 2 root root 40M 1月 2 19:43 demo5.log
drwx------ 2 root root 16K 1月 1 20:59 lost+found