简体   繁体   English

Redisson尝试连接到内部Redis IP,而不是配置中指定的浮动Redis IP

[英]Redisson tries to connect to internal redis IP instead of floating redis IP specified in config

I'm using redisson with ratpack. 我正在将redisson与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. 我已将所有主IP和从IP添加为配置中的节点地址,并且上面添加的IP是浮动IP。 Redisson is able to make connections with all except one master node. Redisson能够与除一个主节点之外的所有节点建立连接。 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. 但是,相同的错误消息显示的是主节点的内部IP,而不是我在redisson配置中添加的浮动IP。 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: 紧接着是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. 在集群模式下,您无需指定所有Redis节点。 Only one node is required. 只需要一个节点。 Redisson fetches cluster info got from first available Redis node. Redisson将从第一个可用的Redis节点获取集群信息。 Check your Redis cluster config. 检查您的Redis集群配置。 It contains wrong Redis ip. 它包含错误的Redis ip。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM