Suppose you have a replica set running MongoDB v4.2.9, and you want to upgrade to MongoDB v4.4.1. The steps for upgrading a 3 node replica set are as follows:
- Upgrade one of the secondaries: kill the v4.2.9 `mongod` process, and run the v4.4.1 `mongod` process. Make sure you set the same dbpath.
- Wait for the new v4.4.1 process’ replication to catch up
- Upgrade the other secondary and wait for replication to catch up.
- Connect to the MongoDB cluster and run `rs.stepDown()` to force an election and make the current primary into a secondary.
- Upgrade the former primary
MongoDB Atlas can handle this upgrade process automatically for you. But the process is pretty easy even if you do it manually, it usually only takes 5-10 minutes.
Since this process only takes down `mongod` processes that are secondaries in the replica set, your app won’t drop any requests while you’re upgrading the individual processes.