You want MySQL 8 high availability without Galera’s certification-based quirks (pxc_strict_mode warnings, DDL caveats, surprise SST during peak). Oracle’s answer is InnoDB Cluster: MySQL 8 + Group Replication (the consensus layer), MySQL Shell (the orchestrator), MySQL Router (the application-facing proxy). All three pieces come from Oracle’s apt repo, fit together cleanly, and don’t require you to think about Galera-isms. The trade-off is single-primary mode by default and a slightly different operational model — failover is sub-second, but the cluster is officially “two-phase” rather than truly multi-primary.
What’s happening
Group Replication is MySQL 8’s native distributed-consensus replication. Three nodes elect a primary; that primary accepts all writes; the others replicate and stand ready to be promoted. MySQL Shell’s cluster module wraps the SQL plumbing — dba.createCluster(), cluster.addInstance(), cluster.status(). MySQL Router connects to the metadata schema that Shell creates on every node, learns the topology, and exposes two ports: 6446 for read/write traffic (always routed to the current primary) and 6447 for read-only traffic (round-robined across secondaries). When the primary dies, Group Replication elects a new one within roughly one second, Router refreshes its view on the next poll, and the application reconnects to the new primary on the same port. The application doesn’t know which physical node it is talking to — it just opens mysql -h router-host -P 6446.
How to verify
From MySQL Shell on any node:
mysqlsh --uri clusteradmin@127.0.0.1:3306 --js -e "
var c = dba.getCluster();
print(c.status());"
You should see one R/W member (the primary) and two R/O members, all with status: ONLINE. A node in RECOVERING or MISSING means it has not joined the group yet or has lost connectivity.
Direct Group Replication view:
SELECT MEMBER_ID, MEMBER_HOST, MEMBER_STATE, MEMBER_ROLE
FROM performance_schema.replication_group_members;
Router state:
mysql -u root -p -h router-host -P 6446 -e "SELECT @@hostname AS primary_node;"
mysql -u root -p -h router-host -P 6447 -e "SELECT @@hostname AS secondary_node;"
The first should always return the current primary; the second rotates through the secondaries on successive connections.
The fix
Save as /root/setup-innodb-node.sh. Run on each of three data nodes after editing the header.
#!/usr/bin/env bash
set -euo pipefail
### Ubuntu 22.04 — MySQL 8.0 InnoDB Cluster — node installer
### Run on each of 3 nodes; cluster creation is a separate Shell step (below)
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT PER NODE ===
NODE_NAME="mysql01"
NODE_IP="10.40.0.11"
PEER_IPS=("10.40.0.11" "10.40.0.12" "10.40.0.13")
SERVER_ID=11 # 11, 12, 13 — must be unique per node
ROOT_PASSWORD="CHANGE_ME_ROOT"
CLUSTER_ADMIN_PASSWORD="CHANGE_ME_ADMIN"
ROUTER_PASSWORD="CHANGE_ME_ROUTER"
# =====================
export DEBIAN_FRONTEND=noninteractive
echo
echo "========================================"
echo "InnoDB Cluster node ${NODE_NAME} (${NODE_IP})"
echo "========================================"
echo
echo "==> apt base"
apt-get update
apt-get -y upgrade
apt-get -y install curl wget gnupg lsb-release ca-certificates \
chrony fail2ban unattended-upgrades \
vim net-tools tar gzip socat jq ufw
systemctl enable --now chrony
echo "==> Sysctl tuning"
cat > /etc/sysctl.d/99-mysql.conf <<'SYSCTL'
vm.swappiness = 1
vm.overcommit_memory = 2
vm.dirty_background_ratio = 3
vm.dirty_ratio = 10
fs.file-max = 2097152
net.core.somaxconn = 4096
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_syncookies = 1
SYSCTL
sysctl --system
cat > /etc/security/limits.d/99-mysql.conf <<'LIMITS'
mysql soft nofile 200000
mysql hard nofile 200000
LIMITS
echo "==> SSH lockdown"
sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
sshd -t && systemctl restart ssh
cat > /etc/fail2ban/jail.d/sshd.local <<'F2B'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
F2B
systemctl enable --now fail2ban
dpkg-reconfigure -fnoninteractive unattended-upgrades
echo "==> /etc/hosts entries so members can resolve each other"
{
echo "${PEER_IPS[0]} mysql01"
echo "${PEER_IPS[1]} mysql02"
echo "${PEER_IPS[2]} mysql03"
} >> /etc/hosts
echo "==> MySQL APT repo"
wget -qO /tmp/mysql-apt.deb https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb
DEBIAN_FRONTEND=noninteractive dpkg -i /tmp/mysql-apt.deb || true
apt-get update
debconf-set-selections <<DEB
mysql-community-server mysql-community-server/root-pass password ${ROOT_PASSWORD}
mysql-community-server mysql-community-server/re-root-pass password ${ROOT_PASSWORD}
mysql-community-server mysql-community-server/default-auth-override select "Use Strong Password Encryption (RECOMMENDED)"
DEB
apt-get -y install mysql-server mysql-shell mysql-router
systemctl stop mysql
echo "==> Group Replication mysqld config"
cat > /etc/mysql/mysql.conf.d/group_replication.cnf <<EOF
[mysqld]
bind-address = 0.0.0.0
server_id = ${SERVER_ID}
default_authentication_plugin = mysql_native_password
log_bin = /var/log/mysql/mysql-bin.log
binlog_format = ROW
gtid_mode = ON
enforce_gtid_consistency = ON
master_info_repository = TABLE
relay_log_info_repository = TABLE
transaction_write_set_extraction = XXHASH64
innodb_buffer_pool_size = 4G
innodb_log_file_size = 512M
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table = 1
max_connections = 1500
performance_schema = ON
# Group Replication
plugin_load_add = 'group_replication.so'
group_replication_group_name = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
group_replication_start_on_boot = OFF
group_replication_local_address = "${NODE_IP}:33061"
group_replication_group_seeds = "${PEER_IPS[0]}:33061,${PEER_IPS[1]}:33061,${PEER_IPS[2]}:33061"
group_replication_bootstrap_group = OFF
group_replication_single_primary_mode = ON
group_replication_enforce_update_everywhere_checks = OFF
EOF
mkdir -p /var/log/mysql
chown -R mysql:mysql /var/log/mysql
systemctl start mysql
systemctl enable mysql
# Wait for socket
for i in {1..30}; do
if mysql -uroot -p"${ROOT_PASSWORD}" -e "SELECT 1" >/dev/null 2>&1; then break; fi
sleep 1
done
echo "==> Cluster admin + router users"
mysql -uroot -p"${ROOT_PASSWORD}" <<SQL
CREATE USER IF NOT EXISTS 'clusteradmin'@'%' IDENTIFIED BY '${CLUSTER_ADMIN_PASSWORD}';
GRANT ALL PRIVILEGES ON *.* TO 'clusteradmin'@'%' WITH GRANT OPTION;
CREATE USER IF NOT EXISTS 'mysqlrouter'@'%' IDENTIFIED BY '${ROUTER_PASSWORD}';
GRANT SELECT, EXECUTE ON mysql_innodb_cluster_metadata.* TO 'mysqlrouter'@'%';
GRANT SELECT ON performance_schema.replication_group_members TO 'mysqlrouter'@'%';
GRANT SELECT ON performance_schema.replication_group_member_stats TO 'mysqlrouter'@'%';
GRANT SELECT ON performance_schema.global_variables TO 'mysqlrouter'@'%';
FLUSH PRIVILEGES;
SQL
echo "==> Firewall"
ufw allow 22/tcp
ufw allow 3306/tcp
ufw allow 33060/tcp # mysqlx
ufw allow 33061/tcp # group replication
ufw --force enable
echo
echo "========================================"
echo "DONE — ${NODE_NAME}"
echo "========================================"
ss -lntp | grep -E ':(3306|33060|33061)\b' || true
echo
echo "Next: from a Shell on mysql01, run dba.configureInstance() against all 3,"
echo " then dba.createCluster() on mysql01, then cluster.addInstance() for the others."
Once all three nodes are up, drive the cluster creation from MySQL Shell on mysql01:
mysqlsh --uri clusteradmin@127.0.0.1:3306
// 1) Make sure each instance is configured for Group Replication.
// Run this against ALL three nodes; Shell will set GR-friendly options
// and restart mysqld where needed.
dba.configureInstance('clusteradmin@mysql01:3306', {clusterAdmin: 'clusteradmin', clusterAdminPassword: '<pw>'});
dba.configureInstance('clusteradmin@mysql02:3306', {clusterAdmin: 'clusteradmin', clusterAdminPassword: '<pw>'});
dba.configureInstance('clusteradmin@mysql03:3306', {clusterAdmin: 'clusteradmin', clusterAdminPassword: '<pw>'});
// 2) Create the cluster from mysql01
var cluster = dba.createCluster('innodb_prod', {
ipAllowlist: '10.40.0.0/24',
exitStateAction: 'READ_ONLY',
consistency: 'EVENTUAL' // or 'BEFORE_ON_PRIMARY_FAILOVER' for stricter reads
});
// 3) Add the two secondaries
cluster.addInstance('clusteradmin@mysql02:3306', {recoveryMethod: 'clone'});
cluster.addInstance('clusteradmin@mysql03:3306', {recoveryMethod: 'clone'});
// 4) Verify
cluster.status();
recoveryMethod: 'clone' uses the built-in CLONE plugin to bootstrap a fresh joiner — a snapshot pull from a donor instead of a full binary-log replay. For a brand-new cluster this is dramatically faster than the legacy “incremental” path. Now bring up MySQL Router on a separate small host (or two of them behind keepalived):
#!/usr/bin/env bash
set -euo pipefail
# === EDIT ===
METADATA_HOST="mysql01"
METADATA_USER="clusteradmin"
METADATA_PASSWORD="CHANGE_ME_ADMIN"
CONF_DIR="/etc/mysqlrouter"
# ============
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y install mysql-router curl wget gnupg ca-certificates
# Bootstrap Router against the metadata schema living on mysql01
mysqlrouter --bootstrap "${METADATA_USER}@${METADATA_HOST}:3306" \
--directory /var/lib/mysqlrouter \
--conf-use-sockets \
--account router \
--account-create always \
--account-host '%' \
--user mysqlrouter \
--conf-base-port 6446
# systemd unit Router writes during bootstrap
systemctl enable --now mysqlrouter
echo
echo "========================================"
echo "Router up — clients connect to:"
echo " R/W (primary): tcp://this-host:6446"
echo " R/O (secondary): tcp://this-host:6447"
echo "========================================"
ss -lntp | grep -E ':(6446|6447|6448|6449)\b' || true
Test the routing:
mysql -h router-host -P 6446 -u app -p -e "SELECT @@hostname, @@server_id;"
# returns the current primary
# Force a failover
mysqlsh --uri clusteradmin@mysql01:3306 --js -e "
var c = dba.getCluster();
c.setPrimaryInstance('mysql02:3306');"
mysql -h router-host -P 6446 -u app -p -e "SELECT @@hostname, @@server_id;"
# now returns mysql02
Application reconnects within roughly two seconds. The Router-to-Group-Replication metadata refresh interval is configurable in mysqlrouter.conf (ttl under [metadata_cache] — default 0.5 seconds) and tighter is better up to the cost of a metadata query per refresh.
A production note: keep group_replication_start_on_boot = OFF. After an unclean reboot of all three nodes (full power event), you re-bootstrap the group from the most up-to-date node using dba.rebootClusterFromCompleteOutage() rather than letting each node race to form its own group at boot — see Oracle’s docs for the exact procedure. The “off-by-default” behavior is intentional.
Stack Harbor runs InnoDB Cluster deployments on Cloud Compute with Router HA and Group Replication state checks in our monitoring plane — start a scoping call if you’d like us to deploy or take over yours.