Tôi có một thùng chứa redis. Tôi muốn sao lưu nó và nhập lại bản sao lưu trên máy khác trong một container redis khác.Làm thế nào để khôi phục lại một bản sao lưu redis trong một redis container?
Tôi đi theo đề tài bước sau:
# Create the original redis container
docker run --name redis -d redis:3.0.3 redis-server --appendonly yes
# add a key inside it for the tests
docker run -it --link redis:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'
> SET foo bar
OK
# backup this container
docker run --volumes-from redis -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /data
# I now have a backup.tar file on my system and I transfer it on another machine
# Recreate a redis container
docker run --name redis2 -d redis:3.0.3 redis-server --appendonly yes
# restore the backup
docker run --volumes-from redis2 -v $(pwd):/backup ubuntu sh -c "cd/&& tar xvf /backup/backup.tar"
# check if the backup has been correctly restored
docker run -it --link redis2:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'
> GET foo
(nil)
Sao lưu không được phục hồi đúng cách. Tôi đang làm gì sai?
tôi phải đối mặt với cùng một vấn đề. Có giải pháp nào cho điều này ? tôi không thấy bất kỳ câu trả lời được chấp nhận cho vấn đề này. – Jugi