Running a backup of the Analytics database

Deploy the analyticsbackup_cr.yaml CR to initiate a backup of the IBM® API Connect Analytics database on Kubernetes.

Before you begin

Configure backup settings for Analytics.

About this task

A backup is triggered by creating the analyticsbackup_cr.yaml CR. The new CR is detected by the ibm-apiconnect operator, which requests a new backup.

Procedure

  1. Create the AnalyticsBackup CR for your deployment in a file called analyticsbackup_cr.yaml.

    The following code shows the sample analyticsbackup_cr.yaml, which is stored in the helper_files directory:

    apiVersion: analytics.apiconnect.ibm.com/v1beta1
    kind: AnalyticsBackup
    metadata:
      generateName: a7s-bup-
    spec:
      crType: create
      comment: "test comment"
      indices: 
      - ui
      enableIgnoreUnavailable: true
  2. In your copy of the CR, update the following settings:
    • crType - Use create to trigger a backup process. When the backup is created, the operator generates another backup CR with crType: record, which represents the stored backup that you can use for a restore operation.

    • Optional: comment - You can use this field to describe the back up for later reference.

    • Optional: indices - A list of index names or keywords, indicating which indices you want to back up. If no indices are specified, then all indices are backed up. The following supported keywords are mapped to indices or aliases in Elasticsearch:
      • all - Backup all data. This is equivalent to listing all of the remaining keywords (apievents, ui, config).
      • apievents - Backup all analytics data.
      • ui - Backup all UI visualizations and dashboards.
      • config - Backup all configuration information, such as the retention period.
    • Optional: enableIgnoreUnavailable - Default value is false. If set to false, the backup fails if a specified index is not present. If set to true, missing indices are skipped and the backup continues.
  3. Deploy your CR by running the following command to create it in the namespace for your Analytics subsystem:
    kubectl create -f analyticsbackup_cr.yaml -n namespace

    where namespace is the name of the Analytics namespace.

    The backup's name and ID are generated when the backup operation runs.

  4. To get a list of available backups, run the following command:
    kubectl get analyticsbackup -n namespace

    The response looks like the following example:

    NAME                  STATUS   ID                                     CR TYPE   INDICES                 AGE   COMMENT
    a7s-bup-266p8         Ready                                           create    [all]                   20h   y
    a7s-bup-pffdh         Ready                                           create    [all]                   34h   y
    analytics-bup-kxwq5   Ready    analytics-all-2020-09-07t03:49:15utc   record    [ui apievents config]   34h
    analytics-bup-p29z8   Ready    analytics-all-2020-09-07t18:04:03utc   record    [ui apievents config]   20h
  5. Display the details for a particular backup by running the following command:

    Use the backup name from the results in step 4.

    kubectl get analyticsbackup backup_NAME -n namespace -o yaml

    The result looks like the following example:

    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"
      selfLink: /apis/analytics.apiconnect.ibm.com/v1beta1/namespaces/my-namespace/analyticsbackups/a7s-bup-gb6s5
      uid: f43b8400-733d-411a-9e9a-de2166bbfb0a
    spec:
      indices:
      - ui
    status:
      conditions:
      - lastTransitionTime: "2020-05-20T16:18:24Z"
        message: SUCCESS
        status: Complete
        type: Ready
      details: |
        {Name:my-backup-id
        Version:5.6.16
        Indices:[.kibana-6]
        StartTime:2020-05-20T16:18:09.698Z
        EndTime:2020-05-20T16:18:16.082Z
        State:SUCCESS
        Failures:[]
        Shards:{Failed:0
        Successful:1}}
      id: my-backup-id