patternsqlMinor
Load Balancer for MySQL MASTER MASTER Replication
Viewed 0 times
replicationmysqlmasterforloadbalancer
Problem
We are having typical requirement.
We are having MySQL MASTER-MASTER Replication setup in place. We require to setup Load Balancer between these 2 MySQL servers.
I am aware of setting up WEB based Load Balancer, but we require load balancer for MySQL servers.
Requirement is there are one Application server and 2 DB servers, Application server will connect to Load Balancer, Load balancer will connect to DB servers by sharing the load.
Please let me know the best approach for this, also let me know if there are any pros and cons.
We are having MySQL MASTER-MASTER Replication setup in place. We require to setup Load Balancer between these 2 MySQL servers.
I am aware of setting up WEB based Load Balancer, but we require load balancer for MySQL servers.
Requirement is there are one Application server and 2 DB servers, Application server will connect to Load Balancer, Load balancer will connect to DB servers by sharing the load.
Please let me know the best approach for this, also let me know if there are any pros and cons.
Solution
As you already have a running Master-Master replication, here a tip for the load balancer: I use HAProxy
It is a free software balancer, needs very less system resources and is quite easy to configure.
A tip: Install 2 loadbalancers with keepalived or keep in mind that you just created a critical bottleneck.
I use the setup keepalived + 2x haproxy + 2x master-mysql for 9 months now and I only noticed one problem with pdo_mysql - you can see my problem here: https://stackoverflow.com/questions/26871221/slow-pdo-mysql-mysqli-with-haproxy
There is also a small example config (in the example it is a hot standby master)
It is a free software balancer, needs very less system resources and is quite easy to configure.
A tip: Install 2 loadbalancers with keepalived or keep in mind that you just created a critical bottleneck.
I use the setup keepalived + 2x haproxy + 2x master-mysql for 9 months now and I only noticed one problem with pdo_mysql - you can see my problem here: https://stackoverflow.com/questions/26871221/slow-pdo-mysql-mysqli-with-haproxy
There is also a small example config (in the example it is a hot standby master)
Context
StackExchange Database Administrators Q#87678, answer score: 2
Revisions (0)
No revisions yet.