栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException:

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException:

org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379

找一下原因:

如果是远程访问redis:

1.redis.conf文件有一项配置默认是bind 127.0.0.1,也就是默认只支持本机访问Redis,你把这一项注释掉。

2.找到protected-mode yes 把它改成no。

3.查看虚拟机防火墙是否关闭

4.改完后要重启redis

如果是本机访问:

一般是配置文件的错误

1.查看配置文件 redis的ip地址和端口是否正确 本地一般配置是 127.0.0.1:6379

redis默认的端口是6379 如果改过就用改过的

2.spring.redis.timeout=10000 设置一下连接超时的时间

3.配置文件的连接密码,是否正确,如果没有设置密码,不必写上

4.查看本地的redi是否是启动状态

spring.redis.host=127.0.0.1
spring.redis.port=6379 
spring.redis.password=1234  #没有密码 可以不写
spring.redis.timeout=10000

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/781254.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号