Ansible-MariaDB-Cluster/README.md

51 lines
1.8 KiB
Markdown
Raw Normal View History

2023-01-19 13:45:41 -07:00
# Ansible-MariaDB-Cluster
2023-02-06 15:47:28 -07:00
Ansible playbook that provisions a group of servers to run mariadb as a Galera Cluster.
2023-01-19 13:45:41 -07:00
## Requirements
2023-02-06 15:47:28 -07:00
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.
```sql
CREATE USER 'haproxy_check'@'10.10.10.253' WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 0 MAX_STATEMENT_TIME 0.0000000001;
```
2023-01-19 13:45:41 -07:00
## Variables
2023-02-06 15:47:28 -07:00
| 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 |
2023-01-19 13:45:41 -07:00
## Example
2023-02-06 15:47:28 -07:00
```yml
---
# 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.
```sql
SHOW GLOBAL STATUS LIKE 'wsrep_%';
```
2023-01-19 13:45:41 -07:00
## License
See LICENSE file for full license information.