原因:io.lettuce.core.RedisConnectionException:XXXX:6379に接続できません

SpringBootを使用して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


解決:

1.application.properties構成ファイルを表示します

#虚拟机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.redis.configファイルの情報を表示します。

1.redis.confは保護モードをキャンセルします

protected-mode no 

2.バインド127.0.0.1に注釈を付けます
ここに画像の説明を挿入します

3つ目は、redisの6379ポートを開きます(私の方法で解決されます)

ここに画像の説明を挿入しますついに完全に解決しました!
ここに画像の説明を挿入します

おすすめ

転載: blog.csdn.net/weixin_44421869/article/details/106949630