Redis:Can‘t connect to master: redis://127.0.0.1:7002 with slot ranges: [[10923-16383]]

介绍

在使用redis做集群的时候,启动SpringBoot遇到的问题。

2020-12-21 16:22:03.294 ERROR 2192 --- [isson-netty-2-8] o.r.cluster.ClusterConnectionManager     : Can't connect to master: redis://127.0.0.1:7003 with slot ranges: [[5461-10922]]
2020-12-21 16:22:03.294 ERROR 2192 --- [isson-netty-2-7] o.r.cluster.ClusterConnectionManager     : Can't connect to master: redis://127.0.0.1:7002 with slot ranges: [[10923-16383]]
2020-12-21 16:22:03.294 ERROR 2192 --- [isson-netty-2-9] o.r.cluster.ClusterConnectionManager     : Can't connect to master: redis://127.0.0.1:7005 with slot ranges: [[0-5460]]
2020-12-21 16:22:05.391  WARN 2192 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redissonController' defined in file [D:\Space\Projects\JavaWeb\Java-Practice\spring-redisson\target\classes\com\example\demo\config\RedissonController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisson' defined in class path resource [org/redisson/spring/starter/RedissonAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redisson' threw exception; nested exception is org.redisson.client.RedisConnectionException: Can't connect to servers!
2020-12-21 16:22:05.401  INFO 2192 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2020-12-21 16:22:05.443  INFO 2192 --- [           main] ConditionEvaluationReportLoggingListener : 

解决办法

检查redis.conf是否配置了bind 127.0.0.1,如果有注释掉,另外把protected-mode设置为no

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
出现"Can't connect to sentinel server. Unable to connect to: rediss://127.0.0.1:6379"这个错误的原因是无法连接到Redis Sentinel服务器。根据引用中的错误信息,可以看出是Redis连接异常导致的。 根据引用提供的信息,可能是由于外网无法连接到Redis服务器导致的问题。需要确保Redis服务已启动并且安全组配置正确。可以尝试使用telnet命令来测试连接Redis服务器的IP地址和端口是否可用。 此外,根据引用的建议,还可以尝试修改Redis配置文件redis.conf,将"bind 127.0.0.1"修改为"bind 0.0.0.0"或者需要绑定的IP地址,并重启Redis服务来解决问题。 总结起来,解决"Can't connect to sentinel server. Unable to connect to: rediss://127.0.0.1:6379"错误的步骤如下: 1. 确保Redis服务已经启动并且安全组配置正确。 2. 使用telnet命令测试连接Redis服务器的IP地址和端口是否可用。 3. 如果无法连接,尝试修改Redis配置文件redis.conf,将"bind 127.0.0.1"修改为"bind 0.0.0.0"或者需要绑定的IP地址。 4. 重启Redis服务。 这些步骤可以帮助您解决无法连接到Redis Sentinel服务器的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [redisson-spring-boot-starter Unable to connect to Redis server: 127.0.0.1/127.0.0.1:6381](https://blog.csdn.net/madness1010/article/details/122298141)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [SpringBoot整合redis报错:Unable to connect to xx.xx.xx.xx:6379](https://blog.csdn.net/chengtry/article/details/121694025)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值