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:
kubectl cp {gateway_pod_name}:/data data -n dct-services
Take the backup (copy) of the data folders for the database Persistent Volume:
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:
kubectl scale --replicas=0 deployment/proxy -n dct-services
Terminate the database to stop internal threads using the database:
kubectl scale --replicas=0 deployment/database -n dct-services
Terminate the gateway to stop using Persistent Volume data:
kubectl scale --replicas=0 deployment/gateway -n dct-services
Create a dummy
pod to access the Persistent Volume using pod.yaml, as shown below.
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:
kubectl apply -f pod.yaml -n dct-services
Copy the backup Persistent Volume data into a new cluster.
Move the encryption key:
kubectl cp data dct-services/{gateway_pod_name}:/data
Move the Postgres data:
kubectl cp dct_database dct-services/{dummy_pod_name}:/var/lib/postgresql/data
Delete the dummy
pod.
kubectl delete pod dummy-pod -n dct-services
Start the database
pod (scale to 1):
kubectl scale --replicas=1 deployment/database -n dct-services
Restart all services.
Delete or patch the gateway
pod:
kubectl delete pod {gateway_pod_name} -n dct-services
Delete or patch the data-library
pod:
kubectl delete pod {data-library_pod_name} -n dct-services
Delete or patch the jobs
pod:
kubectl delete pod {jobs_pod_name} -n dct-services
Delete or patch the data-bookmarks
pod:
kubectl delete pod {data-bookmarks_pod_name} -n dct-services
Start the proxy service to serve the external service:
kubectl scale --replicas=1 deployment/proxy -n dct-services