MySQL Slave I/O Thread 失败问题

1. innobackexp  备份数据 

innobackexp   --defaults-file=/etc/my.cnf   --user=root --password=xxxx   /backup

2. innobackexp  数据恢复

innobackexp   --defaults-file=/etc/my.cnf   --user=root --apply-log   /backup

innobackexp   --defaults-file=/etc/my.cnf   --user=root --copy-back   /backup

3. 授权 目录权限

chown  -r mysql.mysql  mariadb-xxxx

4.启动mariadb  

systemctl  enable  mariadb  && systemctl  start   mariadb

5. M/S 数据同步

cat xtrabackup_binlog_pos_innodb  

登录数据库开始同步数据

change master to 

master_host='127.0.0.1',

master_user='slave',

master_password='123456',

master_port=3306,

master_log_file='my-bin.000001',

master_log_pos=122121;


start slave; 

(1) 数据库同步情况(状态正常)

      show  slave  status  \G;  

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

(2) 日志显示错误信息:Slave I/O thread: Failed reading log event, reconnecting to retry

(3) SLAVE机器relay日志变化异常


注意:检查服务是否正常日志的重要性,谨记


6. 以上情况出现的问题及现象分析


(1) 数据库连接正常, 表明密码授权没有问题,主库不存在表及库等键值和数据不一致问题

(2) slave i/o  pos值一直发生变化,说明slave I/O一直在读并且能读得到,以及relay日志变化较快

从(2) 可以看出i/o 线程读取有问题,导致relay 日志变化较快,考虑主从配置问题

如:多个slave使用相同server_id,存在冲突,导致其他slave的I/O获取数据失败

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The error message "The slave I/O thread is not running" indicates that the slave database server is not able to connect or synchronize with the master database server in a MySQL replication setup. Here are a few steps you can follow to troubleshoot and resolve this issue: 1. Check the connection settings: Verify that the slave database server has the correct configuration settings for connecting to the master database server. This includes the `master_host`, `master_user`, `master_password`, and `master_port` variables in the slave's MySQL configuration file (`my.cnf` or `my.ini`). 2. Verify network connectivity: Ensure that the slave database server can reach the master database server over the network. Check for any firewall rules or network restrictions that may be blocking the connection. 3. Check replication user permissions: Ensure that the replication user on the master database server has the necessary permissions to replicate data to the slave. The user should have the `REPLICATION SLAVE` privilege granted. 4. Check replication status: Use the following command on the slave database server to check the replication status: ``` SHOW SLAVE STATUS; ``` Look for any errors or warnings in the output, such as a failed connection or replication lag. Pay attention to fields like `Slave_IO_Running` and `Last_IO_Error` to identify potential issues. 5. Restart replication: If you have made any changes to the configuration or encountered errors, you can try restarting the replication process on the slave database server. Use the following commands: ``` STOP SLAVE; START SLAVE; ``` 6. Monitor logs: Check the MySQL error log file on both the master and slave database servers for any relevant error messages or warnings that might shed light on the issue. The log files are typically located at `/var/log/mysql/error.log` or `/var/log/mysqld.log`. If you are still unable to resolve the issue, it may be helpful to consult the MySQL documentation or seek assistance from the MySQL community or database administrators with expertise in MySQL replication.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值