Search code examples
mysqlsqlreplication

MySQL replication halting when error occurs


I have a MariaDB Master and slave replication setup on our system. But whenever an attempt to insert incorrect data into a table on the master, it causes the slave to stop working with Slave_SQL_Running: No.

For example, if you try to insert data on a table with a date field that has no default value and it set to not null, and you do not include a value for the date field in the insert statement, this causes the slave to quit (Slave_SQL_Running: No) with error 1364. This is just one example of many interruptions caused by data insertion.

So my question is, how can i prevent this from happening i.e,when you try to insert incorrect data on master, mysql should just throw an error without affecting the slave?


Solution

  • Take a look at Galera replication. Galera uses synchronous multimaster replication, so unless your query actually crashes the server you're running it on, you won't run into any issues such as slaves crashing etc.