mongocli cloud-manager performanceAdvisor slowQueryLogs list
返回性能顾问和查询分析器识别的慢查询日志行。
性能顾问监视MongoDB认为较慢的查询,并建议新的索引以改进查询性能。慢查询的阈值基于集群上操作的平均时间,以提供与您的工作负载相关的建议。
如果您未设置持续时间选项或since选项,此命令将返回过去24小时的数据。
要使用此命令,您必须使用具有项目数据访问读/写角色的用户帐户或API密钥进行身份验证。
语法
命令语法
mongocli cloud-manager performanceAdvisor slowQueryLogs list [options]
选项
名称 | 类型 | 必需 | 描述 |
---|---|---|---|
--duration | int | false | 返回结果的时间长度(毫秒)。如果您指定了since选项,则持续时间从指定的日期和时间开始。如果您未设置since选项,则此命令返回从当前时间之前的时间段内的数据。 |
-h, --help | false | list的帮助信息 | |
--hostId | string | true | MongoDB进程的主机唯一标识符。 |
--nLog | int | false | 返回的最大日志行数。此值默认为20000。 |
--namespaces | string | false | 从其中检索建议的慢查询日志的命名空间,格式为 <数据库>.<集合>。省略此参数以返回所有命名空间的结果。 |
-o, --output | string | false | 输出格式。有效值是json、json-path、go-template或go-template-file。要查看完整的输出,请使用-o json选项。 |
--projectId | string | false | 用于识别要使用项目的十六进制字符串。此选项覆盖配置文件或环境变量中的设置。 |
--since | int | false | 查询检索建议索引的日期和时间。指定此值作为自UNIX纪元以来经过的秒数。如果您未设置duration选项,则此命令返回从since值到当前时间的数据。 |
继承选项
名称 | 类型 | 必需 | 描述 |
---|---|---|---|
-P, --profile | string | false | 从配置文件中使用的配置文件名称。要了解MongoCLI的配置文件配置,请参阅https://dochub.mongodb.org/core/atlas-cli-configuration-file. |
示例
# Return a JSON-formatted list of log lines for collections with slow queries for the atlas-111ggi-shard-00-00.111xx.mongodb.net:27017 host in the project with the ID 5e2211c17a3e5a48f5497de3: mongocli [ops-manager|cloud-manager] performanceAdvisor slowQueryLogs list --processName atlas-111ggi-shard-00-00.111xx.mongodb.net:27017 --projectId 5e2211c17a3e5a48f5497de3 --output json