Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2446495
  • 博文数量: 540
  • 博客积分: 11289
  • 博客等级: 上将
  • 技术积分: 6160
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-11 20:27
个人简介

潜龙勿用,见龙在田

文章分类

全部博文(540)

文章存档

2018年(2)

2013年(5)

2012年(24)

2011年(104)

2010年(60)

2009年(217)

2008年(128)

分类: Mysql/postgreSQL

2008-12-31 12:03:32

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上操作。



阅读(2019) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~