From d34147b84bd89820b957cbed37fa422bd433bfb2 Mon Sep 17 00:00:00 2001 From: Doug Szumski Date: Tue, 20 Aug 2019 17:02:15 +0100 Subject: [PATCH] Fix HAProxy check for MariaDB The MariaDB role HAProxy config section exposes MariaDB on the mariadb_port which may not always be the same as database_port. The HAProxy role checks that the database_port is free, and not the mariadb_port. This could mean that the check passes, but the actual port which HAProxy will attempt to use is taken. This change configures HAProxy to talk to the MariaDB instances on the mariadb_port, and maps them to the database_port which is used by most services as part of the DB connection string. There is a small risk that it may break someones override config. Change-Id: I9507ee709cb21eb743112107770ed3170c61ef74 --- ansible/roles/mariadb/defaults/main.yml | 6 ++++-- ...fix-haproxy-database-port-mapping-46bdf2a0ffc253c7.yaml | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/fix-haproxy-database-port-mapping-46bdf2a0ffc253c7.yaml diff --git a/ansible/roles/mariadb/defaults/main.yml b/ansible/roles/mariadb/defaults/main.yml index 9d1c6408fa..a29f74d759 100644 --- a/ansible/roles/mariadb/defaults/main.yml +++ b/ansible/roles/mariadb/defaults/main.yml @@ -13,7 +13,8 @@ mariadb_services: mariadb: enabled: "{{ enable_mariadb|bool and not enable_external_mariadb_load_balancer|bool }}" mode: "tcp" - port: "{{ mariadb_port }}" + port: "{{ database_port }}" + listen_port: "{{ mariadb_port }}" frontend_tcp_extra: - "option clitcpka" - "timeout client 3600s" @@ -25,7 +26,8 @@ mariadb_services: mariadb_external_lb: enabled: "{{ enable_mariadb|bool and enable_external_mariadb_load_balancer|bool }}" mode: "tcp" - port: "{{ mariadb_port }}" + port: "{{ database_port }}" + listen_port: "{{ mariadb_port }}" frontend_tcp_extra: - "option clitcpka" - "timeout client 3600s" diff --git a/releasenotes/notes/fix-haproxy-database-port-mapping-46bdf2a0ffc253c7.yaml b/releasenotes/notes/fix-haproxy-database-port-mapping-46bdf2a0ffc253c7.yaml new file mode 100644 index 0000000000..aec3512123 --- /dev/null +++ b/releasenotes/notes/fix-haproxy-database-port-mapping-46bdf2a0ffc253c7.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - MariaDB is now exposed via HAProxy on the ``database_port`` and + not the ``mariadb_port``. Out of the box these are both the same, + but if you have customised ``mariadb_port`` so that it is different + to the ``database_port`` and you have a service talking to it + via HAProxy on that port then you should review your configuration.