Bootstrap MySQL Router against an InnoDB Cluster
MySQLRouter & ProxyCommand
# Generates config from metadata and creates the router account; --user is required when run as root
mysqlrouter --bootstrap icadmin@db1:3306 --directory /etc/mysqlrouter/prod --account routeruser --account-create if-not-exists --name router01 --conf-bind-address 0.0.0.0 --user mysqlrouter
/etc/mysqlrouter/prod/start.sh
# Ports: 6446 RW, 6447 RO, 6450 RW split (classic); 6448 / 6449 X protocol
mysql -h app-host -P 6446 -u app -p -e "SELECT @@hostname"
mysql -h app-host -P 6447 -u app -p -e "SELECT @@hostname"
mysqlsh icadmin@db1:3306 -- cluster list-routersWhat it does
Registers Router in the cluster metadata and generates the account and configuration; the application reaches the current primary through the RW port and secondaries round-robin through the RO port.
When to use it
When putting a transparent failover layer in front of an InnoDB Cluster / ClusterSet / ReplicaSet; typically one Router per application server.
Caution
Router is stateless; running it next to the application avoids a single point of failure, a single central Router does not. The bootstrap account is used only during bootstrap; Router reads metadata with its own account (routeruser). It learns topology changes through the metadata cache without re-bootstrapping. The RW split port (6450) sends reads inside a transaction to the primary and others to secondaries; be careful with applications that expect read-your-writes. The Router version must not be older than the MySQL servers in the cluster.