Export/import metadata from MongoDB
Follow the steps below to export and import the server metadata configuration manually. By default, the Users, Channels, Clients, ContactGroups and Mediators collections will be exported.
Ensure that you stop the server before exporting and importing.
Copy the file openhim-configuration-export.sh to a folder where you wish your export to be saved. Run the shell script by executing the following command:
If your MongoDB Server and Mongo Client are different versions your may need to add
mongodumpcommand in the script.
Your exported collections should be located in the folder structure '/dump/openhim/'.
For full import/export API details see here.
To import you data ensure that you are in the correct folder where the dump files are located. Execute the below command to import your collections.
mongorestore --db openhim dump/openhim
Note: If you have changed your database name, then do so for the export/import as well.
Export/import metadata from the OpenHIM Console
Export/import can now be done directly from the OpenHIM console which may be easier.
Navigate to the
Export/Import page on the console.
To export your configuration, open the relevant drop downs to check that the desired configs are selected (all configs are selected by default). Deselect any unwanted settings. Then
click Generate Export Script. See below for expected screen.
To import config drag and drop your export file, generated from the desired OpenHIM instance, into the specified box.
Export More Data
If you need to export more data from your OpenHIM instance, add the desired mongo collection names to the list in the export script using the export method described above.
List of all OpenHIM MongoDb collections:
To add transactions to the data dump for example append the name
transactions to the list in the script:
// openhim-configuration-export.shcollections=(users channels clients contactGroups mediators transactions)