-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhaproxy.cfg
More file actions
41 lines (36 loc) · 1.5 KB
/
Copy pathhaproxy.cfg
File metadata and controls
41 lines (36 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
global
log /dev/log local0 info #日志输出配置
chroot /root #最好指定一个所有人都没权限的空目录
pidfile /tmp/haproxy.pid
maxconn 4000 #最大连接数
user root #用户root
defaults
mode tcp #TCP模式
log global
option dontlognull
option http-server-close
option redispatch
retries 2 #2次连接失败就认为服务器不可用,主要通过后面的check检查
timeout http-request 10s
timeout queue 1m
timeout connect 300ms #超过300毫秒认为失败
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 20s #检查间隔
maxconn 3000
# balance leastconn #选择连接数少的进行使用
balance roundrobin #负载均衡算法,轮询,连接数很平均
default-server inter 30s rise 2 fall 3
listen ssr
bind 0.0.0.0:8388 #haproxy监听地址和端口
server ss1 1.2.3.4:567 check #服务器列表,check表示执行检查
server ss2 1.2.3.4:567 check
listen admin_status #配置监控WEB控制台
bind 0.0.0.0:8389 #侦听IPort
mode http #侦听方式
stats refresh 10s #设置页面刷新时间
stats uri / #haproxy监控页面的访问地址
stats auth admin:admin #设置监控页面的用户和密码,可以设置多个账户密码
# stats hide-version #隐藏统计页面的HAproxy版本信息
stats admin if TRUE #手工启用/禁用后端服务器