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

将副本集成员迁移到新服务器

您可以通过 Cloud Manager 控制台将托管副本集的一个成员替换为另一个成员。 使用此进程可将副本集的成员迁移到新的底层服务器。 此过程要求您:

  1. 预配新服务器。

  2. 向副本集添加一个额外成员。

  3. 关闭副本集的旧成员。

  4. 取消托管旧成员(可选)。

添加新的副本集成员时,该成员必须执行初始同步,这需要时间才能完成,具体取决于数据集的大小。 有关初始同步的更多信息,请参阅副本集数据同步。

您可以一次删除或迁移多个副本集成员,但必须保留大多数投票成员。 如果需要删除更多投票成员,请一次删除一个。

例子

示例 1

您有一个四节点副本集。 所有节点都是有投票权的成员。 您只能删除一个节点,这会保留四个投票节点中三个的多数。 您可以稍后从剩余的三节点副本集中删除另一个节点。这会保留大多数剩余投票节点。

例子

示例 2

您有一个四节点副本集。 三个节点为有投票权成员,一个节点为无投票权成员。 您可以同时删除一名有投票权成员和一名无投票权成员。 这保留了三个投票节点中两个的多数。

要了解有关投票的更多信息,请参阅副本集高可用性和副本集选举。

Removing members during migration might affect the ability of the replica set to acknowledge writes, depending on the level of write concern you use. For more information, see Write Concern in the MongoDB manual.

对要迁移的副本集的每个成员单独执行此过程。

1

请参阅预配服务器。

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

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

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

The Processes page displays.

3
4

In the Member Configuration section, click Add a Mongod to add a new mongod member.

Cloud Manager displays the following configuration settings for the mongod:

设置
说明

Member

从菜单中选择以下副本集节点角色之一:

  • Default

    A data-bearing member of the replica set that can become the primary and vote in elections.

  • 投票节点

    A non-data bearing member of the replica set that can vote in elections. Corresponds to the arbiterOnly replica configuration option.

  • Hidden

    A data-bearing member of the replica set that can vote in elections. Corresponds to the hidden replica configuration option.

  • 延迟隐藏

    A data-bearing member of the replica set that can vote in elections. Corresponds to the secondaryDelaySecs and hidden replica configuration options.

Hostname

从菜单中选择 Cloud Manager Automation 将副本集节点部署到的主机。该菜单仅列出 Cloud Manager Automation 下的主机。有关向 Cloud Manager Automation 添加服务器的完整文档,请参阅预配服务器以实现自动化。

此主机名可以是主机名、FQDN、IPv4 地址或 IPv6 地址。

Port

Specify the IANA port number for the mongod process. This setting corresponds to the net.port configuration file option. Defaults to 27017.

The mongod must have exclusive access to the specified port. If deploying multiple mongod processes to a single host, you must select a unique unused port for each process.

Votes

Specify the number of votes that the replica set member has during elections. This setting corresponds to the votes mongod replica set configuration option.

Priority

Specify the priority of the member during elections. Replica set members with a priority of 0 cannot become the primary and cannot trigger elections. This setting corresponds to the priority mongod replica set configuration option.

Delay

Specify the number of seconds "behind" the primary member this member should "lag". This setting corresponds to the secondaryDelaySecs mongod replica set configuration option.

Build Indexes

Specify true to direct the mongod to build Indexes. This setting corresponds to the buildIndexes mongod replica set configuration option.

Tags

Specify the tag or tags associated to the replica set. This setting corresponds to the tags mongod replica set configuration option.

有关副本集标签的完整文档,请参阅副本集标签

确保选择与新配置的服务器相对应的Hostname 。

5

在Replica Set Configuration部分中,查看Replica Set Settings标题下的表。 Process Name列列出了每个副本集节点的主机名和端口。 Cloud Manager 最初会将进程分组在副本集名称下。 单击设置名称左侧的 图标列出与该副本集关联的所有节点。

为与新添加的成员对应的Process Name配置以下设置:

设置
说明

Version

Select the MongoDB server version of the mongod process.

  • Version

  • Select the MongoDB server version of the mongod process.

Data Directory

Specify the directory where the mongod process stores data files. This setting corresponds to the storage.dbPath mongod configuration file option. The Cloud Manager Automation must have file system permission to read, write, and execute all files and folders in the specified directory.

Each mongod process must have its own database directory. If deploying multiple mongod processes on the same host, ensure each process has its own distinct directory.

Log File

Specify the full path to the mongod log file, including the log file name and extension. This setting corresponds to the systemLog.path configuration file option. The mongod must have permission to read and write to the specified file.

For example, specifying /var/log/mongodb/mongo.log directs the mongod to store its logfile in /var/log/mongodb/ as mongo.log.

The mongod must have its own unique log file. If deploying multiple mongod processes to the same host, ensure each mongod has its own distinct logfile.

6
7
8

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

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

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

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

The Processes page displays.

10

Click the name of the replica set to open the cluster view. Verify that the status for each new member is no longer in the Recovering state.

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

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

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

The Processes page displays.

12
  1. 单击 Modify(连接)。

  2. 导航至 Member Configuration 部分。

  3. 单击要删除的成员的省略号按钮。

  4. 从菜单中选择Remove from Replica Set 。

重要

删除副本集主节点 (primary node in the replica set)节点成员会触发选举。 在选举完成之前,副本集无法进程写入操作。 有关副本集选举的完整文档,请参阅副本集选举。

  1. 单击 Save(连接)。

#.单击Review Changes ,然后单击Confirm & Deploy 。 Cloud Manager将已删除的副本集节点转换为Deployment视图中可见的独立运行集群。

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

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

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

The Processes page displays.

14

单击独立运行的省略号图标并选择Shutdown 。 单击Review Changes ,然后单击Confirm & Deploy 。

15

要从 Cloud Manager 经理中删除成员,请单击...省略号图标并选择Remove from Cloud Manager 。

Cloud Manager 不会自动关闭从管理中删除的进程。如果在上一步中没有关闭进程,则必须通过直接连接到主机来手动关闭。

有关从 Cloud Manager 经理中删除进程的完整文档,请参阅停止管理和/或监控一个部署。

给本页内容打分