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

将副本集转换为分片集群

MongoDB Ops Manager能力将副本集转换为分分片集群的功能。

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

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

  3. 如果尚未出现,请单击侧边栏中的 Deployment(部署)。

  1. 单击 Clusters(集群)视图。
2

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

3

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

  1. 分片集群组件命名为:

    字段
    操作

    Cluster Name

    输入新集群的名称。

    CSRS Name (MongoDB 3.2 或更高版本)

    输入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 Ops 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 Ops 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 Ops 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.

4
5

From the Ops 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.

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

6

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启用分片。

要了解如何对集合进行分片,请参阅对集合进行分片。

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

注意

转换后对备份的影响

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

  • backupEnabled

  • 保留以前的快照

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

转换后,应为整个分片集群启用备份

如果为副本集启用了备份区域化部署区域,则必须为新配置服务器选择部署地区。在您选择地区之前,分片集群处于 Misconfigured 状态。要学习;了解更多信息,请参阅为分片分配部署地区。