zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

解决Unable to connect to Redis server: 192.168.110.1/192.168.110.1:6379[通俗易懂]

Redisserver 解决 通俗易懂 to unable connect 6379
2023-06-13 09:11:58 时间

大家好,又见面了,我是你们的朋友全栈君。

出现场景: springboot整合redis,启动项目时

出现原因: redis的一系列配置不正确 解决方案: 首先在window安装redis,找到安装目录下的

redis.windows.conf

redis.windows-service.conf

1)修改 protected-mode yes 改为:protected-mode no

2)注释掉 #bin 127.0.0.1

3)application.yml的redis配置中的spring.redis.timeout中连接超时时间(毫秒)中时间设置不能为0

4)redis如果没有密码,则需把密码的设置注释

我的配置如下(仅供参考)

# redis配置
# Redis服务器地址
spring.redis.host=192.168.110.1
# Redis服务器连接端口
#spring.redis.port=8895
spring.redis.port=6379
# Redis服务器连接密码
#spring.redis.password=123456
# 连接池最大连接数(使用负值表示没有限制)
spring.redis.jedis.pool.max-active=8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.jedis.pool.max-wait=-1
# 连接池中的最大空闲连接
spring.redis.jedis.pool.max-idle=20
# 连接池中的最小空闲连接
spring.redis.jedis.pool.min-idle=0
# 连接超时时间(毫秒)
spring.redis.timeout=5000

然后重新启动redis的服务,运行通过防火墙,运行项目即可

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/135526.html原文链接:https://javaforall.cn