-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaproxy-emst.cfg
132 lines (116 loc) · 4.28 KB
/
haproxy-emst.cfg
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
# local2.* /var/log/haproxy.log
#
log 127.0.0.1:514 local0 debug
#log 127.0.0.1 local1
#log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy-emst.pid
# turn on stats unix socket
stats socket /var/lib/haproxy/stats-emst level admin
maxconn 2048
user haproxy
group haproxy
daemon
# open #n haproxy process
nbproc 1
# CPU binding
# cpu-map <process-set>[/<thread-set>] <cpu-set>
#cpu-map 1-4 0-3 # bind processes 1 to 4 on the first 4 CPUs
#cpu-map 1/all 0-3 # bind all threads of the first process on the first 4 CPUs
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode tcp
log global
option http-keep-alive
option tcplog
#option httplog
option http-server-close
option dontlognull
option redispatch
#option tcpka
retries 3
timeout queue 5m
timeout connect 5s # Set the maximum time to wait for a connection attempt to a server to succeed.
timeout client 8h # The inactivity timeout applies when the client is expected to acknowledge or send data.
timeout server 8h # The inactivity timeout applies when the server is expected to acknowledge or send data.
timeout check 3s # health check min(timeout check, inter=2s)
timeout client-fin 5s
timeout server-fin 5s
maxconn 2048
#stats refresh 20s # httpmode
balance static-rr
# A "listen" section defines a complete proxy with its frontend and backend
# parts combined in one section. It is generally useful for TCP-only traffic.
listen haproxy_statistics
log 127.0.0.1 local2 info err
bind 0.0.0.0:8000
mode http
timeout client 30s
timeout server 30s
stats enable
stats show-node
stats show-legends
stats realm HAProxy\ Statistics
stats uri /admin?stats
stats refresh 15s
stats auth admin:hapAdminPWD1234
stats admin if TRUE
#stats hide-version
option httplog
log-format "%ci:%cp %si:%sp %ST %TR/%Tw/%Tc/%Tr/%Ta %{+Q}r %ac/%fc/%bc/%sc/%rc %sq/%bq %U %B"
#=========
# 收單服務
#=========
# listen Server_Port
# bind 0.0.0.0:3333
# #bind-process 1
# mode tcp
# balance leastconn
# log global
# option tcp-check
# option tcplog
# option logasap
# maxconn 256
# tcp-request connection reject if !{ src -f /etc/haproxy/白名單.lst }
#--------------
# development
#--------------
# server EMST-Dev01 192.168.0.1:1234 weight 1 check inter 5s fall 3 rise 1
# server EMST-Dev02 192.168.0.2:1234 weight 1 check inter 5s fall 3 rise 1
# server EMST-Dev03 192.168.0.3:1234 weight 1 check inter 5s fall 3 rise 1
#--------------
# production
#--------------
#=====================
# MariaDB
#=====================
listen EMST-MariaDB
bind 0.0.0.0:3307
mode tcp
option tcpka
#option mysql-check user haproxy #<username>
balance static-rr
#--------------
# development
#--------------
server EMST-Dev01 192.168.199.234:3306 weight 5 check inter 10s fall 3 rise 1
server EMST-Dev02 192.168.199.235:3306 backup check inter 10s fall 3 rise 1
server EMST-Dev03 192.168.199.236:3306 backup check inter 10s fall 3 rise 1