2.8. 为容器化 Ceph 守护进程启用日志记录到文件
默认情况下,容器化 Ceph 守护进程不记录到文件。您可以使用集中式配置管理,使容器化 Ceph 守护进程能够记录到文件。
前提条件
- 安装 Red Hat Ceph Storage 软件。
- 根级别访问运行容器化守护进程的节点。
流程
进入
var/log/ceph
目录:Example
[root@host01 ~]# cd /var/log/ceph
记录任何现有日志文件。
语法
ls -l /var/log/ceph/
Example
[root@host01 ceph]# ls -l /var/log/ceph/ total 396 -rw-r--r--. 1 ceph ceph 107230 Feb 5 14:42 ceph-osd.0.log -rw-r--r--. 1 ceph ceph 107230 Feb 5 14:42 ceph-osd.3.log -rw-r--r--. 1 root root 181641 Feb 5 14:42 ceph-volume.log
在示例中,登录 OSD.0 和 OSD.3 的文件已经启用。
获取您要启用日志记录的守护进程的容器名称:
Red Hat Enterprise Linux 7
[root@host01 ceph]# docker ps -a
Red Hat Enterprise Linux 8
[root@host01 ceph]# podman ps -a
使用集中式配置管理,为 Ceph 守护进程启用文件日志记录。
Red Hat Enterprise Linux 7
docker exec CONTAINER_NAME ceph config set DAEMON_NAME log_to_file true
Red Hat Enterprise Linux 8
podman exec CONTAINER_NAME ceph config set DAEMON_NAME log_to_file true
DAEMON_NAME 由 CONTAINER_NAME 派生而来。删除
ceph-
,并将守护进程和守护进程 ID 之间的连字符替换为一个句点。Red Hat Enterprise Linux 7
[root@host01 ceph]# docker exec ceph-mon-host01 ceph config set mon.host01 log_to_file true
Red Hat Enterprise Linux 8
[root@host01 ceph]# podman exec ceph-mon-host01 ceph config set mon.host01 log_to_file true
可选:要为集群日志启用日志日志,请使用
mon_cluster_log_to_file
选项:Red Hat Enterprise Linux 7
docker exec CONTAINER_NAME ceph config set DAEMON_NAME mon_cluster_log_to_file true
Red Hat Enterprise Linux 8
podman exec CONTAINER_NAME ceph config set DAEMON_NAME mon_cluster_log_to_file true
Red Hat Enterprise Linux 7
[root@host01 ceph]# docker exec ceph-mon-host01 ceph config set mon.host01 mon_cluster_log_to_file true
Red Hat Enterprise Linux 8
[root@host01 ceph]# podman exec ceph-mon-host01 ceph config set mon.host01 mon_cluster_log_to_file true
验证更新的配置:
Red Hat Enterprise Linux 7
docker exec CONTAINER_NAME ceph config show-with-defaults DAEMON_NAME | grep log_to_file
Red Hat Enterprise Linux 8
podman exec CONTAINER_NAME ceph config show-with-defaults DAEMON_NAME | grep log_to_file
Example
[root@host01 ceph]# podman exec ceph-mon-host01 ceph config show-with-defaults mon.host01 | grep log_to_file log_to_file true mon default[false] mon_cluster_log_to_file true mon default[false]
可选:重启 Ceph 守护进程:
语法
systemctl restart ceph-DAEMON@DAEMON_ID
Example
[root@host01 ceph]# systemctl restart ceph-mon@host01
验证新日志文件是否存在:
语法
ls -l /var/log/ceph/
Example
[root@host01 ceph]# ls -l /var/log/ceph/ total 408 -rw-------. 1 ceph ceph 202 Feb 5 16:06 ceph.audit.log -rw-------. 1 ceph ceph 3182 Feb 5 16:06 ceph.log -rw-r--r--. 1 ceph ceph 2049 Feb 5 16:06 ceph-mon.host01.log -rw-r--r--. 1 ceph ceph 107230 Feb 5 14:42 ceph-osd.0.log -rw-r--r--. 1 ceph ceph 107230 Feb 5 14:42 ceph-osd.3.log -rw-r--r--. 1 root root 181641 Feb 5 14:42 ceph-volume.log
创建了两个新文件,
ceph-mon.host01.log
用于 monitor 守护进程和ceph.log
,用于集群日志。
其它资源
- 有关更多信息,请参阅 Red Hat Ceph Storage 故障排除指南中的 配置日志记录 部分。