i'm a newbie for redis, i've just been using redis for couple of months. Currently i'm using 2.8.x stable version but i'm trying to use 3.0.0 to import redis cluster funtions. i'm using java jedis as client,and here is my problem:i found that the latest version of Jedis client support redis cluster lua scripting(JedisCluster.evalsha), but nowhere i can find pipelining and transaction related functions, so i was wondering if it is Jedis that have not implement it(pipeline, transactions) yet or is it just redis cluster does not support pipelining and transactions at all?
Asked
Active
Viewed 4,666 times
1 Answers
4
JedisCluster didn't implement Transaction and Pipeline since it is hard to implement. Redis can send MOVED or ASK while it's in cluster mode, and it means that we should take care of moving slot between nodes.
I was thinking about pipeline mode of JedisCluster, but no further research is being held. https://groups.google.com/d/msg/jedis_redis/u6j8slokO3E/Dh5Q94TRjJUJ
Currently Jedis team is focusing to stabilize / provide more APIs to JedisCluster.

Jungtaek Lim
- 1,638
- 1
- 12
- 20
-
Hi, in our case, we are using lots of transactions and pipelines. So if we want to use JedisCluster, do we have to rewrite all those pipelined or transactioned use-cases into lua scripts? – Kim Jun 12 '15 at 09:01
-
Unfortunately yes. Only way to send two or more operations at once safely with "Redis Cluster" is batching with multi-exec. But it would request a lot of works to implement since Jedis didn't think about batched requests. – Jungtaek Lim Jun 12 '15 at 09:05
-
If you're sure that you don't move slot while requesting, you can query "what node is having slot" to any node of Redis Cluster, and create Jedis instance, and request like normal Redis & Jedis. You can query about key -> slot using JedisClusterCRC16, but currently Jedis doesn't provide slot -> node query externally. – Jungtaek Lim Jun 12 '15 at 09:12
-
EDIT: You can query slot -> node via JedisClusterInfoCache. JedisClusterInfoCache.discoverClusterNodesAndSlots() discovers and map slot -> node relations, and JedisClusterInfoCache.getSlotPool() gives you JedisPool connected to node holding slot. Please note that it doesn't reflect node/slot changes automatically, so you may need to call JedisClusterInfoCache.discoverClusterSlots() frequently. – Jungtaek Lim Jun 12 '15 at 09:40
-
Thank you for your patience. It seems neither does ShardedJedis support pipelines and transactions perfectly, so in our case i guess we will have to choose the following two sollutions : 1, use JedisCluster and rewrite all transactions and pipelines into lua scripts, in this case all redis servers will take equal workloads; 2, use ShardedJedis, do all the write related works to the master-redis, and other read works(including pipelined read) with ShardedJedis to slave-redis. Am I right? – Kim Jun 12 '15 at 10:02
-
ShardedJedis doesn't support Redis Cluster so you need to know what's difference between ShardedJedis and Redis Cluster. If Redis Cluster fits for you, 1 seems to be better solution. – Jungtaek Lim Jun 12 '15 at 10:20
-
Btw, Jedis team is discussing about new API which returns node information when users present key for query. Please refer https://github.com/xetorthio/jedis/issues/988 – Jungtaek Lim Jun 12 '15 at 10:27
-
Sorry I have to correct one thing, lua script feature in JedisCluster will be introduced to 2.8.0 (it's in master branch but we should backport to 2.x) so you have to wait some weeks. https://github.com/xetorthio/jedis/issues/987 – Jungtaek Lim Jun 13 '15 at 01:24
-
Is it that transactions are not supported by Redis Cluster itself or just that jedis hasn't implemented it? Is there a client that has implemented transactions in cluster mode? – krackoder Oct 09 '18 at 01:56