Running an on-demand analytics database backup

Deploy the AnalyticsBackup CR to initiate a backup of the analytics database.

Before you begin

Configure your backup settings in your analytics CR: Configuring analytics database backups.

About this task

An on-demand backup is triggered by creating an AnalyticsBackup CR. The API Connect operator detects the presence of the backup CR and runs the backup job.

When you trigger an on-demand backup, a local backup is taken and then copied to your remote backup location (SFTP of object-store). If a remote backup location is not configured, then the backup is stored locally.

Local backups are taken automatically every 55 minutes past each hour. If you trigger an on-demand backup while a scheduled local backup is running, then the on-demand backup waits until the scheduled backup is complete, and then creates a new local backup.

Note: You can run only one backup or restore process at a time.

Procedure

  1. Create a file called analyticsbackup_cr.yaml and paste in the following contents:
    apiVersion: analytics.apiconnect.ibm.com/v1beta1
    kind: AnalyticsBackup
    metadata:
      generateName: <backup prefix>
    spec:
      name: <backup name>
      analyticsCluster: <cluster name>
      crType: create
      comment: <comment>
    where:
    • <backup prefix> is prefix for the name of your backup. The remainder of the name is automatically generated. Keep the prefix short, 8 characters or less.
    • Optional: <backup name>. If you don't want an autogenerated backup name with a prefix, you can specify the complete backup name here and remove the metadata.generateName property.
    • <cluster name> is the name or your analytics CR. To get the name of your analytics cluster, run:
      kubectl get AnalyticsCluster
    • <comment> is an optional comment that you can give your backup, for example load test backup.
  2. Deploy your CR by running the following command to create it in the namespace of your analytics subsystem:
    kubectl -n <namespace> create -f analyticsbackup_cr.yaml
  3. To see the progress of your backup, run the following command:
    kubectl  -n <namespace> get analyticsbackup
    NAME                  STATUS   ID                                     CR TYPE       CLUSTER    AGE   COMMENT
    <backup name>         Running                                       analytics      create       12s   <comment>
    When the backup is complete the status changes from Running to Ready.
  4. Display the details for your backup by running the following command:
    kubectl  -n <namespace> get analyticsbackup <backup name> -o yaml
    apiVersion: analytics.apiconnect.ibm.com/v1beta1
    kind: AnalyticsBackup
    metadata:
      creationTimestamp: "2020-05-20T16:18:05Z"
      generateName: a7s-bup-
      generation: 1
      name: a7s-bup-gb6s5
      namespace: my-namespace
      resourceVersion: "867329"
      uid: f43b8400-733d-411a-9e9a-de2166bbfb0a
    spec:
      indices:
      - all
    status:
      conditions:
      - lastTransitionTime: "2022-06-30T16:18:24Z"
        message: SUCCESS
        status: Complete
        type: Ready
      details: |
        {Name:my-backup-id
        Version:5.6.16
        Indices:[...]
        StartTime:2022-06-30T16:18:09.698Z
        EndTime:2022-06-30T16:18:16.082Z
        State:SUCCESS
        Failures:[]
        Shards:{Failed:0
        Successful:1}}
      id: my-backup-id