mysql_replication

mysql_replication

Database | MySQL, MariaDB

This alert monitors the replication status of the MySQL server.
If you receive this, either both or one of the I/O and SQL threads are not running.

This alert is raised into critical if replication has stopped.

In MySQL, replication involves the source database writing down every change made to the data
held within one or more databases in a special file known as the binary log. Once the replica
instance has been initialized, it creates two threaded processes. The first, called the IO
thread, connects to the source MySQL instance and reads the binary log events line by line,
and then copies them over to a local file on the replica’s server called the relay log. The
second thread, called the SQL thread, reads events from the relay log and then applies them
to the replica instance as fast as possible.

Recent versions of MySQL support two methods for replicating data. The difference between these
replication methods has to do with how replicas track which database events from the source
they’ve already processed.1

For further information, please have a look at the References and Sources section.

References and Sources
  1. Replication in MySQL
  2. MySQL documentation
  3. Section 8.14.6, “Replication Replica I/O
    Thread States”
  4. Section 8.14.7, “Replication Replica SQL Thread
    States”

Troubleshooting Section

Check which thread is not running

From the MySQL command line you can run:

  • For MySQL and MariaDB before v10.2.0:

    SHOW SLAVE STATUS\G
    
  • For MariaDB v10.2.0+:

    SHOW ALL SLAVES STATUS\G
    

This will show you three important rows among other info:

For more info you can refer to the MySQL documentation.