I’m trying to find best solution for migration all MongoDB cluster from 3.4 to latest. the old system is running on MongoDB 3.4 on Centos7.
In mongo official page(Release Notes for MongoDB 8.0 - Database Manual - MongoDB Docs) 4 and 5 versions are not available.
How to upgrade the mongodb from version 3.4 to latest?
And i am maintaining primary and 2 secondaries.
These versions should be available. In the MongoDB Download page go to “More Options … → Archived Releases”
There you can download MongoDB down to version 2.6
Generally yes it is major version to major version. But there are many changes over all these versions. If you download the legacy docs for v4.2 that will include the release notes, compatibility changes and upgrade instructions for all the versions until 4.2, follow the online manual after that.
All the versions to upgrade through looks like:
3.4 → 3.6 → 4.0 → 4.2 → 4.4 → 5.0 → 6.0 → 7.0 → 8.0
An OS upgrade will have to take place to get to MongoDB version 8.0 as RHEL/Centos 7 is not supported for that version.
Since MongoDB 3.4 is quite old (released in 2016), a direct upgrade to the latest version (8.0) requires a phased approach. Below is the detailed upgrade path and steps:
Upgrade Path
The officially recommended MongoDB upgrade sequence is:
Confirm all applications are functioning correctly
Validate index and query performance
Check replica set status (if applicable)
Test sharded cluster functionality (if used)
Important Considerations
Downtime: Plan sufficient maintenance windows
Rollback Plan: Prepare a strategy to revert to the old version if needed
Driver Compatibility: Ensure application MongoDB drivers support the new version
CentOS 7 Limitations: Newer MongoDB versions may require updated system libraries; consider upgrading to CentOS 8 or migrating to another supported platform
For more detailed version-specific upgrade instructions, refer to the “Upgrade” section in the official MongoDB documentation for each release.
If MongoDB 8.0 is not supported on Centos7, then I would suggest upgrade to MongoDB version 7.0 which is fully supported and way better than version 3.4.
Later, when you upgraded your Linux (Centos 7 is also out of support), then you can go for MongoDB 8.0