翻译或纠错本页面

升级单机到 3.4

警告

3.4 与IBM Power 系统上 Ubuntu 16.04 的不兼容性

由于 lock elision bug in glibc ,如果你在IBM Power系统上运行 Ubuntu 16.04, 请不要在生产中使用MongoDB 3.4,直到修改后的 glibc 版本发布并且您已经安装了该版本。

重要

在您尝试任意升级之前,请熟悉本文档的内容。

如果你需要升级到 3.4 的指导, MongoDB offers major version upgrade services 可以在没有任何中断MongoDB应用的情况下,帮助您保证一个平稳的过渡。

升级建议及检查列表

在升级的时候,考虑下列内容:

升级版本路径

如果想将现有的MongoDB部署升级到 3.4 ,您必须运行在 3.2-series 版本上。

为了从早于 3.2-series 的版本中进行升级,您必须依次升级主要版本直到您升级到 3.2-series 。 例如,如果你正在运行一个 3.2-series ,在升级到 3.4-series 之前 ,您必须首先升级到 3.2

准备工作

在开始您的升级之前,查阅 MongoDB 3.4 中的兼容性变化 文档以保证您的应用和部署于 MongoDB 3.4 兼容。在开始升级之前,解决部署中的不兼容性。

在升级MongoDB之前,首先在测试环境中测试您的应用,再将升级部署到您的生产环境。

降级考量

一旦升级到 3.4,您不能降级到 3.2.7 或者是之前的版本。您只可以降级到 3.2.8 或之后的版本。

下列的步骤列举了将单机版 mongod 从 3.2 升级到 3.4 版本的流程。

下载 3.4 二进制文件

通过包管理工具

如果您从 MongoDB aptyumdnf , 或者 zypper 资源库安装的MongoDB,您应该使用包管理工具升级到 3.4 。

在您的Linux系统中遵循正确的 installation instructions 。包括了:增加新版本的资料库,然后执行真正的升级流程。

手动

如果您不是使用包管理工具安装MongoDB,您可以从 MongoDB Download Center <https://www.mongodb.com/download-center?jmp=docs>`_ 手动下载MongoDB二进制文件。

查阅 安装MongoDB 了解更多信息。

升级流程

1

Replace existing 3.2 binaries with the 3.4 binaries.

Shut down your mongod instance. Replace the existing binary with the 3.4 mongod binary and restart mongod.

2

Enable backwards-incompatible 3.4 features.

At this point, you can run the 3.4 binaries without the 3.4 features that are incompatible with 3.2.

To enable these 3.4 features, set the feature compatibility version to 3.4.

警告

Enabling these backwards-incompatible features can complicate the downgrade process. For details, see 删除 3.4 不兼容的功能.

It is recommended that after upgrading, you allow your deployment to run without enabling these features for a burn-in period to ensure the likelihood of downgrade is minimal. When you are confident that the likelihood of downgrade is minimal, enable these features.

Run the setFeatureCompatibilityVersion command against the admin database:

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

This command must perform writes to an internal system collection. If for any reason the command does not complete successfully, you can safely retry the command as the operation is idempotent.

其它升级流程