Domanda

My application is currently running in production. The application and the database are in the same single server. The application is writing-intensive, and can make an UPDATE even on GET requests (but not all, anyway).

I've been reading about Master-Master vs Master-Slave for MySQL. I understand that if I have a Master-Master configuration, I'll have to be careful about inserted data not conflicting when merging, and there may be issues with updates. So, I believe Master-Slave is an easier option to start with.

However, there are some answers that I couldn't find anywhere:

1) Where should my application connect to? Just to the master server? Or does the application need to decide which server to connect, depending on the queries of the process?

2) Since my application is writing-intensive, does it make sense to have a Master-Slave configuration?

3) What if a process has selects and updates?, will it make 2 connections, sending selects to Slave and updates to Master? (isn't that bad? isn't that worse than Master-Master configuration?)

4) If Master goes down, what happens while I don't set a Slave as Master? Will the updates fail in the meanwhile?

È stato utile?

Soluzione 2

Here's the Sam D's answer. I tried to edit his original answer here, to make it more complete, but the edit wasn't approved.

yes there will be transaction loss. so usually there are servers constantly checking the master so when it goes down it promotes a slave asap. Read and write splitting is much better in application level some frameworks do this automatically for you and you can specify master and slaves in configuration.

Altri suggerimenti

PHP frameworks that do read write splitting that I know are laravel and yii I recommend laravel. Good luck

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top