ceph

61次阅读
没有评论

共计 3453 个字符,预计需要花费 9 分钟才能阅读完成。

这篇文章主要介绍了 ceph-mds 中 standby_replay 高速热备状态的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让丸趣 TV 小编带着大家一起了解一下。

ceph 的 MDS 是 cephFS 文件存储服务的元数据服务。

当创建 cephfs 后便会有 ceph-mds 服务进行管理。默认情况下 ceph 会分配一个 mds 服务管理 cephfs, 即使已经创建多个 mds 服务,如下:

[root@ceph-admin my-cluster]# ceph-deploy mds create ceph-node01 ceph-node02
.......
[root@ceph-admin ~]# ceph -s
 cluster:
 id: 06dc2b9b-0132-44d2-8a1c-c53d765dca5d
 health: HEALTH_OK
 
 services:
 mon: 2 daemons, quorum ceph-admin,ceph-node01
 mgr: ceph-admin(active)
 mds: mytest-fs-1/1/1 up {0=ceph-admin=up:active}, 2 up:standby
 osd: 3 osds: 3 up, 3 in
 rgw: 2 daemons active
 
 data:
 pools: 8 pools, 64 pgs
 objects: 299 objects, 137 MiB
 usage: 3.4 GiB used, 297 GiB / 300 GiB avail
 pgs: 64 active+clean

此时 mds 中只有 ceph-admin 处于 active 状态,其余处于 standby 状态。

standby 已近是一种灾备状态,但事实上切换速度比较缓慢,对于实际业务系统必定会造成影响。

测试情况如下:

[root@ceph-admin my-cluster]# killall ceph-mds
[root@ceph-admin my-cluster]# ceph -s
 cluster:
 id: 06dc2b9b-0132-44d2-8a1c-c53d765dca5d
 health: HEALTH_WARN
 1 filesystem is degraded
 
 services:
 mon: 2 daemons, quorum ceph-admin,ceph-node01
 mgr: ceph-admin(active)
 mds: mytest-fs-1/1/1 up {0=ceph-node02=up:rejoin}, 1 up:standby
 osd: 3 osds: 3 up, 3 in
 rgw: 2 daemons active
 
 data:
 pools: 8 pools, 64 pgs
 objects: 299 objects, 137 MiB
 usage: 3.4 GiB used, 297 GiB / 300 GiB avail
 pgs: 64 active+clean
 
[root@ceph-admin my-cluster]# ceph -s
 cluster:
 id: 06dc2b9b-0132-44d2-8a1c-c53d765dca5d
 health: HEALTH_OK
 
 services:
 mon: 2 daemons, quorum ceph-admin,ceph-node01
 mgr: ceph-admin(active)
 mds: mytest-fs-1/1/1 up {0=ceph-node02=up:active}, 1 up:standby
 osd: 3 osds: 3 up, 3 in
 rgw: 2 daemons active
 
 data:
 pools: 8 pools, 64 pgs
 objects: 299 objects, 137 MiB
 usage: 3.4 GiB used, 297 GiB / 300 GiB avail
 pgs: 64 active+clean
 
 io:
 client: 20 KiB/s rd, 3 op/s rd, 0 op/s wr

系统在 active 的 mds 被 kill 之后,standby 的 mds 在经过 rejoin 状态后才变成了 active,大约经过 3 -5s。而在生产环境中由于元数据的数据量更庞大,往往会更漫长。

而要让 mds 更快切换,需要将我们的 mds 服务切换至 standby_replay 状态,官方对于此状态的说明如下:

The MDS is following the journal of another up:active MDS. Should the active MDS fail, having a standby MDS in replay mode is desirable as the MDS is replaying the live journal and will more quickly takeover. A downside to having standby replay MDSs is that they are not available to takeover for any other MDS that fails, only the MDS they follow.

事实上就是 standby_replay 会实时根据 active 的 mds 元数据日志进行同步更新,这样就能加快切换的速率,那么如何让 mds 运行在 standby_replay 状态?

[root@ceph-node01 ~]# ps aufx|grep mds
root 700547 0.0 0.0 112704 976 pts/1 S+ 13:45 0:00 \_ grep --color=auto mds
ceph 690340 0.0 0.5 451944 22988 ? Ssl 10:09 0:03 /usr/bin/ceph-mds -f --cluster ceph --id ceph-node01 --setuser ceph --setgroup ceph
[root@ceph-node01 ~]# killall ceph-mds
[root@ceph-node01 ~]# /usr/bin/ceph-mds -f --cluster ceph --id ceph-node01 --setuser ceph --setgroup ceph --hot-standby 0
starting mds.ceph-node01 at -

我们手动关闭了 ceph-mds 服务并且添加了 –hot-standby 参数重新启动了 mds 服务。

接下来看到,ceph-node02 的 mds 已经处于 standby-replay 状态:

[root@ceph-admin my-cluster]# ceph -s
 cluster:
 id: 06dc2b9b-0132-44d2-8a1c-c53d765dca5d
 health: HEALTH_OK
 
 services:
 mon: 2 daemons, quorum ceph-admin,ceph-node01
 mgr: ceph-admin(active)
 mds: mytest-fs-1/1/1 up {0=ceph-admin=up:active}, 1 up:standby-replay, 1 up:standby
 osd: 3 osds: 3 up, 3 in
 rgw: 2 daemons active
 
 data:
 pools: 8 pools, 64 pgs
 objects: 299 objects, 137 MiB
 usage: 3.4 GiB used, 297 GiB / 300 GiB avail
 pgs: 64 active+clean
 
 io:
 client: 851 B/s rd, 1 op/s rd, 0 op/s wr

当然或者可以 ceph-mds 的启动脚本来让服务启动时自动处于 standby-replay 状态

感谢你能够认真阅读完这篇文章,希望丸趣 TV 小编分享的“ceph-mds 中 standby_replay 高速热备状态的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持丸趣 TV,关注丸趣 TV 行业资讯频道,更多相关知识等着你来学习!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-16发表,共计3453字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)