Skip to content

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.

  1. Open a Command Prompt

  2. Save the stored data:

    mongodump --ssl --sslAllowInvalidCertificates --out /tmp/mongodump
    
  3. Stop MongoDB

    sudo systemctl stop mongod
    
  4. Change to the directory:

    /opt/seal/data/seal-mongodb
    
  5. Remove all subdirectories and files in the /opt/seal/data/seal-mongodb directory, except of the base directory itself.

  6. Install MongoDB.

  7. Restore the data:

    mongorestore --ssl --sslInsecure --drop /tmp/mongodump
    
  8. 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.

  1. Upgrade the secondary members of the replica set one at a time:

    1. Shut down the mongod instance.

    2. Replace the old binary with the new binary.

    3. Restart the member.

  2. Step down the primary server:

    1. Connet a mongo shell to the primary server and execute the following command:

      rs.stepDown()
      
    2. Select a new primary server.

  3. 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.

  4. Enable backwards-incompatible 3.6 features:

    1. Connet a mongo shell to the primary server and execute the following command in the admin database:

      db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )
      

Back to top