简体   繁体   中英

Can you have a single end point for Redis cluster(master/slave)?

I've started reading on how to set-up a Redis cluster and most of the bits of information make sense except the fact that I can't find what will be the common end point of the cluster that I spawn.

Since I am considering using Sentinel to mitigate the fail-overs as well as considering to make the slaves read-only, I would expect that there is some out of the box client that would manage load balancing for me. For C# there is StackExchange.Redis that does exactly that, is there some open source solution in Java? Since one has to write a separate client to manage this, there is no out of the box support from Redis to manage multiple hosts?

Short answer

It's possible, but not (out-of-the-box) with jedis .

Explanation

Jedis supports Redis Sentinel in the sense of high availability but it has no support for slave reads. Using Jedis will read always from the current master node. You can however obtain slaves from Sentinel ( SENTINEL SLAVES <master-name> ) and spin up own clients. Jedis has currently an open ticket to implement that feature.

Alternatively, you might want to check out lettuce or Redisson .

Both clients provide master lookup and control over the read behavior .

You should connect all redis nodes. I've tried lettuce. It was steel the same. Here is AWS Doc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM