...
scale neo4j deployment to 0
Code Block kubectl commandscale --replicas=0 deployment/neo4j -n sunbird
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
Code Block kubectl command to login cd exec -it neo4j -n test -- /bin/bash cd /data/databases mv graph.db graph.db.backup go to your backup file and move graph.db to /data/databases mv cpyourbackup_graph.db /data/databases (make sure directory name shoudl remain graph.db)
Scale again neo4j pod to 1 which will load the data from the backup data
Code Block kubectl command to setup replicas to 1scale --replicas=1 deployment/neo4j -n sunbird
Remove deployment which was created to restore neo4j backup
...
As we took elasticsearch backup with help of azure plugin
Code Block |
---|
Commands to login to the podkubectl exec -it eleasticsearch-0 -n sunbird -- /bin/bash |
create repository with following command
...
Download restore script from below url
Code Block 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
Code Block 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
Code Block 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
Code Block cqlsh -f db_schema.cql
Use below command to restore
Code Block python3 restore.py --snapshotdir /bitnami/cassandra/cassandrabackupfolder --datadirectory /bitnami/cassandra/data/data/
Restart the statefulset once operations is done
Code Block 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
Download required backup from azure storage account and uncompress file
Copy backup to redis pod at location /data
Code Block kubectl cp dump.rdb sunbird/redis-master-0:/data
go to /data/appendonlydir you will see one rdb file eg. appendonly.aof.1.base.rdb , take copy of that file or rename same by appending backup to file name
rename downloded rdb file with the same name eg if the file name inside appendonlydir is appendonly.aof.1.base.rdb then rename your dump.rdb to the same name
Past that rdb to the /data/appendonlydir
restart statefulset
Code Block kubectl rollout restart statefulsets redis -n sunbird
Postgres Restore
Download required backup from azure storage account and uncompress backup file
Copy backup to /bitnami/postgresql directory inside file or you can connect database remotely and do a restore
Code Block kubectl cp backup.sql sunbird/postgres-0:/bitnami/postgresql
Use below command to restore inside the postgres pod
Code Block psql -U username --file=backupfile.sql
Validate databases