GithubHelp home page GithubHelp logo

redross / redis-migrator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yankov/redis-migrator

0.0 2.0 0.0 370 KB

Redis-migrator is a tool to redistribute keys in your redis cluster when its topography has changed.

Ruby 100.00%

redis-migrator's Introduction

Redis-migrator

Redis-migrator is a tool to redistribute keys in your redis cluster when its topography has changed.

##How it works

Say you are using Redis::Distributed to distribute your writes and reads across different redis nodes. Redis::Distributed uses consitent hashing algorithm to determine where a command will go. If you changed configuration of your cluster, for example, changed a hostname or added a new node then routes for some of the keys will change too. If you try to read such a key - you won't get a data from its old node.

Redis-migrator takes a list of nodes for your old cluster and list of nodes for your new cluster and determines for which keys routes were changed. Then it moves those keys to new nodes.

##Install
gem install redis_migrator

##Usage
require 'redis_migrator'

# a list of redis-urls for an old cluster
old_redis_hosts = ["redis://host1.com:6379", "redis://host2.com:6379"]

# a list of redis-urls for a new cluster
new_redis_hosts = ["redis://host1.com:6379", "redis://host2.com:6379", "redis://host3.com:6379"]

migrator = Redis::Migrator.new(old_redis_hosts, new_redis_hosts)
migrator.run

##Requirements

  • ruby 1.9 or jruby (with --1.9 flag)
  • redis >=2.4.14 (only on machine where migrator will be running)

##Contributing

# First fork the project.
# Then bundle
bundle

# and make sure tests pass
bundle exec rspec spec

# Add features and profit.
# Send a pull request back to the original repository.

##TODO

  • Error handling

redis-migrator's People

Contributors

redross avatar sishen avatar yankov avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.