From bee253e337e2fb04ae6334235acfad45ee0fe085 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 18 Oct 2022 11:18:53 +0200 Subject: [PATCH] Adds ability to configure ProxySQL's max replication lag By default ProxySQL's default value of max_replication_lag is 0 which is in fact disabling this feature [1]. If it is greater than 0, ProxySQL will regularly monitor replication lag and if it goes beyond the configured threshold it will temporary shun the host until replication catches up. This should be configurable via kolla-ansible as every openstack deployment can be different in terms of network delays, database load etc.. , so user should have option to configure when database backend will be shunned. [1] https://proxysql.com/documentation/main-runtime/ Change-Id: I66171638abc712cb84b380042f1d29f54c499e73 --- ansible/roles/loadbalancer/defaults/main.yml | 1 + .../loadbalancer/templates/proxysql/proxysql.yaml.j2 | 1 + ...sql-conf-max-replication-lag-9c8f8f26cd92d66d.yaml | 11 +++++++++++ 3 files changed, 13 insertions(+) create mode 100644 releasenotes/notes/proxysql-conf-max-replication-lag-9c8f8f26cd92d66d.yaml diff --git a/ansible/roles/loadbalancer/defaults/main.yml b/ansible/roles/loadbalancer/defaults/main.yml index 722d8a1033..7a7a1f5746 100644 --- a/ansible/roles/loadbalancer/defaults/main.yml +++ b/ansible/roles/loadbalancer/defaults/main.yml @@ -122,6 +122,7 @@ proxysql_workers: "{{ openstack_service_workers }}" proxysql_max_connections: 40000 # The maximum number of connections to mariadb backends. proxysql_backend_max_connections: 10000 +proxysql_backend_max_replication_lag: "0" proxysql_admin_user: "kolla-admin" proxysql_stats_user: "kolla-stats" diff --git a/ansible/roles/loadbalancer/templates/proxysql/proxysql.yaml.j2 b/ansible/roles/loadbalancer/templates/proxysql/proxysql.yaml.j2 index 4e1e8ea57f..f5c6f38a31 100644 --- a/ansible/roles/loadbalancer/templates/proxysql/proxysql.yaml.j2 +++ b/ansible/roles/loadbalancer/templates/proxysql/proxysql.yaml.j2 @@ -33,6 +33,7 @@ mysql_servers: port : {{ database_port }} hostgroup : {{ WRITER_GROUP }} max_connections: {{ proxysql_backend_max_connections }} + max_replication_lag: {{ proxysql_backend_max_replication_lag }} weight : {{ WEIGHT }} comment : "Writer {{ host }}" {% endfor %} diff --git a/releasenotes/notes/proxysql-conf-max-replication-lag-9c8f8f26cd92d66d.yaml b/releasenotes/notes/proxysql-conf-max-replication-lag-9c8f8f26cd92d66d.yaml new file mode 100644 index 0000000000..bf2d5eb6ab --- /dev/null +++ b/releasenotes/notes/proxysql-conf-max-replication-lag-9c8f8f26cd92d66d.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + Adds ability to configure ProxySQL's max replication lag + via configuration value ``proxysql_backend_max_replication_lag`` + which is set to default value as per documentation. If it is + greater than 0, ProxySQL will regularly monitor replication lag + and if it goes beyond the configured threshold it will temporary + shun the host until replication catches up. Please see the official + `upgrade notes `__ + for more detail.