金鱼哥RHCA回忆录:RH236GlusterFS-管理分层
🎹 个人简介:大家好,我是 金鱼哥,CSDN运维领域新星创作者,华为云·云享专家,阿里云社区·专家博主
📚个人资质:CCNA、HCNP、CSNA(网络分析师),软考初级、中级网络工程师、RHCSA、RHCE、RHCA、RHCI、ITIL😜
💬格言:努力不一定成功,但要想成功就必须努力🔥
概念和术语
能够基于用户的I/O,进行自动分类和数据移动。
tiering持续性的监控工作负载,识别热点数据,也就是用户经常访问的数据,通过统计和分析活跃的数据,将这些热点数据移到一个I/O比较快的热区(比如SSD),而非热点数据移到比较慢的冷区(比如机械硬盘),过程不会造成I/O中断。
所谓热区、冷区,就是在一个volume内部,又划分成两个子volume,一个热区,一个冷区。
分层架构
分层转换器基于 DHT 和重新平衡逻辑,将一个卷分割为两个子卷:hot 和 cold。hot 子卷被视为 cold 子卷的缓存。转换器负责决定将哪一分层用于文件,以及何时在分层之间迁移文件。一个文件可以驻留于任一个卷,但一个文件不能分割到两个子卷上。文件迁移按照以下条件发生:
- 热度:文件被访问的频率。
- 容量:达到了 hot 子卷的容量(或水位)。
cluster.watermark-hi和cluster.watermark-low是高水位和低水位。
数据移动框架
数据移动框架是利用重新平衡逻辑的迁移逻辑一般化。用于迁移文件的触发器由应用驱动。文件被升级或降级到适当的分层。可以配置文件的升级和降级检查频率,以适合具体的 glusterfs 架构。
数据移动触发器
数据移动触发器是触发文件从源存储单元到目标存储单元的机制。源存储单元 (SSU) 和目标存储单元 (DSU) 分别指定从中迁移出数据的 glusterfs brick/卷,以及迁移后数据所驻留的 glusterfs brick/卷。数据移动触发器将创建数据移动请求 (DMR),该请求将提交至数据移动服务 (DMS)。触发器有两个,即 I/O Path Trigger和 Scanning Trigger。
- I/O Path Trigger
当文件符合指定的数据移动规则时,此触发器将启动。
- Scanner Trigger
根据指定的移动规则,Scanner Trigger 遍历指定的源单元并选择对象/文件。在选择对象/文件后,向数据移动服务提交数据移动请求。
数据移动服务 (DMS)
数据移动服务负责数据的实际移动。此服务接收由数据移动触发器提交的数据移动请求。数据移动请求指定用于处理该请求的适当插件。
配置管理tiering
创建热区
注意:如果有geo-replication,必须先停掉
#gluster volume geo-replication vol1 desktop::vol1-slave stop
添加热区:
向一个已经存在的volume中,添加一个热区子卷,这个热区由两个brick组成的一个复制份数为2 的子卷
# gluster volume tier vol1 attach replica 2 \
node3:/brick/brick1
node4:/brick/brick1
查看卷信息,可以看到有tire信息:
# gluster volume info vol1
查看热区状态:
# gluster volume tier vol1 status
移除热区
先迁移数据
# gluster volume tier vol1 detach start
查看状态,状态都是completed时,就可以提交移除了
# gluster volume tier vol1 status
提交状态,确认已完成数据迁移,并移除热区
# gluster volume tier vol1 detach commit
设置阀值
也就是说数据被读写次数达到多少的时候,它就成为一个热点数据
# gluster volume set vol1 cluster.read-freq-threshold 500
# gluster volume set vol1 cluster.write-freq-threshold 500
值在0-1000之间,如果为0,表示此功能不起作用
其余详见课本。
扩容热区
1.先将热区detach
2.再attach热区,只不过这次tach的时候,多加几个brick
课本练习(以练习来进行了解)
[root@workstation ~]# lab tiering setup
1. 验证volume和brick的情况。
[root@servera ~]# gluster volume info prod-vol
Volume Name: prod-vol
Type: Replicate
Volume ID: 23354de6-241b-43ef-93ea-c19161939b00
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: servera:/bricks/brick-a1/brick
Brick2: serverb:/bricks/brick-b1/brick
Options Reconfigured:
performance.readdir-ahead: on
[root@workstation ~]# for I in server{a,b}
> do
> ssh ${I} "mount | grep brick"
> done
/dev/mapper/vg_bricks-brick--a1 on /bricks/brick-a1 type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/mapper/vg_bricks-brick--a2 on /bricks/brick-a2 type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/mapper/vg_bricks-brick--b1 on /bricks/brick-b1 type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/mapper/vg_bricks-brick--b2 on /bricks/brick-b2 type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
2. 创建热区。
[root@servera ~]# gluster volume tier prod-vol attach replica 2 servera:/bricks/brick-a2/brick serverb:/bricks/brick-b2/brick
volume attach-tier: success
Tiering Migration Functionality: prod-vol: success: Attach tier is successful on prod-vol. use tier status to check the status.
ID: 378d1cd9-afbb-4509-b692-59ff548a4c63
3. 验证卷信息
[root@servera ~]# gluster volume info prod-vol
Volume Name: prod-vol
Type: Tier
Volume ID: 23354de6-241b-43ef-93ea-c19161939b00
Status: Started
Number of Bricks: 4
Transport-type: tcp
Hot Tier :
Hot Tier Type : Replicate
Number of Bricks: 1 x 2 = 2
Brick1: serverb:/bricks/brick-b2/brick
Brick2: servera:/bricks/brick-a2/brick
Cold Tier:
Cold Tier Type : Replicate
Number of Bricks: 1 x 2 = 2
Brick3: servera:/bricks/brick-a1/brick
Brick4: serverb:/bricks/brick-b1/brick
Options Reconfigured:
cluster.tier-mode: cache
features.ctr-enabled: on
performance.readdir-ahead: on
4. 验证启用状态。
[root@servera ~]# gluster volume tier prod-vol status
Node Promoted files Demoted files Status
--------- --------- --------- ---------
localhost 0 0 in progress
serverb.lab.example.com 0 0 in progress
5. 脚本评分。
[root@workstation ~]# lab tiering grade
课本练习(以练习来进行了解)
[root@workstation ~]# lab extend-tier setup
1. 明确热区
[root@servera ~]# gluster volume info prod-vol
Volume Name: prod-vol
Type: Tier
Volume ID: 2e225516-2b43-4dc7-869d-4252bd8cfe51
Status: Started
Number of Bricks: 4
Transport-type: tcp
Hot Tier :
Hot Tier Type : Replicate
Number of Bricks: 1 x 2 = 2
Brick1: serverb:/bricks/brick-b2/brick
Brick2: servera:/bricks/brick-a2/brick
Cold Tier:
Cold Tier Type : Replicate
Number of Bricks: 1 x 2 = 2
Brick3: servera:/bricks/brick-a1/brick
Brick4: serverb:/bricks/brick-b1/brick
Options Reconfigured:
cluster.tier-mode: cache
features.ctr-enabled: on
performance.readdir-ahead: on
2. 按要求扩容热区。
[root@servera ~]# gluster volume tier prod-vol detach start
volume detach-tier start: success
ID: 4a91fea8-f81a-4736-8801-00b19c9ea6ca
[root@servera ~]# gluster volume tier prod-vol detach status
Node Rebalanced-files size scanned failures skipped status run time in secs
--------- ----------- ----------- ----------- ----------- ----------- ------------ --------------
localhost 0 0Bytes 20 0 0 completed 2.00
serverb.lab.example.com 20 391.0KB 20 0 0 completed 2.00
[root@servera ~]# gluster volume tier prod-vol detach commit
Removing tier can result in data loss. Do you want to Continue? (y/n) y
volume detach-tier commit: success
Check the detached bricks to ensure all files are migrated.
If files with data are found on the brick path, copy them via a gluster mount point before re-purposing the removed brick.
[root@servera ~]# rm -rf /bricks/brick-a2/brick
[root@servera ~]# mkdir /bricks/brick-a2/brick
[root@serverb ~]# rm -rf /bricks/brick-b2/brick
[root@serverb ~]# mkdir /bricks/brick-b2/brick
[root@servera ~]# gluster volume tier prod-vol attach replica 2 servera:/bricks/brick-a2/brick serverb:/bricks/brick-b2/brick servera:/bricks/brick-a3/brick serverb:/bricks/brick-b3/brick
volume attach-tier: success
Tiering Migration Functionality: prod-vol: success: Attach tier is successful on prod-vol. use tier status to check the status.
ID: e7b7c5aa-9548-48ec-8afd-bc09778f9c82
3. 明确创建好的热区。
[root@servera ~]# gluster volume info prod-vol
Volume Name: prod-vol
Type: Tier
Volume ID: 2e225516-2b43-4dc7-869d-4252bd8cfe51
Status: Started
Number of Bricks: 6
Transport-type: tcp
Hot Tier :
Hot Tier Type : Distributed-Replicate
Number of Bricks: 2 x 2 = 4
Brick1: serverb:/bricks/brick-b3/brick
Brick2: servera:/bricks/brick-a3/brick
Brick3: serverb:/bricks/brick-b2/brick
Brick4: servera:/bricks/brick-a2/brick
Cold Tier:
Cold Tier Type : Replicate
Number of Bricks: 1 x 2 = 2
Brick5: servera:/bricks/brick-a1/brick
Brick6: serverb:/bricks/brick-b1/brick
Options Reconfigured:
cluster.tier-mode: cache
features.ctr-enabled: on
performance.readdir-ahead: on
4. 明确热区。
[root@servera ~]# gluster volume info dev-vol
Volume Name: dev-vol
Type: Tier
Volume ID: c7b4ae35-4575-4dbc-abcc-4bef7d5be671
Status: Started
Number of Bricks: 6
Transport-type: tcp
Hot Tier :
Hot Tier Type : Distributed-Replicate
Number of Bricks: 2 x 2 = 4
Brick1: serverb:/bricks/brick-b6/brick
Brick2: servera:/bricks/brick-a6/brick
Brick3: serverb:/bricks/brick-b5/brick
Brick4: servera:/bricks/brick-a5/brick
Cold Tier:
Cold Tier Type : Replicate
Number of Bricks: 1 x 2 = 2
Brick5: servera:/bricks/brick-a4/brick
Brick6: serverb:/bricks/brick-b4/brick
Options Reconfigured:
cluster.tier-mode: cache
features.ctr-enabled: on
performance.readdir-ahead: on
5. 按要求进行缩容热区。
[root@servera ~]# gluster volume tier dev-vol detach start
volume detach-tier start: success
ID: c65bd110-4c20-4ff5-9539-f5af843b4624
[root@servera ~]# gluster volume tier dev-vol detach status
Node Rebalanced-files size scanned failures skipped status run time in secs
--------- ----------- ----------- ----------- ----------- ----------- ------------ --------------
localhost 0 0Bytes 0 0 0 completed 0.00
serverb.lab.example.com 0 0Bytes 22 0 0 completed 0.00
[root@servera ~]# gluster volume tier dev-vol detach commit
Removing tier can result in data loss. Do you want to Continue? (y/n) y
volume detach-tier commit: success
Check the detached bricks to ensure all files are migrated.
If files with data are found on the brick path, copy them via a gluster mount point before re-purposing the removed brick.
[root@servera ~]# rm -rf /bricks/brick-a6/brick/
[root@servera ~]# mkdir /bricks/brick-a6/brick
[root@serverb ~]# rm -rf /bricks/brick-b6/brick
[root@serverb ~]# mkdir /bricks/brick-b6/brick
[root@servera ~]# gluster volume tier dev-vol attach replica 2 servera:/bricks/brick-a6/brick serverb:/bricks/brick-b6/brick
volume attach-tier: success
Tiering Migration Functionality: dev-vol: success: Attach tier is successful on dev-vol. use tier status to check the status.
ID: 9d46db5b-c22b-43b5-bcd7-afe8c03d992d
6. 明确缩容后的热区。
[root@servera ~]# gluster volume info dev-vol
Volume Name: dev-vol
Type: Tier
Volume ID: c7b4ae35-4575-4dbc-abcc-4bef7d5be671
Status: Started
Number of Bricks: 4
Transport-type: tcp
Hot Tier :
Hot Tier Type : Replicate
Number of Bricks: 1 x 2 = 2
Brick1: serverb:/bricks/brick-b6/brick
Brick2: servera:/bricks/brick-a6/brick
Cold Tier:
Cold Tier Type : Replicate
Number of Bricks: 1 x 2 = 2
Brick3: servera:/bricks/brick-a4/brick
Brick4: serverb:/bricks/brick-b4/brick
Options Reconfigured:
cluster.tier-mode: cache
features.ctr-enabled: on
performance.readdir-ahead: on
7. 脚本评分。
[root@workstation ~]# lab extend-tier grade
总结
RHCA认证需要经历5门的学习与考试,还是需要花不少时间去学习与备考的,好好加油,可以噶🤪。
以上就是【金鱼哥】对 第十一章 GlusterFS-管理分层 的简述和讲解。希望能对看到此文章的小伙伴有所帮助。
💾红帽认证专栏系列:
RHCSA专栏:戏说 RHCSA 认证
RHCE专栏:戏说 RHCE 认证
此文章收录在RHCA专栏:RHCA 回忆录
如果这篇【文章】有帮助到你,希望可以给【金鱼哥】点个赞👍,创作不易,相比官方的陈述,我更喜欢用【通俗易懂】的文笔去讲解每一个知识点。
如果有对【运维技术】感兴趣,也欢迎关注❤️❤️❤️ 【金鱼哥】❤️❤️❤️,我将会给你带来巨大的【收获与惊喜】💕💕!
- 点赞
- 收藏
- 关注作者
评论(0)