MySQL Slave同步错误
Description:
mysql> show slave status\G
Slave_IO_Running: Yes
Slave_SQL_Running: No
Last_Errno: 1062
....
Seconds_Behind_Master:NULL
原因:
1.程序可能在slave上进行了写操作
2.也可能是slave机器重起后,事务回滚造成的.
Resolve solution 1:
stop slave;set global sql_slave_skip_counter=1;start slave
Resolve solution 2:
1. stop slave;
2. show master status;
# Remeber master log file name and position.
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000006 | 46683 | | |
+------------------+----------+--------------+------------------+
3. change masgter to
master_host='192.168.3.21'
master_port=3307
master_user='slave'
master_password='12345678'
master_log_file='mysql-bin.000006'
master_log_pos=46683
4. start slave;
5. show slave status\G; #To confirm whether the slave is normal.
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
...
Seconds_Behind_Master: 0
以上只第2步在master上操作,其他都是在slave上操作。
阅读(2059) | 评论(0) | 转发(0) |