Shuo I'm a DBA(Database Administrator), we can share and discuss MySQL, MongoDB, Redis and other databases here, also including learning Python, Shell, Golang together.


7 Checks to Successfully Upgrade MongoDB Replica Set in Production


1. 数据兼容性

在release changes里面进行查看,是否有configurations, metadata, protocol version, validations, indexes or options等的一些变化

2. 驱动兼容性

可以在网站上进行对比: The driver compatibility matrix lists the versions of MongoDB and language-specific versions that are compatible with those versions.

3. 更新的顺序


  • Upgrade your current MongoDB version to the latest revision of current release series
  • Go to check 1 and plan your upgrade

4. 设置兼容配置

Feature Compatibility Flags, 可以setFeatureCompatibilityVersion allows you to set the features those are incompatible with the previous versions ON or OFF.

5. 在测试环境先进行演练

Now that you’re prepared, you can upgrade the MongoDB replica set in rolling fashion. This upgrade will involve the DB upgrade, driver upgrades and application code that is compatible with this driver version and DB version. To minimize the impact, upgrade secondaries in a replica set first, followed by stepping down a primary and its upgrade.

Test your downgrade path:Prepare for downgrading in the test environment. A MongoDB replica set must follow the downgrade path from the path to be upgraded to, to the latest revision of the currently used release series.

为使影响最小,先升级从节点secondaries ,再升级主节点primary。


6. 预发布 Allow a Burn-in Period


7. Upgrade MongoDB Tools

  • Upgrade the mongo shell to the same version as the MongoDB deployment
  • Upgrade mongodump and mongorestore versions used in your backup and restore scripts.
  • Use the same version of mongodump/mongorestore to backup/restore deployment of the same version on MongoDB.

使用相同版本的mongo shell,升级mongodump和mongorestore 工具。

comments powered by Disqus