Upgrade mongoDB 3.0 Shard Servers to 3.2

Share us

Fellas, This article is for those, who wants to upgrade their mongoDB servers 3.0 to 3.2.

Note:- Before upgrading make sure you have taken backup of your database as well as config db. First test in Dev server then move to QA and Production.

You can follow the below steps-
1.Disable the Balancer

$ mongo --port 27020  --host mongos_host

mongos> sh.getBalancerState()
mongos> sh.isBalancerRunning()
mongos> sh.stopBalancer()
Waiting for active hosts...
Waiting for the balancer lock...
Waiting again for active hosts after balancer is off...
mongos> sh.getBalancerState()

2. Download the binaries for the latest MongoDB version-
Visit MongoDB Download Page and store the binaries in a temporary location. The binaries downloaded as compressed files, un-compress it to the directory structure used by the MongoDB installation.

Do this for Secondary Instance & then Primary then config DB in reverse order given to mongos config & then in MongoS.
3. Shutdown the secondary instance.
4. Replace the existing MongoDB binaries with the downloaded binaries.
5. Restart the secondary instance and check is there any lag.

mongo> use admin
	mongo> db.shutdownServer();
        mongo> exit; 
        $ mongod -f /etc/mongod1.conf
	mongo> rs.printSlaveReplicationInfo();

If no lag, then stepDown the primary, else wait for the secondary to sync with primary.
6. Restart the primary by stepping down.

 mongo> rs.stepDown();
	mongo> db.shutdownServer()
        mongo> exit;
$ mongod -f /etc/mongod2.conf

7. Restart mongoDB config instance

$ mongo --port 27020 --host configdb_host_name

configsvr> use admin
configsvr> db.shutdownServer();
configsvr> exit

$ mongod -f /etc/mongodbconfigsvr.conf

8. Restart mongos Instance

$ mongo --port --host mongos_host_name

mongos> use admin
mongos> db.shutdownServer();
mongos> exit;

$ mongos -f /etc/mongod_s.conf

Conclusion:- Your mongo Shard has been upgraded, you can verify the same by executing-

 mongo> db.serverStatus().version 

in mongo shell.

2 Commentsto Upgrade mongoDB 3.0 Shard Servers to 3.2

  1. Rajesh says:

    Explaining step by step Mon to e.g. upgrade is of great help.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.