Docs 菜单

Downgrade 6.0 Standalone to 5.0

尝试降级之前,请先熟悉本页面的内容。

如果需要从 6.0 降级,请降级到最新的 5.0 补丁版本。

MongoDB 仅支持单版本降级。您无法降级到比当前版本落后多个版本的版本。

例如,您可以将 6.0 系列部署降级为 5.0 系列部署。但是,不支持将 5.0 系列部署进一步降级为 4.4 系列部署。

If your deployment has access control enabled, your downgrade user privileges must include privileges to list and manage indexes across databases. A user with root role has the required privileges.

在开始降级程序之前,必须完成以下先决条件步骤。

可选但建议使用。创建数据库备份。

要学习;了解如何创建备份,请参阅自托管部署的备份方法。

如需从 6.0 降级到 5.0,必须删除与 5.0 不兼容的 6.0 功能。有关不兼容功能的列表以及如何删除这些功能,请参阅“降级注意事项”。

To downgrade the featureCompatibilityVersion of your standalone instance:

  1. 使用 mongosh to connect to the mongod instance.

  2. featureCompatibilityVersion 降级为 "5.0"

    db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } )

    setFeatureCompatibilityVersion 命令对内部系统集合执行写入操作,并且是幂等的。如果命令未成功完成,请在 mongod 实例上重试命令。

警告

Before proceeding with the downgrade procedure, ensure that the prerequisites have been completed.

1

Using either a package manager or a manual download, get the latest patch release in the 5.0 series. If using a package manager, add a new repository for the 5.0 binaries, then perform the actual downgrade process.

2

确保 5.0 二进制文件位于系统路径中。要确认二进制版本,请运行以下命令:

mongod --version

命令输出应会显示 5.0 系列版本。

3

To shut down the mongod process, use mongosh to connect to the deployment and run the following command:

db.adminCommand( { shutdown: 1 } )
4

Disable any configurable 6.0 features by updating the mongod instance's configuration file before restarting.

To see the list of configurable 6.0 features, review the 6.0 Release Notes.

5

要启动 mongod 进程,请运行以下命令:

mongod --dbpath </path-to-data-folder>

如需了解有关启动 mongod 进程的更多信息,请参阅“启动 mongod 进程”。