Install Percona XtraDB Cluster (PXC) on Debian 12
Percona XtraDB Cluster provides multi-master MySQL replication using the Galera library with zero data loss.
Step 1 – Install PXC
# Add Percona repository
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
percona-release enable-only pxc-80 release
apt update
apt install -y percona-xtradb-cluster
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 Debian 12.
Step 4 – Add additional nodes
See Add a Node to PXC Cluster on Debian 12.
Architecture overview
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Node 1 │◄──────►│ Node 2 │◄──────►│ Node 3 │
│ Primary │ │ │ │ │
└──────────┘ └──────────┘ └──────────┘
All writes replicated synchronously (wsrep)