【Ceph】Ceph 进阶系列(一):Ceph日志和调试|日志代码

本文深入探讨了Ceph的日志记录和调试方法,包括运行时和启动时的临时及配置文件激活日志,日志等级设置,以及如何进行日志切割轮转。还详细介绍了Ceph的子系统、日志和调试选项,如osd、mon和mds的配置,并分析了代码中的日志使用。此外,讨论了加快日志更迭和Valgrind在调试中的应用,提供了解决系统资源占用问题的策略。
摘要由CSDN通过智能技术生成

目录

即看即用

1 运行时

2 启动时

3 加速日志更迭

4 子系统、日志和调试设置

详细说明


一、即看即用

1 已经运行临时激活

a查看配置

查看OSD的配置:

ceph daemon osd.2 config show | less  #.2 是OSD 的id

查看 mgr 、 mon 或 mds的配置:

ceph daemon mon.rdma55  config show | less  #.rdma55 是ID

ceph daemon mgr.rdma55  config show | less  #.rdma55 是ID

ceph daemon mds.rdma55  config show | less  #.rdma55 是ID

osd 、mgr 、 mon 或 mdsID 查看方式:

查看osd 的ID:

[root@rdma55 ~]# ps -aux|grep -E "ceph-osd"|grep -v "grep"
ceph 2382201 /opt/h3c/bin/ceph-osd --cluster=ceph -i 2
ceph 2382343 /opt/h3c/bin/ceph-osd --cluster=ceph -i 9
ceph 2382487 /opt/h3c/bin/ceph-osd --cluster=ceph -i 15
ceph 2382632 /opt/h3c/bin/ceph-osd --cluster=ceph -i 22
ceph 2382835 /opt/h3c/bin/ceph-osd --cluster=ceph -i 28
ceph 2383021 /opt/h3c/bin/ceph-osd --cluster=ceph -i 32

-i 后面的就是ID

查看mgr 、 mon 或 mds的ID:

[root@rdma55 ~]# ps -aux|grep -E "ceph-mgr|ceph-mon|ceph-mds"|grep -v "grep"
ceph 2268447 /opt/h3c/bin/ceph-mon -f --id rdma55
ceph 3384811 /opt/h3c/bin/ceph-mgr -f --id rdma55

-i d后面的就是ID

查看配置语法说明

运行时执行下列命令,用 osd 、 mon 或 mds 替代 {daemon-type}:

ceph daemon {daemon-name} config show | less
例如: 

ceph daemon osd.0 config show | less

b激活 Ceph 的调试输出(dout() )

例子:

  ceph tell osd.0 injectargs --debug-osd 0/5

  ceph tell osd.4 injectargs --debug-ms 15/15

语法说明:

ceph  tell 命令把参数注入运行时配置:

    ceph tell {daemon-type}.{daemon id or *} injectargs --{name} {value} [--{name} {value}]


用 osd 、 mon 或 mds 替代 {daemon-type} 。 *  同类型的所有守护进程,id:指定具体守护进程。例如:

    ceph tell osd.0 injectargs --debug-osd 0/5

   ceph tell osd.4 injectargs --debug-ms 15/15


ceph tell 命令会通过 monitor 起作用。如果你不能绑定 monitor,仍可以登录你要改的那台主机然后用 ceph daemon 来更改。例如:

    sudo ceph daemon osd.0 config set debug_osd 0/5

2 配置文件激活日志

激活 Ceph 的调试输出(dout() )

把选项加入配置文件, [global] 段:各进程共有, [mon] 、 [osd] 、 [mds] :某类进程的配置。例如:

[global]
            debug ms = 1/5
 
    [mon]
            debug mon = 20
            debug paxos = 1/5
            debug auth = 2
 
    [osd]
            debug osd = 1/5
            debug filestore = 1/5
            debug journal = 1
            debug monc = 5/20
 
    [mds]
            debug mds = 1
            debug mds balancer = 1
            debug mds log = 1
            debug mds migrator = 1

4 日志等级设置(log等级和内存等级)

 
分为:日志文件(log file level)和 内存日志(memory level)

子系统(ms、osd、rdb等)二者可以设置为统一级别,也可以分别为不同级别(用正斜杠(/)分隔它们)。如下:

debug {subsystem} = {log-level}/{memory-level}

#for example

#日志文件级别 和 内存日志级别都设置成5
debug ms = 5

#日志文件级别设置为1,内存日志级别设置为5

debug ms = 1/5

3 日志切割轮转

logrotate是linux下负责检查日志和切割轮转的服务,它的配置文件在 /etc/logrotate.d/目录下,/etc/logrotate.d/ceph是ceph添加的配置,

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值