Updating MongoDB¶
Manual Steps for Updating MongoDB 3.6.17 to 4.4.4¶
Due to incompatibility of the MongoDB service
versions 4.4.4 and 3.1.6 you have to export the stored data before the update and reimport them afterwards.
-
Open a Command Prompt
-
Save the stored data:
mongodump --ssl --sslAllowInvalidCertificates --out /tmp/mongodump
-
Stop MongoDB
sudo systemctl stop mongod
-
Change to the directory:
/opt/seal/data/seal-mongodb
-
Remove all subdirectories and files in the
/opt/seal/data/seal-mongodb
directory, except of the base directory itself. -
Restore the data:
mongorestore --ssl --sslInsecure --drop /tmp/mongodump
-
Restart MongoDB
sudo systemctl restart mongod
Upgrading a Replica Set¶
When using MongoDB in a cluster, you have to update a complete replica set of MongoDB.
Hint - Details in the original documentation
The following description is a only short outline of the necessary steps which have all to be done manually.
For details on the upgrading, refer to the original MongoDB documentation.
-
Upgrade the secondary members of the replica set one at a time:
-
Shut down the
mongod
instance. -
Replace the old binary with the new binary.
-
Restart the member.
-
-
Step down the primary server:
-
Connet a mongo shell to the primary server and execute the following command:
rs.stepDown()
-
Select a new primary server.
-
-
Upgrade the former primary server of the replica set:
-
Shut down the stepped-down primary server.
-
Replace the old
mongod
binary with the new binary. -
Restart the member.
-
-
Enable backwards-incompatible 3.6 features:
-
Connet a mongo shell to the primary server and execute the following command in the admin database:
db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )
-