查看 Ceph 客户端所见

shan

标题可能有点奇怪且具有误导性,但我找不到比这更好的了 :). 这里的想法是深入了解具有映射 RBD 设备的每个客户端的内核客户端所见的内容。 在本文中,我们专注于内核 RBD 功能。

为了查看内容,您需要调整一些调试值。 因此,您需要在 ceph.conf 中添加以下内容

[mon]
...
debug ms = 1
...

[osd]
...
debug ms = 1

然后,您可以创建并映射设备,如下所示

$ rbd create foo -s 10240
$ rbd map foo
/dev/rbd0

由于我们提高了调试级别,您应该已经注意到我们在 /sys/kernel/debug/ceph/ 中有一个客户端目录。

$ sudo ls /sys/kernel/debug/ceph/dee72d38-cd8b-42c1-93c1-3be0698206ca.client24166/
monc  monmap  osdc  osdmap

正如您所见,我们有客户端将用于与集群交互的几个关键信息。 存在诸如 OSD 映射之类的重要文件

$ sudo cat /sys/kernel/debug/ceph/dee72d38-cd8b-42c1-93c1-3be0698206ca.client24166/osdmap
epoch 68
flags
pool 0 pg_num 64 (63) read_tier -1 write_tier -1
osd0    10.143.114.189:6800     100%    (exists, up)    100%
osd1    10.143.114.187:6800     100%    (exists, up)    100%
osd2    10.143.114.186:6800     100%    (exists, up)    100%
osd3    10.143.114.188:6800     100%    (exists, up)    100%
osd4    10.143.114.186:6804     100%    (exists, up)    100%
osd5    10.143.114.187:6804     100%    (exists, up)    100%
osd6    10.143.114.188:6804     100%    (exists, up)    100%
osd7    10.143.114.189:6804     100%    (exists, up)    100%
osd8    10.143.114.187:6808     100%    (exists, up)    100%
osd9    10.143.114.188:6808     100%    (exists, up)    100%
osd10   10.143.114.189:6808     100%    (exists, up)    100%
osd11   10.143.114.186:6808     100%    (exists, up)    100%
osd12   10.143.114.188:6812     100%    (exists, up)    100%
osd13   10.143.114.189:6812     100%    (exists, up)    100%
osd14   10.143.114.187:6812     100%    (exists, up)    100%
osd15   10.143.114.186:6812     100%    (exists, up)    100%
osd16   10.143.114.188:6816     100%    (exists, up)    100%
osd17   10.143.114.189:6816     100%    (exists, up)    100%
osd18   10.143.114.186:6806     100%    (exists, up)    100%
osd19   10.143.114.187:6801     100%    (exists, up)    100%

以及监视器映射

$ sudo cat /sys/kernel/debug/ceph/dee72d38-cd8b-42c1-93c1-3be0698206ca.client24166/monmap
epoch 1
        mon0    10.143.114.185:6789
        mon1    10.143.114.186:6789
        mon2    10.143.114.187:6789

就这样了!