yankov / redis-migrator Goto Github PK
View Code? Open in Web Editor NEWRedis-migrator is a tool to redistribute keys in your redis cluster when its topography has changed.
Redis-migrator is a tool to redistribute keys in your redis cluster when its topography has changed.
Probably too early as long as 2.6 is in RC. So this is a place holder issue.
Redis 2.6 supports the MIGRATE command that allows to atomically migrate a key between two servers without the need to know the type of the key.
from the docs:
Atomically transfer a key from a source Redis instance to a destination Redis instance. On success the key is deleted from the original instance and is guaranteed to exist in the target instance.
Usage :
MIGRATE host port key destination-db timeout
I had tried use redis-migrator to split a large DB, there have more than 20,000,000 keys in Redis.
In this line, I saw that use keys(*)
to get all of the keys from Redis, that can't work, because it will timeout.
require 'redis_migrator'
old_redis_hosts = ["redis://127.0.0.1:6379"]
new_redis_hosts = ["redis://127.0.0.1:6380", "redis://127.0.0.1:6381", "redis://127.0.0.1:6382", "redis://127.0.0.1:6383", "redis://127.0.0.1:6384"]
migrator = Redis::Migrator.new(old_redis_hosts, new_redis_hosts)
migrator.run
/usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/pipeline.rb:126:in `value': ERR wrong number of arguments for 'migrate' command (Redis::CommandError)
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/pipeline.rb:118:in `_set'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/pipeline.rb:64:in `block in finish'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/pipeline.rb:63:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/pipeline.rb:63:in `each_with_index'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/pipeline.rb:63:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/pipeline.rb:63:in `map'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/pipeline.rb:63:in `finish'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:121:in `block in call_pipeline'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:243:in `with_reconnect'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:119:in `call_pipeline'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis.rb:2031:in `block in pipelined'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis.rb:36:in `block in synchronize'
from /usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis.rb:36:in `synchronize'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis-3.0.4/lib/redis.rb:2027:in `pipelined'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis_migrator-0.1.1/lib/redis_migrator/redis_native_migrator.rb:21:in `block in migrate'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis_migrator-0.1.1/lib/redis_migrator/redis_native_migrator.rb:20:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis_migrator-0.1.1/lib/redis_migrator/redis_native_migrator.rb:20:in `migrate'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis_migrator-0.1.1/lib/redis_migrator.rb:53:in `migrate_keys'
from /usr/local/lib/ruby/gems/2.0.0/gems/redis_migrator-0.1.1/lib/redis_migrator.rb:68:in `block (2 levels) in run'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.