MySQL 8.0 搭建主从复制报错:[ERROR] [MY-010584] [Repl] Slave I/O for channel '': error connecting to master '

操作系统:CentOS Linux release 7.7.1908 (Core)
MySQL版本:8.0.11
主库创建用户

create user 'repl'@'%' identified by 'repl';
grant replication slave,replication client on *.* to 'repl'@'%';
flush privileges;

从库执行

change master to
master_user='repl',
master_password='repl', 
master_host='192.168.56.101', 
master_log_file='master-binlog.000002', 
master_log_pos=2351,
master_port=3308;

启动从库服务

start slave;

错误代码

2020-02-02T13:27:43.178538Z 9 [ERROR] [MY-010584] [Repl] Slave I/O for channel '': error connecting to master '[email protected]:3308' - retry-time: 60  retries: 170, Error_code: MY-001129

排查原因
检查Linux服务器端口正常:
netstat -apn | grep 3306
检查Linux防火墙全部都关闭了:
sestatus
iptables -L

出现错误原因
同一ip在短时间内产生太多(超过mysql数据库max_connection_errors的最大值)终端的数据库连接而导致的阻塞;
查看参数值:

show global variables like '%max_connect_errors%';

MySQL 8.0 搭建主从复制报错:[ERROR] [MY-010584] [Repl] Slave I/O for channel '': error connecting to master '_第1张图片
然后修改该属性

set global max_connect_errors=1000;

修改后查看参数值

show global variables like '%max_connect_errors%';

MySQL 8.0 搭建主从复制报错:[ERROR] [MY-010584] [Repl] Slave I/O for channel '': error connecting to master '_第2张图片
修改之后主从同步正常
MySQL 8.0 搭建主从复制报错:[ERROR] [MY-010584] [Repl] Slave I/O for channel '': error connecting to master '_第3张图片

你可能感兴趣的:(MySQL)