How can we help you?
Database Migration Between DMC Demo Mode Instances
To prevent data loss, you may need to migrate your database from one Demo Mode instance to another. This guide covers why you would need to migrate between Demo Mode instances and how to do so successfully.
Multiple Demo Mode Instances
Users often have two instances of an application setup in their DevOps toolchain. There are two scenarios below that cover why this feature is helpful for users.
-
If you would like to test a new DMC version, you can install two instances of Demo Mode. One for production and one for testing.
- You can install two or more instances if you need to upgrade the server that DMC is installed on. For example, when upgrading all servers from RHEL 7 to RHEL 8, you will need to first install DMC on RHEL 8. This confirms it works as expected before the change is applied to the production infrastructure.
Example: If an upgrade from RHEL 7 to RHEL 8 is necessary and DMC is running indefinitely in Demo Mode, you will need to use this guide to ensure all of your data is retained. If you are in DMC Demo Mode and update from RHEL 7 to 8 without backing up your database to a separate instance, data may be lost in the process. You will need to backup the existing database to a second instance to upgrade RHEL in the first instance. Then you will migrate the database back to the first instance after the RHEL upgrade. Learn how to use this migration process in the guide below.
Part 1: Backup existing database and some cluster.config properties (instance1)
- Login to instance1
- If DMC is actively running, stop all services with the following command:
- Then, start postgresql service with the following command:
- Execute pg_dump to backup the Liquibase Enterprise database.
- Save the two properties listed below from the
<datical-service-install-dir>/config/cluster.properties
file.Tip: These properties will be added to a new configuration file on a new instance. This is covered in Part 2: Step 6 on this page.
datical.keycloak.internalPassword
datical.keycloak.internalClientSecret
properties
Example: sudo datical-control service stop all
Example: sudo datical-control service start postgresql
Example of pg_dump command run:
<datical-service-install-dir>/postgresql13/bin/pg_dump
-F t datical > ~/datical_database_backup.tar
'-F' argument selects the format of the output
't' argument is tar format of backup file
'enterprise'argument is name of database which is default name in demo mode
'>' argument is to specify where backup file should be saved
Note: Liquibase Enterprise will save the database backup to ~/datical_database_backup.tar file.
Tip: Don’t forget to start all services if you need working instance
Part 2: Restore backup and update properties in cluster config properties file (instance2)
- Login to instance2 and install datical-service (DMC) if it’s not already installed.
- If DMC is actively running, stop all services with the following command:
- Then, start postgresql service with the following command:
- Copy the backup file and save it in a secure location.
- Execute
pg_restore
to restore the database. - Then you need to update
datical.keycloak.internalPassword
,datical.keycloak.internalClientSecret
properties in<datical-service-install-dir>/config/cluster.properties
file with values copied from instance1Tip: This is mentioned in Part 1: Step 5 at the top of this page.
- Start all services:
sudo datical-control service start all
to establish the DMC Demo Mode successfully.
Example: sudo datical-control service stop all
Example: sudo datical-control service start postgresql
Example of pg_restore
command run:
<datical-service-install-dir>/pg_restore -c -Ft -d datical < /home/datical/datical_database_backup.tar
'-c' argument is to clean database before restore
'-F' argument selects the format of the output
't' argument is tar format of backup file
'-d' argument is to specify database name for restore
'<' argument is to specify backup file location which will be used for restore
Warning: It’s highly not recommended to migrate data to a newer version of DMC because restoration cleans the source database and backup from the older database instance. An older database instance may have a different table structure from newer tables which are required for keycloak, enterprise-service backend, or may not have some table structures at all.
Example: You have DMC 7.7 in demo mode on instance1, but you want to install DMC 8.1 on instance2 and migrate data using the steps described above.
In this case, you need to:
- Install DMC 7.7 on instance2.
- Migrate your data using the steps from above.
- After that, update DMC instance1 to 8.1 using DMC 8.1 installer script.