Databases 5 min read

How MySQL Router 8.2 Enables Seamless Read/Write Splitting with InnoDB ReplicaSet

MySQL Router 8.2 now supports automatic read/write splitting for InnoDB ReplicaSet clusters, allowing reads to be routed to replicas and writes to the primary without any changes to application code, as demonstrated through configuration steps, connection examples, and practical observations.

Top Architect
Top Architect
Top Architect
How MySQL Router 8.2 Enables Seamless Read/Write Splitting with InnoDB ReplicaSet

MySQL InnoDB ReplicaSet

This section introduces the simplest InnoDB ReplicaSet architecture, consisting of a single source instance and one or more asynchronous replicas.

Image
Image

The ReplicaSet object status can be viewed in MySQL Shell.

Image
Image

Starting MySQL Router 8.2

Configure and launch MySQL Router to enable read/write splitting.

Image
Image

The Router appears in the ReplicaSet object within MySQL Shell.

Image
Image

Connecting to MySQL via the read/write port (6450) demonstrates that read operations are automatically directed to a replica, while write operations go to the primary source without changing the connection parameters.

Image
Image

When a transaction is started, the connection switches to the source instance, while plain reads continue to use the replica.

Image
Image

The generated read/write split configuration appears in the Router's configuration file:

[routing:bootstrap_rw_split]
bind_address=0.0.0.0
bind_port=6450
destinations=metadata-cache://myreplica/?role=PRIMARY_AND_SECONDARY
routing_strategy=round-robin
protocol=classic
connection_sharing=1
client_ssl_mode=PREFERRED
server_ssl_mode=PREFERRED
access_mode=auto

Session-level control is possible with the ROUTER SET access_mode= command to specify which instance type to use.

Image
Image

Conclusion

MySQL Router 8.2 fully supports read/write splitting for InnoDB ReplicaSet clusters, allowing all read traffic to be routed to read‑only replicas and all write traffic to the primary instance without any application changes. This feature improves database performance, scalability, and simplifies deployment and management.

ConfigurationMySQLRead/Write SplittingRouterdatabase scalingInnoDB ReplicaSet
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.