Ansible playbook that provisions a group of servers to run mariadb as a Galera Cluster.
Find a file
2023-02-06 15:47:28 -07:00
roles/mariadb_cluster Initial commit 2023-02-03 10:59:47 -07:00
.gitignore Initial commit 2023-01-19 13:45:41 -07:00
hosts.yml Initial commit 2023-02-03 10:59:47 -07:00
LICENSE Initial commit 2023-01-19 13:45:41 -07:00
mariadb_cluster.yml Initial commit 2023-02-03 10:59:47 -07:00
README.md README Update 2023-02-06 15:47:28 -07:00
site.yml Initial commit 2023-02-03 10:59:47 -07:00

Ansible-MariaDB-Cluster

Ansible playbook that provisions a group of servers to run mariadb as a Galera Cluster.

Requirements

If you are using HaProxy as a front end to the cluster, you will need to create a user for the health checks to work properly. The user does not need to be able to access any databases, it just needs to be able to authenticate against the server.

CREATE USER 'haproxy_check'@'10.10.10.253' WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 0 MAX_STATEMENT_TIME 0.0000000001;

Variables

Variable Required Default Description
mariadb_cluster_wsrep_cluster_name yes my_wsrep_cluster The wsrep cluster name that should be used for the galera cluster
mariadb_cluster_access_ip no "" If defined, the normal database port (3306) will only be accessible from the defined IP for use with a load balancer

Example

---
# file: hosts

mariadb_cluster:
  hosts:
    db01:
      ansible_host: 10.10.10.11
    db02:
      ansible_host: 10.10.10.12

  vars:
    mariadb_cluster_wsrep_cluster_name: "CustomCluster1"
    mariadb_cluster_access_ip: "10.10.10.253"
    ansible_user: ansible
    

Troubleshooting

You can view the status of the cluster by running the following command.

SHOW GLOBAL STATUS LIKE 'wsrep_%';

License

See LICENSE file for full license information.