Notice: Please keep the Keycloak data intact until you check the data is already migrated to the new place.
Overview
We provide three ways to backup Keycloak data:
- Backup by Keycloak web console: Keycloak level backup. We can use this to keep keycloak resources in JSON format.
- Backup by PostgreSQL pg_dump: The best way to backup for daily maintenance. No PostgreSQL downtime.
- Backup up PostgreSQL from the filesystem: Recommended solution as the second backup plan if we want to upgrade Keycloak of PostgreSQL. Require to shutdown the PostgreSQL before backup.
Method 1: Backup and Restore on Keycloak console
Backup Keycloak (Export)
- The method to backup the Keycloak.
Restore Keycloak (Import)
- The method to restore the Keycloak.
Method 2: Database Backup and Restore
Here, we use pg_dump
to backup the database. It references the PostgreSQL document
Backup Keycloak
- The method to backup the Keycloak.
Restore Keycloak
Note 1: There is a slight difference between embedded Keycloak (Keycloak installed in primehub chart) and standalone Keycloak (Keycloak installed in separate helm release), please choose the instructions accordingly.
Note 2: We need the postgres
user to do the following operation, even the original database user is not postgres
.
Case 1: Embedded Keycloak (Keycloak installed in primehub chart)