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

编辑副本集

您可以直接在 Cloud Manager 控制台中添加、删除和重新配置副本集中的节点。

注意

Cloud Manager restarts a node in a replica set or sharded cluster when you change configuraton file options for the MongoDB process running on the node. The following options trigger a restart only for the specified changes:

  • security.clusterAuthMode: Changing the value from keyfile to sendKeyFile triggers a restart. All other changes to this option do not.

  • net.tls.mode: Changing the value from disabled to allowTLS triggers a restart. All other changes to this option do not.

A restarted node triggers an election if the node was the primary. In addition, modifying the member settings of the current primary may trigger an election.

您必须有一台现有服务器来部署新的副本集成员。 要将成员添加到现有副本集,并增加副本集的大小:

1
  1. 如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含所需项目的组织。

  2. 如果尚未显示,请从导航栏的Projects菜单中选择所需的项目。

  3. 在侧边栏中,单击 Database 标题下的 Processes。

The Processes page displays.

2
3
4
5

如果主机未出现在Hostname列表中,请使用以下步骤添加主机:

  1. 在 Hostname 中,选择 New Server。

    如果尚未将主机添加到项目中,则不会显示Hostname列表。 单击Install Agent 。

  2. 在Add New Server对话框中,选择您的操作系统并单击Next 。

  3. 按照说明在新主机上安装MongoDB 助手。

注意

When adding a new member to a replica set, set Build Indexes to True if you want the member's mongod to build indexes. You cannot change this value after the Automation adds the new member to the replica set. To learn more, see members[n].buildIndexes.

警告

If your replica set uses TLS, you must create and install the necessary TLS certificates on the new replica set member host first. Then, set the TLS settings for the mongod or mongos process for the new replica set member on that host. Automation does not create and install the certificates and configure these settings automatically. If you do not configure TLS on the new member, you cannot add it to the existing TLS-enabled replica set. To learn how to enable TLS on the new replica set member, see Enable TLS for a Deployment.

  1. 在Replica Set Configuration部分中,为新成员填写以下字段:

    Auth Schema Version

    选择用于存储部署的用户数据的模式。 有关更多信息,请参阅升级到 SCRAM 。

    Feature Compatibility (可选)

    Version

    为您的副本集选择 MongoDB 版本。

    Data Directory

    指定mongod进程将存储数据文件的目录的完整路径。

    重要提示:确保新成员的数据目录不包含数据。新成员将从现有成员复制数据。

    If the new member is in a recovering state, it must exit and become a secondary before MongoDB can copy all data as part of the replication process. This process doesn't require administrator intervention.

    Log File

    指定新主机上mongod进程的日志文件的位置和名称。

6
7
8

否则,请单击 Cancel,您可以进行其他更改。

重要

To avoid disrupting majority writes, new members are now added to replica sets as priority=0, votes=0 until they reach secondary state, after which Cloud Manager automatically updates the configuration to match the priority and votes value specified in the deployment.

To reconfigure a member as an arbiter, see Replace a Member with an Arbiter

1
  1. 如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含所需项目的组织。

  2. 如果尚未显示,请从导航栏的Projects菜单中选择所需的项目。

  3. 在侧边栏中,单击 Database 标题下的 Processes。

The Processes page displays.

2
3
4

您可以修改以下设置:

Votes

指定副本集节点是否在选举中投票。 值为1表示该成员投票,而值为0表示该成员不投票。

Priority

指定副本集节点在选举期间的优先级。 无投票权成员的优先级必须为0 。

Delay

指定该成员是否为延迟副本集成员。

Build Indexes

指定副本集节点是否构建索引。

Tags

输入 JSON,定义要添加到副本集成员的标签集。

注意

After deploying the replica set, you can't modify a replica set member's hostname or port.

5
6
7

否则,请单击 Cancel,您可以进行其他更改。

您不能直接将节点重新配置为仲裁节点。 相反,您必须将一个新成员作为仲裁节点添加到副本集。 然后,您必须关闭现有的从节点。

1
  1. 如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含所需项目的组织。

  2. 如果尚未显示,请从导航栏的Projects菜单中选择所需的项目。

  3. 在侧边栏中,单击 Database 标题下的 Processes。

The Processes page displays.

2
3
4

添加副本集成员时,从Member列表中选择Arbiter 。

5
6
7

否则,请单击 Cancel,您可以进行其他更改。

8

注意

要确定哪些进程是从节点,请单击Metrics标签页并在Toggle Members中选择从节点。

  1. 单击副本集旁边的Modify 。

  2. 选择 Remove from Replica Set 。

  3. 单击 Save(连接)。

9
10

When you remove a member from a replica set, Cloud Manager converts the member's mongod to a standalone process and shuts it down.

删除节点时,必须在原始投票节点数量的基础上,保持大多数有投票权的节点处于活跃状态。 如果没有多数,副本集主节点将降级,副本集将变为只读。 有关投票的更多信息,请参阅 MongoDB 手册中的副本集选举和副本集高可用性。

删除成员可能会影响副本集确认写入的能力,具体取决于您使用的写关注级别。 有关更多信息,请参阅 MongoDB 手册中的写关注。

要删除成员:

1
  1. 如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含所需项目的组织。

  2. 如果尚未显示,请从导航栏的Projects菜单中选择所需的项目。

  3. 在侧边栏中,单击 Database 标题下的 Processes。

The Processes page displays.

2
3
4
5
6
7
8

要编辑集群配置,请执行以下操作:

1
  1. 如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含所需项目的组织。

  2. 如果尚未显示,请从导航栏的Projects菜单中选择所需的项目。

  3. 在侧边栏中,单击 Database 标题下的 Processes。

The Processes page displays.

2
3
4

在 Replica Set Configuration 部分中,填写以下字段。

Auth Schema Version

选择用于存储部署的用户数据的架构。

Feature Compatibility (可选)

Version

为您的副本集选择 MongoDB 版本。

Log File

Specify the location and name of the log file for the mongod process. The location must exist on the host.

5
6
7

否则,请单击 Cancel,您可以进行其他更改。

要编辑复制设置:

1
  1. 如果尚未显示,请从导航栏上的 Organizations 菜单中选择包含所需项目的组织。

  2. 如果尚未显示,请从导航栏的Projects菜单中选择所需的项目。

  3. 在侧边栏中,单击 Database 标题下的 Processes。

The Processes page displays.

2
3

如果没有看到副本集,请单击Processes标签页,然后单击Topology视图。

4

请参阅副本集配置字段以了解所有字段的说明以及哪些 MongoDB 版本支持每个字段。

5
6
7

否则,请单击 Cancel,您可以进行其他更改。

有关副本集配置选项的更多信息,请参阅 MongoDB 手册中的副本集配置。