Skip to content

Commit 810f5b3

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Allow user to set sysctl_net_ipv4_tcp_retries2" into stable/wallaby
2 parents bd0bcd7 + 8521ddc commit 810f5b3

File tree

6 files changed

+79
-3
lines changed

6 files changed

+79
-3
lines changed

ansible/roles/haproxy/defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,8 @@ haproxy_check_timeout: "10s"
9090
# Check http://www.haproxy.org/download/1.5/doc/configuration.txt for available options
9191
haproxy_defaults_balance: "roundrobin"
9292

93+
# Avoid TCP connections refusing to die after VIP switch
94+
# https://bugs.launchpad.net/kolla-ansible/+bug/1917068
95+
haproxy_host_ipv4_tcp_retries2: "KOLLA_UNSET"
96+
9397
kolla_externally_managed_cert: False

ansible/roles/haproxy/tasks/config-host.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
sysctl_file: "{{ kolla_sysctl_conf_path }}"
1111
become: true
1212
with_items:
13-
- { name: "net.ipv4.ip_nonlocal_bind", value: 1}
14-
- { name: "net.ipv6.ip_nonlocal_bind", value: 1}
15-
- { name: "net.unix.max_dgram_qlen", value: 128}
13+
- { name: "net.ipv4.ip_nonlocal_bind", value: 1 }
14+
- { name: "net.ipv6.ip_nonlocal_bind", value: 1 }
15+
- { name: "net.ipv4.tcp_retries2", value: "{{ haproxy_host_ipv4_tcp_retries2 }}" }
16+
- { name: "net.unix.max_dgram_qlen", value: 128 }
1617
when:
1718
- set_sysctl | bool
1819
- item.value != 'KOLLA_SKIP'
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.. _haproxy-guide:
2+
3+
=============
4+
HAProxy Guide
5+
=============
6+
7+
Kolla Ansible supports a Highly Available (HA) deployment of
8+
Openstack and other services. High-availability in Kolla
9+
is implented as via Keepalived and HAProxy. Keepalived manages virtual IP
10+
addresses, while HAProxy load-balances traffic to service backends.
11+
These two components must be installed on the same hosts
12+
and they are deployed to hosts in the ``haproxy`` group.
13+
14+
Preparation and deployment
15+
~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
17+
HAProxy and Keepalived are enabled by default. They may be disabled by
18+
setting the following in ``/etc/kolla/globals.yml``:
19+
20+
.. code-block:: yaml
21+
22+
enable_haproxy: "no"
23+
enable_keepalived: "no"
24+
25+
Configuration
26+
~~~~~~~~~~~~~
27+
28+
Failover tuning
29+
---------------
30+
31+
When a VIP fails over from one host to another, hosts may take some
32+
time to detect that the connection has been dropped. This can lead
33+
to service downtime.
34+
35+
To reduce the time by the kernel to close dead connections to VIP
36+
address, modify the ``net.ipv4.tcp_retries2`` kernel option by setting
37+
the following in ``/etc/kolla/globals.yml``:
38+
39+
.. code-block:: yaml
40+
41+
haproxy_host_ipv4_tcp_retries2: 6
42+
43+
This is especially helpful for connections to MariaDB. See
44+
`here <https://pracucci.com/linux-tcp-rto-min-max-and-tcp-retries2.html>`__,
45+
`here <https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/>`__ and
46+
`here <https://access.redhat.com/solutions/726753>`__ for
47+
further information about this kernel option.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=================
2+
High-availability
3+
=================
4+
5+
This section describes high-availability configuration of services.
6+
7+
.. toctree::
8+
:maxdepth: 1
9+
10+
haproxy-guide

doc/source/reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Projects Deployment Configuration Reference
1717
message-queues/index
1818
deployment-config/index
1919
deployment-and-bootstrapping/index
20+
high-availability/index
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
features:
3+
- |
4+
Added a new haproxy configuration variable,
5+
``haproxy_host_ipv4_tcp_retries2``,
6+
which allows users to modify this kernel option.
7+
This option sets maximum number of times a TCP packet is retransmitted
8+
in established state before giving up. The default kernel value is 15,
9+
which corresponds to a duration of approximately between 13 to 30
10+
minutes, depending on the retransmission timeout. This variable can be used
11+
to mitigate an issue with stuck connections in case of VIP failover,
12+
see `bug 1917068 <https://bugs.launchpad.net/kolla-ansible/+bug/1917068>`__
13+
for details.

0 commit comments

Comments
 (0)