Database Manual / Self-Managed Deployments / Installation / Upgrade Community to Enterprise

Upgrade to MongoDB Enterprise (Sharded Cluster)升级到MongoDB企业版(分片集群)

Warning

MongoDB 8.3 Not Yet Available

MongoDB 8.3 release candidates are not yet available. This version of the manual is for an upcoming release and is currently a work in progress.MongoDB 8.3候选版本尚未发布。此版本的手册适用于即将发布的版本,目前正在进行中。

Important

MongoDB 8.3 is the latest minor release. Starting with MongoDB 8.2, minor releases are available for on-premises deployments (Community and EA) for specific use cases. For more information, see MongoDB Versioning.MongoDB 8.3是最新的次要版本。从MongoDB 8.2开始,次要版本可用于特定用例的本地部署(社区和EA)。有关更多信息,请参阅MongoDB版本控制

To install the latest MongoDB version supported for on-premises use, see the installation instructions.要安装支持本地使用的最新MongoDB版本,请参阅安装说明

MongoDB Enterprise provides various features not available in the MongoDB Community edition, such as:MongoDB Enterprise提供了MongoDB社区版中没有的各种功能,例如:

The following steps outline the procedure to upgrade a sharded cluster from the MongoDB Community Edition to the MongoDB Enterprise Edition. For example, the steps can be used to upgrade MongoDB 7.0 Community to MongoDB 7.0 Enterprise.以下步骤概述了将分片集群从MongoDB社区版升级到MongoDB企业版的过程。例如,这些步骤可用于将MongoDB 7.0社区升级到MongoDB 7.0企业版。

Consideration考虑

Warning

Do not use these instructions to upgrade to another release version. To upgrade release versions, refer to the appropriate release upgrade instructions, such as Upgrade to MongoDB 8.0.不要使用这些说明升级到其他版本。要升级发布版本,请参阅相应的发布升级说明,例如升级到MongoDB 8.0

Download Enterprise Binaries下载企业二进制文件

Depending on your operating system, you can install the MongoDB Enterprise binaries by using a package manager or by downloading the binaries manually.根据操作系统,您可以使用包管理器或手动下载二进制文件来安装MongoDB Enterprise二进制文件。

Linux(Package Manager)

If you have installed MongoDB Community using a package manager, follow the package manager instructions for your operating system:如果您使用包管理器安装了MongoDB Community,请按照操作系统的包管理器说明进行操作:

During the installation, the package manager will remove the community packages; this will not affect the running deployment until you restart.在安装过程中,包管理器将删除社区包;在您重新启动之前,这不会影响正在运行的部署。

Linux(Manual Download)

If you have not installed MongoDB using a package manager, you can manually download the MongoDB binaries from the MongoDB Download Center. 如果你没有使用包管理器安装MongoDB,你可以从MongoDB下载中心手动下载MongoDB二进制文件。Follow the manual instructions, including specific prerequisites for MongoDB Enterprise, for your operating system:遵循适用于操作系统的手册说明,包括MongoDB Enterprise的特定先决条件:

Important

Install to a location different from that of your current Community edition.安装到与当前社区版本不同的位置。

In the upgrade procedure, you will use the existing data directory and, if applicable, the existing configuration file.在升级过程中,您将使用现有的数据目录,并在适用的情况下使用现有的配置文件。

Windows

Important

You cannot use the .msi to install the Enterprise edition if you have the Community edition of the same release series installed on the same machine. That is, if you have version 4.4.0 Community edition installed, you cannot use the .msi to install the 4.4.0 or 4.4.1 Enterprise edition.如果在同一台计算机上安装了相同版本系列的社区版,则无法使用.msi安装企业版。也就是说,如果您安装了4.4.0社区版,则无法使用msi安装4.4.0或4.4.1企业版。

  1. Manually download the archive file from the MongoDB Download Center.MongoDB下载中心手动下载存档文件。
  2. To install, extract/unzip the file to a location different from that of your current Community edition.要安装,请将文件解压缩到与当前社区版本不同的位置。

    In the upgrade procedure, you will use the existing data directory and, if applicable, the existing configuration file.在升级过程中,您将使用现有的数据目录,并在适用的情况下使用现有的配置文件。

MacOS

Install the binaries:安装二进制文件:

  1. Manually download the archive file from the MongoDB Download Center.MongoDB下载中心手动下载存档文件。
  2. Extract the files to a location different from that of your current Community edition. For details on extracting the files, see macOS.将文件解压缩到与当前社区版本不同的位置。有关提取文件的详细信息,请参阅macOS

    In the upgrade procedure, you will use the existing data directory and, if applicable, the existing configuration file.在升级过程中,您将使用现有的数据目录,并在适用的情况下使用现有的配置文件。

Procedure过程

To minimize downtime, you can upgrade from MongoDB Community to Enterprise Edition using a "rolling" upgrade by upgrading the members individually while the other members are available.为了尽量减少停机时间,您可以使用“滚动”升级从MongoDB社区升级到企业版,方法是在其他成员可用的情况下单独升级成员。

1

Disable the Balancer.禁用平衡器。

Connect mongosh to a mongos instance in the sharded cluster, and run sh.stopBalancer() to disable the balancer:mongosh连接到分片集群中的mongos实例,并运行sh.stopBalancer()以禁用平衡器:

sh.stopBalancer()

Note

If a migration is in progress, the system will complete the in-progress migration before stopping the balancer. You can run sh.isBalancerRunning() to check the balancer's current state.如果正在进行迁移,系统将在停止平衡器之前完成正在进行的迁移。您可以运行sh.isBalancerRunning()来检查平衡器的当前状态。

To verify that the balancer is disabled, run sh.getBalancerState(), which returns false if the balancer is disabled:要验证平衡器是否已禁用,请运行sh.getBalancerState(),如果平衡器已禁用,则返回false

sh.getBalancerState()

Starting in MongoDB 6.0.3, automatic chunk splitting is not performed. This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation.从MongoDB 6.0.3开始,不执行自动块分割。这是因为平衡了政策的改进。自动拆分命令仍然存在,但不执行操作。

In MongoDB versions earlier than 6.0.3, sh.stopBalancer() also disables auto-splitting for the sharded cluster.在早于6.0.3的MongoDB版本中,sh.stopBalancer()还禁用了分片集群的自动拆分。

For more information on disabling the balancer, see Disable the Balancer.有关禁用平衡器的更多信息,请参阅禁用平衡器

2

Upgrade the config servers.升级配置服务器。

  1. Upgrade the secondary members of the replica set one at a time:一次升级一个副本集的secondary成员:

    1. Shut down the secondary mongod instance.关闭辅助mongod实例。
    2. Restart the member with the Enterprise mongod, specifying the same configuration options (e.g. same data directory, configuration file, etc.).使用Enterprise mongod重新启动成员,指定相同的配置选项(例如,相同的数据目录、配置文件等)。
    3. Wait for the member to recover to SECONDARY state before upgrading the next secondary member. 在升级下一个辅助成员之前,请等待成员恢复到SECONDARY状态。To check the member's state, issue rs.status() in mongosh.要检查成员的状态,请用mongosh发出rs.status()

    Repeat for each remaining secondary member.对剩余的每个次要成员重复此操作。

  2. Step down the replica set primary.逐步关闭主副本集。

    Connect mongosh to the primary and use rs.stepDown() to step down the primary and force an election of a new primary:mongosh连接到初选,并使用rs.stepDown()退出初选并强制选举新的初选:

    rs.stepDown()
  3. When rs.status() shows that the primary has stepped down and another member is primary, upgrade the stepped-down primary:rs.status()显示主成员已降级,另一个成员为主成员时,升级降级的主成员:

    1. Shut down the stepped-down primary.关闭已降级的primary。
    2. Restart with the Enterprise mongod, specifying the same configuration options (e.g. same data directory, configuration file, etc.).使用Enterprise mongod重新启动,指定相同的配置选项(例如,相同的数据目录、配置文件等)。
3

Upgrade the shards.升级分片。

Upgrade the shards one at a time.一次升级一个分片。

For each shard replica set:对于每个分片副本集:

  1. Upgrade the secondary members of the replica set one at a time:一次升级一个副本集的辅助成员:

    1. Shut down the secondary mongod instance.关闭辅助mongod实例。
    2. Restart the member with the Enterprise mongod, specifying the same configuration options (e.g. same data directory, configuration file, etc.).使用Enterprise mongod重新启动成员,指定相同的配置选项(例如,相同的数据目录、配置文件等)。
    3. Wait for the member to recover to SECONDARY state before upgrading the next secondary member. To check the member's state, issue rs.status() in mongosh.在升级下一个辅助成员之前,请等待成员恢复到SECONDARY状态。要检查成员的状态,请用mongosh发出rs.status()

    Repeat for each remaining secondary member.对剩余的每个次要成员重复此操作。

  2. Step down the replica set primary.逐步关闭主副本集。

    Connect mongosh to the primary and use rs.stepDown() to step down the primary and force an election of a new primary:mongosh连接到初选,并使用rs.stepDown()退出初选并强制选举新的初选:

    rs.stepDown()
  3. When rs.status() shows that the primary has stepped down and another member is primary, upgrade the stepped-down primary:rs.status()显示主成员已降级,另一个成员为主成员时,升级降级的主成员:

    1. Shut down the stepped-down primary.关闭已降级的primary。
    2. Restart with the Enterprise mongod, specifying the same configuration options (e.g. same data directory, configuration file, etc.).使用Enterprise mongod重新启动,指定相同的配置选项(例如,相同的数据目录、配置文件等)。
4

Upgrade the mongos instances.升级mongos实例。

For each mongos instance, shutdown mongos and restart with the Enterprise mongos, specifying the same configuration options.对于每个mongos实例,关闭mongos并使用Enterprise mongos重新启动,指定相同的配置选项。

5

Re-enable the balancer.重新启用平衡器。

Using mongosh, connect to a mongos in the cluster and run sh.startBalancer() to re-enable the balancer:使用mongosh,连接到集群中的mongos并运行sh.startBalancer()以重新启用平衡器:

sh.startBalancer()

Starting in MongoDB 6.0.3, automatic chunk splitting is not performed. This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation.从MongoDB 6.0.3开始,不执行自动块分割。这是因为平衡了政策的改进。自动拆分命令仍然存在,但不执行操作。

In MongoDB versions earlier than 6.0.3, sh.startBalancer() also enables auto-splitting for the sharded cluster.在早于6.0.3的MongoDB版本中,sh.startBalancer()还启用了分片集群的自动拆分。

For more inforamtion on the balancer, see Enable the Balancer.有关平衡器的更多信息,请参阅启用平衡器

Important

Before using any Enterprise features, ensure that all members have been upgraded to Enterprise edition.在使用任何企业版功能之前,请确保所有成员都已升级到企业版。