High availability in Jedis client side.

1,544 views
Skip to first unread message

Mingkui Liu

unread,
Apr 8, 2014, 3:31:07 AM4/8/14
to jedis...@googlegroups.com
Hi guys,
If I have several slaves of one master, can I dispatch read requests to different slaves in client side using Jedis?
I know I can archive this using load balance, does load balance have some disadvantages to do this job?

임정택

unread,
Apr 9, 2014, 5:48:23 PM4/9/14
to jedis...@googlegroups.com
Hello.

If you rely on Redis Sentinel and need 'High Availability', not 'High Performance', leave slaves to standby.

Redis Sentinel failover target is just master, it means Sentinel decides ODOWN only master, not slave or sentinel.
It's up to you if slaves / sentinels are failing (we can get this by SDOWN, though it's not perfect) and need to resurrect.
It's Redis Sentinel's limitation.

So JedisSentinelPool is not using slave, and completely rely on master.
There're some interval to failover, so some (small) downtime exists during failover.
If you need to read while failover is in progress, you can use Jedis (not JedisSentinelPool) to connecting slave.

Sincerely.
Jungtaek Lim (HeartSaVioR)

2014년 4월 8일 화요일 오후 4시 31분 7초 UTC+9, Mingkui Liu 님의 말:

Mingkui Liu

unread,
Apr 10, 2014, 3:01:27 AM4/10/14
to jedis...@googlegroups.com
Thanks 임정택  for your explanation.

Yes, I know Redis Sentinel is for master failover, and it archive 'High Availability' although there is some downtime.

My question is:
If I have multi slave instances, I want to archive 'High Performance' (I mean throughput ability), and only want read from slaves(master only responsible for write). Do you have any suggestions?

Please let me know if i did not clarify it.

임정택

unread,
Apr 10, 2014, 3:19:12 AM4/10/14
to jedis...@googlegroups.com
I already talked my opinion. :)

If you need to read while failover is in progress, you can use Jedis (not JedisSentinelPool) to connecting slave.

There're no query offload feature on JedisSentinelPool, maybe it's harm to availability.
So you need to separate write/read things and query manually by Jedis instance. :)

2014년 4월 10일 목요일 오후 4시 1분 27초 UTC+9, Mingkui Liu 님의 말:

Mingkui Liu

unread,
Apr 10, 2014, 3:55:27 AM4/10/14
to jedis...@googlegroups.com
Thanks,
But you know the slave may be promoted to master, how can i use multi slaves by Jedis and do not read from master?
can you describe more concrete? it will be better if you could give some code/config example.
Thanks, guy.


--
You received this message because you are subscribed to a topic in the Google Groups "Jedis" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jedis_redis/6UgoWVKhpIM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jedis_redis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best Regards
Mingkui Liu
@Hulu Beijing

정택 임

unread,
Apr 10, 2014, 4:06:06 AM4/10/14
to jedis...@googlegroups.com
I’m using JedisSentinelPool with no query offloading. So it’s not real scenario.

JedisSentinelPool tells only current master, so you cannot get slaves from JedisSentinelPool.
You need to store master & slaves, or make connection to one of Sentinel by Jedis instance and query redis instances list.
(It may good point to improve - you can contribute to Jedis! )

Now we have all redis instances information, then it’s simple.
If you need to read from slaves, "try to random pick instance but not master", and do read using Jedis instance.

I have no time to show example, but I think you can understand. :)

2014. 4. 10., 오후 4:55, Mingkui Liu <liumi...@gmail.com> 작성:

Mingkui Liu

unread,
Apr 10, 2014, 4:23:23 AM4/10/14
to jedis...@googlegroups.com
Yes, it is very clear, i understood it well.
sentinel slaves master-name will return the slave lists.

That will be exciting if I can contribute to Jedis.

Thanks 정택 임
Reply all
Reply to author
Forward
0 new messages