de973b81fa
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
29 lines
978 B
Django/Jinja
29 lines
978 B
Django/Jinja
# This configuration file is used to configure proxysql users,
|
|
# in our case we just define default_hostgroup and the mysql galera
|
|
# cluster group where user is routed to.
|
|
#
|
|
# This is used especially when services are creating databases, users
|
|
# and connects via user 'root_shard_SHARD_ID', so ProxySQL know
|
|
# where to route this query.
|
|
#
|
|
# Table mysql_users defines MySQL users that clients can use to connect to
|
|
# ProxySQL, and then used to connect to backends.
|
|
#
|
|
# ProxySQL Admin> SHOW CREATE TABLE mysql_users\G
|
|
#
|
|
# https://proxysql.com/documentation/main-runtime/#mysql_users
|
|
|
|
mysql_users:
|
|
{% for user in proxysql_project_database_shard['users'] %}
|
|
{% if user['shard_id'] is defined %}
|
|
{% set WRITER_GROUP = user['shard_id'] | int * 10 %}
|
|
{% endif %}
|
|
- username: "{{ user['user'] }}"
|
|
password: "{{ user['password'] }}"
|
|
{% if user['shard_id'] is defined %}
|
|
default_hostgroup: {{ WRITER_GROUP }}
|
|
{% endif %}
|
|
transaction_persistent: 1
|
|
active: 1
|
|
{% endfor %}
|