Posts: 1
Registered: ‎02-02-2021

Figuring out a mysql master/slave setup

I know that I still need to do a lot of reading about mysql replication, but since it seems to be a huge subject, I'd like to figure out what I could focus on as a start. In particular, I'm interested in a solution that I can deploy by myself on my homelab (for learning purpose mostly), which can fit the needs of a small business out there as well.

So, let's assume that I have server in which runs a software which in turns uses a mysql database deployed in two other machines (be they physical or virtual machine), one as a master and the other as a slave (or a master/master solution..still don't know).

I'd like to figure out what happens when the master one breaks? In particular, how the software can know that a machine has gone down and needs to redirect its queries to the other one. Is it something you have to implement in your, say, php code or there can be kind of a load balancer behind the two mysql machines? Thanks