From 3744f1d77d1217e70f006d53a278e2c1528340d4 Mon Sep 17 00:00:00 2001 From: Vera Clemens Date: Mon, 29 Jul 2024 11:30:28 +0200 Subject: [PATCH] feat(k8s.dataverse): add instructions for solr backup & restore to README --- k8s/dataverse/README.md | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/k8s/dataverse/README.md b/k8s/dataverse/README.md index 69b3299..b03d724 100644 --- a/k8s/dataverse/README.md +++ b/k8s/dataverse/README.md @@ -3,7 +3,9 @@ # Backup & Restore -## Restore database backup +## Database + +### Restoring a database backup Postgres is configured to automatically create and store a logical backup in S3. You can use the script at [`scripts/load_dataverse_backup.sh`][1] to load it into a Dataverse deployed on Kubernetes. @@ -21,7 +23,7 @@ Before running the script, you must set these env variables: The values for `LOGICAL_BACKUP_S3_BUCKET`, `SCOPE` and `LOGICAL_BACKUP_S3_BUCKET_SCOPE_SUFFIX` can be found using `kubectl describe pod` on one of the backup job pods. -## Creating a database backup +### Creating a database backup 1. Login into the postgres pod and create and compress a logical backup. @@ -33,4 +35,28 @@ The values for `LOGICAL_BACKUP_S3_BUCKET`, `SCOPE` and `LOGICAL_BACKUP_S3_BUCKET 2. Copy the logical backup to your local computer - `kubectl cp $POSTGRES_POD_NAME:/tmp/jd.dump.gz ./jd.dump.gz` \ No newline at end of file + `kubectl cp $POSTGRES_POD_NAME:/tmp/jd.dump.gz ./jd.dump.gz` + +## Solr + +If you want to avoid a re-index (which may take a long time), you can also create and restore Solr backups. + +### Creating a Solr backup + +``` +$ kubectl exec -it $SOURCE_DATAVERSE_DEPLOYMENT_NAME-solr-0 -- bash +# curl localhost:8983/solr/collection1/replication?command=backup +# curl localhost:8983/solr/collection1/replication?command=details +$ kubectl cp $SOURCE_DATAVERSE_DEPLOYMENT_NAME-solr-0:/var/solr/data/collection1/data/$SNAPSHOT_FILE_NAME $SNAPSHOT_FILE_NAME +``` + +Note: replace `$SNAPSHOT_FILE_NAME` with the name given by `curl localhost:8983/solr/collection1/replication?command=details`. + +### Restoring a Solr backup + +``` +$ kubectl cp $SNAPSHOT_FILE_NAME $DESTINATION_DATAVERSE_DEPLOYMENT_NAME-solr-0:/var/solr/data/collection1/data +$ kubectl exec -it $DESTINATION_DATAVERSE_DEPLOYMENT_NAME-solr-0 -- bash +# curl localhost:8983/solr/collection1/replication?command=restore +# curl localhost:8983/solr/collection1/replication?command=restorestatus +``` \ No newline at end of file