Skip to main content
Skip table of contents

DCT data backup and recovery

This method is only applicable for Kubernetes and OpenShift.

  • For Kubernetes, use the kubectl command prefix.

  • For OpenShift, use the oc command prefix. 

Data backup of Persistent Volumes used by DCT

Based on customer need or backup policy, they need to take a backup of data in Persistent Volumes. In DCT, gateway and database services are using Persistent Volume hence customer need to take backup of data folder mounted on mounted path.

Take the backup (copy) of the data folders for the gateway Persistent Volume:

NONE
~$ kubectl cp {gateway_pod_name}:/data data -n dct-services

Take the backup (copy) of the data folders for the database Persistent Volume:

NONE
~$ kubectl cp {database_pod_name}:/var/lib/postgresql/data/ dct_database -n dct-services

Restore data backup in a new DCT setup

Deploy DCT services with the same version for which data back-up was taken. This deployment will create a new Persistent Volume data folder for the cluster. 

Use the following steps to copy the backup data in this new deployment.

First, stop all services.

Terminate proxy pod to stop serving external traffic:

NONE
~$ kubectl scale --replicas=0 deployment/proxy -n dct-services

Terminate the database to stop internal threads using the database:

NONE
~$ kubectl scale --replicas=0 deployment/database -n dct-services

Terminate the gateway to stop using Persistent Volume data:

NONE
~$ kubectl scale --replicas=0 deployment/gateway -n dct-services

Create a dummy pod to access the Persistent Volume using pod.yaml, as shown below.

NONE
apiVersion: v1
kind: Pod
metadata:
Namespace: dct-services  
name: dummy-pod
  labels:
    app: dummy-pod
spec:
  containers:
    - image: ubuntu
      command:
        - "sleep"
        - "604800"
      imagePullPolicy: IfNotPresent
      name: ubuntu
  restartPolicy: Always
  volumes:
    - name: gwdatabase-data
      persistentVolumeClaim:
        claimName: gwdatabase-data

Create the dummy pod with:

NONE
~$ kubectl apply -f pod.yaml -n dct-services

Copy the backup Persistent Volume data into a new cluster.

Move the encryption key:

NONE
~$ kubectl cp data dct-services/{gateway_pod_name}:/data

Move the Postgres data:

NONE
~$ kubectl cp dct_database dct-services/{dummy_pod_name}:/var/lib/postgresql/data

Delete the dummy pod.

NONE
 ~$ kubectl delete pod dummy-pod -n dct-services

Start the database pod (scale to 1):

NONE
~$ kubectl scale --replicas=1 deployment/database -n dct-services

Restart all services.

Delete or patch the gateway pod:

NONE
~ % kubectl delete pod {gateway_pod_name} -n dct-services

Delete or patch the data-library pod:

NONE
~ % kubectl delete pod {data-library_pod_name} -n dct-services

Delete or patch the jobs pod:

NONE
~ % kubectl delete pod {jobs_pod_name} -n dct-services

Delete or patch the data-bookmarks pod:

NONE
~ % kubectl delete pod {data-bookmarks_pod_name} -n dct-services

Start the proxy service to serve the external service:

NONE
~$ kubectl scale --replicas=1 deployment/proxy -n dct-services
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.