您可以使用 Ops Manager API来确定副本集成员是否落后太多而无法追赶。您还可以读取该成员的最后一次复制错误。
Ops Manager adds two fields to the host document, tooStale and lastReplError, and returns them from new v2.0 versions of the three Get Host endpoints. The v1.0 endpoints are unchanged and never return the new fields.
To call these endpoints, you must have the Project Read Only role.
新增功能
列项 | Detail |
|---|---|
新端点 | v2.0 versions of Get One Host by ID, Get One Host by Hostname and Port, and Get All Hosts. Same paths as v1.0 under |
新领域 |
|
现有端点 | v1.0 is unchanged, including the hosts endpoints in the Admin API. |
开始之前
Your deployment must run Ops Manager 8.0.28 or 9.0.2 or later.
必须为项目启用监控。如果监控被禁用,运维管理器将忽略新字段。
Change the base path of your requests from
/api/public/v1.0to/api/public/v2.0. The rest of each request is unchanged.
检查成员的复制健康状况
找到主机。
Use v2.0 Get All Hosts to list hosts, or use the hostname:port you already know.
新字段
名称 | 类型 | 说明 |
|---|---|---|
太陈旧了 | 布尔 | 该成员的进程落后于操作日志窗口,无法从副本集中追赶进度。该成员需要进行初始同步。 |
最后一次复制错误 | 字符串 | The member's last replication error, from |
野外行为
下表描述了 Ops Manager 在特定场景下如何填充新字段。
Scenario | 行为 |
|---|---|
主机是健康的副本集成员 |
|
成员位于 oplog 窗口后面 |
|
主机不是副本集成员 | 这两个字段均已省略。 |
Request uses a v1.0 endpoint | 这两个字段均已省略。 |
获取所有主机 | 每个主机报告的是自己成员的值,而不是副本集的值。 |
这两个字段描述的是响应中的单个主机,而不是整个副本集。
故障排除
The following table describes common errors and symptoms when you use the v2.0 Get Host endpoints.
症状 | 可能的原因 | 解决方案 |
|---|---|---|
| The base path is | Use |
| The host isn't a replica set member, monitoring is disabled, or you called a v1.0 endpoint. | Confirm the host belongs to a replica set, monitoring is enabled, and the path uses v2.0. |
| 该成员报告没有复制错误。 | 无需采取任何行动。 |
|
| Confirm the value with v2.0 Get All Hosts. |
使用API
要以编程方式读取复制健康状况,请参阅“获取具有复制健康状况的主机”。