Backup to S3.

This commit is contained in:
Ivaylo Novakov 2021-01-20 13:17:24 +01:00
parent bc81921bd7
commit a05555f93e
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
2 changed files with 14 additions and 1 deletions

View File

@ -7,4 +7,4 @@ docker exec cockroach \
cockroach sql \
--host cockroach:26257 \
--certs-dir=/certs \
--execute="BACKUP TO 'http://cockroach-backup:3000/cockroach/backups/$DT';"
--execute="BACKUP TO 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KET';"

13
scripts/crdb_restore.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
BACKUP=$1
if [[ $BACKUP == "" ]]; then
echo "No backup name given. It should look like '2020-01-29'."
exit 1
fi
docker exec cockroach \
cockroach sql \
--host cockroach:26257 \
--certs-dir=/certs \
--execute="RESTORE DATABASE defaultdb FROM 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KET';"