Last active
February 5, 2020 17:33
-
-
Save hsm207/7d7d1bd21b77eb831a2f3ca98be57173 to your computer and use it in GitHub Desktop.
Script to migrate all keys inside a redis instance into another redis instance
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
# source: https://stackoverflow.com/questions/37166947/copying-all-keys-in-redis-database-using-migrate | |
# make sure the redis in SOURCE_HOST and DESTINATION_HOST are identical! | |
SOURCE_HOST=127.0.0.1 | |
SOURCE_PORT=6381 | |
DESTINATION_HOST=foo.bar | |
DESTINATION_PORT=6379 | |
redis-cli -h $SOURCE_HOST -p $SOURCE_PORT --raw KEYS '*' | \ | |
xargs redis-cli -h $SOURCE_HOST -p $SOURCE_PORT MIGRATE $DESTINATION_HOST $DESTINATION_PORT "" 0 5000 KEYS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment