SpringBoot error connecting to redis:exception is io.lettuce.core.RedisException: java.io.IOException: remote host forced an existing connection to close
Technical otaku
2022-12-16
1. Solutions
(1). Check whether the configuration of redis is correct
the spring
redis:
host: localhost
port: 6379
password: 123456
database: 0
timeout: 60s
## Change the connection pool from jedis to lettuce after springboot2.0
lettuce:
pool:
max-idle: 30
max-active: 8
max-wait: 10000
min-idle: 10
(2). At the same time, configure the tcp-keepalive time in redis.conf to be 60s; the redis-3.2.1 version defaults to 300, and the above problem does not appear after setting 60

0 Comments