Giter VIP home page Giter VIP logo

redis-mmm's Introduction

redis-mmm - redis multi master replication manager

IMPORTANT: This project is superseeded by redis-sentinel functionality in redis core. Don't use redis-mmm!

This project is a port of a lot of ideas of mysql-mmm to redis. That also explains the name as an hommage to the mysql-mmm project

Multi-Master?

No. Not really.

What then?

redis-mmm aims to provide automatic (and, to some extent, manual) failover functionality in case the redis master crashes or anything else happens. This functionality does not exist in redis itself.

The whole idea behind that is having a virtual IP address to which all redis clients connect to reach the master. This IP is then migrated to the current master machine, so that the client will always reach the master. There is a slave IP address, too, so you could even balance the reads off of the master!

All work is done by a separate monitoring process (which, for obvious reasons, should reside on a completely different host).

How to make it work

Before you start, you need to make sure you have the following prerequisites:

  • a network where you can dynamically change IPs (should be a private network)
  • 2 free IP addresses
  • you are NOT on Amazon EC2, since you can't add / remove IPs there (that's a lesson I had to learn)
  • a separate monitoring host on your network
  • two redis servers on different machines (I'll call them db1 and db2)
  • redis is listening on 0.0.0.0
  • the monitoring host can access both redis instances (I'll call it mon)
  • a redis-mmm user on all hosts
  • redis-mmm@mon can ssh to redis-mmm@db1 and redis-mmm@db2 without entering a password
  • redis-mmm@db{1,2} can use sudo to do the following commands
    • /sbin/ip addr {show,add,del}
    • /usr/bin/arping

Now, go to the monitoring host, install redis-mmm (gem install redis-mmm) and configure /etc/redis-mmm.conf

Example configuration:

master_ip = 192.168.10.70
cluster_interface = eth1

[db1]
address = 192.168.10.1
port = 6379
ssh_user = redis-mmm
ssh_port = 22

[db2]
address = 192.168.10.2
port = 6379
ssh_user = redis-mmm
ssh_port = 22

To start the monitoring, start redis_mmm mon. It's left as an excercise for the reader to use upstart, god or bluepill to keep that process running.

To view the cluster's status, call redis_mmm status

To view info about a node, use redis_mmm info <node>

To show help: redis_mmm help

Warning

This is an experimental piece of software not yet ready for prime time. I can't guarantee consistency for now, since there's no way to make a redis server read only and some redis clients seem to ignore crashed servers

Nevertheless, play and try, fork and update and give feedback!

redis-mmm's People

Contributors

siebertm avatar

Stargazers

 avatar David.Gao avatar  avatar Michael Hart avatar Michael Hoegemann avatar  avatar Roman Heinrich avatar

Watchers

James Cloos 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.