HAProxy config
1 例子
global
maxconn 1000
nbproc 16
log 127.0.0.1 local0 info
log 127.0.0.1 local1 warning
pidfile /home/work/haproxy/conf/haproxy.pid
daemon
defaults
mode tcp
log global
option dontlognull
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 120m
timeout server 120m
timeout http-keep-alive 10s
timeout check 10s
listen service1
bind *:1235
mode tcp
balance roundrobin
timeout server 60m
server rs1 10.151.238.13:1235 weight 5 maxconn 4000 check inter 10s
server rs2 10.161.48.50:1235 weight 5 maxconn 4000 check inter 10s
listen service2
bind *:1236
mode tcp
balance roundrobin
timeout server 60m
server rs1 10.151.238.13:1236 weight 5 maxconn 4000 check inter 10s
server rs2 10.161.48.50:1236 weight 5 maxconn 4000 check inter 10s
连接回收策略
timeout http-request 10s # HTTP请求超时10秒
timeout queue 1m # 请求在队列中的等待超时时间。若后端服务器负载过高导致请求排队,超过此时间将返回503错误。
timeout connect 10s # 连接建立超时时间。若在指定时间内未完成TCP握手,连接将被终止。
timeout client 120m # 客户端连接空闲超时时间。若客户端在指定时间内未发送数据,连接将被关闭。
timeout server 120m # 服务器端连接空闲超时时间。若服务器在指定时间内未响应,连接将被关闭。
timeout http-keep-alive 10s # 定义HTTP长连接的空闲超时时间。若客户端或服务器在指定时间内未发送新请求,连接将被关闭。
timeout check 10s #
Last updated