redisson java客户端可以检测群集拓扑中重新启动失败的主副本对吗?

我的Spring启动应用程序使用redisson 3.3.0来访问具有以下YML配置的redis集群拓扑:

redis:
   cluster:
       nodes: ${CLUSTER_HOST}:6379
       read-mode: 'MASTER'
   connections: 125
   max_wait_millis: 10000
   cluster-scan-interval: 1000

redis群集设置为默认值(3个节点,每个节点1个副本) .

我停止包含相同插槽的2个节点(主副本对) . 然后,当我的应用程序尝试从这些插槽中读取密钥时,正如预期的那样,我得到了以

org.redisson.client.RedisConnectionException: 
MasterConnectionPool no available Redis entries.  
Disconnected hosts: [/${CLUSTER_HOST}:6379]

我认为这是正确的,因为在使用CLUSTER NODES命令检查我的redis节点后,我可以看到2个节点已关闭,并且群集中缺少其插槽 .

事情是,当我再次启动节点时,我使用群集返回的CLUSTER INFO和CLUSTER NOD来检查 . 然而,当我的应用程序试图从群集中再次读取时,我得到了这个redisson异常:

io.netty.util.concurrent.DefaultPromise: 151 - An 
    exception was thrown by org.redisson.command.CommandAsyncService$9.operationComplete()
java.lang.NullPointerException: null
    at org.redisson.connection.MasterSlaveConnectionManager.connectionReadOp(MasterSlaveConnectionManager.java:731)
    at org.redisson.command.CommandAsyncService.async(CommandAsyncService.java:501)
    at org.redisson.command.CommandAsyncService.checkAttemptFuture(CommandAsyncService.java:751)
    at org.redisson.command.CommandAsyncService.access$300(CommandAsyncService.java:80)
    at org.redisson.command.CommandAsyncService$9.operationComplete(CommandAsyncService.java:610)
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:512)
    at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:505)
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:484)
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:425)
    at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:122)
    at org.redisson.misc.RedissonPromise.tryFailure(RedissonPromise.java:98)
    at org.redisson.client.protocol.CommandData.tryFailure(CommandData.java:78)
    at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:247)
    at ...

每次我的应用程序尝试从/向那些特定的插槽(意味着特定的主副本对)读取或写入时,我都会继续这样做,尽管redis集群是正常的 .

Redisson似乎无法检索特定主副本对的正确状态 .

这可能是配置问题,还是默认行为?

回答(0)