首页 > 数据库 >python redis keepalive 保活

python redis keepalive 保活

时间:2023-03-23 12:33:11浏览次数:50  
标签:socket python REDIS redis 保活 timeout True keepalive

 

https://dxian.github.io/2016/07/21/python-redis-subscribe-tcp-keepalive/

 

https://github.com/opennumber/opennumber/blob/bab590c29ab227bbcf1c301cf454c0e6681a64cc/src/context.py

 

pool = redis.ConnectionPool(host=REDIS_HOST,
                            port=REDIS_PORT,
                            password=REDIS_PW,
                            max_connections=1,
                            decode_responses=True,
                            retry_on_timeout=True,
                            socket_timeout=10,
                            socket_connect_timeout=9,
                            socket_keepalive=True,
                            socket_keepalive_options={
                                socket.TCP_KEEPIDLE: 120,
                                socket.TCP_KEEPCNT: 2,
                                socket.TCP_KEEPINTVL: 30
                            },
                            health_check_interval=30,
                            db=REDIS_DB)
db_redis = redis.Redis(connection_pool=pool, retry_on_error=True)

 

标签:socket,python,REDIS,redis,保活,timeout,True,keepalive
From: https://www.cnblogs.com/angdh/p/17247029.html

相关文章