mysql 停止io thread_mysql Slave_IO_Running:NO(解决方法)

mysql Slave_IO_Running:NO(解决方法)

转载 2012年06月26日 18:13:06

25707

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)

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MySQL 主从复制是一种非常重要且常用的数据同步方式,对于数据库管理员来说,保证主从同步的正常运行对于数据库的可靠性和稳定性都是非常重要的。当我们在使用 MySQL 主从同步时,如果发现 slave_io_running:no 的情况,那么意味着 MySQL 从服务器的 IO 线程停止了工作。 IO 线程是 MySQL 主从复制中非常重要的一个组件,它的作用是从主服务器上读取二进制数据,并将其传输到从服务器上。如果 IO 线程出现问题,那么意味着从服务器无法从主服务器获取新的数据,从而导致从服务器无法同步主服务器的数据。 在出现 slave_io_running:no 的情况时,我们需要立即查找 IO 线程出现问题的原因,并进行解决。以下是常见的 IO 线程故障原因及对应解决方案: 1. 网络问题。如果主服务器和从服务器之间的网络出现了问题,那么 IO 线程就无法正常工作。我们可以通过检查网络连接以及网络质量来解决这个问题。 2. DNS 解析错误。如果主服务器和从服务器之间使用的是主机名进行通信,那么可能出现 DNS 解析错误的情况。我们需要检查主机名是否正确,以及 DNS 解析是否正常。 3. 权限问题。如果从服务器的用户权限不正确,那么也可能会导致 IO 线程无法正常工作。我们需要检查从服务器的用户权限是否足够,以及是否正确配置了主从服务器之间的连接信息。 4. 数据库配置问题。如果从服务器的数据库配置不正确,那么也可能会导致 IO 线程无法正常工作。我们需要检查从服务器的数据库配置是否正确,并根据需要进行更改。 总的来说,当出现 slave_io_running:no 的情况时,我们需要立即对问题进行排查和解决,以便尽快恢复 MySQL 主从同步的正常运行。在排查问题过程中,我们需要充分了解 MySQL 主从复制的工作原理,熟悉常见的故障原因,并加强对 MySQL 数据库的日常维护和管理工作,以提高数据库的可靠性和稳定性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值