kolla-ansible/ansible/roles/proxysql-config/templates/rules.yaml.j2
Michal Arbet de973b81fa Add proxysql support for database
Kolla environment currently uses haproxy
to fullfill HA in mariadb. This patch
is switching haproxy to proxysql if enabled.

This patch is also replacing mariadb's user
'haproxy' with user 'monitor'. This replacement
has two reasons:
  - Use better name to "monitor" galera claster
    as there are two services using this user
    (HAProxy, ProxySQL)
  - Set password for monitor user as it's
    always better to use password then not use.
    Previous haproxy user didn't use password
    as it was historically not possible with
    haproxy and mariadb-clustercheck wasn't
    implemented.

Depends-On: https://review.opendev.org/c/openstack/kolla/+/769385
Depends-On: https://review.opendev.org/c/openstack/kolla/+/765781
Depends-On: https://review.opendev.org/c/openstack/kolla/+/850656

Change-Id: I0edae33d982c2e3f3b5f34b3d5ad07a431162844
2022-07-29 15:05:21 +02:00

19 lines
691 B
Django/Jinja

# This configuration file is used to configure proxysql rules,
# in our case we define the schemaname and the mysql galera cluster
# group which query is routed to.
#
# Query rules are a very powerful vehicle to control traffic passing
# through ProxySQL and are configured in the mysql_query_rules table:
#
# ProxySQL Admin> SHOW CREATE TABLE mysql_query_rules\G
#
# https://proxysql.com/documentation/main-runtime/#mysql_query_rules
mysql_query_rules:
{% for rule in proxysql_project_database_shard['rules'] %}
{% set WRITER_GROUP = rule['shard_id'] | int * 10 %}
- schemaname: "{{ rule['schema'] }}"
destination_hostgroup: {{ WRITER_GROUP }}
apply: 1
active: 1
{% endfor %}