Skip to content

Commit

Permalink
Merge pull request #24 from nfdi4health/feat/solr-backup-restore-readme
Browse files Browse the repository at this point in the history
feat(k8s.dataverse): add instructions for solr backup & restore to README
  • Loading branch information
johannes-darms authored Jul 29, 2024
2 parents ab509d4 + 3744f1d commit a915a6e
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions k8s/dataverse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.

Expand All @@ -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`
`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
```

0 comments on commit a915a6e

Please sign in to comment.