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.
-
Open a PowerShell (Administrator).
-
Create a subdirectory for the dump in the %TEMP% directory if it does not exist yet:
cd $env:TEMP mkdir mongodump
-
Start MongoDB, if necessary:
Start-Service -name seal-mongodb
-
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.
-
Stop MongoDB:
Stop-Service -name seal-mongodb -Force
-
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
-
Reinitialize the database - only on single systems and the replica set primary.
Restoring the Database Content¶
Hint - cluster
In a cluster, you have to perform the following instructions on the replica set primary only.
- Remove the admin directory:
Remove-Item "$env:TEMP\mongodump\admin" -Force -Recurse
-
Restore the data:
& "C:\Program Files\MongoDB\Tools\100\bin\mongorestore.exe" /ssl /tlsInsecure /drop "$env:TEMP\mongodump"
-
Restart MongoDB:
Restart-Service -name seal-mongodb -Force