注意
注意:群组和项目是同义词。您的 {PROJECT-ID} 与您的项目 ID 相同。对于现有群组,群组/项目 ID 保持不变。当引用说明时,此页面将使用“群组”这个更为人熟知的术语。终结点仍如文档中所述。
Use this endpoint to trigger an initial sync on a replica set member. Ops Manager sets lastResync for the process in the automation configuration and publishes the change. Use resync to recover a member stuck in RECOVERING because it fell behind the oplog window.
为确保成功执行,请将重新同步请求限制在副本集的辅助成员上。每个副本集仅允许一次并发重新同步,该同步操作将一直处于活动状态,直到部署达到目标状态。请避免在主成员上请求重新同步:自动化代理不会执行此操作,并且需要人工干预。
The request is asynchronous: 200 OK means Ops Manager published the change, not that the resync has finished. Poll the automation status resource until the plan completes, then poll v2.0 Get One Host by ID until replicaStateName is SECONDARY. An initial sync can take a long time on large data sets.
基本 URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0
Resource
POST /groups/{GROUP-ID}/process/{HOST-PORT}:resync所需角色
The API key that makes this request must have the Project Automation Admin role.
请求路径参数
名称 | 类型 | 必要性 | 说明 |
|---|---|---|---|
群组 ID(group ID) | 字符串 | 必需 | 标识项目的唯一 24 位十六进制数字字符串。 |
托管-端口 | 字符串 | 必需 | Target process, as |
请求查询参数
名称 | 类型 | 必要性 | 说明 | 默认 |
|---|---|---|---|---|
干运行 | 布尔 | Optional | If |
|
以下查询参数为可选参数:
名称 | 类型 | 必要性 | 说明 | 默认 |
|---|---|---|---|---|
pretty | 布尔 | Optional | 指示响应正文是否采用 pretty-print 格式的标志。 |
|
envelope | 布尔 | Optional | 指示是否将响应包装在信封中的标志。 某些 API 客户端无法访问 HTTP 响应标头或状态代码。要解决这个问题,可在查询中设置 envelope=true。 对于返回一个结果的端点,响应体包括:
|
|
请求正文参数
此端点不使用 HTTP 请求正文参数。
响应
Ops Manager returns 200 OK and the target process as it appears in the automation configuration, with the change applied. lastResync is set. The body is the same whether you set dryRun or not.
名称 | 类型 | 说明 |
|---|---|---|
名称 | 字符串 | 自动化配置中的流程名称。 |
主机名 | 字符串 | 进程的主机名。 |
处理类型 | 字符串 | Type of process, for example |
版本 | 字符串 | 该流程的 MongoDB 版本。 |
残疾人 | 布尔 |
|
lastRestart | 字符串 | Timestamp, in ISO 8601 UTC format, of the last requested restart. |
lastResync | 字符串 | Timestamp, in ISO 8601 UTC format, of the last requested resync. |
The document also contains the rest of the process's automation configuration, such as args2_6, featureCompatibilityVersion, and authSchemaVersion. See the Automation Configuration reference.
请求示例
The following example triggers an initial sync on the process running on node1.example.com:27017.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --include \ --request POST "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{GROUP-ID}/process/node1.example.com:27017:resync?pretty=true"响应示例
响应标头
HTTP/1.1 401 UnauthorizedContent-Type: application/json;charset=ISO-8859-1Date: {dateInUnixFormat}WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=falseContent-Length: {requestLengthInBytes}Connection: keep-aliveHTTP/1.1 200 OKVary: Accept-EncodingContent-Type: application/jsonStrict-Transport-Security: max-age=300Date: {dateInUnixFormat}Connection: keep-aliveContent-Length: {requestLengthInBytes}X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}响应体
{ "name": "rs0_1", "processType": "mongod", "version": "8.0.4", "hostname": "node1.example.com", "disabled": false, "lastResync": "2026-10-06T09:15:20Z", "authSchemaVersion": 5, "featureCompatibilityVersion": "8.0", "args2_6": { "net": { "port": 27017 }, "replication": { "replSetName": "rs0" }, "storage": { "dbPath": "/data/rs0_1" }, "systemLog": { "destination": "file", "path": "/data/rs0_1/mongodb.log" } }}响应代码
HTTP Status | 错误代码 | 说明 |
|---|---|---|
200 | -- | The change was published, or computed with |
400 | PROCESS_RESYNC_NOT_SUPPORTED | The target is a |
409 | 进程重新同步进行中 | 目标副本集已存在另一次待处理的重新同步。 |
409 | 进程代理未报告 | 目标主机的自动化代理从未向运维管理器报告过。 |
409 | 组处于恢复模式 | 项目在恢复后正在进行协调。 |
403 | 流程外部管理 | 该项目的流程由外部系统管理。 |
409 | AUTOMATION_CONFIG_DRAFT_ALREADY_EXISTS | 项目中有一个尚未发布的自动化配置草稿。 |
404 | 进程未找到 |
|
400 | 无效查询参数 |
|
409 | AUTOMATION_CONFIG_CONCURRENT_MODIFICATION | 请求处理期间,有人发布了更改。运维管理器仅在收到真实请求时才会返回此代码。 |
运维经理会按列出的顺序检查共享错误。有关前提条件和限制,请参阅流程生命周期。