文件系统简介
组成
作用
文件系统的挂载使用
GlusterFSt分布式文件系统概述
GlusterFSt简介
用于存储、管理物理文件(保存磁盘时使用)
元数据
元数据(Metadata)是描述其它数据的数据(data about other data),或者说是用于提供某种资源的有关信息的结构数据(structured data)。元数据是描述信息资源或数据等对象的数据,其使用目的在于:识别资源;评价资源;追踪资源在使用过程中的变化;实现简单高效地管理大量网络化数据;实现信息资源的有效发现、查找、一体化组织和对使用资源的有效管理。元数据的特点主要有:
①元数据是关于数据的结构化的数据,它不一定是数字形式的,可来自不同的资源。
②元数据是与对象相关的数据,此数据使其潜在的用户不必先具备对这些对象的存在和特征的完整认识。
③元数据是对信息包裹(Information Package)的编码的描述。
④元数据包含用于描述信息对象的内容和位置的数据元素集,促进了网络环境中信息对象的发现和检索。
⑤元数据不仅对信息对象进行描述,还能够描述资源的使用环境、管理、加工、保存和使用等方面的情况。
⑥在信息对象或系统的生命周期中自然增加元数据。
⑦元数据常规定义中的“数据”是表示事务性质的符号,是进行各种统计、计算、科学研究、技术设计所依据的数值,或是说数字化、公式化、代码化、图表化的信息。
基本结构
元数据库基本结构与数据库差不多。数据库的基本结构分三个层次,反映了观察数据库的三种不同角度。
以内模式为框架所组成的数据库叫做物理数据库;以概念模式为框架所组成的数据叫概念数据库;以外模式为框架所组成的数据库叫用户数据库。
⑴ 物理数据层。
它是数据库的最内层,是物理存贮设备上实际存储的数据的集合。这些数据是原始数据,是用户加工的对象,由内部模式描述的指令操作处理的位串、字符和字组成。
⑵ 概念数据层。
它是数据库的中间一层,是数据库的整体逻辑表示。指出了每个数据的逻辑定义及数据间的逻辑联系,是存贮记录的集合。它所涉及的是数据库所有对象的逻辑关系,而不是它们的物理情况,是数据库管理员概念下的数据库。
⑶ 用户数据层。
它是用户所看到和使用的数据库,表示了一个或一些特定用户使用的数据集合,即逻辑记录的集合。
数据库不同层次之间的联系是通过映射进行转换的。
元数据服务器系统
按照基础信息库目录服务标准,以服务的形式提供元数据查询检索功能。该系统是参考《信息检索:应用服务定义与协议规范(ANSI/NISO Z39.50—2003)》实现的分布式服务器软件系统,基本功能包括:
服务参数配置管理
提供服务参数配置功能,包括最大结果数量、查询超时参数设置等。
元数据库管理
元数据库是存储和管理元数据的一种特定数据库。元数据库管理模块需要具有较高效率的数据索引,并支持XML格式的元数据存储,提供元数据库的建立和删除,元数据库索引的建立和删除,以及元数据的导入、导出等维护管理功能。元数据库管理模块是一个C/S模式的应用,由具有XML存储管理功能的关系型数据库管理系统作为服务器端,通过具有元数据库管理操作功能的客户端应用实现元数据库管理的各项功能,其主要功能包括:
(1) 元数据库创建
元数据库管理模块是将元数据记录存储在关系数据库中,为用户提供建立元数据库的功能。同时,该模块需要支持多个元数据标准及其元数据记录的存储。
(2) 元数据库管理
元数据库管理模块主要是管理元数据,支持元数据信息的网络发布,这要求该模块具有较高效率的数据索引。针对这一要求,模块应采用具有较高效率的静态索引算法对元数据记录进行索引。通过定义数据库的可索引域,将数据库索引至不同的元素字段,较好地适应查全率和查准率的要求。
元数据库管理具有元数据库建立、导入、导出、删除、备份功能,并且具备支持元数据记录的标准一致性和内容正确性验证功能。
(3) 元数据库配置管理
可同时管理多个待发布的元数据库,包括元数据库地址信息配置等多项功能。
目录服务
提供符合基础信息库目录服务标准的元数据目录服务,具体功能包括元数据查询、查询结果提取、数据编目信息查询等。
元数据服务器的作用
存储元数据,帮用户定位文件的位置、索引等信息
有元数据服务器文件系统中,如果元数据损坏,会直接导致文件系统不可用( 单点故障-服务器定位)
详见下图:若A宕机,就无法获取数据
GlusterFS特点
关于GlusterFS的术语🥳🥳
模块化堆栈式架构
GFS工作流程
分布式如何在后端存储中定位文件
分布式的优点
卷的分类
基本卷
复合卷
彳亍,接下来我们就部署一下GFS集群⑧
部署GFS集群
Node1节点:node1/192.168.1.5 磁盘:/dev/sdb1 挂载点:/data/sdb1
/dev/sdc1 /data/sdc1
/dev/sdd1 /data/sdd1
/dev/sde1 /data/sde1
Node2节点:node2/192.168.1.101 磁盘:/dev/sdb1 挂载点:/data/sdb1
/dev/sdc1 /data/sdc1
/dev/sdd1 /data/sdd1
/dev/sde1 /data/sde1
Node3节点:node3/192.168.1.102 磁盘:/dev/sdb1 挂载点:/data/sdb1
/dev/sdc1 /data/sdc1
/dev/sdd1 /data/sdd1
/dev/sde1 /data/sde1
Node4节点:node4/192.168.1.103 磁盘:/dev/sdb1 挂载点:/data/sdb1
/dev/sdc1 /data/sdc1
/dev/sdd1 /data/sdd1
/dev/sde1 /data/sde1
客户端节点:192.168.1.110
vim /opt/fdisk.sh
#!/bin/bash
NEWDEV=`ls /dev/sd* | grep -o 'sd[b-z]' | uniq`
for VAR in $NEWDEV
do
echo -e "n\np\n\n\n\nw\n" | fdisk /dev/$VAR &> /dev/null
mkfs.xfs /dev/${VAR}"1" &> /dev/null
mkdir -p /data/${VAR}"1" &> /dev/null
echo "/dev/${VAR}"1" /data/${VAR}"1" xfs defaults 0 0" >> /etc/fstab
done
mount -a &> /dev/null
chmod +x /opt/fdisk.sh
cd /opt/
./fdisk.sh
echo "192.168.1.5 node1" >> /etc/hosts
echo "192.168.1.101 node2" >> /etc/hosts
echo "192.168.1.102 node3" >> /etc/hosts
echo "192.168.1.103 node4" >> /etc/hosts
echo "192.168.1.110 node5" >> /etc/hosts
vim /etc/yum.repos.d/glfs.repo
[glfs]
name=glfs
baseurl=file:///opt/gfsrepo
gpgcheck=0
enabled=1
[root@node1 opt]# yum clean all && yum makecache
已加载插件:fastestmirror, langpacks
正在清理软件源: glfs
Cleaning up list of fastest mirrors
Other repos take up 1.0 G of disk space (use --verbose for details)
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
glfs | 2.9 kB 00:00:00
(1/3): glfs/filelists_db | 62 kB 00:00:00
(2/3): glfs/other_db | 46 kB 00:00:00
(3/3): glfs/primary_db | 92 kB 00:00:00
元数据缓存已建立
[root@node1 opt]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
源标识 源名称 状态
glfs glfs 115
repolist: 115
yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma
systemctl start glusterd.service
systemctl enable glusterd.service
systemctl status glusterd.service
[root@node1 opt]# ntpdate ntp.aliyun.com
14 Aug 00:47:17 ntpdate[19902]: adjust time server 203.107.6.88 offset 0.000251 sec
gluster peer probe node1
gluster peer probe node2
gluster peer probe node3
gluster peer probe node4
[root@node1 opt]# gluster peer status
Number of Peers: 3
Hostname: node3
Uuid: 39f9fb11-eeaf-452a-867e-a778c715f247
State: Peer in Cluster (Connected)
Hostname: node4
Uuid: 6b1e2f99-9191-4756-8ea2-cb2a1ec98868
State: Peer in Cluster (Connected)
Hostname: node2
Uuid: 56f55fd4-4c9e-4a51-94a8-6e31044efa09
State: Peer in Cluster (Connected)
创建卷
卷名称 卷类型 Brick
dis-volume 分布式卷 node1(/data/sdb1)、node2(/data/sdb1)
stripe-volume 条带卷 node1(/data/sdc1)、node2(/data/sdc1)
rep-volume 复制卷 node3(/data/sdb1)、node4(/data/sdb1)
dis-stripe 分布式条带卷 node1(/data/sdd1)、node2(/data/sdd1)、node3(/data/sdd1)、node4(/data/sdd1)
dis-rep 分布式复制卷 node1(/data/sde1)、node2(/data/sde1)、node3(/data/sde1)、node4(/data/sde1)
创建分布式卷
gluster volume create dis-volume node1:/data/sdb1 node2:/data/sdb1 force
[root@node1 opt]# gluster volume list
dis-volume //代表分布式卷
[root@node1 opt]# gluster volume start dis-volume
volume start: dis-volume: success
[root@node1 opt]# gluster volume info dis-volume
Volume Name: dis-volume
Type: Distribute
Volume ID: 49a9d03b-8d59-4bdf-8f3f-0079902e484d
Status: Started
Snapshot Count: 0
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: node1:/data/sdb1
Brick2: node2:/data/sdb1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
创建条带卷
[root@node1 opt]# gluster volume create stripe-volume stripe 2 node1:/data/sdc1 node2:/data/sdc1 force
volume create: stripe-volume: success: please start the volume to access data
[root@node1 opt]# gluster volume start stripe-volume
volume start: stripe-volume: success
[root@node1 opt]# gluster volume info stripe-volume
Volume Name: stripe-volume
Type: Stripe
Volume ID: f0a5c752-fce9-4191-a25a-489a9a8d41b6
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: node1:/data/sdc1
Brick2: node2:/data/sdc1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
创建复制卷
[root@node1 opt]# gluster volume create rep-volume replica 2 node3:/data/sdb1 node4:/data/sdb1 force
volume create: rep-volume: success: please start the volume to access data
[root@node1 opt]# gluster volume start rep-volume
volume start: rep-volume: success
[root@node1 opt]# gluster volume info rep-volume
Volume Name: rep-volume
Type: Replicate
Volume ID: dcad45e5-9083-4ac4-a63b-e93f0028cecb
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: node3:/data/sdb1
Brick2: node4:/data/sdb1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
创建分布式条带卷
[root@node1 opt]# gluster volume create dis-stripe stripe 2 node1:/data/sdd1 node2:/data/sdd1 node3:/data/sdd1 node4:/data/sdd1 force
volume create: dis-stripe: success: please start the volume to access data
[root@node1 opt]# gluster volume start dis-stripe
volume start: dis-stripe: success
[root@node1 opt]# gluster volume info dis-stripe
Volume Name: dis-stripe
Type: Distributed-Stripe
Volume ID: 82345486-2286-4d5d-a0fd-cbeb42c5df6b
Status: Started
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: node1:/data/sdd1
Brick2: node2:/data/sdd1
Brick3: node3:/data/sdd1
Brick4: node4:/data/sdd1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
创建分布式复制卷
[root@node1 opt]# gluster volume create dis-rep replica 2 node1:/data/sde1 node2:/data/sde1 node3:/data/sde1 node4:/data/sde1 force
volume create: dis-rep: success: please start the volume to access data
[root@node1 opt]# gluster volume start dis-rep
volume start: dis-rep: success
[root@node1 opt]# gluster volume info dis-rep
Volume Name: dis-rep
Type: Distributed-Replicate
Volume ID: 571a1468-cb91-40e6-9e58-460b3eb1a3bc
Status: Started
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: node1:/data/sde1
Brick2: node2:/data/sde1
Brick3: node3:/data/sde1
Brick4: node4:/data/sde1
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
[root@node1 opt]# gluster volume list
dis-rep
dis-stripe
dis-volume
rep-volume
stripe-volume
部署GFS的客户端
[root@node5 opt]# unzip gfsrepo.zip
[root@node5 opt]# cd /etc/yum.repos.d/
[root@node5 yum.repos.d]# mkdir repo.bak
[root@node5 yum.repos.d]# mv *.repo repo.bak
[root@node5 yum.repos.d]# vim glfs.repo
[glfs]
name=glfs
baseurl=file:///opt/gfsrepo
gpgcheck=0
enabled=1
- 清除yum源再重建yum源
[root@node5 yum.repos.d]# yum clean all && yum makecache 已加载插件:fastestmirror, langpacks 正在清理软件源: glfs Cleaning up list of fastest mirrors Other repos take up 1.1 G of disk space (use --verbose for details) 已加载插件:fastestmirror, langpacks Determining fastest mirrors glfs | 2.9 kB 00:00:00 (1/3): glfs/filelists_db | 62 kB 00:00:00 (2/3): glfs/other_db | 46 kB 00:00:00 (3/3): glfs/primary_db | 92 kB 00:00:00 元数据缓存已建立 [root@node5 yum.repos.d]# yum repolist 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile 源标识 源名称 状态 glfs glfs 115 repolist: 115
[root@node5 yum.repos.d]# yum -y install glusterfs glusterfs-fuse
[root@node5 yum.repos.d]# mkdir -p /test/{dis,stripe,rep,dis_stripe,dis_rep} [root@node5 yum.repos.d]# ls /test/ dis dis_rep dis_stripe rep stripe
echo "192.168.1.5 node1" >> /etc/hosts echo "192.168.1.101 node2" >> /etc/hosts echo "192.168.1.102 node3" >> /etc/hosts echo "192.168.1.103 node4" >> /etc/hosts echo "192.168.1.110 node5" >> /etc/hosts
[root@node5 yum.repos.d]# mount.glusterfs node1:dis-volume /test/dis [root@node5 yum.repos.d]# mount.glusterfs node1:stripe-volume /test/stripe [root@node5 yum.repos.d]# mount.glusterfs node1:rep-volume /test/rep [root@node5 yum.repos.d]# mount.glusterfs node1:dis-stripe /test/dis_stripe [root@node5 yum.repos.d]# mount.glusterfs node1:dis-rep /test/dis_rep
[root@node5 yum.repos.d]# df -h df: "/data/sdb1": 传输端点尚未连接 df: "/data/sdd1": 传输端点尚未连接 文件系统 容量 已用 可用 已用% 挂载点 /dev/sda3 16G 6.5G 9.6G 41% / devtmpfs 895M 0 895M 0% /dev tmpfs 910M 0 910M 0% /dev/shm tmpfs 910M 11M 900M 2% /run tmpfs 910M 0 910M 0% /sys/fs/cgroup /dev/sda1 1014M 174M 841M 18% /boot tmpfs 182M 8.0K 182M 1% /run/user/42 tmpfs 182M 40K 182M 1% /run/user/0 /dev/sr0 4.3G 4.3G 0 100% /run/media/root/CentOS 7 x86_64 /dev/sdc1 5.0G 33M 5.0G 1% /data/sdc1 /dev/sde1 5.0G 33M 5.0G 1% /data/sde1 node1:dis-volume 25G 65M 25G 1% /test/dis node1:stripe-volume 10G 65M 10G 1% /test/stripe node1:rep-volume 5.0G 33M 5.0G 1% /test/rep node1:dis-stripe 20G 130M 20G 1% /test/dis_stripe node1:dis-rep 10G 65M 10G 1% /test/dis_rep
[root@node5 yum.repos.d]# vim /etc/fstab node1:dis-volume /test/dis glusterfs defaults,_netdev 0 0 node1:stripe-volume /test/stripe glusterfs defaults,_netdev 0 0 node1:rep-volume /test/rep glusterfs defaults,_netdev 0 0 node1:dis-stripe /test/dis_stripe glusterfs defaults,_netdev 0 0 node1:dis-rep /test/dis_rep glusterfs defaults,_netdev 0 0 [root@node5 yum.repos.d]# mount -a
测试gluster文件系统
[root@node5 yum.repos.d]# cd /opt/ [root@node5 opt]# dd if=/dev/zero of=/opt/demo1.log bs=1M count=20 记录了20+0 的读入 记录了20+0 的写出 20971520字节(21 MB)已复制,0.0352689 秒,595 MB/秒 [root@node5 opt]# dd if=/dev/zero of=/opt/demo2.log bs=1M count=20 记录了20+0 的读入 记录了20+0 的写出 20971520字节(21 MB)已复制,0.0630754 秒,332 MB/秒 [root@node5 opt]# dd if=/dev/zero of=/opt/demo3.log bs=1M count=20 记录了20+0 的读入 记录了20+0 的写出 20971520字节(21 MB)已复制,0.0650207 秒,323 MB/秒 [root@node5 opt]# dd if=/dev/zero of=/opt/demo4.log bs=1M count=20 记录了20+0 的读入 记录了20+0 的写出 20971520字节(21 MB)已复制,0.0635848 秒,330 MB/秒 [root@node5 opt]# dd if=/dev/zero of=/opt/demo5.log bs=1M count=20 记录了20+0 的读入 记录了20+0 的写出 20971520字节(21 MB)已复制,0.0632193 秒,332 MB/秒 [root@node5 opt]# ll -h /opt/ 总用量 150M -rw-r--r-- 1 root root 20M 8月 13 23:17 demo1.log -rw-r--r-- 1 root root 20M 8月 13 23:17 demo2.log -rw-r--r-- 1 root root 20M 8月 13 23:17 demo3.log -rw-r--r-- 1 root root 20M 8月 13 23:17 demo4.log -rw-r--r-- 1 root root 20M 8月 13 23:17 demo5.log
[root@node5 opt]# cp demo* /test/dis [root@node5 opt]# cp demo* /test/stripe/ [root@node5 opt]# cp demo* /test/rep/ [root@node5 opt]# cp demo* /test/dis_stripe/ [root@node5 opt]# cp demo* /test/dis_rep/
[root@node1 opt]# ls -lh /data/sdb1/ 总用量 40M -rw-r--r--. 2 root root 20M 8月 14 01:21 demo1.log -rw-r--r--. 2 root root 20M 8月 14 01:21 demo3.log [root@node2 opt]# ll -h /data/sdb1/ 总用量 60M -rw-r--r-- 2 root root 20M 8月 13 23:21 demo2.log -rw-r--r-- 2 root root 20M 8月 13 23:21 demo4.log -rw-r--r-- 2 root root 20M 8月 13 23:21 demo5.log
[root@node1 opt]# ls -lh /data/sdc1/ 总用量 50M -rw-r--r--. 2 root root 10M 8月 14 01:21 demo1.log -rw-r--r--. 2 root root 10M 8月 14 01:21 demo2.log -rw-r--r--. 2 root root 10M 8月 14 01:21 demo3.log -rw-r--r--. 2 root root 10M 8月 14 01:21 demo4.log -rw-r--r--. 2 root root 10M 8月 14 01:21 demo5.log [root@node2 opt]# ll -h /data/sdc1 总用量 50M -rw-r--r-- 2 root root 10M 8月 13 23:21 demo1.log -rw-r--r-- 2 root root 10M 8月 13 23:21 demo2.log -rw-r--r-- 2 root root 10M 8月 13 23:21 demo3.log -rw-r--r-- 2 root root 10M 8月 13 23:21 demo4.log -rw-r--r-- 2 root root 10M 8月 13 23:21 demo5.log
[root@node3 opt]# ll -h /data/sdb1/ 总用量 100M -rw-r--r--. 2 root root 20M 8月 13 23:21 demo1.log -rw-r--r--. 2 root root 20M 8月 13 23:21 demo2.log -rw-r--r--. 2 root root 20M 8月 13 23:21 demo3.log -rw-r--r--. 2 root root 20M 8月 13 23:21 demo4.log -rw-r--r--. 2 root root 20M 8月 13 23:21 demo5.log [root@node4 opt]# ll -h /data/sdb1/ 总用量 100M -rw-r--r--. 2 root root 20M 8月 13 23:21 demo1.log -rw-r--r--. 2 root root 20M 8月 13 23:21 demo2.log -rw-r--r--. 2 root root 20M 8月 13 23:21 demo3.log -rw-r--r--. 2 root root 20M 8月 13 23:21 demo4.log -rw-r--r--. 2 root root 20M 8月 13 23:21 demo5.log
[root@node1 opt]# ll -h /data/sdd1/ 总用量 40M -rw-r--r--. 2 root root 10M 8月 14 01:21 demo1.log -rw-r--r--. 2 root root 10M 8月 14 01:21 demo2.log -rw-r--r--. 2 root root 10M 8月 14 01:21 demo3.log -rw-r--r--. 2 root root 10M 8月 14 01:21 demo4.log [root@node2 opt]# ll -h /data/sdd1 总用量 40M -rw-r--r-- 2 root root 10M 8月 13 23:21 demo1.log -rw-r--r-- 2 root root 10M 8月 13 23:21 demo2.log -rw-r--r-- 2 root root 10M 8月 13 23:21 demo3.log -rw-r--r-- 2 root root 10M 8月 13 23:21 demo4.log [root@node3 opt]# ll -h /data/sdd1 总用量 10M -rw-r--r--. 2 root root 10M 8月 13 23:21 demo5.log [root@node4 opt]# ll -h /data/sdd1 总用量 10M -rw-r--r--. 2 root root 10M 8月 13 23:21 demo5.log
[root@node1 opt]# ll -h /data/sde1 总用量 80M -rw-r--r--. 2 root root 20M 8月 14 01:21 demo1.log -rw-r--r--. 2 root root 20M 8月 14 01:21 demo2.log -rw-r--r--. 2 root root 20M 8月 14 01:21 demo3.log -rw-r--r--. 2 root root 20M 8月 14 01:21 demo4.log [root@node2 opt]# ll -h /data/sde1 总用量 80M -rw-r--r-- 2 root root 20M 8月 13 23:21 demo1.log -rw-r--r-- 2 root root 20M 8月 13 23:21 demo2.log -rw-r--r-- 2 root root 20M 8月 13 23:21 demo3.log -rw-r--r-- 2 root root 20M 8月 13 23:21 demo4.log [root@node3 opt]# ll -h /data/sde1 总用量 20M -rw-r--r--. 2 root root 20M 8月 13 23:21 demo5.log [root@node4 opt]# ll -h /data/sde1 总用量 20M -rw-r--r--. 2 root root 20M 8月 13 23:21 demo5.log
破坏测试
[root@node2 opt]# systemctl stop glusterd.service [root@node5 test]# cd dis [root@node5 dis]# ls demo1.log demo3.log //node2中的分布的文件不显示
[root@node5 dis]# cd ../stripe/ [root@node5 stripe]# ll ls: 正在读取目录.: 传输端点尚未连接 总用量 0 //无法访问,条带卷不具备冗余性
[root@node5 test]# cd rep/ [root@node5 rep]# ll //文件能正常查看 总用量 102400 -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo1.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo2.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo3.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo4.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo5.log
[root@node5 dis_stripe]# ll //只能看到3跟4上的文件 总用量 20480 -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo5.log
[root@node5 dis_rep]# ll //可以访问,分布式复制卷具备冗余性 总用量 102400 -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo1.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo2.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo3.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo4.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo5.log
[root@node5 dis_rep]# cd ../rep/ [root@node5 rep]# ll //数据都能看到 总用量 102400 -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo1.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo2.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo3.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo4.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo5.log
[root@node5 rep]# cd ../dis_stripe/ [root@node5 dis_stripe]# ll //看不到数据 ls: 正在读取目录.: 传输端点尚未连接 总用量 0
[root@node5 dis_rep]# ll //数据正常访问 总用量 102400 -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo1.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo2.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo3.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo4.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo5.log
[root@node1 opt]# gluster volume list dis-rep dis-stripe dis-volume rep-volume stripe-volume
[root@node1 opt]# gluster volume info Volume Name: dis-rep Type: Distributed-Replicate Volume ID: 571a1468-cb91-40e6-9e58-460b3eb1a3bc Status: Started Snapshot Count: 0 Number of Bricks: 2 x 2 = 4 Transport-type: tcp Bricks: Brick1: node1:/data/sde1 Brick2: node2:/data/sde1 Brick3: node3:/data/sde1 Brick4: node4:/data/sde1 Options Reconfigured: nfs.disable: on transport.address-family: inet Volume Name: dis-stripe Type: Distributed-Stripe Volume ID: 82345486-2286-4d5d-a0fd-cbeb42c5df6b Status: Started Snapshot Count: 0 Number of Bricks: 2 x 2 = 4 Transport-type: tcp Bricks: Brick1: node1:/data/sdd1 Brick2: node2:/data/sdd1 Brick3: node3:/data/sdd1 Brick4: node4:/data/sdd1 Options Reconfigured: nfs.disable: on transport.address-family: inet Volume Name: dis-volume Type: Distribute Volume ID: 49a9d03b-8d59-4bdf-8f3f-0079902e484d Status: Started Snapshot Count: 0 Number of Bricks: 2 Transport-type: tcp Bricks: Brick1: node1:/data/sdb1 Brick2: node2:/data/sdb1 Options Reconfigured: nfs.disable: on transport.address-family: inet Volume Name: rep-volume Type: Replicate Volume ID: dcad45e5-9083-4ac4-a63b-e93f0028cecb Status: Started Snapshot Count: 0 Number of Bricks: 1 x 2 = 2 Transport-type: tcp Bricks: Brick1: node3:/data/sdb1 Brick2: node4:/data/sdb1 Options Reconfigured: nfs.disable: on transport.address-family: inet Volume Name: stripe-volume Type: Stripe Volume ID: f0a5c752-fce9-4191-a25a-489a9a8d41b6 Status: Started Snapshot Count: 0 Number of Bricks: 1 x 2 = 2 Transport-type: tcp Bricks: Brick1: node1:/data/sdc1 Brick2: node2:/data/sdc1 Options Reconfigured: nfs.disable: on transport.address-family: inet
[root@node1 opt]# gluster volume status Status of volume: dis-rep Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick node1:/data/sde1 49155 0 Y 20324 Brick node2:/data/sde1 49152 0 Y 16938 Brick node3:/data/sde1 49154 0 Y 9984 Brick node4:/data/sde1 49152 0 Y 7793 Self-heal Daemon on localhost N/A N/A Y 21321 Self-heal Daemon on node2 N/A N/A Y 16926 Self-heal Daemon on node3 N/A N/A Y 10692 Self-heal Daemon on node4 N/A N/A Y 7783 Task Status of Volume dis-rep ------------------------------------------------------------------------------ There are no active volume tasks Status of volume: dis-stripe Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick node1:/data/sdd1 49154 0 Y 20258 Brick node2:/data/sdd1 49153 0 Y 16945 Brick node3:/data/sdd1 49153 0 Y 9932 Brick node4:/data/sdd1 49153 0 Y 7801 Task Status of Volume dis-stripe ------------------------------------------------------------------------------ There are no active volume tasks Status of volume: dis-volume Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick node1:/data/sdb1 49152 0 Y 19999 Brick node2:/data/sdb1 49154 0 Y 16953 Task Status of Volume dis-volume ------------------------------------------------------------------------------ There are no active volume tasks Status of volume: rep-volume Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick node3:/data/sdb1 49152 0 Y 9844 Brick node4:/data/sdb1 49154 0 Y 7808 Self-heal Daemon on localhost N/A N/A Y 21321 Self-heal Daemon on node3 N/A N/A Y 10692 Self-heal Daemon on node4 N/A N/A Y 7783 Self-heal Daemon on node2 N/A N/A Y 16926 Task Status of Volume rep-volume ------------------------------------------------------------------------------ There are no active volume tasks Status of volume: stripe-volume Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick node1:/data/sdc1 49153 0 Y 20102 Brick node2:/data/sdc1 49155 0 Y 16962 Task Status of Volume stripe-volume ------------------------------------------------------------------------------ There are no active volume tasks
[root@node1 opt]# gluster volume stop dis-stripe Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y volume stop: dis-stripe: success [root@node5 dis_stripe]# ll ls: 无法打开目录.: 传输端点尚未连接 [root@node1 opt]# gluster volume start dis-stripe volume start: dis-stripe: success [root@node5 dis_stripe]# ll 总用量 102400 -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo1.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo2.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo3.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo4.log -rw-r--r-- 1 root root 20971520 8月 13 23:21 demo5.log
[root@node1 opt]# gluster volume delete dis-stripe Deleting volume will erase all information about the volume. Do you want to continue? (y/n) y volume delete: dis-stripe: failed: Volume dis-stripe has been started.Volume needs to be stopped before deletion. [root@node1 opt]# gluster volume stop dis-stripe Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y volume stop: dis-stripe: success [root@node1 opt]# gluster volume delete dis-stripe Deleting volume will erase all information about the volume. Do you want to continue? (y/n) y volume delete: dis-stripe: success
[root@node5 dis_stripe]# cd .. //此时客户端不能在目录中操作了 -bash: cd: ..: 传输端点尚未连接
gluster volume set dis-rep auth.allow 192.168.1.* //设置192.168.226.0网段的所有IP地址都能访问dis-rep卷