我遵循本教程的主从复制: http : //www.howtoforge.com/mysql_master_master_replication
基本上,这就是我所做的。
为什么不能插入所有的行,并使其与我的主人完全一样? 为什么删除的东西,一遍又一遍地插入?
show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: Master_User: Master_Port: Connect_Retry: 60 Master_Log_File: mysql-bin.000025 Read_Master_Log_Pos: 694442541 Relay_Log_File: mysqld-relay-bin.000039 Relay_Log_Pos: 201628150 Relay_Master_Log_File: mysql-bin.000018 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: 201628013 Relay_Log_Space: 8213564485 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: 6343 1 row in set (0.00 sec) ERROR: No query specified show master status\G; *************************** 1. row *************************** File: mysql-bin.000033 Position: 540194 Binlog_Do_DB: fal Binlog_Ignore_DB: 1 row in set (0.01 sec)
在MySQL复制中,master写出“binlog”文件,详细描述只改变复制数据库的查询(UPDATE,DELETE,INSERT,CREATE TABLE …,而不是SELECT等等)。
从相同的数据库副本开始,主服务器写入binlog文件,从服务器读取它们,并执行所有更改:因此会发生复制。
您的状态消息表明从服务器的副本不是最新的(6343s = 105分钟输出),并且有一个SQL语句队列运行,位于binlog文件中:
主:
File: mysql-bin.000033 Position: 540194
奴隶:
Master_Log_File: mysql-bin.000025 Read_Master_Log_Pos: 694442541 ... Exec_Master_Log_Pos: 201628013 .... Seconds_Behind_Master: 6343
我怀疑在主服务器上发生了一些DELETE / INSERTtypes的操作,从服务器正在复制这些更改,虽然延迟了几个小时。
要确定哪些查询正在运行/即将运行,可以使用mysqlbinlog查看(二进制)二进制日志文件的内容。
Lockie