Running a backup of the Analytics database on OpenShift and Cloud Pak for Integration

Deploy the AnalyticsBackup CR to initiate a backup of the IBM® API Connect Analytics database on OpenShift or Cloud Pak for Integration.

Before you begin

Configure backup settings for Analytics.

About this task

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

Procedure

  1. Make sure your analytics cluster status is Running and READY.
    The cluster is ready when the READY condition states x/y where x = y. You can check the status in the OpenShift Form UI, or by running the following command:
    oc get a7s -n <analytics namespace>
    where a7s is the name of your Analytics subsystem. The response looks like the following example:
    NAME        READY   STATUS    VERSION      RECONCILED VERSION   AGE
    analytics   5/5     Running   10.0.5.0     10.0.5.0-426           19h
  2. Create the AnalyticsBackup CR using either the IBM Cloud Pak Platform UI, the OpenShift web console, or the CLI.

    For example:

    apiVersion: analytics.apiconnect.ibm.com/v1beta1
    kind: AnalyticsBackup
    metadata:
      generateName: a7s-bup-
      namespace: <analytics namespace>
    spec:
      crType: create
      comment: "test comment"
      indices: 
      - all
      enableIgnoreUnavailable: true
    where:
    • metadata.generateName - Use to specify a prefix for your backup name, the remainder of the name will be generated at runtime.
    • metadata.name - Use as an alternative to generateName, where you want to specify the full name of the backup.
    • Optional: metadata.namespace - Specify the analytics namespace.
    • spec.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: spec.comment - You can use this field to describe the back up for later reference.

    • Optional: spec.indices - A list of index names or keywords, indicating which indices you want to back up. Options are: all|apievents|ui, or the names of individual indices. If no indices are specified, then all indices are backed up. The default of 'all' is specified explicitly in the above sample.
    • Optional: spec.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. Trigger the backup operation by clicking Create in the UI, or by running the following command to deploy the CR in the namespace for your Analytics subsystem:
    oc create -f analyticsbackup_cr.yaml -n <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:
    oc get analyticsbackup -n <Analytics-namespace>

    where <Analytics-namespace> is the namespace where the Analytics subsystem is deployed. 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
  5. Display the details for a particular backup by running the following command:

    Use the backup name from the results in the previous step.

    oc get analyticsbackup backup_NAME -n <Analytics-namespace> -o yaml

    The result looks like the following example:

    apiVersion: analytics.apiconnect.ibm.com/v1beta1
    kind: AnalyticsBackup
    metadata:
      creationTimestamp: "2022-06-29T12:48:56Z"
      generateName: analytics-bup-
      generation: 1
      name: analytics-bup-4m7g8
      namespace: apic
      resourceVersion: "11207730"
      uid: e1d1c259-850f-4b90-82b3-6a13c05e5d72
    spec:
      comment: ""
      crType: create
      enableIgnoreUnavailable: false
      indices:
      - all
    status:
      backupID: analytics-all-2022-06-29t12:48:49utc
      commentLeft: ""
      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