用haproxy代理两个后端数据库 监听端口设置为15432
使用ss可以看到监听端口
[root@cloudwise-docp-1 ~]# ss -nptl | grep 15432
LISTEN 0 2000 *:15432 *:* users:(("haproxy",pid=9449,fd=5))
telnet报错如下
[root@cloudwise-docp-1 ~]# telnet 127.0.0.1 15432
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
^CConnection closed by foreign host.
搜了网上的文章 看了下自己的防火墙和selinux 如下 是不影响的
[root@cloudwise-docp-1 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
7月 30 15:21:32 cloudwise-docp-1 systemd[1]: Starting firewalld - dynamic firewall daemon...
7月 30 15:21:33 cloudwise-docp-1 systemd[1]: Started firewalld - dynamic firewall daemon.
7月 30 15:21:49 cloudwise-docp-1 systemd[1]: Stopping firewalld - dynamic firewall daemon...
7月 30 15:21:49 cloudwise-docp-1 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@cloudwise-docp-1 ~]# getenforce
Disabled
一直也没解决 想着是不是机器的问题 再搭建一个haproxy试试
在新的proxy上修改配置文件的时候 发现问题了 原来是配置写错了 而且是低级错误 真是被自己蠢哭了 错误的配置如下
defaults
log global
mode http
option httplog
retries 3
option redispatch
maxconn 2000
timeout connect 5000ms
timeout client 50000ms
timeout server 50000m
可以发现timeout server
后边的时间单位是m 错误就在这里 这个地方的单位是ms 可以不写 于是 去掉了单位 重新启动服务 OK了