Install Percona XtraDB Cluster (PXC) on Arch Linux
Percona XtraDB Cluster provides multi-master MySQL replication using the Galera library with zero data loss.
Step 1 – Install PXC
# Install from AUR (using yay or paru)
yay -S percona-xtradb-cluster --noconfirm
# Or install MariaDB with Galera as an alternative:
pacman -S --noconfirm mariadb galera
Step 2 – Secure initial installation
# Get the temporary root password
grep 'temporary password' /var/log/mysqld.log
# Connect and change password
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'StrongRoot123!';
Start service:
systemctl enable --now mysql
Step 3 – Configure node 1 (bootstrap node)
See Bootstrap a PXC Cluster on Arch Linux.
Step 4 – Add additional nodes
See Add a Node to PXC Cluster on Arch Linux.
Architecture overview
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Node 1 │◄──────►│ Node 2 │◄──────►│ Node 3 │
│ Primary │ │ │ │ │
└──────────┘ └──────────┘ └──────────┘
All writes replicated synchronously (wsrep)