From b224f18b283dd9d7dd4a75b9810859a5f813b99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=A1gr?= Date: Wed, 26 Jan 2022 13:48:31 +0100 Subject: [PATCH] Increase connection timeouts for Redis When using py-redis for connecting to Redis via HAProxy the connection is being closed even when alive by HAProxy. Unfortunately this is a know issue on py-redis side (see [1]). This patch increases connection timeouts to not pollute (for example) Gnocchi [2] logs with reconnect tracebacks every 2 minutes. [1] https://github.com/redis/redis-py/issues/1140 [2] https://bugzilla.redhat.com/show_bug.cgi?id=1924373 Change-Id: Ie7ee7c90107cfe5bff08f5c778a6273ae9ffcc76 (cherry picked from commit 209e954c5f77d827ca0dff836d86b10fa04f80c3) --- manifests/haproxy.pp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/manifests/haproxy.pp b/manifests/haproxy.pp index ad2a74de1..6e7854ee7 100644 --- a/manifests/haproxy.pp +++ b/manifests/haproxy.pp @@ -1618,15 +1618,17 @@ bind => $redis_bind_opts, collect_exported => false, options => { + 'timeout client' => '90m', 'default_backend' => 'redis_be', 'option' => [ 'tcplog' ], }, } haproxy::backend { 'redis_be': options => { - 'balance' => 'first', - 'option' => [ 'tcp-check' ], - 'tcp-check' => $redis_tcp_check_options, + 'timeout server' => '90m', + 'balance' => 'first', + 'option' => [ 'tcp-check' ], + 'tcp-check' => $redis_tcp_check_options, }, } $redis_service = 'redis_be' @@ -1634,9 +1636,11 @@ haproxy::listen { 'redis': bind => $redis_bind_opts, options => { - 'balance' => 'first', - 'option' => [ 'tcp-check', 'tcplog' ], - 'tcp-check' => $redis_tcp_check_options, + 'balance' => 'first', + 'timeout client' => '90m', + 'timeout server' => '90m', + 'option' => [ 'tcp-check', 'tcplog' ], + 'tcp-check' => $redis_tcp_check_options, }, collect_exported => false, }