1.问题:从节点连接主节点错误,初步定位为网络原因
Last_IO_Error: error connecting to master ‘backup@192.168.1.150:3307’ - retry-time: 60 retries: 1
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: 192.168.1.150
Master_User: backup
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 22499
Relay_Log_File: 7f89b92077fc-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB: mysql,sys,information_schema,performance_schema
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: 4
Relay_Log_Space: 154
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
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 2003
Last_IO_Error: error connecting to master 'backup@192.168.1.150:3307' - retry-time: 60 retries: 1
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: /var/lib/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 200104 07:26:47
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
ERROR:
No query specified
2.经历了曲折艰辛的弯路之后,找到了真正的问题所在:linux防火墙问题。之后关闭防火墙,主从同步正常。
[root@localhost data]
[root@localhost data]
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
3.直接关闭防火墙虽然两个docker容器可以互相访问了,但是当重启docker的容器时,会报iptables: No chain/target/match by that name.
的错误。原因是因为systemctl start docker
时是有防火墙的,在docker启动的状态下关闭防火墙会造成该问题。深度原因没有研究。
解决办法:在防火墙关闭的状态下重启docker。
[root@localhost data]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7f89b92077fc mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up About an hour 33060/tcp, 0.0.0.0:3316->3306/tcp mysql-slaver-01
054236fce86e mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up About an hour 33060/tcp, 0.0.0.0:3307->3306/tcp mysql-master
[root@localhost data]
Error response from daemon: Cannot restart container 7f8: driver failed programming external connectivity on endpoint mysql-slaver-01 (c64f19fba0938f6016ff879d52476c0151e98429f1779a23b28b8bd94a28ef96): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3316 -j DNAT --to-destination 172.17.0.3:3306 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1))
[root@localhost data]
[root@localhost data]
Error response from daemon: driver failed programming external connectivity on endpoint mysql-slaver-01 (76b66f4777354c50635ccc39db4d559d28278da055eabee6ce20e5083cac49ee): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3316 -j DNAT --to-destination 172.17.0.3:3306 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1))
Error: failed to start containers: 7f8
[root@localhost data]
054
[root@localhost data]
[root@localhost data]
7f8
[root@localhost data]
054
[root@localhost data]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)