7 Create OCNADD Restore Job

  1. Restore the OCNADD database by executing the following steps:
    1. Go to the custom-templates folder inside the extracted ocnadd-release package and update the ocnadd_restore.yaml file based on the restore requirements:
      1. The value of BACKUP_ARG can be set to DB, KAFKA, and ALL. By default, the value is 'ALL'.
      2. The value of BACKUP_FILE can be set to folder name which needs to be restored, if not mentioned the latest backup will be used.
      3. Update other values as below:
        
        apiVersion:batch/v1
        kind:Job
        metadata:
           name:ocnaddrestore
           namespace:ocnadd-deploy    #---> update the namespace
        spec:
           template: 
               metadata:
                  name:ocnaddrestore
               spec:
                 volumes:
                  -name:backup-vol 
                   persistentVolumeClaim:
                     claimName:backup-mysql-pvc
                  -name:config-vol 
                    configMap:     
                      name:config-backuprestore-scripts    
                      serviceAccountName:ocnadd-deploy-gitlab-admin      #---> update the service account name. Format:<namespace>-gitlab-admin
                      containers:
                      -name:ocnaddrestore       
                      image:<repo-path>/ocnaddbackuprestore:1.0.0      #--->update repository path   
                      volumeMounts:
                            -mountPath:"work-dir"      
                             name:backup-vol       
                            -mountPath:"config-backuprestore-scripts"        
                             name:config-vol
        
                         env:       
                          -name:HOME   
                           value:/tmp  
                          -name:DB_USER   
                           valueFrom:
                              secretKeyRef: 
                                 name:db-secret 
                                  key:MYSQL_USER
        
                          -name:DB_PASSWORD    
                             valueFrom:   
                               secretKeyRef:     
                                  name:db-secret     
                                  key:MYSQL_PASSWORD
                    
                           -name:BACKUP_ARG     
                               value:ALL    
                           -name:BACKUP_FILE   
                              value:
                      command:    
                      - /bin/sh    
                      - -c    
                      - |
                      cp /config-backuprestore-scripts/*.sh /tmp    
                      chmod +x /tmp/*.sh          
                      echo "Executing restore script"        
                      ls -lh /work-dir/backup         
                      bash /tmp/restore.sh $BACKUP_ARG $BACKUP_FILE     
                      sleep 15m
               
                   restartPolicy:Never
        status:{}
                      
        
  2. Execute the below command to run the restore job:
    kubectl create -f ocnadd_restore.yaml 
  3. Restart the ocnaddconfiguration, ocnaddalarm, and ocnaddhealthmonitoring pods once the restore job gets completed.

Note:

If the backup is not available for the mentioned date, the pod will be in an error state, notifying the Backup is not available for the given date: $DATE, in such case provide the correct backup dates and repeat the procedure.