6.4.10. Port-based Routing

Auto Read/Write Splitting No
Master Selection Manually, by network port
Slave Selection Manually, by network port
QoS Compatibility None
SmartScale Compatibility None

Port-based routing configures two independent ports that enable client applications to select whether to connect to a master or slave based on the port they connect to. This method relies on the application choosing the correct port, automatic r/w splitting is not supported. Similar to host-based routing, port-based routing requires the client application to be modified to manually select the appropriate port.

Once enabled, a client can open a connection directly to a master or slave by connecting to the appropriate port. For example:

shell> mysql -P3306

Will connect to the currently active master, while:

shell> mysql -P3307

will connect to a read-resource, ideally a slave, but will revert to the master if no appropriate slave is avaialble.


The ports to be used for each connection type are configurable during installation. Enabling Port-based Routing

Enabling port-based routing requires configuring the two ports that will accept queries. One port will be designated as the master port, one the read-only port, and queries will be automatically routed accordingly. For example:

shell> tpm configure alpha \
... \
--connector-readonly-listen-port=3307 \

Cient applications must be updated to support the two port interfaces and manually direct their queries to the appropriate master or slave.

Using port routing in this way effectively marks all connections to the read-only port as behaving in a similar fashion to setting the connection QoS to RO_RELAXED.