Redisson complains about multiple masters when two replicated address nodes resolve to the same IP
See original GitHub issueWe are working through issues with using Redisson with AWS Elasticache during upgrade/failover/etc.
We currently have a replicated cluster of size 2: 1 master and 1 replicated node. AWS Elasticache provides us with two DNS endpoints to use:
- master.
<redacted>
.cache.amazonaws.com:6379 - replica.
<redacted>
.cache.amazonaws.com:6379
During normal operation both of these DNS entries will resolves to different IP addresses, however during upgrade/failover it is possible that only one cluster node is available and the DNS entries will resolve to the same IP addresses.
Even when operating the cluster with 1 node I think this should be allowed. This allows infrastructure teams to easily to scale up/down underlying cluster nodes load balanced by DNS without having to modify the application config to include/exclude certain hostnames.
Expected behavior
Redisson should tolerate when more than one node address resolves to the same IP address, that happens to be a master in the cluster.
Actual behavior
org.redisson.connection.ReplicatedConnectionManager.<init>(ReplicatedConnectionManager.java:80) org.redisson.Redisson.<init>(Redisson.java:67) org.redisson.config.ConfigSupport.createConnectionManager(ConfigSupport.java:199) org.redisson.Redisson.create(Redisson.java:108)
<redacted>
.main(Application.kt:97) Exception in thread “main” org.redisson.client.RedisException: Multiple masters detected
Steps to reproduce or test case
Initialize replicated configuration with two DNS entries that resolve to the same IP address.
Redis version
6+
Redisson version
3.15.2
Redisson configuration
final Config config = new Config();
final ReplicatedServersConfig replicatedConfig = config.useReplicatedServers();
replicatedConfig.addNodeAddress("AWS Elasticache primary endopoint");
replicatedConfig.addNodeAddress("AWS Elasticache replica endpoint");
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
dnsMonitoring will be disabled, since host name resolution is always executed in config check scheduler. Next release will compare resolved ip and not host name as before to detect master change.
Thank you
I had one more question regarding this change.
Will the dnsMonitoring feature be available for replicated mode in the next release ?