org.springframework.data.redis.RedisConnectionFailureException

application.properties 配置

spring.redis.host=192.168.59.131
spring.redis.port=6379
#spring.redis.password=root #根据需要
# Redis数据库索引(默认为0)
spring.redis.database=0
# 连接池最大连接数(使用负值表示没有限制)
spring.redis.pool.max-active=8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.pool.max-wait=-1
# 连接池中的最大空闲连接
spring.redis.pool.max-idle=8
# 连接池中的最小空闲连接
spring.redis.pool.min-idle=0
# 连接超时时间(毫秒)
spring.redis.timeout=0

编辑 redis 配置 文件

查找 文件 位置

find / -name find /-name redis.conf

vim 地址路径

VIM编辑

  1. 关闭redis的保护模式
protected-mode = no

3.注释掉绑定的默认ip

# bin 1270.0.0.1

4.关闭防火墙

centOS7的命令:
systemctl stop firewalld
 
centOS6及之前的命令:
service iptables stop

原文地址:https://www.cnblogs.com/userzf/p/14669817.html