使用 Ops Manager API可以检查 Ops Manager 安装的许可证密钥状态,并安装或释放许可证密钥。要了解 Ops Manager 如何计算许可证密钥状态,请参阅Ops Manager 许可证密钥概述。要在 Ops Manager 界面中管理许可证密钥,请参阅Ops Manager 中的许可证密钥管理。
先决条件
在开始之前,请确保您具备以下内容:
An API key with the
Global Ownerrole.您在密钥门户中生成的许可证密钥文件。要了解具体操作方法,请参阅Ops Manager 中的“管理许可证密钥”。
安装许可证密钥
按照以下步骤安装许可证密钥,并确认 Ops Manager 已应用该密钥。
检查当前许可证密钥状态
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.
安装许可证密钥
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 拒绝许可证密钥,则响应中会包含错误信息。要解决此错误,请参阅“排查安装错误”。
确认新的许可证密钥状态
在上一步的响应中,检查以下字段:
enforcement.effectiveState是LICENSED。The new license key appears in the
licensesarray with astatusofACTIVE.
如果状态与预期不符,请调用“按需重新计算许可证密钥状态”端点重新计算状态,然后再次检查字段。
发布许可证密钥
使用以下步骤从您的 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.
发布许可证密钥
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 释放许可证密钥”。
获取密钥管理器 ID
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:
字段 | 说明 |
|---|---|
| Error code, such as |
| 描述错误及后续操作步骤的消息。 |
有关错误代码、HTTP 状态和消息的列表,请参阅“排查安装错误”。
相关页面
有关许可证密钥的更多信息,请参阅以下页面: