前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >mysql Slave_IO_Running:NO(解决方法)

mysql Slave_IO_Running:NO(解决方法)

作者头像
拓荒者
发布2019-03-11 17:42:52
18.1K0
发布2019-03-11 17:42:52
举报
文章被收录于专栏:运维经验分享运维经验分享

Master slave 复制错误

Description:

Slave_IO_Running:NO

Slave_SQL_Running:Yes

Seconds_Behind_Master: NULL

本人遇到的Slave_IO_Running:NO的情况有下面两种:

1. 在配置slave同步时因为slave访问master没有权限导致;

2. master上的mysql-bin.xxxxxx文件全被我误删除了;

对于第一种情况,仔细检查数据库访问权限即可解决;

对于第二种情况,下面稍微详细介绍一下:

mysql> show slave status\G

*************************** 1. row ***************************

             Slave_IO_State: 

                Master_Host: 192.168.3.21

                Master_User: slave

                Master_Port: 3307

              Connect_Retry: 60

            Master_Log_File: mysql-bin.000016

        Read_Master_Log_Pos: 173

             Relay_Log_File: mysqld-relay-bin.000008

              Relay_Log_Pos: 98

      Relay_Master_Log_File: mysql-bin.000016

           Slave_IO_Running: No

          Slave_SQL_Running: Yes

            Replicate_Do_DB: 

        Replicate_Ignore_DB: 

         Replicate_Do_Table: 

     Replicate_Ignore_Table: br>                 Last_Errno: 0

                 Last_Error: 

               Skip_Counter: 0

        Exec_Master_Log_Pos: 173

            Relay_Log_Space: 98

            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

1 row in set (0.00 sec)

[root@slave mysql]# tail /var/log/mysqld.log

081223 15:51:50  InnoDB: Started; log sequence number 0 43655

081223 15:51:51 [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=/var/run/mysqld/mysqld-relay-bin' to avoid this problem.

081223 15:51:51 [Note] /usr/libexec/mysqld: ready for connections.

Version: '5.0.45-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3307  Source distribution

081223 15:51:51 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000016' at 

position 173, relay log '/var/run/mysqld/mysqld-relay-bin.000007' position: 98

081223 15:51:51 [Note] Slave I/O thread: connected to master 

slave@192.168.3.21:3307''>'slave@192.168.3.21:3307'

,  replication started 

in log 'mysql-bin.000016' at position 173

081223 15:51:51 [ERROR] Error reading packet from server: Could not find first log file name in binary log 

index file ( server_errno=1236)

081223 15:51:51 [ERROR] Got fatal error 1236: 'Could not find first log file name in binary log index file' 

from master when reading data from binary log

081223 15:51:51 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000016', position 173

081223 15:51:58 [Note] Error reading relay log event: slave SQL thread was killed

解决步骤:

重启master库:service mysqld restart

mysql> show master status;

+------------------+----------+--------------+------------------+

| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |

+------------------+----------+--------------+------------------+

| mysql-bin.000001 |       98 |              |                  | 

+------------------+----------+--------------+------------------+

mysql> slave stop;

mysql> change master to Master_Log_File='mysql-bin.000001',Master_Log_Pos=98;

mysql> slave start;

mysql> show slave status\G

*************************** 1. row ***************************

             Slave_IO_State: Waiting for master to send event

                Master_Host: 192.168.3.21

                Master_User: slave

                Master_Port: 3307

              Connect_Retry: 60

            Master_Log_File: mysql-bin.000001

        Read_Master_Log_Pos: 98

             Relay_Log_File: mysqld-relay-bin.000002

              Relay_Log_Pos: 235

      Relay_Master_Log_File: mysql-bin.000001

           Slave_IO_Running: Yes

          Slave_SQL_Running: Yes

            Replicate_Do_DB: 

    Replicate_Wild_Do_Table: 

Replicate_Wild_Ignore_Table: 

Replicate_Ignore_DB: 

         Replicate_Do_Table: 

     Replicate_Ignore_Table: 

    Replicate_Wild_Do_Table: 

Replicate_Wild_Ignore_Table: 

                 Last_Errno: 0

                 Last_Error: 

               Skip_Counter: 0

        Exec_Master_Log_Pos: 98

            Relay_Log_Space: 235

            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: 0

1 row in set (0.00 sec)

转自:http://hi.baidu.com/zhanglp/item/9bd563e186b4b918585dd8ba

(adsbygoogle = window.adsbygoogle || []).push({});

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018/01/10 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档