0

I have setup mysql master-slave replication with 1 master and 3 slaves. Now that I have finished setting up the architecture I am curious as to the best way to make my reads. I realize all writes, updates, and deletes will be directed to the master.

Do I need to spin up another server running something like HAproxy to load balance the reads to all the slaves? Is it possible for the master to load balance reads? It would be preferred for all operations to be performed on the same endpoint so I don't need to modify logic in the web layer to read from one IP ( stand alone load balancer ) and write, update, and delete to a second IP ( master ).

Is there a standard way to handle CRUD on a master-slave architecture?

2

You can use a proxy designed for MySQL, such as MySQL Proxy or MaxScale, to not only load balance your read queries, but also to ensure that writes are directed to the master. From the point of view of the clients, there is only one MySQL connection, which is useful for clients which can't make separate connections for reads and writes.

  • I'm using MaxScale and am loving it. I'd recommend MaxScale to anyone. Make sure to follow the directions in the /documentation folder when you download. – John Foley Jan 25 '15 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.