码迷,mamicode.com
首页 > 数据库 > 详细

Mysql主从同步 异常Slave_SQL_Running: No

时间:2019-11-24 00:02:33      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:服务器   主机   name   span   tls   bsp   pat   one   info   

在刚搭建好的mysql主从节点上对从节点进行操作,导致同步异常:报错如下:

从节点执行:

mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.43.10
Master_User: db
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 32168
Relay_Log_File: mysql-relay.000004
Relay_Log_Pos: 4091
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1146
Last_Error: Error executing row event: ‘Table ‘test.test1‘ doesn‘t exist‘
Skip_Counter: 0
Exec_Master_Log_Pos: 19009
Relay_Log_Space: 18368
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1146
Last_SQL_Error: Error executing row event: ‘Table ‘test.test1‘ doesn‘t exist‘
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: 36285a17-0dea-11ea-908d-000c298eae92
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp: 191124 22:25:38
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)

ERROR:
No query specified

解决方法1:

Slave_SQL_Running: No
1.程序可能在slave上进行了写操作

2.也可能是slave机器重起后,事务回滚造成的.

一般是事务回滚造成的:
解决办法:
mysql> stop slave ;
mysql> set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
mysql> start slave ;

解决办法二、

首先停掉Slave服务:slave stop
到主服务器上查看主机状态:
记录File和Position对应的值

进入master

mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000003 | 32168 | test | mysql | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

 

然后到slave服务器上执行手动同步:

mysql> change master to 
> master_host=‘192.168.43.10‘,
> master_user=‘db‘, 
> master_password=‘123456‘, 
> master_port=3306, 
> master_log_file=‘mysql-bin.000003‘, 
> master_log_pos=32168 ;
mysql> start slave ;

 

Mysql主从同步 异常Slave_SQL_Running: No

标签:服务器   主机   name   span   tls   bsp   pat   one   info   

原文地址:https://www.cnblogs.com/guipeng/p/11920586.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!