I am trying to upgrade mongodb from 4.4 > 5.0
I have a 2 separate replica set (replicaset1, replicaset2) which hosts different platform on our site.
replicaset1 setup: (mongodb version 4.4)
rs1VM1 (10.1.0.1:27017) - PRIMARY
rs1VM2 (10.1.0.2:27017) - SECONDARY
rs2VM1 (10.1.0.10:27018) - ARBITER
replicaset2 setup: (mongodb version 4.4)
rs2VM1 (10.1.0.10:27017) - PRIMARY
rs2VM2 (10.1.0.11:27017) - SECONDARY
rs1VM1 (10.1.0.1:27018) - ARBITER
We happened to put the arbiter for each replicaset on the other platform to provide at least a little bit of HA on our setup.
Now I want to upgrade only the replicaset1 from 4.4 > 5.0
My proposed approach would be:
- Create a arbiter on rs1VM1 (10.1.0.1:27017) that would be 10.1.0.1:27018 - ARBITER
- Delete the old arbiter rs2VM1 (10.1.0.10:27018) on the replicaset1
- Shutdown the secondary then upgrade the binary files. Restart mongod on secondary
After this the setup would be
replicaset1 setup: (mongodb version 4.4)
rs1VM1 (10.1.0.1:27017) - PRIMARY (mongod 4.4)
rs1VM2 (10.1.0.2:27017) - SECONDARY (mongod 5.0)
rs1VM3 (10.1.0.1:27018) - ARBITER (mongod 4.4)
- Once secondary is already good. I would create another arbiter which will be located on rs1VM2 (10.1.0.2:27018) After this the setup would be
replicaset1 setup:
rs1VM1 (10.1.0.1:27017) - PRIMARY (mongod 4.4)
rs1VM2 (10.1.0.2:27017) - SECONDARY (mongod 5.0)
rs1VM2 (10.1.0.2:27018) - ARBITER (mongod 5.0)
- Now I can now upgrade the PRIMARY. Perform rs.stepDown() then db.shutdownServer(), then upgrade the binary files to 5.0 then restart mongodb service
replicaset1 setup:
rs1VM1 (10.1.0.1:27017) - PRIMARY (mongod 5.0)
rs1VM2 (10.1.0.2:27017) - SECONDARY (mongod 5.0)
rs1VM2 (10.1.0.2:27018) - ARBITER (mongod 5.0)
is this feasible or there are much more easier approach to this
/usr/bin/mongod
). Download the binary package tgz. It's really just a single binarymongod
, copy it to your machine, then you can use it. Of course, you must edit your .service files accordingly. See manpages.ubuntu.com/manpages/xenial/man5/systemd.service.5.html