Switch mariadb's loadbalancer from HAProxy to ProxySQL

It's been some time since ProxySQL has been
with us in Kolla. Let's switch the load balancer
for MariaDB connections from HAProxy to ProxySQL.

Depends-On: https://review.opendev.org/c/openstack/kolla/+/928956
Change-Id: I42ba4fb83b5bb31058e888f0d39d47c27b844de5
This commit is contained in:
Michal Arbet 2024-03-19 23:42:16 +01:00
parent dafac823d1
commit 8f0a4bcb0d
8 changed files with 29 additions and 10 deletions

View File

@ -549,6 +549,7 @@ mariadb_shard_id: "{{ mariadb_default_database_shard_id }}"
mariadb_shard_name: "shard_{{ mariadb_shard_id }}"
mariadb_shard_group: "mariadb_{{ mariadb_shard_name }}"
mariadb_loadbalancer: "{{ 'proxysql' if enable_proxysql | bool else 'haproxy' }}"
mariadb_backup_target: "{{ 'active' if mariadb_loadbalancer == 'haproxy' else 'replica' }}"
mariadb_shard_root_user_prefix: "root_shard_"
mariadb_shard_backup_user_prefix: "backup_shard_"
mariadb_shards_info: "{{ groups['mariadb'] | database_shards_info() }}"
@ -937,7 +938,7 @@ enable_ovs_dpdk: "no"
enable_osprofiler: "no"
enable_placement: "{{ enable_nova | bool or enable_zun | bool }}"
enable_prometheus: "no"
enable_proxysql: "no"
enable_proxysql: "yes"
enable_redis: "no"
enable_skyline: "no"
enable_swift: "no"

View File

@ -129,7 +129,7 @@ mariadb_backup_possible: "{{ mariadb_loadbalancer != 'haproxy' or inventory_host
####################
# Clustercheck
####################
enable_mariadb_clustercheck: "{{ enable_haproxy }}"
enable_mariadb_clustercheck: "{{ 'True' if mariadb_loadbalancer == 'haproxy' else 'False' }}"
####################
# Sharding

View File

@ -89,3 +89,4 @@
- restart mariadb-clustercheck
when:
- kolla_action != "config"
- service | service_enabled_and_mapped_to_host

View File

@ -10,10 +10,12 @@
register: container_facts
- name: Taking {{ mariadb_backup_type }} database backup via Mariabackup
vars:
cmd: "{{ 'kolla_mariadb_backup.sh' if mariadb_backup_target == 'active' else 'kolla_mariadb_backup_replica.sh' }}"
become: true
kolla_container:
action: "start_container"
command: "bash -c 'sudo -E kolla_set_configs && /usr/local/bin/kolla_mariadb_backup.sh'"
command: "bash -c 'sudo -E kolla_set_configs && /usr/local/bin/{{ cmd }}'"
common_options: "{{ docker_common_options }}"
detach: False
# NOTE(mgoddard): Try to use the same image as the MariaDB server container

View File

@ -180,7 +180,7 @@
dimensions: "{{ item.value.dimensions }}"
environment: "{{ item.value.environment | default({}) }}"
healthcheck: "{{ item.value.healthcheck | default(omit) }}"
with_dict: "{{ mariadb_services }}"
with_dict: "{{ mariadb_services | select_services_enabled_and_mapped_to_host }}"
when:
- bootstrap_host is defined
- bootstrap_host != inventory_hostname
@ -211,7 +211,7 @@
dimensions: "{{ item.value.dimensions }}"
environment: "{{ item.value.environment | default({}) }}"
healthcheck: "{{ item.value.healthcheck | default(omit) }}"
with_dict: "{{ mariadb_services }}"
with_dict: "{{ mariadb_services | select_services_enabled_and_mapped_to_host }}"
when:
- bootstrap_host is defined
- bootstrap_host == inventory_hostname

View File

@ -411,7 +411,7 @@ workaround_ansible_issue_8743: yes
#enable_osprofiler: "no"
#enable_placement: "{{ enable_nova | bool or enable_zun | bool }}"
#enable_prometheus: "no"
#enable_proxysql: "no"
#enable_proxysql: "yes"
#enable_redis: "no"
#enable_skyline: "no"
#enable_swift: "no"

View File

@ -0,0 +1,15 @@
---
upgrade:
- |
The config option ``enable_proxysql`` has been changed to
``yes``, which means that MySQL connections will now be
handled by ProxySQL by default instead of HAProxy. Users
who wish to retain load balancing of MySQL connections
through HAProxy must set ``enable_proxysql`` to ``no``.
Also Due to this change, the config option
``enable_mariadb_clustercheck`` is also dynamically
changed to ``no``. Users who still wish to maintain
``mariadb_clustercheck`` can override this config option
in the configuration. However, with ProxySQL,
``mariadb_clustercheck`` is no longer needed and can be
manually removed.

View File

@ -13,7 +13,7 @@ function prepare_images {
fi
if [[ $SCENARIO != "bifrost" ]]; then
GATE_IMAGES="^cron,^fluentd,^glance,^haproxy,^keepalived,^keystone,^kolla-toolbox,^mariadb,^memcached,^neutron,^nova-,^openvswitch,^rabbitmq,^horizon,^heat,^placement"
GATE_IMAGES="^cron,^fluentd,^glance,^haproxy,^proxysql,^keepalived,^keystone,^kolla-toolbox,^mariadb,^memcached,^neutron,^nova-,^openvswitch,^rabbitmq,^horizon,^heat,^placement"
else
GATE_IMAGES="bifrost"
fi
@ -58,7 +58,7 @@ function prepare_images {
fi
if [[ $SCENARIO == "mariadb" ]]; then
GATE_IMAGES="^cron,^fluentd,^haproxy,^keepalived,^kolla-toolbox,^mariadb"
GATE_IMAGES="^cron,^fluentd,^haproxy,^proxysql,^keepalived,^kolla-toolbox,^mariadb"
fi
if [[ $SCENARIO == "lets-encrypt" ]]; then
@ -66,11 +66,11 @@ function prepare_images {
fi
if [[ $SCENARIO == "prometheus-opensearch" ]]; then
GATE_IMAGES="^cron,^fluentd,^grafana,^haproxy,^keepalived,^kolla-toolbox,^mariadb,^memcached,^opensearch,^prometheus,^rabbitmq"
GATE_IMAGES="^cron,^fluentd,^grafana,^haproxy,^proxysql,^keepalived,^kolla-toolbox,^mariadb,^memcached,^opensearch,^prometheus,^rabbitmq"
fi
if [[ $SCENARIO == "venus" ]]; then
GATE_IMAGES="^cron,^opensearch,^fluentd,^haproxy,^keepalived,^keystone,^kolla-toolbox,^mariadb,^memcached,^rabbitmq,^venus"
GATE_IMAGES="^cron,^opensearch,^fluentd,^haproxy,^proxysql,^keepalived,^keystone,^kolla-toolbox,^mariadb,^memcached,^rabbitmq,^venus"
fi
if [[ $SCENARIO == "skyline" || $SCENARIO == "skyline-sso" ]]; then