Redis叢集 JedisNoReachableClusterNodeException異常(No reachable node in cluster)
阿新 • • 發佈:2018-12-08
redis.clients.jedis.exceptions.JedisNoReachableClusterNodeException: No reachable node in cluster at redis.clients.jedis.JedisSlotBasedConnectionHandler.getConnection(JedisSlotBasedConnectionHandler.java:57) at redis.clients.jedis.JedisSlotBasedConnectionHandler.getConnectionFromSlot(JedisSlotBasedConnectionHandler.java:74) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:116) at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:31) at redis.clients.jedis.JedisCluster.get(JedisCluster.java:124) at cn.tbnb1.service.redis.RedisCacheService.get(RedisCacheService.java:55) at cn.tbnb1.seckil.controller.SeckillController.resultQuery(SeckillController.java:68) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)
呼叫JedisCluster.close()方法造成的,我們使用的是redis3.0的叢集,用jedis的JedisCluster.close()方法造成的叢集連線關閉的情況。 jedisCluster內部使用了池化技術,每次使用完畢都會自動釋放Jedis因此不需要關閉。如果呼叫close方法後再呼叫jedisCluster的api進行操作時就會出現如上錯誤。
參考連結:http://www.cnblogs.com/java-synchronized/p/7910716.html