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

配置应用程序数据库的连接

If your Ops Manager Application Database uses authentication or TLS, update the connection settings from Ops Manager to the Ops Manager Application database in the conf-mms.properties file.

本教程假设您部署了Ops Manager 应用程序数据库并将其配置为使用身份验证、 TLS或两者。

提示

要了解如何使用访问控制来部署 MongoDB 或使用TLS ,请参阅 MongoDB 手册中的安全概念

Ops Manager 可以使用以下方法之一向 Ops Manager 应用程序数据库进行身份验证:

使用 MongoDB Community

  • 用户名和密码 ( MONGODB-CR / SCRAM-SHA-1 / SCRAM-SHA-256 )

  • LDAP

  • X.509 客户端证书

使用 MongoDB Enterprise

  • 用户名和密码 ( MONGODB-CR / SCRAM-SHA-1 / SCRAM-SHA-256 )

  • LDAP

  • Kerberos

  • X.509 客户端证书

如果您的 Ops Manager 应用程序数据库使用身份验证,您必须配置 Ops Manager 以便能够连接到数据库。

1

使用root特权在首选文本编辑器中打开conf-mms.properties文件。

此文件配置 Ops Manager 与Ops Manager 应用程序数据库的连接。

2

mongo.mongoUri包含用于访问Ops Manager 应用程序数据库的连接字符串。连接字符串必须包含以下内容(如果适用):

  • 如果 Ops Manager 应用程序数据库是副本集,那么副本集的所有成员。

  • Authentication credentials for the authentication mechanism used on the Ops Manager Application database.

mongo.mongoUri参考文档提供了每种身份验证机制的连接字符串格式示例,并详细说明了连接用户所需的权限。

其中包括 可以使用的任何 连接string 选项 MongoDB database。这些选项包括但不限于TLS 、设置读关注和写关注以及身份验证。

例子

对于使用 Kerberos 身份验证的 Ops Manager 应用程序数据库, mongo.mongoUri设置可能类似于:

mongo.mongoUri=mongodb://username%40REALM.example.net@mydb1.example.net:
40000/?authMechanism=GSSAPI
3

conf-mms.properties中编辑以下设置:

如果使用Kerberos身份验证,则必须配置Kerberos设置,如下所示:

jvm.java.security.krb5.kdc=kdc.example.com
jvm.java.security.krb5.realm=EXAMPLE.COM
mms.kerberos.principal=mms/mmsweb.example.com@EXAMPLE.COM
mms.kerberos.keyTab=/path/to/mms.keytab

如果使用 x.509 客户端证书身份验证,则还必须通过 TLS 进行连接。下一节“配置与应用程序数据库的 TLS 连接”将介绍 TLS 配置说明。

4

如果Ops Manager Application Database使用TLS运行,请继续学习 SSL 配置教程。

使用适合您平台的命令重新启动 Ops Manager:

sudo service mongodb-mms restart
<install_dir>/bin/mongodb-mms restart

要启用与 Ops Manager 应用程序数据库的TLS连接,请按照以下步骤操作。

1

此文件配置 Ops Manager 与Ops Manager 应用程序数据库的连接。

2

conf-mms.properties中配置以下设置:

选项
设置

Set this to true to indicate that the Ops Manager Application Database is using TLS.

指定包含来自签署 MongoDB Server 证书的证书颁发机构的根证书链的文件。

如果 MongoDB 实例使用--sslCAFile选项运行,请指定包含 x.509 证书和私钥的 PEM 文件。

该证书的 Extended Key Usage 字段应包含 TLS Web client authentication

如果客户端 PEM 文件包含加密私钥,请指定 PEM 文件的密码。 要在配置文件中加密此密码,请使用 Ops Manager credentialstool 工具。请参阅凭证工具。

3

使用适合您平台的命令重新启动 Ops Manager:

sudo service mongodb-mms restart
<install_dir>/bin/mongodb-mms restart