更新时间:2025-08-12 gmt 08:00

redis健康检查-j9九游会登录

配置redis定时健康检查

redis健康检查的作用是判断redis服务端是否正常工作,使用health_check_interval配置对redis进行定时健康检查,该配置单位为秒,默认值为0不进行健康检查,代码如下:
    retry = retry(exponentialbackoff(), 3)
    pool = blockingconnectionpool(host=redis_host, port=redis_port,
                                  password=redis_password,
                                  max_connections=50, timeout=3,
                                  socket_timeout=2,
                                  socket_connect_timeout=2,
                                  retry=retry,
                                  retry_on_error=[busyloadingerror,
                                                  connectionerror,
                                                  timeouterror],
                                  health_check_interval=60,
                                  decode_responses=true)

如果业务量大建议不使用该配置,进而减少开销。

相关文档

网站地图