Manually backing up Knox tables
Learn about the methods how you can manually back up Knox tables.
You have the following options to back up the Knox tables:
- Running a backup script that creates a backup and pushes the dump to the object store
- Running the
pg_dumpcommand that creates a local backup
Running the backup script
You can create a backup from the Knox tables using the backup script.
To run the backup script, you will need the values of the listed parameters included in the following files:
- From the
/srv/pillar/postgresql/disaster_recovery.slsfile:close_connectionsobject_storage_urlranger_admin_group
- From the
/srv/pillar/postgresql/postgre.slsfile:remote_adminremote_db_portremote_db_url
- Ensure that a Data Lake backup has been executed before running
the script.
Running the Data Lake backup creates the files that include the required values for the script. For more information, see the Configuring and running Data Lake backups documentation.
Running the pg_dump command
You can create a backup from the Knox tables using the pg_dump command.
To run the pg_dump command, you will need the values of
the listed parameters included in the following files:
- From the
/srv/pillar/postgresql/postgre.slsfile:remote_admin_pwremote_adminremote_db_portremote_db_url
- Ensure that a Data Lake backup has been executed before running
the script.
Running the Data Lake backup creates the files that include the required values for the script. For more information, see the Configuring and running Data Lake backups documentation.
pg_dump command, you need to export the Knox keys as described in
Exporting Knox keys.Exporting Knox keys
Knox keys need to be exported in order to authenticate with the services after the backup is restored.
export PGPASSWORD=[***SECRET_CM_DB_PW***]
psql -h [***CM_DB_HOST***] -U [***CM_USER***] -d [***CM_DB***] -t -A -c "SELECT value FROM configs WHERE attr = 'knox_token_mac_key';" > knox_token_mac_key.txt
knox_token_mac_key.txt contains the
secret that will be used for authentication. The secret is not going to be
displayed.