MySQL Shell 9.2  /  MySQL Router and AdminAPI  /  Routing Guidelines

7.8 Routing Guidelines

Routing Guidelines control MySQL Router's routing behavior, using rules defining the destinations of incoming client sessions.

Routing Guidelines enable the following:

  • Implementing load balancing by distributing traffic across multiple destination classes with different priorities. Manage resource allocation by routing traffic based on server or router tags to ensure workloads are distributed according to resource availability and capabilities.

  • Routing sessions based on application or user role, and automatically route client sessions to the appropriate Cluster based on the schema being used, simplifying configuration and ensuring data and application-specific needs are met.

  • Routing sessions to clusters or servers based on the MySQL version, ensuring compatibility and proper functioning of features.

  • Defining routes that manage failover by moving traffic to available instances in different tiers if primary instances are down. This ensures continuous service availability even in the event of server failures.

  • Optimizing traffic based on the specific connection attributes to ensure compatibility, performance, compliance, and so on.

Routing Guidelines consist of two components, destination classes and routes. Destination classes group MySQL topology members using expressions. Routes are defined by expressions matching incoming client sessions and a list of destination classes, forming a pool of candidate MySQL servers to route them to.

Clients can be classified according to attributes such as source IP address, default schema, router port, or session connection attributes including client name, operating system, and so on.

MySQL Router continually monitors the topology. If the topology changes, servers are reclassified, client sessions are reevaluated, and invalid connections are disconnected.

Routing Guidelines can be defined at the topology-level, where they apply to all connected routers, or can be defined per-router.