Backup and Restore
The sections below show how to perform backup, teardown, and restore.
Backup
It is always a good idea to regularly back up your report data and decryption keys. Please execute the following steps to back up.
$ mkdir -p /home/sevone/backups
$ sevone-cli exec mysql -- mysqldump -uroot -pdatainsight \
--lock-tables=false --databases datainsight reportscheduler | \
grep -v "Using a password" > \
/home/sevone/backups/mysqldump-$(date +%d-%m-%Y-%s).sql
$ kubectl get secret securitykeys -ojson | \
jq -r '.data."keys.json"' | \
base64 -d > /home/sevone/backups/keys.json
Teardown
In some cases, it may be necessary to teardown the Kubernetes cluster.
$ sevone-cli cluster down
Restore
Report data and decryption keys can
only be restored on a running Kubernetes cluster.
$ sevone-cli cluster up
$ MYSQL_STS=$(kubectl get sts -l app.kubernetes.io/name=mysql -oname)
$ SECRET=$(kubectl get secrets | grep securitykeys | awk '{print $1}')
$ kubectl rollout status -w $MYSQL_STS
$ kubectl delete secret $SECRET
$ kubectl create secret generic $SECRET \
--from-file=keys.json=/home/sevone/backups/keys.json
$ sevone-cli exec mysql -- mysql -uroot -pdatainsight \
< $(ls -Art ~/backups/mysqldump-*.sql | tail -n 1)
$ kubectl delete pods -l app.kubernetes.io/component=graphql