. . .

Data Migration

The term "data" of an application can be divided into two parts:

  1. The metadata containing the apps modules, their classes, attributes and servercode

  2. The instance data of the classes which one can see in data editor

While the first part is stored in a global database named apiomat, the second is stored in separate databases; their name depends on the applications name. Thus, if an applications name would be "ConferenceApp", the corresponding databases would look like:

  • ConferenceApp for the LIVE system

  • ConferenceApp-staging for the STAGING system

  • ConferenceApp-test for the TEST system

Migrating data between installations depends on which of both data should be migrated.

Migrating metadata

Since all metadata is stored in a global database, a script is needed to extract the information for specific application. Please contact ApiOmat Support for obtaining the script. Exporting data can be done using:

java -jar migration.jar <MyAppName>

This will print out a filename where the exported data is stored. Copy this file to the destination system and start import using:

java -jar migration.jar <MyAppName> true <PathToMogrationFile>

The second boolean parameter is set to "true" if you want to reset the customers password to "secret","false" to keep the original value.

Migrating application data

To migrate the "real" data of an application, a dump of the database is created, copied to destination and getting extracted. We are using mongodump in this example, but all other usual MongoDB backup & restore variants will work as well.

Create an export:

mongodump -d <NameOfAppsDatabase>

All data is stored in a ./dump folder. Copy this whole folder to the destination host. Import the data using:

mongorestore --drop

Kindly make sure that there is no existing dump folder on the destination host, since all data of the existing folder would be imported as well.

Also, ensure that you do not traverse into the dump folder when executing the mongo restore! You have to execute the command in one directory above. That is, if you copied the dump folder to /tmp/dump, you have to execute mongodump in /tmp!