Manually restoring Knox tables
Learn about the methods how you can manually restore Knox tables.
You need to manually restore the Knox tables within the Data Lake after a successful backup.
After a restore, you need to ensure that the restored metadata of the Data Lake reflect the desired end state, based on the purpose of the restore:
- If you want to reflect the current state of the data just prior to the restore:
- You must manually apply any SDX service changes that were in effect at the time of the restore.
- You must manually apply any custom configuration changes to default configuration for SDX services in the Data Lake.
- You must create and delete any applicable objects/policies that did not exist at the time of the backup.
- You must validate access and performance characteristics.
- If you want to reflect the state of the cluster at the time of the backup, for
example to roll back an undesired Data Lake change:
- You must manually delete any objects that are no longer covered by the Data Lake policy. Ensure that you created a backup first.
- You must manually apply any custom configuration changes to the default configuration for SDX services in the Data Lake.
- Validate access and performance characteristics.
- Running the restore script that recreates the backup from the dump in the object store
- Running the
pg_restorecommand that restores the Knox tables from a local backup
Running the restore script
You can restore the previously backed up Knox tables using the restore script.
To run the restore 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
Running the pg_restore command
You can restore the previously backed up Knox tables using the pg_restore command.
To run the pg_restore 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
pg_restore --host=[***REMOTE_DB_URL***] --port=[***REMOTE_DB_PORT***] --username=[***REMOTE_ADMIN***] --dbname="knox_gateway" --clean --if-exists --verbose /var/tmp/knox_gateway.dump
pg_restore command, you need to upload the Knox keys as described
in Uploading Knox keys.Uploading Knox keys
The exported Knox keys need to be uploaded in order to authenticate with the services after the backup is restored.
- Note down the current key before overwriting
it:
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';" > current_knox_token_mac_key.txt
