开发者社区> 问答> 正文

idea使用jedis连接Centos中的Redis集群时出现Connection refused:

错误信息: Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at redis.clients.util.Pool.getResource(Pool.java:53) at redis.clients.jedis.JedisPool.getResource(JedisPool.java:226) at redis.clients.jedis.JedisSlotBasedConnectionHandler.getConnectionFromSlot(JedisSlotBasedConnectionHandler.java:66) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:116) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:141) at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:31) at redis.clients.jedis.JedisCluster.set(JedisCluster.java:103) at com.xzk.Demo3.main(Demo3.java:25) Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect at redis.clients.jedis.Connection.connect(Connection.java:207) at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:93) at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1767) at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:106) at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363) at redis.clients.util.Pool.getResource(Pool.java:49) ... 10 more Caused by: java.net.ConnectException: Connection refused: connect at java.base/java.net.PlainSocketImpl.waitForConnect(Native Method) at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403) at java.base/java.net.Socket.connect(Socket.java:608) at redis.clients.jedis.Connection.connect(Connection.java:184) ... 17 more

我在单独使用6379端口号做连接测试或连接池测试时都可以成功,但是在使用集群时就会报错。 在安全组规则中已经配置了那12个端口号(7001-7006、17001-17006),出入方向都有

这个具体错误是什么?怎么修改呀?

展开
收起
游客r5uwyhh3pmxrm 2020-11-27 21:13:14 1185 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
蚂蚁金服高级开发工程师萧恺:IDEA 插件开发入门教程 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载