Restoring a backup restores the state of the components at the time of the backup.

Procedure

  1. Connect to the deployer VM and execute below command:
    export KUBECONFIG=/root/.kube/<KubeConfig File>
  2. In a text editor, create the restoration configuration file in YAML format.

    The example file is located in the tcx-deployer/examples/backup-and-restore/restore.yaml.example.

    Use the following template for the component backup:
    apiVersion: tcx.vmware.com/v1alpha1
    kind: Restore
    metadata:
      name: restore-name
    spec:
      restore:
        postgres:
          enabled: true
          timeout: 10m
          dbs:
            - "analyticsservice"
            - "alarmservice"
            - "collector"
            - "grafana"
            - "keycloak"
        elastic:
          enabled: true
          timeout: 10m
          removeAndAddRepository: false
          cleanUpIndices: ""
        collectors:
          enabled: true
          timeout: 10m
        configmaps:
          enabled: false
          timeout: 10m
        secrets:
          enabled: false
          timeout: 10m
        zookeeper:
          enabled: true
          timeout: 10m
          rootPaths:
            - "/vmware/vsa/gateway"
            - "/vmware/vsa/smarts"
            - "/omega/enrichment"
            - "/omega/kpi"
            #- "/vmware/vsa/ncm"
      backupName: "backup-name"

    Uncomment #- "/vmware/vsa/ncm" to restore backup of NCM reports.

  3. To restore the backup, run the following command:
    kubectl apply -f <configuration YAML file>
    The following command creates the restore CR, and the status of the restore are updated in the status field as follows:
    ~> kubectl get restore.tcx.vmware.com --watch
    NAME           STATUS        TIME STARTED               TIME COMPLETED             MESSAGE
    restore-name                                                                                     # <------ The restore got created
    restore-name   IN_PROGRESS   2022-05-13T21:32:11.541Z                                            # <------ The restore status is IN_PROGRESS
    restore-name   SUCCESSFUL    2022-05-13T21:32:11.541Z   2022-05-13T21:32:14.741Z                 # <------ The restore was SUCCESSFUL, the MESSAGE field would be populated in case there is a failure with the details
    
    Note: Once restore is triggered it can not be undo, a failure to restore might result to a partial restore of the system. If the restore is failed, the failure message displays in the Message field.
    Option Description
    removeAndAddRepository Remove and add repository will delete the existing repository. When you are performing backup and restore across clusters, you must set removeAndAddRepository: true.`
    cleanUpIndices when you perform backup and restore across clusters, you must update the indices. For example, cleanUPIndices:ELASTICSEARCH_EVENTS,ELASTICSEARCH_CONFIG,ELASTICSEARCH_KAFKA_MAPPER
    Note:

    Disable Unnecessary Datastores

    Before starting the restore process, it is important to disable any datastores that are not required. To do this, update the Restore CR. Also, if you have not taken a backup for a datastore, you must update the restore CRs by setting enabled: false. For example:
    spec:
      restore:
        configmap:
          enabled: false

    Comment Out Unbacked Components

    If you have not backed up some components in a datastore, you must comment out the corresponding components in the Restore CRs. For example:
    spec:
      restore:
        postgres:
          enabled: true
          dbs:
            analyticservice: # comment out this component