0

I was initially using Redis in cluster mode at production. But later I realised that if I use Redis independent servers using ShardedJedis java API, I can use ShardedJedisPipeline which has better performance due to obvious reasons. But while using Redis Server to maintain automatic fail over and high availability, I must use Redis Sentinel. So, I started looking into Sentinel. But while doing the initial POC, I got to know that I can not use ShardedJedis and Sentinel at the same time.

Now it seems that all my paths are closed as

  1. Redis Cluster does not support Pipeline
  2. I can not achieve high availability and automatic fail over without Sentinel
  3. I can not use Sentinel with ShardedJedis.

Please correct me if I am wrong anywhere and please suggest me the best strategy to achieve performance as well as high availability and automatic fail over.

RahulArackal
  • 944
  • 12
  • 28
abi_pat
  • 572
  • 2
  • 12
  • 35

2 Answers2

1

Spoken in general terms:

  • Redis Cluster supports Pipelining the same way like Redis Standalone does. The important part here is to hit the right node when issuing commands with keys. Commands without keys (such as MULTI or EXEC) are a no-go for Redis Cluster
  • The HA-Part is not 100% correct. While it's true, that Redis Cluster has no HA-Registry like Redis Sentinel, the Cluster itself maintains a topology. If using masters and slaves, it's not a big deal to do a client-failover to the new master. The only trick here is, to find the right moment and to update the cluster view accordingly.

AFAIK, Redisson has an automated topology-update mechanism. I'm not sure, whether Jedis updates it's cluster view on a regular basis, but it's possible to do this manually. lettuce has a auto-reconnect feature and the automated cluster view update is scheduled for the 3.3 release

HTH.

mp911de
  • 17,546
  • 2
  • 55
  • 95
  • I found a [third party API](https://github.com/warmbreeze/sharded-jedis-sentinel-pool) which provides JedisSentinelPool with ShardedJedis. But as you suggested some more API's like Redisson and lettuce, I am really getting confused that which API is better or best. Can you help me out in selecting the correct API? – abi_pat Jul 15 '15 at 14:05
  • 1
    Yes, it depends on your requirements. Had a similar question here: http://stackoverflow.com/questions/30878431/java-client-to-connect-elasticcache-redis-cache-node/30900503#30900503 – mp911de Jul 15 '15 at 14:12
0

You should take Redis Cluster behavior (Redis Cluster can respond to trigger redirection at any operation) into consideration.

Each process of Redis Cluster acts like normal Redis process, so it supports Pipelining. But, it doesn't guarantee that we're safe with pipelining with multiple nodes.

It was a long discussion, so I attach the link I was posted to Redis Google Groups about Redis Cluster with Pipeline. Please refer here with more details.

Redis Cluster with Pipeline

Jungtaek Lim
  • 1,638
  • 1
  • 12
  • 20