发现问题
今晚做haproxy+mysql+keepalived高可用方案时发现在部署haproxy时候发现了haproxy不能正常启动
错误如下:
意思是不能绑定3306端口
解决思路
- 主机中3306端口被占用导致绑定不了
- 防火墙和selinux没有关闭
解决问题
1.查看对应端口是不是被某一进程占用了,如果被占用了关闭进程即可
root@haproxy1 ~] netstat -ntpl
然鹅发现3306并没有被占用。。。。
2.看看我的防火墙和selinux有没有关
[root@haproxy1 ~]# getenforce
Enforcing
[root@haproxy1 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since 六 2021-04-10 21:21:07 CST; 10s ago
Docs: man:firewalld(1)
Main PID: 8082 (firewalld)
CGroup: /system.slice/firewalld.service
└─8082 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
好家伙,竟然没有关,手动关一下
[root@haproxy1 ~] setenforce 0
[root@haproxy1 ~] systemctl stop firewalld
[root@haproxy1 ~] systemctl restart haproxy
成功解决啦!