博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL同步故障:" Slave_SQL_Running:No" 两种解决办法 (转载)
阅读量:4681 次
发布时间:2019-06-09

本文共 1551 字,大约阅读时间需要 5 分钟。

来源:

故障现象:

进入slave服务器,运行:

mysql> show slave status\G

         .......

             Relay_Log_File: localhost-relay-bin.000535
              Relay_Log_Pos: 21795072
      Relay_Master_Log_File: localhost-bin.000094
           Slave_IO_Running: Yes
          Slave_SQL_Running: No
            Replicate_Do_DB: 
        Replicate_Ignore_DB: 
      ......

解决办法一、

Slave_SQL_Running: No

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

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

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

 

解决办法二、

首先停掉Slave服务:slave stop

到主服务器上查看主机状态:
记录File和Position对应的值

进入master

mysql> show master status;

+----------------------+----------+--------------+------------------+
| File                 | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+----------------------+----------+--------------+------------------+
| localhost-bin.000094 | 33622483 |              |                  | 
+----------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

 

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

mysql> change master to 
> master_host='master_ip',
> master_user='user', 
> master_password='pwd', 
> master_port=3306, 
> master_log_file=localhost-bin.000094', 
> master_log_pos=33622483 ;
1 row in set (0.00 sec)
mysql> slave start;
1 row in set (0.00 sec)

 

mysql> show slave status\G

*************************** 1. row ***************************
........
            Master_Log_File: localhost-bin.000094
        Read_Master_Log_Pos: 33768775
             Relay_Log_File: localhost-relay-bin.000537
              Relay_Log_Pos: 1094034
      Relay_Master_Log_File: localhost-bin.000094
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB:

手动同步需要停止master的写操作! 

 

(完)

转载于:https://www.cnblogs.com/pangou/p/3203295.html

你可能感兴趣的文章
【POJ - 3009】Curling 2.0 (dfs+回溯)
查看>>
Windows下载安装良心教程
查看>>
Android上下文菜单ContextMenu
查看>>
【bzoj4543】Hotel加强版(thr)
查看>>
React-Native学习手册----搭建基于ios平台的开发环境
查看>>
[stm32] 中断
查看>>
L1-043 阅览室
查看>>
RTP Payload Format for Transport of MPEG-4 Elementary Streams over http
查看>>
两个时间相差多少 .net中的timespan应用
查看>>
递归 换零钱问题——由打靶子问题引申
查看>>
Python-函数基础
查看>>
Extensible Messaging and Presence Protocol (XMPP) 简介
查看>>
Farm Irrigation
查看>>
windows平板的开发和选型
查看>>
无平方因子的数(数论初步) By ACReaper
查看>>
C语言截取字符串
查看>>
如何查自己的账单
查看>>
JAVA8学习笔记(二)----三个预定义接口
查看>>
JDBC连接各种数据库的字符串
查看>>
构建之法阅读笔记06
查看>>