As we are using kubernetes to host databases, so approach is different to restore database
Refer the following link to take backup of the databases:
Neo4j Restore
copy backup folder from the azure storage account to the pod which you will create with the below manifest, this pod will mount same pv where data is present of neo4j.
apiVersion: apps/v1 kind: Deployment metadata: name: ubuntu-deployment labels: app: ubuntu spec: replicas: 1 selector: matchLabels: app: ubuntu template: metadata: labels: app: ubuntu spec: containers: - name: ubuntu image: ubuntu command: ["sleep", "123456"] volumeMounts: - mountPath: /data name: neo4j-data volumes: - name: neo4j-data persistentVolumeClaim: claimName: neo4j-claim
scale neo4j deployment to 0
kubectl command
Go inside the pod which you created with the manifest, navigate to /data/databases, rename graph.db to graph.db.backup and paste the graph.db folder at same location. Exit from the pod
kubectl command to login cd /data/databases mv cp
Scale again neo4j pod to 1 which will load the data from the backup data
kubectl command to setup replicas to 1
Remove deployment which was created to restore neo4j backup
Elasticsearch Restore
As we took elasticsearch backup with help of azure plugin
Commands to login to the pod
create repository with following command
curl -XPUT 'http://localhost:9200/_snapshot/azurebackup' -H 'Content-Type: application/json' -d '{ "type": "azure", "settings": { "container": "<blob_name>", "base_path": "<storage_account_name>"} }'
restore the snapshot with below command
curl -XPOST 'http://localhost:9200/_snapshot/azurebackup/snapshot_1/_restore'
checking status of the snapshot restore
curl -s "http://localhost:9200/_snapshot/azurebackup/snapshot_1/_status?pretty"
Cassandra Restore
Download restore script from below url
https://sunbirdstagingpublic.blob.core.windows.net/dbrestorescripts/restore.py
Download backup from storage account and untar the backup
Copy backup folder to pod at location /bitnami/cassandra
kubectl cp backupfolder sunbird/cassandra-0:/bitnami/cassandra/
Copy restore script also which you have downloaded from the url to the pod and place it to /bitnami/cassandra
kubectl cp restore.py sunbird/cassandra-0:/bitnami/cassandra/
Restore schema got to backupfolder eg. /bitnami/cassandra/cassandrabackup, you will find db_schema.cql. Use below command
cqlsh -f db_schema.cql
Use below command to restore
python3 restore.py --snapshotdir /bitnami/cassandra/cassandrabackupfolder --datadirectory /bitnami/cassandra/data/data/
Restart the statefulset once operations is done
kubectl rollout restart statefulsets cassandra -n sunbird
Validate data by using cqlsh
Delete backup folder which you have copied earlier you can delete restore.py script
Redis Restore
1.
Postgres Restore