I have set up an InnoDB cluster with one primary(R/W) and two secondaries (R/O) and bootstrapped a MySQL Router. The router has 2 port 6646(R/W port) and 6647(R/O) port. My application is currently connected to the cluster through the R/W port. Now I am looking for a way to implement load balancing in the cluster. Suppose there are 2 reading requests, how can I route the traffic to a different available database?
-
Look in the documentation for "round robin". (It is the only practical method for this situation.)Rick James– Rick James2022年11月26日 04:50:01 +00:00Commented Nov 26, 2022 at 4:50
-
you mean edit the config file of mysql router for the r/w section?Wong Chung sze– Wong Chung sze2022年11月29日 01:40:46 +00:00Commented Nov 29, 2022 at 1:40
1 Answer 1
By default, the Router will load-balance the R/O request in a round-robin fashion.
You can configure the routing strategy to meet your needs, see [basic routing] and [routing_strategy].
-
so let say my app is only connecting to the r/w port, there will be no load balancing? suppose there is one node for r/w, two nodes for r/oWong Chung sze– Wong Chung sze2022年12月10日 02:17:04 +00:00Commented Dec 10, 2022 at 2:17
-
If your app is only connecting to the R/W port then all traffic will be forwarded to the primary member of the Cluster, always. You won't have any load balancing for R/O traffic.Miguel Araújo– Miguel Araújo2022年12月13日 10:16:24 +00:00Commented Dec 13, 2022 at 10:16
Explore related questions
See similar questions with these tags.