Redis/Jedis no single point of failure and automated failover

In a simple situation with 3 servers with 1 master and 2 slaves with no sharding. Is there a proven solution with java and Jedis that has no single point of failure and will automatically deal with a single server going down be that master or slave(automated failover). e.g. promoting masters and reseting after the failure without any lost data.

It seems to me like it should be a solved problem but I can't find any code on it just high level descriptions of possible ways to do it.

Who actually has this covered and working in production?

Answers


You may want to give a try to Redis Sentinel to achieve that:

Redis Sentinel is a system designed to help managing Redis instances. It performs the following three tasks:

  • Monitoring. Sentinel constantly check if your master and slave instances are working as expected.

  • Notification. Sentinel can notify the system administrator, or another computer program, via an API, that something is wrong with one of the monitored Redis instances.

  • Automatic failover. If a master is not working as expected, Sentinel can start a failover process where a slave is promoted to master, the other additional slaves are reconfigured to use the new master, and the applications using the Redis server informed about the new address to use when connecting.

... or to use an external solution like Zookeeper and Jedis_failover:

JedisPool pool = new JedisPoolBuilder()
    .withFailoverConfiguration(
        "localhost:2838", // ZooKeeper cluster URL
        Arrays.asList( // List of redis servers
            new HostConfiguration("localhost", 7000), 
            new HostConfiguration("localhost", 7001))) 
    .build();

pool.withJedis(new JedisFunction() {
    @Override
    public void execute(final JedisActions jedis) throws Exception {
        jedis.ping();
    }
});

See this presentation of Zookeeper + Redis.

[Update] ... or a pure Java solution with Jedis + Sentinel is to use a wrapper that handles Redis Sentinel events, see SentinelBasedJedisPoolWrapper.


Need Your Help

how to apply multiple css image filters using jquery

javascript jquery css

How do I apply the following css code using jquery

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.