对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。

通过 API 管理许可证密钥

使用 Ops Manager API可以检查 Ops Manager 安装的许可证密钥状态,并安装或释放许可证密钥。要了解 Ops Manager 如何计算许可证密钥状态,请参阅Ops Manager 许可证密钥概述。要在 Ops Manager 界面中管理许可证密钥,请参阅Ops Manager 中的许可证密钥管理。

在开始之前,请确保您具备以下内容:

按照以下步骤安装许可证密钥,并确认 Ops Manager 已应用该密钥。

1

Send a GET request to the /admin/licenses endpoint:

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --include \ --request GET \ "https://<OpsManagerHost>:<Port>/api/public/v1.0/admin/licenses?pretty=true"

The response includes the enforcement.effectiveState field and the licenses array. For a description of each field, see Get the License Key Status of an Installation.

2

Send a PUT request to the /admin/licenses endpoint. Use the contents of your license key file as the request body:

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --include \ --request PUT \ "https://<OpsManagerHost>:<Port>/api/public/v1.0/admin/licenses?pretty=true" \ --data @{LICENSE-KEY-FILE}

如果 Ops Manager 接受许可证密钥,则会重新计算状态并返回结果。如果 Ops Manager 拒绝许可证密钥,则响应中会包含错误信息。要解决此错误,请参阅“排查安装错误”。

3

在上一步的响应中,检查以下字段:

  • enforcement.effectiveState 是 LICENSED。

  • The new license key appears in the licenses array with a status of ACTIVE.

如果状态与预期不符,请调用“按需重新计算许可证密钥状态”端点重新计算状态,然后再次检查字段。

使用以下步骤从您的 Ops Manager 安装中释放许可证密钥。

重要

After you release a license key, you can't use it again. If you release the only usable license key, your installation has no coverage. The state changes to GRACE, and then to UNLICENSED after 90 days.

1

Send a GET request to the /admin/licenses endpoint. In the response, copy the artifactId value of the license key that you want to release.

2

Send a DELETE request to the /admin/licenses/{artifactId} endpoint. Replace {ARTIFACT-ID} with the artifactId value:

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --include \ --request DELETE \ "https://<OpsManagerHost>:<Port>/api/public/v1.0/admin/licenses/{ARTIFACT-ID}?pretty=true"

Ops Manager 会重新计算状态并返回结果。要了解更多信息,请参阅“从 Ops Manager 释放许可证密钥”。

The Key Manager ID identifies your Ops Manager installation, including every instance in a high-availability setup. The API returns the Key Manager ID in the holderId field. To retrieve it, send a GET request to the /admin/artifacts/identity endpoint. To learn more, see Get the Key Manager ID of an Installation.

您的 Ops Manager 安装会生成一个身份密钥:这是一个密钥对,安装程序在连接到 MongoDB 时使用该密钥对来验证其身份。如果您怀疑组织外部人员获取了私钥,请轮换密钥以将其替换为新的密钥对。您的安装程序必须能够连接到 MongoDB 才能轮换密钥。要了解更多信息,请参阅“轮换安装程序的身份密钥”。

When Ops Manager rejects a license key, the response has an HTTP status of 400, 403, or 409 and a JSON body that describes the error. The following fields identify the error:

字段
说明

errorCode

Error code, such as ARTIFACT_OUTDATED.

detail

描述错误及后续操作步骤的消息。

有关错误代码、HTTP 状态和消息的列表,请参阅“排查安装错误”。

有关许可证密钥的更多信息,请参阅以下页面: