HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to know if MySQL replication is working?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
knowworkingreplicationmysqlhow

Problem

I am replicating from a MySQL v 5.5.50 master, to a MySQL v 5.5.46 slave hosted in RDS. I've followed the AWS documentation on how to do this to the letter, got the dump file imported into the slave server and ran the CALL mysql.rds_set_external_master... command to begin things a few days ago.

My SHOW MASTER STATUS; result is:

+---------------------+----------+--------------+------------------+
| File                | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+---------------------+----------+--------------+------------------+
| mysql-binlog.000023 | 48684053 |              |                  |
+---------------------+----------+--------------+------------------+
1 row in set (0.00 sec)


And my SHOW SLAVE STATUS \G; result is:

```
1. row
Slave_IO_State: Waiting for master to send event
Master_Host: [master host IP here]
Master_User: [local replication user here]
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-binlog.000023
Read_Master_Log_Pos: 53052514
Relay_Log_File: relaylog.000007
Relay_Log_Pos: 81145300
Relay_Master_Log_File: mysql-binlog.000017
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table: mysql.rds_sysinfo,mysql.rds_history,mysql.rds_replication_status
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1016905328
Relay_Log_Space: 5695987840
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:

Solution

The two ...Running values say YES; that is usually sufficient to say all is well. However Seconds_Behind_Master: 394467 is scary. That 11 hours!

Run a test: On the Master do CREATE DATABASE dummy;, then see if it is there on the Slave. (You'll probably need to be root both times.)

There are situations where Seconds_Behind_Master bounces between 0 and some big value. That is a fluke. Watch it for a while to see that is the case.

Context

StackExchange Database Administrators Q#146965, answer score: 6

Revisions (0)

No revisions yet.