This repository contains Ansible scripts for deploying Percona XtraDB Cluster, a high-performance MySQL clustering solution.
This project uses Ansible playbooks to easily set up Percona XtraDB Cluster on multiple nodes, installs ProxySQL, and connects the proxy to the database nodes .
Before using this playbook, ensure that the following prerequisites are met:
- Ansible is installed on the machine running the playbook.
- Servers/nodes are available with root or sudo access.
-
Clone this repository to your local machine:
git clone https://github.com/shayanamiri037/Ansible-Xtradb-Cluster cd Ansible-Xtradb-Cluster
-
Define your server nodes in the inventory.ini file:
[all] node1 ansible_host=your-node1-ip ansible_user=your-ssh-user node2 ansible_host=your-node2-ip ansible_user=your-ssh-user node3 ansible_host=your-node3-ip ansible_user=your-ssh-user . . . [database_nodes] node1 ansible_host=your-node1-ip ansible_user=your-ssh-user node2 ansible_host=your-node2-ip ansible_user=your-ssh-user node3 ansible_host=your-node3-ip ansible_user=your-ssh-user . . .
-
Set your root password and your proxysql password in password.yaml file.
-
Customize the MySQL configuration in my.cnf.j2 to suit your requirements.
-
Customize the Proxysql configuration in proxysql_admin_config.j2 and proxysql_config.j2 to suit your requirements.
-
Run the playbook
ansible-playbook -i inventory.ini -b play.yaml