Only Certificate Hub installations migrated from older versions support an internal database—that is, a database running on the same host as the application. See below for switching from an internal database to an external one.
Run the steps below in the same version of Certificate Hub that will use the database.
Exporting the database contents
Set the following environment variables in the host running the internal database.
Variable | Value |
---|---|
KUBECTL | The value of the |
NAMESPACE | The value of the |
POSTGRES_DB |
|
POSTGRES_PWD | The value of the |
POSTGRES_USER | The value of the |
Run the following commands.
now=$(date +
"%m_%d_%Y"
)
$KUBECTL exec deployment/postgres -n
"$NAMESPACE"
-- bash -c
"export PGPASSWORD=$POSTGRES_PWD; pg_dump -d $POSTGRES_DB -U $POSTGRES_USER"
>
"db-backup-$now.sql"
Restoring the database contents
Perform the following steps on an external host to restore the database contents.
To restore the database contents on an external host
- Install the PostgreSQL version described in Database requirements.
- Copy the
db-backup-<date>.sql
backup file generated when Exporting the database contents. - Set the following environment variables to the values described in Exporting the database contents.
- POSTGRES_DB
- POSTGRES_PWD
- POSTGRES_USER
- Run the following command.
export PGPASSWORD=$POSTGRES_PWD; psql -d $POSTGRES_DB -U $POSTGRES_USER -f db-backup-<date>.sql
Applying the database changes to Certificate Hub
Complete the database migration by performing the following operations on the Certificate Manager host.
To apply the database changes to Certificate Hub
- Update the database configuration parameters described in Configuring the deployment to match the new external database.
- Redeploy Certificate Hub to make the changes effective.
- Wait while the redeployment with the external database is complete.
- Manually remove the PostgreSQL pod.