Running an on-demand backup of the management database

Deploy the Backup CR to initiate a backup of the management database.

About this task

If you are taking a management database backup, you should also take a portal database backup for all registered portal services. Management and portal databases must be kept in sync.

Note: For OpenShift users: The steps that are detailed in this topic use the Kubernetes kubectl command. On OpenShift, use the equivalent oc command in its place.

Procedure

  1. Verify the health of your ManagementCluster:
    kubectl -n <management namespace> get ManagementCluster
    The status should show Running, and all pods should be up:
    NAME   READY   STATUS    VERSION      RECONCILED VERSION   AGE
    mgmt   n/n     Running   10.0.8.0     10.0.8.0             19h
    Note: On Cloud Pak for Integration a keycloak cluster is also shown in this output. Check the status on the ManagementCluster only.
  2. Identify the management database cluster name:
    kubectl -n <management namespace> get cluster
    Example output that shows the database cluster name is m1-dc1-db:
    NAME        AGE   INSTANCES   READY   STATUS                     PRIMARY
    m1-dc1-db   8d    3           3       Cluster in healthy state   m1-dc1-db-1
  3. Create a file called mgmtbackup_cr.yaml and paste in the following text:
    apiVersion: postgresql.k8s.enterprisedb.io/v1
    kind: Backup
    metadata:
      generateName: mgmt-backup- # prefix for the name of the backup CR that is generated.
    spec:
      cluster:
        name: <database cluster name> 
    

    where <database cluster name> is the cluster name that you identified in step 2.

  4. Create the Backup CR from the mgmtbackup_cr.yaml file:
    kubectl -n <management namespace> create -f mgmtbackup_cr.yaml
  5. Verify that the backup is running with:
    kubectl -n <management namespace> get backup -o custom-columns="name:.metadata.name,backupId:.status.backupId,endpoint:.status.endpointURL,path:.status.destinationPath,servername:.status.serverName,status:.status.phase"
    
    The expected output when the backup is completed is:
    name                 backupId          endpoint                                     path                       servername                                        status
    test-backup-1.17.1   20230831T110022   https://apic-mgmt-s3proxy.default.svc:8765   s3://backups/backup01ibm   apic-mgmt-d54a2194-db-2023-08-31T11:49:10+01:00   completed
    
    Do not delete the Backup CR when the backup is complete. The Backup CR is required to restore the backup.

What to do next

Take a database backup of any portal subsystems that are registered with this management subsystem: Running an on-demand backup of the portal database.