mongodb atlas 警报的调试流程

Debugging flow for mongodb atlas alert

我对 mongodb 和 atlas 还很陌生,对以下警告感到困惑

Query Targeting: Scanned Objects / Returned has gone above 1000

我希望有更多数据来帮助调试,例如查询或至少是集合。查询并不慢,因为性能顾问没有捕捉到任何东西。

警报中给出的唯一信息是
- 创建时间
- 副本集
- 一个 link 到碎片
- 分片类型 (primary/secondary)

我应该如何调试假定的警报问题?

未来的警报包含有关如何解决问题的信息 - 简而言之就是下载 mongodb 日志并搜索低效查询。

To download the logs

1. Navigate to the Cluster page

If you do not see the cluster you want on the page, ensure you have selected the > proper Project

2. Select the cluster

a. Click the ellipsis icon (...) next to the cluster containing the mongod instance whose logs you want to download.
b. Select Download Logs.

3. In the Download Logs modal, edit the following fields

Select process: Select the process for which you want logs. Valid options are mongod and mongod-audit-log.
Select server: Select the server in the cluster whose logs you want to retrieve.
Start Time: Specify the date and time in your group’s time zone defining the inclusive lower bound of log activity to return. The start time must be less than 30 days ago.
End Time: Specify the date and time in your group’s time zone defining the inclusive upper bound of log activity to return.

4. Click Download Logs

一个低效的查询is explained here

The following mongod log entry shows statistics generated from an inefficient query:

planSummary: COLLSCAN keysExamined:0
docsExamined: 10000 cursorExhausted:1 numYields:234
nreturned:4  protocol:op_query 358ms<Timestamp> COMMAND  <query>

This query scanned 10,000 documents and returned only 4 for a ratio of 2500, which is highly inefficient.