How to restore tarantool backup? #6799
-
I create a backup script something like this: #!/usr/bin/env bash
set -x
CONNSTR=myusername:[email protected]:3301
SERVERUSER="ubuntu"
SERVERHOST="10.204.28.21"
SSHPORT=22
BACKDATE=$(date '+%Y%m%d_%H%M%S')
BACKDIR=./backup/tt_${BACKDATE}
echo 'box.backup.start()' | tarantoolctl connect $CONNSTR > ./backup/tt.log
cat ./backup/tt.log | grep '/var/lib/tarantool/' | cut -d '/' -f 5 > ./backup/tt_snapshot.txt
mkdir -p ${BACKDIR}
rsync -avP -e "ssh -p ${SSHPORT}" --files-from=./backup/tt_snapshot.txt $SERVERUSER@$SERVERHOST:/home/$SERVERUSER/tarantool-data ${BACKDIR}
echo 'box.backup.stop()' | tarantoolctl connect $CONNSTR
tar cvfz ./backup/tt_backup_${BACKDATE}.tgz -C ${BACKDIR} .
rm -rf ${BACKDIR} then do the backup, and it works properly: ls -al ./backup | grep tt_
-rw-rw-r-- 1 kyz 6241 Jan 23 14:46 tt_backup_20220123_144607.tgz
-rw-rw-r-- 1 kyz 26 Jan 23 14:46 tt_snapshot.txt but I cannot restore (maybe because missing xlog files) tarantoolctl connect myusername:mysecretpassword@localhost:3301
User 'myusername' is not found when I tried to backup everything (including xlog), it works, and can be restored locally (thru arantoolctl connect myusername:mysecretpassword@localhost:3301
connected to localhost:3301
localhost:3301> box.space
---
- []
... the latest backup script: #!/usr/bin/env bash
set -x
CONNSTR=myusername:[email protected]:3301
SERVERUSER="ubuntu"
SERVERHOST="10.204.28.21"
SSHPORT=22
BACKDATE=$(date '+%Y%m%d_%H%M%S')
BACKDIR=./backup/tt_${BACKDATE}
echo 'box.backup.start()' | tarantoolctl connect $CONNSTR #> ./backup/tt.log
#cat ./backup/tt.log | grep '/var/lib/tarantool/' | cut -d '/' -f 5 > ./backup/tt_snapshot.txt
mkdir -p ${BACKDIR}
rsync -avP -e "ssh -p ${SSHPORT}" $SERVERUSER@$SERVERHOST:/home/$SERVERUSER/tarantool-data ${BACKDIR} # --files-from=./backup/tt_snapshot.txt
echo 'box.backup.stop()' | tarantoolctl connect $CONNSTR
tar cvfz ./backup/tt_backup_${BACKDATE}.tgz -C ${BACKDIR} .
rm -rf ${BACKDIR} how to properly backup and restore to local docker? this the local docker-compose.yaml file: version: "3.3"
services:
tarantool1:
image: tarantool/tarantool:latest # 2.8.3
# x.x.0 = alpha, x.x.1 = beta, x.x.2+ = stable, latest not always stable
environment:
TARANTOOL_USER_NAME: "myusername"
TARANTOOL_USER_PASSWORD: "mysecretpassword"
volumes:
- ./backup/tarantool-data:/var/lib/tarantool
ports:
- "3301:3301" this the docker-compose.yaml file on server: version: "3.3"
services:
tt1:
container_name: tt1
hostname: tt1
image: tarantool/tarantool:latest # 2.8.3
# x.x.0 = alpha, x.x.1 = beta, x.x.2+ = stable, latest not always stable
environment:
TARANTOOL_USER_NAME: "myusername"
TARANTOOL_USER_PASSWORD: "mysecretpassword"
volumes:
- ./tarantool-data:/var/lib/tarantool
ports:
- "3301:3301"
restart: always |
Beta Was this translation helpful? Give feedback.
Answered by
Totktonada
Jan 24, 2022
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Totktonada
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
box.snapshot()
beforebox.backup.start()
.tarantoolctl cat --show-system <file>
to inspect snap/xlog files and know what actually you're stored in backups.