question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does RedissonRedLock support Redis cluster Master/Slave mode?

See original GitHub issue

In this issuehttps://github.com/redisson/redisson/issues/1333#issuecomment-371817371 I found that RedissonRedLock supports Redis cluster mode. In the Redlock algorithm https://redis.io/topics/distlock,I don’t think it supports Master/Slave mode.The description is:

In the distributed version of the algorithm we assume we have N Redis masters. Those nodes are totally independent, so we don’t use replication or any other implicit coordination system.

For example: The Redis cluster 1 is as follows: Master1 Slave1 Master2 Slave2 Master3 Slave3

The Redis cluster 2 is as follows: Master1 Master2 Master3

I am troubled. Does it support type of Redis cluster 1 ? .If it supports then how do I add a configuration, whether the master and slave are added or only the master configuration is added. For example : Add as type1

Config config = new Config();
config.useClusterServers().addNodeAddress(Master1, Master2,Master3, Slave1,Slave2, Slave3);
RedissonClient redisson = Redisson.create(config);
RLock lock1 = redisson.getLock(lockName + "1");
RLock lock2 = redisson.getLock(lockName + "2");
RLock lock3 = redisson.getLock(lockName + "3");
RLock lock4 = redisson.getLock(lockName + "4");
RLock lock5 = redisson.getLock(lockName + "5");
RLock lock6 = redisson.getLock(lockName + "6");

Add as type2

Config config = new Config();
config.useClusterServers().addNodeAddress(Master1, Master2,Master3);
RedissonClient redisson = Redisson.create(config);
RLock lock1 = redisson.getLock(lockName + "1");
RLock lock2 = redisson.getLock(lockName + "2");
RLock lock3 = redisson.getLock(lockName + "3");

Add as type3

Config config = new Config();
config.useClusterServers().addNodeAddress(Master1, Master2,Master3, Slave1,Slave2, Slave3);
RedissonClient redisson = Redisson.create(config);
RLock lock1 = redisson.getLock(lockName + "1");
RLock lock2 = redisson.getLock(lockName + "2");
RLock lock3 = redisson.getLock(lockName + "3");

Which type should I choose,or they are all wrong?

Redis version

3.x

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
faceanycommented, Nov 13, 2018

@mrniko I know it. I am concerned about is that the master node is hung. When switching from the node, it will cause the red lock to be lost, resulting in a deadlock. E.g: (1) If the cluster has 5 active and standby nodes, process P1 requests to acquire lock lock1 (on Node Master1), lock2 (on Node Master2), lock3 (on Node Master3), lock4 (on Node Master4), lock5 (on Node Master5) ). Finally got lock1, lock2, lock3. Because lock4, lock5 is obtained by P2. (2) Master1 hangs, switches Slave1, and loses lock1. (3) Process P2 requests to acquire locks lock1, lock2, lock3, lock4, lock5, acquire lock lock1 (on Node Slave1), lock4 (on Node Master4), lock5 (on Node Master5). lock2 and lock3 fail to be acquired by P1. . (4) P1, P2 have acquired the lock According to the algorithm, I understand that there should be no slave nodes. Is my understanding correct?

0reactions
jackyguruicommented, Nov 28, 2019

You can use predetermined value in the key name and use {} to force the key slot calculation onto your desired node.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redis Master-Slave Replication - Redisson
Master-slave replication is an important technique for ensuring the performance and availability of your data. In this article, we'll discuss the topic of ......
Read more >
Redis: Master-Slave Architecture - Medium
Redis server can be run in two modes: Master Mode (Redis Master); Slave Mode (Redis Slave or Redis Replica). We can configure which...
Read more >
What are Redis master-slave and Redis clusters ... - Learn Steps
In this mode, there are a set of nodes that are masters and a set of nodes that are slaves or replicas. They...
Read more >
What is the difference between:Redis Replicated setup, Redis ...
Disclaimer I am an AWS employee. I do not know how Redis Replicated Setup is different from Redis in Master-Slave mode.
Read more >
Redis Cluster: Architecture, Replication, Sharding and Failover
During the initial phase we placed Redis in a Master Slave mode with ... Here, Redis service will be running on port 6379...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found