第 2 章 使用 must-gather 下载日志文件和诊断信息
如果 Red Hat OpenShift Data Foundation 无法自动解决问题,请使用 must-gather
工具收集日志文件和诊断信息,以便您或红帽支持可以查看问题并确定解决方案。
当将 Red Hat OpenShift Data Foundation 部署为外部模式时,must-gather
仅从 OpenShift Data Foundation 集群收集日志,且不会从外部 Red Hat Ceph Storage 集群收集调试数据和日志。要从外部 Red Hat Ceph Storage 集群收集调试日志,请参阅 Red Hat Ceph Storage 故障排除指南 并联系您的 Red Hat Ceph Storage 管理员。
先决条件
可选: 如果 OpenShift Data Foundation 在断开连接的环境中部署,请确保将独立的
must-gather
镜像镜像(mirror)到断开连接的环境中可用的镜像 registry。oc image mirror registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 <local-registry>/odf4/odf-must-gather-rhel9:v4.15 [--registry-config=<path-to-the-registry-config>] [--insecure=true]
$ oc image mirror registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 <local-registry>/odf4/odf-must-gather-rhel9:v4.15 [--registry-config=<path-to-the-registry-config>] [--insecure=true]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <local-registry>
- 是本地镜像 registry 可用于断开连接的 OpenShift Container Platform 集群。
<path-to-the-registry-config>
-
是 registry 凭证的路径,默认为
~/.docker/config.json
。 --insecure
- 只有在镜像 registry 不安全时才添加此标志。
如需更多信息,请参阅红帽知识库解决方案:
流程
从连接到 OpenShift Data Foundation 集群的客户端运行
must-gather
命令:oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=<directory-name>
$ oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=<directory-name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <directory-name>
是要将数据写入的目录的名称。
重要对于断开连接的环境部署,将镜像 in-
image 参数替换为
镜像的must-gather
镜像。oc adm must-gather --image=<local-registry>/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=<directory-name>
$ oc adm must-gather --image=<local-registry>/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=<directory-name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <local-registry>
- 是本地镜像 registry 可用于断开连接的 OpenShift Container Platform 集群。
这会在指定目录中收集以下信息:
- 所有与 Red Hat OpenShift Data Foundation 集群相关的自定义资源(CR)及其命名空间。
- 所有 Red Hat OpenShift Data Foundation 相关 pod 的 Pod 日志。
- 某些标准 Ceph 命令的输出,如 Status、Cluster health 等。
2.1. must-gather 命令的变化 复制链接链接已复制到粘贴板!
如果一个或多个 master 节点没有处于 Ready 状态,use
-node-name
提供一个状态为 Ready 的 master 节点,以便可以安全地调度must-gather
pod。oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=_<directory-name>_ --node-name=_<node-name>_
$ oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=_<directory-name>_ --node-name=_<node-name>_
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 如果要从特定时间收集信息:
要为收集的日志指定相对时间段,比如在 5 秒或 2 天内,添加
/usr/bin/gather since=<duration>
:oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=_<directory-name>_ /usr/bin/gather since=<duration>
$ oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=_<directory-name>_ /usr/bin/gather since=<duration>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 要指定收集日志的特定时间,请添加
/usr/bin/gather since-time=<rfc3339-timestamp>
:oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=_<directory-name>_ /usr/bin/gather since-time=<rfc3339-timestamp>
$ oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.15 --dest-dir=_<directory-name>_ /usr/bin/gather since-time=<rfc3339-timestamp>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
按如下方式替换这些命令中的示例值:
- <node-name>
-
如果一个或多个 master 节点没有处于 Ready 状态,请使用此参数提供仍然处于 Ready 状态的 master 节点的名称。这可避免调度错误,确保
must-gather
pod 没有调度到未就绪的 master 节点上。 - <directory-name>
-
must-gather
收集的信息的目录。 - <duration>
-
将收集信息的时间段指定为相对持续时间,例如
5h
(从 5 小时以前开始)。 - <rfc3339-timestamp>
-
指定收集信息的时间周期为 RFC 3339 时间戳,例如
2020-11-10T04:00:00+00:00
( 2020 年 11 月 11 日 4 am UTC)。