mongocli ops-manager performanceAdvisor suggestedIndexes list
返回查询缓慢的集合的建议索引。
性能顾问监控MongoDB认为缓慢的查询,并建议新的索引以改善查询性能。
使用此命令,您必须使用具有项目只读角色的用户帐户或API密钥进行身份验证。
语法
命令语法
mongocli ops-manager performanceAdvisor suggestedIndexes list [options]
选项
名称 | 类型 | 必需 | 描述 |
---|---|---|---|
--duration | int | false | 返回结果的毫秒数长度。如果您指定了since选项,则持续时间从指定的日期和时间开始。如果没有设置since选项,则此命令返回当前时间之前的持续时间内的数据。 |
-h, --help | false | list的帮助信息 | |
--hostId | string | true | 用于MongoDB进程的主机的唯一标识符。 |
--nExamples | int | false | 提供建议索引将改善的最大查询示例数量。 |
--nIndexes | int | false | 建议的最大索引数。 |
--namespaces | string | false | 从中检索建议索引的命名空间。 |
-o, --output | string | false | 输出格式。有效值是json、json-path、go-template或go-template-file。要查看完整输出,请使用-o json选项。 |
--projectId | string | false | 用于识别要使用的项目的十六进制字符串。此选项覆盖配置文件或环境变量中的设置。 |
--since | int | false | 查询获取建议索引的日期和时间。请以自 UNIX 纪元以来经过的秒数指定此值。如果您不设置持续时间选项,则此命令将返回自 since 值到当前时间的所有数据。 |
继承选项
名称 | 类型 | 必需 | 描述 |
---|---|---|---|
-P, --profile | string | false | 从配置文件中使用配置文件中使用的配置文件名称。有关 MongoCLI 的配置文件中配置文件的信息,请参阅https://dochub.mongodb.org/core/atlas-cli-configuration-file. |
示例
# Return a JSON-formatted list of suggested indexes 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 suggestedIndexes list --processName atlas-111ggi-shard-00-00.111xx.mongodb.net:27017 --projectId 5e2211c17a3e5a48f5497de3 --output json