You can back up and restore the DataClarity database by copying the postgres pvc folder. If you are migrating the database to another server, see Back up and restore Postgresql DB via pg_dump.

Create a backup

  1. Connect to the VM where the DataClarity platform is installed, and then go to the microk8s default storage location:

    cd /var/snap/microk8s/common/default-storage


    The folder containing the postgres data starts with ‘default-postgres-pv-claim-pvc’.

    Note: To access, copy, or delete the folder, you will likely need to switch to the superuser (root). To switch to the superuser, find the corresponding command for your OS. For example, the sudo su command is used in Ubuntu.



  2. Create a copy of the folder with the postgres pv, where /home/user/pgbackup is the location of the new copy that you can change as needed:

    cp -a default-postgres-pv-claim-pvc-910fec3c-89f8-4191-86ab-fd5d587ec7d5/ /home/user/pgbackup/default-postgres-pv-claim-pvc-910fec3c-89f8-4191-86ab-fd5d587ec7d5


    Note: In the above example, the folder name is default-postgres-pv-claim-pvc-910fec3c-89f8-4191-86ab-fd5d587ec7d5. In your case, it will be different, but it always starts with ‘default-postgres-pv-claim-pvc’.

Restore the backup

  1. Go to the default storage location and record the name of the folder containing the postgres pv:

    cd /var/snap/microk8s/common/default-storage


    Then, delete the folder with the postgres pv:

    rm -rf default-postgres-pv-claim-pvc-910fec3c-89f8-4191-86ab-fd5d587ec7d5

  2. Copy the backup folder back into the default storage location:

    cp -a /home/user/pgbackup/default-postgres-pv-claim-pvc-910fec3c-89f8-4191-86ab-fd5d587ec7d5 /var/snap/microk8s/common/default-storage/default-postgres-pv-claim-pvc-910fec3c-89f8-4191-86ab-fd5d587ec7d5

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.