Created
February 28, 2017 08:16
-
-
Save h0lyalg0rithm/5195bc532107b21fa5996ccccb010f32 to your computer and use it in GitHub Desktop.
Redis copy
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
#forked from https://coderwall.com/p/eclzyg/redis-to-redis-data-copy | |
require 'redis' | |
redisSrc = Redis.connect :url => "redis://localhost:6379" | |
redisDest = Redis.connect :url => "redis://localhost:6379" | |
redisSrc.keys("*").each do |key| | |
data = redisSrc.dump key | |
redisDest.restore key, 0, data unless redisDest.exists(key) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment