RH236GlusterFS-性能监控
RHCSA专栏:戏说 RHCSA 认证
RHCE专栏:戏说 RHCE 认证
此文章(第十四章 GlusterFS-性能监控)收录在RHCA专栏:RHCA 回忆录
VolumeProfile命令
VolumeProfile 命令提供了一个接口,可以查看一些卷的信息,比如I/O或一些文件操作等,从而可以找出瓶颈所在。
启动 Profiling
命令格式:
#gluster volume profile VOLNAME start
For example:
# gluster volume profile test-volume start
# 开启此命令会影响性能,因此建议只在做debug时启用。
查看IO信息
命令格式:
# gluster volume profile VOLNAME info [nfs]
For example:
# gluster volume profile test-volume info
关闭 Profiling
命令格式:
#gluster volume profile VOLNAME stop
For example:
# gluster volume profile test-volume stop
VolumeTop命令
Volume Top命令可以查看glusterFS bricks的一些性能指标。
查看当前打开的文件数及最大打开的文件数
命令格式:
# gluster volume top VOLNAME open [nfs | brick BRICK-NAME] [list-cnt CNT]
For example:
# gluster volume top test-volume open brick g1:/data list-cnt cnt5
# 如果不指定brick ,Volume Top命令默认会返回100条结果,可以使用list-cnt 限制返回的数量。
查看读取频率最高的文件
命令格式:
# gluster volume top VOLNAME read [nfs | brick BRICK-NAME] [list-cnt CNT]
For example:
# gluster volume top test-volume read
# 如果不指定brick ,Volume Top命令默认会返回100条结果,可以使用list-cnt 限制返回的数量。
查看写频率最高的文件
命令格式:
# gluster volume top VOLNAME write [nfs | brick BRICK-NAME] [list-cnt CNT]
Forexample:
# gluster volume top test-volume write list-cnt 10
# 如果不指定brick ,Volume Top命令默认会返回100条结果,可以使用list-cnt 限制返回的数量。
查看打开频率最高的目录
命令格式:
# gluster volume top VOLNAME opendir [nfs | brick BRICK-NAME] [list-cnt CNT]
For example:
# gluster volume top test-volume opendir brick g1:/data list-cnt cnt5
# 如果不指定brick ,Volume Top命令将返回该卷上所有brick的信息。
查看读取频率最高的目录
命令格式:
# gluster volume top VOLNAME readdir [nfs | brick BRICK-NAME] [list-cnt CNT]
For example:
# gluster volume top test-volume readdir
查看brick的读/写性能
命令格式:
# gluster volume top <VOLNAME> {read-perf|write-perf} [bs <size> count <count>] [brick <brick>] [list-cnt <value>] - volume top operations
此命令可以测试卷的读写性能,命令类似dd
For example:
# gluster volume top test-volume read-perf
# gluster volume top test-volume write-perf bs 1024 count 10 brick g1:/data list-cnt 5
列出当前所有的卷
# gluster volume list
转储状态文件
可以将卷的一些内部变量及状态信息转储到文件中去,文件的默认存储路径为/var/run/gluster,文件名为BRICK-PATH.BRICK-PID.dump.*。
命令格式:
# gluster volume statedump VOLNAME [nfs] [all|mem|iobuf|callpool|priv|fd|inode|history]
mem Dumps the memory usage and memory pool detailsof the bricks.
Iobuf Dumps iobuf details of the bricks.
priv Dumps private information of loaded translators.
callpool Dumpsthe pending calls of the volume.
fd Dumps the open file descriptor tables of the volume.
inode Dumpsthe inode tables of the volume.
history Dumpsthe event history of the volume
更改转储文件的路径
# gluster volume set VOLNAME server.statedump-path PATH
查看卷的状态
命令格式:
# gluster volume status [all] VOLNAME [nfs | shd | BRICKNAME]] [detail |clients | mem | inode | fd |callpool]
For example:
# gluster volume status test-volume shd
# gluster volume status test-volume g1:/data detail
detail Displays additional information aboutthe bricks.
clients Displays the list of clients connectedto the volume.
mem Displays the memory usage andmemory pool details of the bricks.
inode Displays the inode tables of thevolume.
fd Displays the open filedescriptor tables of the volume.
callpool Displaysthe pending calls of the volume.
shd Displays the Self-heal info ofthe volume.
课本练习(以练习来进行了解)
[root@workstation ~]# lab profiling setup
1. 启用对prod-vol卷的分析。
[root@servera ~]# gluster volume profile prod-vol start
Starting volume profile on prod-vol has been successful
2. 验证已经为prod-vol启用了分析。
[root@servera ~]# gluster volume info prod-vol
Volume Name: prod-vol
Type: Replicate
Volume ID: 56889e01-995f-47f7-bb9a-c38c4907e747
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:
diagnostics.count-fop-hits: on
diagnostics.latency-measurement: on
performance.readdir-ahead: on
3. 检查prod-vo1的累积统计信息。
[root@servera ~]# gluster volume profile prod-vol info cumulative
Brick: servera:/bricks/brick-a1/brick
-------------------------------------
Cumulative Stats:
Block Size: 1b+ 2b+ 4b+
No. of Reads: 0 0 0
No. of Writes: 4010 610 1355
Block Size: 8b+ 16b+ 32b+
No. of Reads: 0 0 0
No. of Writes: 38581 9466 95
Block Size: 64b+
No. of Reads: 0
No. of Writes: 17
%-latency Avg-latency Min-Latency Max-Latency No. of calls Fop
--------- ----------- ----------- ----------- ------------ ----
0.00 0.00 us 0.00 us 0.00 us 40 RELEASE
0.00 0.00 us 0.00 us 0.00 us 669 RELEASEDIR
0.11 3.44 us 2.00 us 5.00 us 80 OPENDIR
9.63 392.42 us 48.00 us 1279.00 us 60 STATFS
18.98 290.23 us 32.00 us 832.00 us 160 READDIR
24.28 424.19 us 32.00 us 2210.00 us 140 GETXATTR
47.00 442.19 us 41.00 us 1584.00 us 260 LOOKUP
Duration: 103168 seconds
Data Read: 0 bytes
Data Written: 669785 bytes
Brick: serverb:/bricks/brick-b1/brick
-------------------------------------
Cumulative Stats:
Block Size: 1b+ 2b+ 4b+
No. of Reads: 0 0 0
No. of Writes: 4010 610 1355
Block Size: 8b+ 16b+ 32b+
No. of Reads: 0 0 0
No. of Writes: 38581 9466 95
Block Size: 64b+
No. of Reads: 0
No. of Writes: 17
%-latency Avg-latency Min-Latency Max-Latency No. of calls Fop
--------- ----------- ----------- ----------- ------------ ----
0.00 0.00 us 0.00 us 0.00 us 40 RELEASE
0.00 0.00 us 0.00 us 0.00 us 511 RELEASEDIR
0.13 3.65 us 3.00 us 5.00 us 80 OPENDIR
7.90 293.02 us 57.00 us 981.00 us 60 STATFS
18.53 257.52 us 34.00 us 768.00 us 160 READDIR
26.57 422.15 us 31.00 us 2564.00 us 140 GETXATTR
46.86 400.89 us 43.00 us 1307.00 us 260 LOOKUP
Duration: 76271 seconds
Data Read: 0 bytes
Data Written: 669785 bytes
4. 禁用对prod-vol的分析。
[root@servera ~]# gluster volume profile prod-vol stop
Stopping volume profile on prod-vol has been successful
[root@servera ~]# gluster volume info prod-vol
Volume Name: prod-vol
Type: Replicate
Volume ID: 56889e01-995f-47f7-bb9a-c38c4907e747
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
5. 使用glusterfs volume top选项查看性能指标。
查看当前打开的文件数及最大打开的文件数
[root@servera ~]# gluster volume top prod-vol open
Brick: servera:/bricks/brick-a1/brick
Current open fds: 0, Max open fds: 1, Max openfd time: 2020-12-14 09:08:06.670735
Count filename
=======================
1 /file020.bin
1 /file019.bin
1 /file018.bin
1 /file017.bin
…………
查看读取频率最高的文件
[root@servera ~]# gluster volume top prod-vol read brick servera:/bricks/brick-a1/brick
Brick: servera:/bricks/brick-a1/brick
# 因为没这频率
查看写频率最高的文件
[root@servera ~]# gluster volume top prod-vol write brick servera:/bricks/brick-a1/brick
Brick: servera:/bricks/brick-a1/brick
Count filename
=======================
4664 /file004.bin
4128 /file012.bin
4089 /file016.bin
3967 /file005.bin
3958 /file007.bin
3554 /file006.bin
…………
查看brick的读/写性能
[root@servera ~]# gluster volume top prod-vol read-perf bs 256 count 1 brick servera:/bricks/brick-a1/brick
Brick: servera:/bricks/brick-a1/brick
Throughput 12.80 MBps time 0.0000 secs
[root@servera ~]# gluster volume top prod-vol write-perf bs 512 count 2 brick servera:/bricks/brick-a1/brick
Brick: servera:/bricks/brick-a1/brick
Throughput 30.12 MBps time 0.0000 secs
MBps Filename Time
==== ======== ====
0 /file020.bin 2020-12-15 02:46:21.855432
0 /file019.bin 2020-12-15 02:46:19.710012
0 /file018.bin 2020-12-15 02:46:17.935527
…………
查看打开频率最高的目录
[root@servera ~]# gluster volume top prod-vol opendir brick servera:/bricks/brick-a1/brick
Brick: servera:/bricks/brick-a1/brick
Count filename
=======================
1 /2010
1 /2009
1 /2008
查看读取频率最高的目录
[root@servera ~]# gluster volume top prod-vol readdir brick servera:/bricks/brick-a1/brick
Brick: servera:/bricks/brick-a1/brick
Count filename
=======================
2 /2010
6. 脚本评分。
[root@workstation ~]# lab profiling grade
总结
以上就是【金鱼哥】对Gluster性能监控的分享 。希望能对看到此文章的小伙伴有所帮助。
如果这篇【文章】有帮助到你,希望可以给【金鱼哥】点个赞👍,创作不易,相比官方的陈述,我更喜欢用【通俗易懂】的文笔去讲解每一个知识点,如果有对【运维技术】感兴趣,也欢迎关注❤️❤️❤️ 【金鱼哥】❤️❤️❤️,我将会给你带来巨大的【收获与惊喜】💕💕!