0

This might be something simple but I cannot find answer anywhere (in the codebase included).

I have a simple Redis deployment with master + slave. How am I supposed to configure JedisPool to use master for writes and slave/master for reads?

Everything I see now tells me that I have to configure JedisPool to connect to master, but I don't see any logic that auto-detects slaves and sends "gets" there.

What am I missing?

Would appreciate your clarification. Thanks in advance. Paul

PaulGPA
  • 1
  • 1
  • 2

1 Answers1

0

There is a solution called Jedis-failover: well it was specifically made to be a failover solution but maybe you can extend this library to your own usage. JedisPool is just a pool of Jedis instances, and I don't think there is a way to tell Jedis to call another Redis server depending on the query as a Jedis instance is defined by a single connection. You'll probably have to define your own facade on JedisPool which can contain a list of JedisPool based on your topology of redis servers.

Here are interesting links on jedis-failover, note that you'll probably need a Zookeeper to manage this configuration.

https://github.com/officedrop/jedis_failover

http://fr.slideshare.net/ryanlecompte/handling-redis-failover-with-zookeeper

There is also redis sentinel which is quite new and alpha / beta. But it is official.

zenbeni
  • 7,019
  • 3
  • 29
  • 60