Commit a8704343 by Carson Gee

Add HAProxy check user to prevent `max_connect_error` exceptions

parent 378a68e8
......@@ -63,7 +63,7 @@ haproxy_applications:
balance roundrobin
option tcplog
option tcpka
option mysql-check
option mysql-check user haproxy
server galera1 192.168.33.100:3306 check weight 1
server galera2 192.168.33.110:3306 check weight 1
server galera3 192.168.33.120:3306 check weight 1
......
......@@ -19,6 +19,13 @@ MARIADB_CLUSTERED: no
MARIADB_CLUSTER_USER_ADMIN: "mariadb_clu_root"
MARIADB_CLUSTER_PASSWORD_ADMIN: "password"
MARIADB_HOST_PRIV: '%'
MARIADB_HAPROXY_USER: 'haproxy'
MARIADB_HAPROXY_HOSTS:
- '192.168.33.100'
- '192.168.33.110'
- '192.168.33.120'
MARIADB_LISTEN_ALL: false
MARIADB_DATABASES:
......
......@@ -48,4 +48,11 @@
when: not mariadb_bootstrap.stat.exists
- name: touch bootstrap file to confirm we are fully up
file: path="/etc/mysql/ansible_cluster_started" state=touch
\ No newline at end of file
file: path="/etc/mysql/ansible_cluster_started" state=touch
# This is needed for mysql-check in haproxy or other mysql monitor
# scripts to prevent haproxy checks exceeding `max_connect_errors`.
- name: create haproxy monitor user
command: >
mysql -e "INSERT INTO mysql.user (Host,User) values ('{{ item }}','{{ MARIADB_HAPROXY_USER }}'); FLUSH PRIVILEGES;"
with_items: MARIADB_HAPROXY_HOSTS
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment