The following errors occur when using SpringBoot to integrate Redis:
org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool;
nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to X.X.X.X:6379
Caused by: io.netty.channel.ConnectTimeoutException: connection timed out: /X.X.X.X:6379
Solution:
1. View the application.properties configuration file
#虚拟机ip地址
spring.redis.host=XXXXX
#redis端口号
spring.redis.port=6379
# Redis数据库索引(默认为0)
spring.redis.database= 0
spring.redis.timeout=1800000
spring.redis.lettuce.pool.max-active=20
# 连接池最大连接数(负数表示没限制)
spring.redis.lettuce.pool.max-wait=-1
# 连接池中的最大空闲连接
spring.redis.lettuce.pool.max-idle=5
# 连接池中的最小空闲连接
spring.redis.lettuce.pool.min-idle=0
2. View the information in the redis.config file:
1.redis.conf cancels the protection mode
protected-mode no
2. Annotate bind 127.0.0.1
Three, open the 6379 port of redis (mine is solved in this way)
Finally solved perfectly! ! ! !