Important Note :
- Following features are deprecated in 3.6 ‘rest = true’ and ‘httpinterface = true’ these options need to be commented in mongod.conf .
- Before we start upgrading to 3.6, we need to check for feature compatibility version on primary node :
1 |
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) – shall return 3.4 |
If above command doesn’t return value as 3.4 then we need to go ahead and set setFeatureCompatibilityVersion to 3.4 on Primary as below:
1 |
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ) |
3. “db.upgradeCheckAllDBs()” feature is deprecated in 3.6 as the upgrade check is taken care within the binary itself and no action is required.
Step by Steps execution:
- Disable if any monitoring tool enable to avoid unnecessary alerts while performing upgrade process.
- Check/Set for Feature Compatibility Version to 3.4:
db.adminCommand( { setFeatureCompatibilityVersion: “3.4” } )- Stop and Start DB services on port 27018. In case of replica set disable replSet option along with changing port
-
1sudo /etc/init.d/mongod stop12345678910111213sudo vi /etc/mongod.conf---Change port to 27018#replSet = XYZ#rest = true - Remove this line#httpinterface = true - Remove this line---1sudo /etc/init.d/mongod start
Take DB backup
12345cd /mongo/log/backups/Upgrade/Upgradetime mongodump --port 27018 --authenticationDatabase admin -u admin -p ****** --db DB_NAME -o PATHsudo /etc/init.d/mongod stop - Upgrade mongo binaries.
12345 # yum upgrade mongodb-org-server# yum upgrade mongodb-org-shell#yum upgrade mongodb-org-tools
5.Start DB services and confirm the upgraded version:
123 sudo /etc/init.d/mongod startmongo --port 27018 admin -u admin -p
Confirm, if mongo is upgraded to 3.6.2
Note: Once, step 4 is completed “db.version()” shall reflect to 3.6.2 as the upgrade check is executed within step 4 while upgrading binaries.
6. Start DB services on initial mongodb configuration. For replicaSet server will come back in replicaSet and will start replicating from Primary
1234567891011121314151617 sudo /etc/init.d/mongod stopsudo vi /etc/mongod.conf---Change port to 27017replSet = XYZbind_ip_all = true – For 'PLAIN TEXT' FormatbindIpAll: true – For 'YAML' format---sudo /etc/init.d/mongod start
7. While upgrade on replicaSet, it will be performed node by node and all above steps will be performed on each DB node in replicaSet starting with Secondary server
8.When doing the upgrade on Primary, step this down to become Secondary and choose Primary from already upgraded Secondary server
123 mongo admin -u admin -pPRIMARY>rs.stepDown()
Note :
In version 3.6, the default binding is to localhost. In this state, the node cannot communicate with the rest of the replica set nodes.
To fix this need to specify the IP address on the node explicitly using the net.bindIp option in the configuration file or alternatively
enable bind_ip_all= true