共計 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 行業資訊頻道,更多相關知識等著你來學習!