Skip to content

Updating MongoDB


Updating MongoDB 3.6 to 4.4

Due to incompatibility of the MongoDB service versions 3.6 and 4.4 you have to export the stored data before updating and reimport them afterwards.

Hint - single system and cluster

The following instructions include the update of both, single system and cluster.

In a single system, perform all instructions, except of those concerning the replica set.

In a cluster, perfom the instructions as stated in the subchapters.


Saving the Database Content

Hint - cluster

In a cluster, you have to perform the following instructions on the replica set primary only.

  1. Open a PowerShell (Administrator).

  2. Create a subdirectory for the dump in the %TEMP% directory if it does not exist yet:

    cd $env:TEMP
    mkdir mongodump
    
  3. Start MongoDB, if necessary:

    Start-Service -name seal-mongodb
    
  4. Save the stored data:

    & "C:\Program Files\MongoDB\Server\3.6\bin\mongodump.exe" --ssl --sslAllowInvalidCertificates --out "$env:TEMP\mongodump"
    

Updating the Database

Hint - cluster

In a cluster, you have to perform the following instructions except of the initializing of the database on every member of the replica set.

Caution - update member of the replica set

Make sure that all cluster members are upgraded and reconfigured before you restore the database.

  1. Stop MongoDB:

    Stop-Service -name seal-mongodb -Force
    
  2. Remove all subdirectories and files in the C:\ProgramData\SEAL Systems\data\seal-mongodb directory, except of the base directory itself:

    Remove-Item "C:\ProgramData\SEAL Systems\data\seal-mongodb\*" -Force -Recurse
    
  3. Install MongoDB.

  4. Reconfigure the shared replica set.

  5. Reinitialize the database - only on single systems and the replica set primary.

  6. Reconnect the database servers to the cluster.


Restoring the Database Content

Hint - cluster

In a cluster, you have to perform the following instructions on the replica set primary only.

  1. Remove the admin directory:
Remove-Item "$env:TEMP\mongodump\admin" -Force -Recurse
  1. Restore the data:

    & "C:\Program Files\MongoDB\Tools\100\bin\mongorestore.exe" /ssl /tlsInsecure /drop "$env:TEMP\mongodump"
    
  2. Restart MongoDB:

    Restart-Service -name seal-mongodb -Force
    

Back to top