two questions about RedisCluster

177 views
Skip to first unread message

rhaona...@gmail.com

unread,
Jul 29, 2015, 2:15:58 PM7/29/15
to Redis DB
hello,

I would like to ask two questions about RedisCluster
1. Is the slave in a RedisCluster can't be read and written? is it just a backup ? can i read/write it by manually set ?
2. does the RedisCluster achieve loadblance?How?

Salvatore Sanfilippo

unread,
Jul 29, 2015, 2:40:00 PM7/29/15
to Redis DB
On Wed, Jul 29, 2015 at 7:57 PM, <rhaona...@gmail.com> wrote:
> hello,

Hello,

> I would like to ask two questions about RedisCluster
> 1. Is the slave in a RedisCluster can't be read and written? is it just a
> backup ? can i read/write it by manually set ?

The READONLY command allows you to read from slaves. They can't be
used to scale writes.

> 2. does the RedisCluster achieve loadblance?How?

By resharding hash slots from nodes with more load to nodes with less
loads. Reads instead are scaled using slaves & READONLY.

> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/d/optout.



--
Salvatore 'antirez' Sanfilippo
open source developer - Redis Labs https://redislabs.com

"If a system is to have conceptual integrity, someone must control the
concepts."
— Fred Brooks, "The Mythical Man-Month", 1975.

rhaona...@gmail.com

unread,
Aug 4, 2015, 4:03:58 AM8/4/15
to Redis DB
thank you,
but i don't understand the READONLY command very well,and i didn't find it in http://redis.io/commands.
when i used get key on a Slave node,it moved my command to its Master(by using redis-cli). I use jedis as my client , it is also the same situation. If i read from a Slave ip(new jedis instance),it will be an error an and give me a "moved" info.
I  want to know if i read from my cluster(jediscluster instance),will it read from slave in my cluster automatically? Did RedisCluster achieved Read/Write Splitting transparently?

在 2015年7月30日星期四 UTC+8上午2:40:00,Salvatore Sanfilippo写道:

rhaona...@gmail.com

unread,
Aug 4, 2015, 4:20:13 AM8/4/15
to Redis DB
I test the READONLY command by redis-cli just now,it is useful.
But when if i restart the client(redis-cli),i need to use READONLY command again.
I use jedis now,how can i read from  Slave nodes?


在 2015年7月30日星期四 UTC+8上午2:40:00,Salvatore Sanfilippo写道:
On Wed, Jul 29, 2015 at 7:57 PM,  <rhaona...@gmail.com> wrote:

Mark Paluch

unread,
Aug 4, 2015, 9:21:21 AM8/4/15
to Redis DB
If you want to read from slaves, then you have to connect yourself to the slave you want to use. AFAIK there is no Java client, that supports a read from slave behavior. antirez gave some insight on his view of cluster clients some time ago.

I'm collecting use cases with lettuce 4.0 on this topic to implement master preferred/slave preferred/nearest node read semantics. The development version of lettuce 4.0 allows to execute commands on a specific set of nodes.
Reply all
Reply to author
Forward
0 new messages