环境: mysql
Mysql: 5.0.51 dual master(节点为A,B)sql
OS: Linux 4.6session
节点A启动slave就报下面的错误:spa
080725 22:47:18 [ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236)code
080725 22:47:18 [ERROR] Got fatal error 1236: 'Client requested master to start replication from impossible position' from master when reading data from binary logserver
080725 22:47:18 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000008', position 753871857it
节点B是正常的。io
先偿试手动change master:ast
CHANGE MASTER TO MASTER_HOST='xxxx.xxx.xxx.xxx',thread
-> MASTER_USER='repl',
-> MASTER_PASSWORD='xxxxx',
-> MASTER_LOG_FILE='mysql-bin.000008',
-> MASTER_LOG_POS=753871857;
可是问题依旧,仔细看错误的描述,里面说753871857这个position是impossible position。
难道说mysql-bin.000008里面没有这个位置的?
登录到B节点上面用mysqlbinlog查看
[root@im_offlog2b mysql]# mysqlbinlog --start-position=753871857 mysql-bin.000008
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
好像是没有。
为了进一步确认,我将binlog dump成文本文件
mysqlbinlog mysql-bin.000008 > 1.txt
tail -n 100000 1.txt > 2.txt
而后打开2.txt文件,跳到最后:
# at 753870260
#080724 16:21:25 server id 2 end_log_pos 753870665 Query thread_id=185 exec_time=0 error_code=0
SET TIMESTAMP=1216887685/*!*/;
insert into im_offlinemsg_200807(gmt_create,type,from_id,to_id,content)values(sysdate(),0,'cnalichnzizufhm','cnalichnluelee','AAFcQzB4NzBmZlxGy87M5VxUob7Iureiob9cQzBcUzB4OS4weGI0XEbLzszlXFRodHRwOi8vYmJzLmticmVuLmNuL3RhaXdhbi5odG1sDQq7qMHLztLV+9X70rvN7cnPtcTKsbzksKGjrNbV09q447rDwcujrL/syKW/tL+0o6y8x7XDwfS49tHUxbZcVC86JFxULzpnaXJs')/*!*/;
# at 753870665
#080724 16:21:25 server id 2 end_log_pos 753870692 Xid = 35714167
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
发现mysql-bin.000008里面最后的一个有效的position是753870665。
这真是奇怪。
而后 再change master,将位置指定为这个最后位置:
CHANGE MASTER TO MASTER_HOST='172.18.57.154',
-> MASTER_USER='aliim',
-> MASTER_PASSWORD='xlia9810pal',
-> MASTER_LOG_FILE='mysql-bin.000008',
-> MASTER_LOG_POS=753870665;
问题就解决了。
至于为何会出现这样的问题,仍是不清楚。