Backup and restore
|
IMPORTANT
If you are using an external database, you will need to make additional backups and restores on the side of that database.
|
The backup and recovery method depends on the data storage type used: bind mount or named volume.
|
NOTE
The backup and recovery procedure can also be used to migrate ADCM data between storage types — from a bind mount to a named volume or vice versa.
|
Backup
Bind mount
To perform a backup when using a bind mount, follow these steps:
-
Stop the ADCM container:
$ sudo docker stop adcm -
Go to the directory on the host used for ADCM data storage (default is /opt/adcm):
$ cd /opt/adcm -
Create a backup of the data directory. The backup will be saved in the current user’s home directory:
$ sudo tar czvf ~/backup.tar.gz . -
Start the ADCM container:
$ sudo docker start adcm
Named volume
To perform a backup when using a named volume, follow these steps:
-
Stop the ADCM container:
$ sudo docker stop adcm -
Create a data archive from the volume using a temporary container (the example uses the
adcm-datavolume):$ sudo docker run --rm \ -v adcm-data:/adcm/data \ -v ~:/backup \ alpine \ tar czvf /backup/backup.tar.gz -C /adcm/data . -
Start the ADCM container:
$ sudo docker start adcm
Restore
Bind mount
To perform a restore when using a bind mount, follow these steps:
-
Stop the ADCM container:
$ sudo docker stop adcm -
Create a new directory on the host:
$ sudo mkdir /opt/adcm-restored -
Go to the created directory:
$ cd /opt/adcm-restored -
Restore data from the previously created backup:
$ sudo tar xvf ~/backup.tar.gz -
Remove the current ADCM container:
$ sudo docker container rm adcm -
Ensure that the directory containing the restored data is owned by the
10001:10001user. If necessary, change the owner:$ sudo chown -R 10001:10001 /opt/adcm-restoredNOTEIf you do not need to reuse the
adcmcontainer name, you can skip the current step and use another container name instead ofadcmin the next steps. -
Create a new ADCM container using the same startup parameters as the original container. Specify the /opt/adcm-restored directory instead of /opt/adcm:
$ sudo docker create \ --name adcm \ -p 8000:8000 \ -v /opt/adcm-restored:/adcm/data \ -e DB_HOST="<DATABASE_HOSTNAME_OR_IP_ADDRESS>" \ -e DB_PORT="<DATABASE_TCP_PORT>" \ -e DB_USER="<DATABASE_USERNAME>" \ -e DB_NAME="<DATABASE_NAME>" \ -e DB_PASS="<DATABASE_USER_PASSWORD>" \ hub.arenadata.io/adcm/adcm:<version>where
<version>is the desired ADCM image version. You can use a version number equal to or greater than the ADCM version for which the backup was created. It is not recommended to upgrade ADCM by more than five minor versions. ADCM downgrade is not supported. For more information, see Upgrade. -
Start the new ADCM container:
$ sudo docker start adcm
Named volume
To perform a restore when using a named volume, follow these steps:
-
Stop the ADCM container:
$ sudo docker stop adcm -
Remove the existing container:
$ sudo docker container rm adcm -
Remove the existing named volume and create a new one to restore the data:
$ sudo docker volume rm adcm-data $ sudo docker volume create adcm-data -
Extract the backup archive into the new volume using a temporary container:
$ sudo docker run --rm \ -v adcm-data:/adcm/data \ -v ~:/backup \ alpine \ tar xvf /backup/backup.tar.gz -C /adcm/data -
Create a new ADCM container with the same startup parameters, specifying the
adcm-datavolume:$ sudo docker create \ --name adcm \ -p 8000:8000 \ -v adcm-data:/adcm/data \ -e DB_HOST="<DATABASE_HOSTNAME_OR_IP_ADDRESS>" \ -e DB_PORT="<DATABASE_TCP_PORT>" \ -e DB_USER="<DATABASE_USERNAME>" \ -e DB_NAME="<DATABASE_NAME>" \ -e DB_PASS="<DATABASE_USER_PASSWORD>" \ hub.arenadata.io/adcm/adcm:<version>where
<version>is the desired ADCM image version. You can use a version number equal to or greater than the ADCM version for which the backup was created. It is not recommended to upgrade ADCM by more than five minor versions. ADCM downgrade is not supported. For more information, see Upgrade. -
Start the new ADCM container:
$ sudo docker start adcm