更新时间:2023-11-06 GMT+08:00
分享

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)

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

分享:

    相关文档

    相关产品