两台haproxy配置文件:
[root@ha-proxy-master ~]# cat /etc/haproxy/haproxy.cfg
Haproxy L4
===================================================================================
global
log 127.0.0.1 local2
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
nbproc 1
defaults
mode http
log global
option redispatch
retries 3
maxconn 4000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen stats
bind *:81
stats enable
stats uri /haproxy
stats auth qianfeng:123
frontend web
mode http
bind *:80
option httplog
default_backend httpservers
backend httpservers
balance roundrobin
server http1 192.168.246.162:80 maxconn 2000 weight 1 check inter 1s rise 2 fall 2
server http2 192.168.246.163:80 maxconn 2000 weight 1 check inter 1s rise 2 fall 2
listen mysql
bind *:3306
mode tcp
balance roundrobin
server mysql1 192.168.246.163:3306 weight 1 check inter 1s rise 2 fall 2
server mysql2 192.168.246.162:3306 weight 1 check inter 1s rise 2 fall 2
**Haproxy 实现四层负载均衡**
最新推荐文章于 2023-10-02 14:25:02 发布