我用 mysqlbinlog查看master大概出现问题的日志:mysqlbinlog --no-defaults --start-datetime='2009-08-18 15:00:00' --stop-datetime='2009-08-18 18:00:00' /edata/database2/mysql-bin.000019 出现以下错误:/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 #090817 21:17:55 server id 1 end_log_pos 106 Start: binlog v 4, server v 5.1.37-log created 090817 21:17:55 # Warning: this binlog was not closed properly. Most probably mysqld crashed writing it.会不会跟这个有关?
# Warning: this binlog was not closed properly. Most probably mysqld crashed writing it. 嗯,很可能就是这个问题引起的
这个比较可怕,我用的是 5.1.37-log
Maybe you not excute failed really.
Check the table's data,if there have been the data.
然后对照表数据,找出数据出错的来源从根本上解决问题才是关键的,否则,这次出错了,下次又出现怎么办
出现以下错误:/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#090817 21:17:55 server id 1 end_log_pos 106 Start: binlog v 4, server v 5.1.37-log created 090817 21:17:55
# Warning: this binlog was not closed properly. Most probably mysqld crashed writing it.会不会跟这个有关?
嗯,很可能就是这个问题引起的
但,让我奇怪的是,即便如此 '从服务器'从bin-log里获得并执行insert into后,无非是自增一个数字,为什么会出现Duplicate entry的错误呢?而且还导致同步的停滞!也就是这样一个过程:
从: insert into tbl(id) values(null); #id为自增
主: insert into tbl(id) values(null); #记录与bin-log中
从: 从主服务器上获得log-bin,执行刚才主服务器上的insert into tbl(id) values(null); 发生了 Duplicate entry的错误,并停止了同步!不知说清楚没有!
哦,太谢谢了!不过主的binlog我查了,就是这样啊,insert into tbl(id) values(null);
是让我看从服务器的binlog吗?