Skip to content

Instantly share code, notes, and snippets.

@h0lyalg0rithm
Created February 28, 2017 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h0lyalg0rithm/5195bc532107b21fa5996ccccb010f32 to your computer and use it in GitHub Desktop.
Save h0lyalg0rithm/5195bc532107b21fa5996ccccb010f32 to your computer and use it in GitHub Desktop.
Redis copy
#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