I'm using redisson with ratpack. Below is the configuration I've set for redisson.
Config redissionConfig = new Config();
redissionConfig.setTransportMode(TransportMode.EPOLL);
redissionConfig.useClusterServers()
.addNodeAddress(System.getenv("redis_url"))
.addNodeAddress("redis://XXX.XX.XXX.X:6379","redis://XXX.XX.XXX.X:6379","redis://XXX.XX.XXX.X:6379",
"redis://XXX.XX.XXX.X:6379","redis://XXX.XX.XXX.X:6379",
"redis://XXX.XX.XXX.X:6379","redis://XXX.XX.XXX.X:6379",
"redis://XXX.XX.XXX.X:6379","redis://XXX.XX.XXX.X:6379")
.setPassword(System.getenv("redis_password"))
.setKeepAlive(config.keepAlive)
.setPingTimeout(1000)
.setConnectTimeout((int) config.getConnectTimeoutMillis())
.setFailedSlaveReconnectionInterval(30000)
.setReadMode(ReadMode.MASTER_SLAVE)
.setMasterConnectionPoolSize(100)
.setIdleConnectionTimeout(60000)
.setSlaveConnectionPoolSize(100)
.setRetryAttempts(2);
RedissonClient redclient = Redisson.create(redissionConfig);
redclient.getKeys();
redclient.getLock("").delete();
I've added all of the master and slave IPs as node addresses in the configuration and the IPs added above are floating IPs. Redisson is able to make connections with all except one master node. But, the error message for the same displays the internal IP of the master node as opposed to the floating IP that I have added in the redisson config. The error message I get is the following
{"timeMillis":1522752497107,"thread":"redisson-netty-9-8","level":"ERROR","loggerName":"org.redisson.cluster.ClusterConnectionManager","message":"Can't connect to master: redis://192.168.197.2:6379 with slot ranges: [[0-5460]]","endOfBatch":true,"loggerFqcn":"org.apache.logging.slf4j.Log4jLogger","contextMap":{},"threadId":48,"threadPriority":5}
Followed by a RedisConnectionException:
org.redisson.client.RedisConnectionException: Not all slots are covered! Only 10923 slots are avaliable
Any insights into this matter are much appreciated.
In cluster mode you don't need to specify all Redis nodes. Only one node is required. Redisson fetches cluster info got from first available Redis node. Check your Redis cluster config. It contains wrong Redis ip.