
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
57 lines
2.3 KiB
Django/Jinja
57 lines
2.3 KiB
Django/Jinja
# This configuration file is used to configure proxysql.
|
|
#
|
|
# Admin_variables: https://proxysql.com/documentation/global-variables/admin-variables
|
|
# Mysql_variables: https://proxysql.com/documentation/global-variables/mysql-variables
|
|
# Mysql_servers: https://proxysql.com/documentation/main-runtime/#mysql_servers
|
|
# Mysql_galera_hostgroups: https://proxysql.com/documentation/main-runtime/#mysql_galera_hostgroups
|
|
|
|
datadir: "/var/lib/proxysql"
|
|
errorlog: "/var/log/kolla/proxysql/proxysql.log"
|
|
|
|
admin_variables:
|
|
admin_credentials: "{{ proxysql_admin_user }}:{{ proxysql_admin_password }}"
|
|
mysql_ifaces: "{{ api_interface_address }}:{{ proxysql_admin_port }};{{ kolla_internal_vip_address }}:{{ proxysql_admin_port }};/var/lib/kolla/proxysql/admin.sock"
|
|
stats_credentials: "{{ proxysql_stats_user }}:{{ proxysql_stats_password }}"
|
|
|
|
mysql_variables:
|
|
threads: {{ proxysql_workers }}
|
|
max_connections: {{ proxysql_max_connections }}
|
|
interfaces: "{{ kolla_internal_vip_address }}:{{ database_port }}"
|
|
monitor_username: "{{ mariadb_monitor_user }}"
|
|
monitor_password: "{{ mariadb_monitor_password }}"
|
|
|
|
mysql_servers:
|
|
{% for shard_id, shard in mariadb_shards_info.shards.items() %}
|
|
{% set WRITER_GROUP = shard_id | int * 10 %}
|
|
{% for host in shard.hosts %}
|
|
{% if loop.first %}
|
|
{% set WEIGHT = 100 %}
|
|
{% else %}
|
|
{% set WEIGHT = 10 %}
|
|
{% endif %}
|
|
- address: "{{ 'api' | kolla_address(host) }}"
|
|
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 %}
|
|
{% endfor %}
|
|
|
|
mysql_galera_hostgroups:
|
|
{% for shard_id, shard in mariadb_shards_info.shards.items() %}
|
|
{% set WRITER_GROUP = shard_id | int * 10 %}
|
|
{% set BACKUP_WRITER_GROUP = WRITER_GROUP | int + 1 %}
|
|
{% set READER_GROUP = BACKUP_WRITER_GROUP | int + 1 %}
|
|
{% set OFFLINE_GROUP = READER_GROUP | int + 1 %}
|
|
- writer_hostgroup: {{ WRITER_GROUP }}
|
|
backup_writer_hostgroup: {{ BACKUP_WRITER_GROUP }}
|
|
reader_hostgroup: {{ READER_GROUP }}
|
|
offline_hostgroup: {{ OFFLINE_GROUP }}
|
|
max_connections: {{ proxysql_backend_max_connections }}
|
|
max_writers: 1
|
|
writer_is_also_reader: 0
|
|
comment: "Galera cluster for shard {{ shard_id }}"
|
|
{% endfor %}
|