背景交代:
公司某个项目,生产环境用的自建在服务器内的redis ,由于访问量不大,redis用的是单机的
针对自建的redis ,我一直是持有不看好意见的。自建redis 容易宕机,宕机后数据全无,且监控难做,虽然有普米修斯这种监控工具面板,但粒度、报警等还是达不到实际需求。当然 如果你们公司有能力,有专门的团队开发运维监控工具当我没说。
线上大促期间发生了几次,redis 报错问题,排查日志后,原因大多为报错:JedisConnectionException: Could not get a resource from the pool
因为自建redis,无法细粒度看到过去时间的连接数、连接池资源,排查问题难上加南。
一、迁移前
redis 连接池 逻辑代码
@Data
@Configuration
public class JedisConfig {
@Value("${spring.jedis.config.db}")
private Integer db;
@Value("${spring.jedis.config.maxTotal}")
private Integer maxTotal;
@Value("${spring.jedis.config.maxIdle}")
private Integer maxIdle;
@Value("${spring.jedis.config.minIdle}")
private Integer minIdle;
@Value("${spring.jedis.config.maxWaitMillis}")
private Long maxWaitMillis;
@Value("${spring.jedis.config.testOnBorrow}")
private Boolean testOnBorrow;
@Value("${spring.jedis.host}")
private String host;
@Value(

最低0.47元/天 解锁文章
7494

被折叠的 条评论
为什么被折叠?



