首页

解决java代码示例连接redis集群时报"redis.clients.jedis.exceptions.JedisNoReachableClusterNodeException: No reachable node in cluster"异常

标签:JedisNoReachableClusterNodeException,redis集群异常,JedisCluster,HostAndPort     发布时间:2019-04-22   

一、异常说明

在进行redis5.0集群配置后,通过java示例代码进行连接测试验证报"redis.clients.jedis.exceptions.JedisNoReachableClusterNodeException: No reachable node in cluster"异常,详情日志如下>>

Exception in thread "main" redis.clients.jedis.exceptions.JedisNoReachableClusterNodeException: No reachable node in cluster@b@	at redis.clients.jedis.JedisSlotBasedConnectionHandler.getConnection(JedisSlotBasedConnectionHandler.java:61)@b@	at redis.clients.jedis.JedisSlotBasedConnectionHandler.getConnectionFromSlot(JedisSlotBasedConnectionHandler.java:78)@b@	at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:102)@b@	at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:25)@b@	at redis.clients.jedis.JedisCluster.set(JedisCluster.java:112)@b@	at com.xwood.redis.cluster.JedisClusterTest.main(JedisClusterTest.java:25)

二、解决方法

主要因redis集群配置文件redis.conf配置文件中"bind 127.0.0.1"修改具体本地ip地址如"bind  192.168.1.204"  (完整详细配置步骤参见”redis集群配置..示例代码“文章)

[root@centos-cluster-s19423 redis-cluster-conf]# vi   /home/app/redis5/redis-cluster-conf7001/redis.conf@b@...@b@#bind 127.0.0.1@b@bind  192.168.1.204@b@...
<<热门下载>>