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

将副本集转换为分片集群

Cloud Manager provides the ability to convert a replica set to a sharded cluster.

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

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

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

The Processes page displays.

2
3

From the menu on the desired replica set, click Convert to Sharded Cluster.

4

在Provide details for your new sharded cluster模式中配置以下设置:

  1. Name your sharded cluster components:

    字段
    操作

    Cluster Name

    输入新集群的名称。

    CSRS Name

    输入CSRS的名称。

    注意

    单击Convert后无法更改这些值。

  2. Set the following values for each mongod process in your Config Servers. All fields are required.

    注意

    您必须部署至少一台配置服务器。

    字段
    操作

    Host Name

    从菜单中选择现有主机名,或在列表上方的搜索框中键入主机名以查找主机。

    如果需要添加新主机:

    1. 单击 New Server(管理员)链接。

    2. 单击 Next(连接)。

    3. 按照说明在该新主机上安装新的自动化。

    4. 单击 Verify Agent(连接)。

    Port

    输入IANA端口号。

    Data Directory

    Type the absolute directory path to the database files for each mongod.

    示例路径为/data 。

    The mongod must have exclusive use of these paths on the specified host. The Cloud Manager Automation must have file system permission to read, write, and execute all files and folders in this directory.

    Log File

    Type the absolute file path for the log file for each mongod.

    示例路径为/data/mongodb.log 。

    The mongod must have exclusive use of these paths on the specified host. The Cloud Manager Automation must have file system permission to read, write, and execute all files and folders in this directory.

    注意

    添加或删除配置服务器

    • 要添加新的配置服务器,请单击Add a Config Server 。

    • 要删除配置服务器,请单击位于要删除的配置服务器右侧。

  3. 为分片集群中的每个MongoS进程设置以下值。 所有字段均为必填字段。

    注意

    You must deploy at least one mongos.

    字段
    操作

    Host Name

    从菜单中选择现有主机名,或在列表上方的搜索框中键入主机名以查找主机。

    如果需要添加新主机:

    1. 单击 New Server(管理员)链接。

    2. 单击 Next(连接)。

    3. 按照说明在该新主机上安装新的自动化。

    4. 单击 Verify Agent(连接)。

    Port

    输入IANA端口号。

    Log File

    Type the abolute file path for the log of each mongos process.

    示例路径为/data/mongodb.log 。

    The mongos must have exclusive use of these paths on the specified host. The Cloud Manager Automation must have file system permission to read, write, and execute all files and folders in this directory.

    注意

    添加或删除 Mongo 分片路由器

    • To add a new mongos, click Add a MongoS.

    • To remove a mongos, click to the right of the mongos you want to remove.

5
6

From the Cloud Manager UI, click the icon, then click Connect to this instance. The Connect to your Deployment dialog provides the hostname and port of a mongos in the cluster.

有关连接到 Cloud Manager 部署的完整文档,请参阅连接到 MongoDB 进程

7

If you want to make any further changes to the sharded cluster, see the Sharded Cluster tab on the Edit a Deployment's Configuration page.

将副本集转换为分片集群后,您可以为数据库和collection启用分片。

To learn how to shard collections, see Shard a Collection.

如果您需要添加其他分片以支持更大的容量,请单击分片集群的扳手菜单以创建其他分片。

注意

转换后对备份的影响

转换后的分片(原始副本集)具有:

  • backupEnabled

  • 保留以前的快照

  • 只有能力将快照恢复到此分片

After converting, you should enable Backup for the entire sharded cluster. On databases running MongoDB FCV 4.0 or earlier, activating Backup causes Cloud Manager to start an initial sync on the config servers and the converted shard. Restores to the entire sharded cluster should use snapshots taken after conversion only.