Mysql 5.6 (Master)到5.1主从同步错误[2]

今天查看Mysql同步状态的时候发现同步出错。错误如下:

Slave_SQL_Running: No


看Err log发现如下错误,这条是数据库shutdown引起的。。。应该不是。

如果是这个错误的话可以用此条命令

set global sql_slave_skip_counter=1;

140226 14:49:47 [Note] Event Scheduler: Purging the queue. 0 events
140226 14:49:47 [Note] Error reading relay log event: slave SQL thread was killed
140226 14:49:47 [ERROR] Error reading packet from server: Lost connection to MySQL server during query ( server_errno=2013)
140226 14:49:47 [Note] Slave I/O thread killed while reading event
140226 14:49:47 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000002', position 338
140226 14:49:47  InnoDB: Starting shutdown...
140226 14:49:52  InnoDB: Shutdown completed; log sequence number 0 1713364200
140226 14:49:52 [Note] mysql: Shutdown complete

接下来是执行sql插入语句报错

140226 16:35:23 [Note] Plugin 'FEDERATED' is disabled.
140226 16:35:23  InnoDB: Initializing buffer pool, size = 8.0M
140226 16:35:23  InnoDB: Completed initialization of buffer pool
140226 16:35:23  InnoDB: Started; log sequence number 0 1713364200
140226 16:35:23 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=administrator-relay-bin' to avoid this problem.
140226 16:35:23 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000002' at position 338, relay log '.\
administrator-22-relay-bin.000007' position: 265
140226 16:35:23 [Note] Slave I/O thread: connected to master 'slave@192.168.111.111:3306',replication started in log 'mysql-bin.000002' at position 338140226 16:35:23 [Note] Event Scheduler: Loaded 0 events140226 16:35:23 [Note] mysql: ready for connections.Version: '5.1.56-community-log' socket: '' port: 3305 MySQL Community Server (GPL)140227 19:40:16 [ERROR] Slave SQL: Error 'Duplicate entry '8221' for key 'PRIMARY'' on query. Default database: 'dbname'. Query: 'insert into table (status, 'Valid')', Error_code: 1062

然后执行
start slave sql_thread;
然后再查看slave状态,SQL_thread已经起起来了,那么同步也就可以了。
有时间再看错误。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值