MongoDB 4.0 to 5.0 Migration

I have to migrate a MongoDB database in a 3-node replicaset in version 4.0 from one infra to another infra with MongoDB but version 5.0, the problem is that the database cannot be stopped during the corresponding time to perform the mongodump and the corresponding mongorestore, what would be the options to carry out the migration with the shortest service downtime? Is there any possibility of setting up a replica from a version 4.0 node to a version 5.0 node?

I thank you in advance for any comment on this.

Welcome to the MongoDB community @Gerardo_Capelli!

If you want to perform an in-replace migration from 4.0 to 5.0 without downtime you will need to upgrade through each successive major release following the documented procedures for your deployment type:

Replication between adjacent major releases (4.0 => 4.2, 4.2 => 4.4, 4.4 => 5.0) is possible during a rolling upgrade, but you cannot mix 4.0 and 5.0 in the same replica set as there are multiple intervening release series.

Upgrades and other maintenance processes can be automated using tooling like MongoDB Ops Manager or MongoDB Cloud Manager, but those are commercial solutions outside of evaluation or trial periods.

Regards,
Stennie

2 Likes

Hello Stennie, thanks for the quick answer, in that way, if i can to add a member in 4.2 to a replicaset in 4.0 , after de syncronization, could i start a new replicaset from the member in 4.2, somehow?

Regards Gerardo.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.