- 需要先确认已经配置了内核参数:
-
echo 'net.ipv4.ip_nonlocal_bind = 1' /etc/sysctl.conf
-
echo 'net.ipv4.ip_forward = 1' /etc/sysctl.conf
-
-
sysctl -p
- 安装haproxy
yum install haproxy -y
/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg
vi /etc/haproxy/haproxy.cfg
service haproxy reload
https://blog.csdn.net/genglei1022/article/details/83374188
defaults
log global
mode tcp
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
listen stats
bind 0.0.0.0:1080
stats refresh 30s
stats uri /stats
stats realm Haproxy Manager
frontend www
bind *:80
mode tcp
option forwardfor
log global
default_backend htmpool
backend htmpool
mode tcp
option redispatch
option abortonclose
balance roundrobin
server k8s-node-1 testcafe.xxxx.com:32410 check
评论已关闭!