如何检查数据库抄写状态
官方手册:
http://http://dev.mysql.com/doc/refman/5.0/en/replication-administration-status.html
http://dev.mysql.com/doc/refman/5.0/en/show-slave-status.html
在SlaveDB执行下述statement:
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.10.10.112
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 98
Relay_Log_File: mysqld-relay-bin.000003
Relay_Log_Pos: 235
Relay_Master_Log_File: mysql-bin.000002
Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_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: 98
Relay_Log_Space: 235
Until_Condition: NoneUntil_Log_File:Until_Log_Pos: 0
Master_SSL_Allowed: NoMaster_SSL_CA_File:Master_SSL_CA_Path:
Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key:
Seconds_Behind_Master: 0
1 row in set (0.00 sec)
\G-这参数可以调整为较友善的显示方式。
在MasterDB检查SlaveDB状态,执行下述statement,搜寻有无BinlogDump。
mysql> show processlist \G;
*************************** 2. row ***************************Id: 3
User: repl
Host: 10.10.10.134:2065
db: NULL
Command: Binlog Dump
Time: 1381
State: Has sent all binlog to slave; waiting for binlog to be updated
Info: NULL
2 rows in set (0.01 sec)
参考连结
MySQL 5.0 Reference Manual :: 16 Replication