redis-cli -h <IP of MemoryStore Instance> --rdb dump.rdb
-
-
Save Om4ar/5f1b09d362623fa242c2de8d91ad691a to your computer and use it in GitHub Desktop.
Dump Redis rdb file from Google Cloud MemoryStore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First, create a dump on server A. | |
A$ redis-cli | |
127.0.0.1:6379> CONFIG GET dir | |
1) "dir" | |
2) "/var/lib/redis/" | |
127.0.0.1:6379> SAVE | |
OK | |
This ensures dump.rdb is completely up-to-date, and shows us where it is stored (/var/lib/redis/dump.rdb in this case). dump.rdb is also periodically written to disk automatically. | |
Next, copy it to server B: | |
A$ scp /var/lib/redis/dump.rdb myuser@B:/tmp/dump.rdb | |
Stop the Redis server on B, copy dump.rdb (ensuring permissions are the same as before), then start. | |
B$ sudo service redis-server stop | |
B$ sudo cp /tmp/dump.rdb /var/lib/redis/dump.rdb | |
B$ sudo chown redis: /var/lib/redis/dump.rdb | |
B$ sudo service redis-server start | |
The version of Redis on B must be greater or equal than that of A, or you may hit compatibility issues. |
rdb
command is available by installing rdb-tools
rdb --command protocol ~/dump.rdb | redis-cli -h <IP of MemoryStore Instance> -p <Port of MemoryStore Instance> --pipe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment