Check that replication is working by performing the show slave status on Slave
mysql> SHOW SLAVE Status\g
1. Row ***************************
Slave_io_state:waiting for Master to send event
Master_host:master1
Master_user:root
master_port:3306
Connect_retry:60
master_log_file:mysql-bin.000004
read_master_log_pos:931
relay_log_file:slave1-relay-bin.000056
relay_log_pos:950
relay_master_log_file:mysql-bin.000004
Slave_io_running:yes
Slave_sql_running:yes
replicate_do_db:
replicate_ignore_db:
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
last_errno:0
Last_error:
skip_counter:0
exec_master_log_pos:931
relay_log_space:1365
Until_condition:none
Until_log_file:
until_log_pos:0
Master_ssl_allowed:no
Master_ssl_ca_file:
Master_ssl_ca_path:
Master_ssl_cert:
Master_ssl_cipher:
Master_ssl_key:
seconds_behind_master:0
Master_ssl_verify_server_cert:no
last_io_errno:0
Last_io_error:
last_sql_errno:0
Last_sql_error:
replicate_ignore_server_ids:0
Slave_io_state: Represents the state of the current Slave
Slave_io_running: Represents whether the IO thread that is responsible for reading the main library bin log is a running state and should normally
It's the Yes.
Slave_sql_running: Represents whether the SQL thread responsible for performing the standby relay log is running, and the normal
The condition should be yes
Last_io_error, Last_sql_error: Represents the last IO thread and the error that occurred with the SQL thread, respectively,
Normally it should be empty, no error.
Seconds_behind_master: The SQL line representing the standby library turndown the bin log of the main library for how many seconds later. 0 represents the current
No replication delay
(Master_log_file, Read_master_log_pos): represents the coordinate position of the IO thread in the main library bin Log
(Relay_master_log_file, Exec_master_log_pos): Represents the SQL thread sitting in the main library bin Log
Mark Location
(Relay_log_file, Relay_log_pos): represents the coordinate position of the SQL thread in the standby Relay Log
In the main library you can view the main library's bin log generation process by executing the show processlist command
mysql> SHOW processlist \g;
4. Row ***************************
Id:10
User:root
host:slave1:58371
Db:null
Command:binlog Dump
time:777
State:has sent all binlog to slave; Waiting for Binlog to be updated
Info:null
Most of the databases used by internet companies are MySQL, want to stand out from the many it workers, need to have advanced technology, learning to add value is essential. The way of learning is your insistence. Old boy Education MySQL DBA course, after several update courses, to eliminate the theory, the whole enterprise real case combined with theoretical teaching, want to deep learning MySQL DBA knowledge, can pay attention to the old boy education.
How do I check if MySQL replication is working correctly in the MySQL database?