Haproxy 线上在用配置

  1 global
  2 log 127.0.0.1 local0 info
  3 chroot /var/lib/haproxy
  4 pidfile /var/run/haproxy.pid
  5 maxconn 4000
  6 user haproxy
  7 group haproxy
  8 daemon
  9 stats socket /var/lib/haproxy/stats
 10 defaults
 11 mode http
 12 log global
 13 option httplog
 14 option dontlognull
 15 option http-server-close
 16 option redispatch
 17 retries 3
 18 timeout http-request 10s
 19 timeout queue 1m
 20 timeout connect 10s
 21 timeout client 1m
 22 timeout server 1m
 23 timeout http-keep-alive 10s
 24 timeout check 10s
 25 maxconn 3000
 26 frontend main *:5000
 27 acl url_static path_beg -i /static /images /javascript /stylesheets
 28 acl url_static path_end -i .jpg .gif .png .css .js
 29 use_backend static if url_static
 30 default_backend app
 31 backend static
 32 balance roundrobin
 33 server static 127.0.0.1:4331 check
 34 backend app
 35 balance roundrobin
 36 server app1 127.0.0.1:5001 check
 37 server app2 127.0.0.1:5002 check
 38 server app3 127.0.0.1:5003 check
 39 server app4 127.0.0.1:5004 check
 40 listen rabbitmq_cluster 0.0.0.0:5670
 41 #配置TCP模式
 42 mode tcp
 43 option tcplog
 44 #加权轮询
 45 balance roundrobin
 46 #rabbitMQ集群节点配置
 47 server rabbitmq1 172.19.78.91:5672 check inter 2000 rise 2 fall 3
 48 server rabbitmq2 172.19.78.87:5672 check inter 2000 rise 2 fall 3
 49 
 50 listen consul 0.0.0.0:8500
 51 mode http
 52 balance roundrobin
 53 server c2 172.19.78.88:8500 check inter 2000 rise 2 fall 3
 54 server c3 172.19.78.83:8500 check inter 2000 rise 2 fall 3
 55 
 56 listen IQFDataTransferReplay 0.0.0.0:18661
 57 mode tcp
 58 option tcplog
 59 balance roundrobin
 60 server ferReplay2 172.19.78.88:18661 check inter 2000 rise 2 fall 3
 61 server ferReplay1 172.19.78.83:18661 check inter 2000 rise 2 fall 3
 62 server ferReplay3 172.19.78.89:18661 check inter 2000 rise 2 fall 3
 63 
 64 listen IQFDataTransferRt 0.0.0.0:18662
 65 mode tcp
 66 option tcplog
 67 balance roundrobin
 68 server ferRt2 172.19.78.88:18662 check inter 2000 rise 2 fall 3
 69 server ferRt1 172.19.78.83:18662 check inter 2000 rise 2 fall 3
 70 server ferRt3 172.19.78.89:18662 check inter 2000 rise 2 fall 3
 71 
 72 listen IQFQuoteProxy 0.0.0.0:18661
 73 mode tcp
 74 option tcplog
 75 balance roundrobin
 76 server Proxy2 172.19.78.88:19866 check inter 2000 rise 2 fall 3
 77 server Proxy1 172.19.78.83:19866 check inter 2000 rise 2 fall 3
 78 server Proxy3 172.19.78.89:19866 check inter 2000 rise 2 fall 3
 79 
 80 listen community
 81 bind 0.0.0.0:15333
 82 mode http
 83 acl static_path_community path_beg -i /community
 84 use_backend path_community if static_path_community
 85 acl static_path_kolmanage path_beg -i /kolmanager
 86 use_backend path_kolmanage if static_path_kolmanage
 87 backend path_community
 88 server community2 172.19.78.88:5308 check inter 2000 rise 2 fall 3
 89 server community1 172.19.78.83:5308 check inter 2000 rise 2 fall 3
 90 backend path_kolmanage
 91 server kolmanage2 172.19.78.92:55059 check inter 2000 rise 2 fall 3
 92 server kolmanage1 172.19.78.90:55059 check inter 2000 rise 2 fall 3
 93 
 94 listen user
 95 bind 0.0.0.0:5307
 96 mode http
 97 acl static_path_strategy path_beg -i /strategy
 98 use_backend strategy if static_path_strategy
 99 
100 acl static_path_fullsearch path_beg -i /fullsearch
101 use_backend fullsearch if static_path_fullsearch
102 
103 acl static_path_apigateway path_beg -i /apigateway
104 use_backend apigateway if static_path_apigateway
105 
106 acl static_path_msgcenter path_beg -i /msgcenter
107 use_backend msgcenter if static_path_msgcenter
108 
109 default_backend UserWeb
110 backend strategy
111 server strategy2 172.19.78.91:5320 check inter 2000 rise 2 fall 3
112 server strategy1 172.19.78.87:5320 check inter 2000 rise 2 fall 3
113 
114 backend fullsearch
115 timeout connect 5000ms
116 option redispatch
117 option http-pretend-keepalive
118 timeout server 200000ms
119 server fullsearch1 172.19.78.88:5306 check inter 2000 rise 2 fall 3
120 
121 backend apigateway
122 server apigateway2 172.19.78.88:5318 check inter 2000 rise 2 fall 3
123 server apigateway1 172.19.78.83:5318 check inter 2000 rise 2 fall 3
124 
125 backend msgcenter
126 server msgcenter2 172.19.78.92:5321 check inter 2000 rise 2 fall 3
127 server msgcenter1 172.19.78.90:5321 check inter 2000 rise 2 fall 3
128 
129 backend UserWeb
130 server UserWeb2 172.19.78.88:5307 check inter 2000 rise 2 fall 3
131 server UserWeb1 172.19.78.83:5307 check inter 2000 rise 2 fall 3
132 
133 listen kolmannager
134 bind 0.0.0.0:5333
135 mode http
136 acl static_path_kolmanager path_beg -i /kolmanager
137 use_backend path_kolmanager if static_path_kolmanager
138 backend path_kolmanager
139 server kolmanager2 172.19.78.90:55059 check inter 2000 rise 2 fall 3
140 server kolmanager1 172.19.78.92:55059 check inter 2000 rise 2 fall 3
141 
142 listen live
143 bind 0.0.0.0:5334
144 mode http
145 acl static_path_live path_beg -i /live
146 use_backend path_live if static_path_live
147 
148 acl static_path_video path_beg -i /video
149 use_backend path_video if static_path_video
150 
151 acl static_path_im path_beg -i /im
152 use_backend path_im if static_path_im
153 
154 backend path_im
155 server im2 172.19.78.90:44315 check inter 2000 rise 2 fall 3
156 server im1 172.19.78.92:44315 check inter 2000 rise 2 fall 3
157 
158 backend path_live
159 server live2 172.19.78.90:44314 check inter 2000 rise 2 fall 3
160 server live1 172.19.78.92:44314 check inter 2000 rise 2 fall 3
161 
162 backend path_video
163 server video2 172.19.78.90:44316 check inter 2000 rise 2 fall 3
164 server video1 172.19.78.92:44316 check inter 2000 rise 2 fall 3
165 
166 listen QuantApi 0.0.0.0:15320
167 mode tcp
168 option tcplog
169 balance roundrobin
170 server QuantApi2 172.19.78.91:5320 check inter 2000 rise 2 fall 3
171 server QuantApi1 172.19.78.87:5320 check inter 2000 rise 2 fall 3
172 
173 listen VirtualApiWeb 0.0.0.0:5319
174 mode tcp
175 option tcplog
176 balance roundrobin
177 server VirtualApiWeb2 172.19.78.88:5319 check inter 2000 rise 2 fall 3
178 server VirtualApiWeb1 172.19.78.83:5319 check inter 2000 rise 2 fall 3
179 
180 listen FullSearchWebApi 0.0.0.0:5306
181 mode tcp
182 option tcplog
183 balance roundrobin
184 server FullSearchWebApi2 172.19.78.88:5306 check inter 2000 rise 2 fall 3
185 server FullSearchWebApi1 172.19.78.83:5306 check inter 2000 rise 2 fall 3
186 
187 listen Octopus.QuoteTransferService 0.0.0.0:18996
188 mode tcp
189 option tcplog
190 balance roundrobin
191 server QuoteTransferService2 172.19.78.92:8996 check inter 2000 rise 2 fall 3
192 server QuoteTransferService1 172.19.78.90:8996 check inter 2000 rise 2 fall 3
193 
194 listen DataSynchronizationWebApi 0.0.0.0:15323
195 mode tcp
196 option tcplog
197 balance roundrobin
198 server DataSynchronizationWebApi2 172.19.78.92:5323 check inter 2000 rise 2 fall 3
199 server DataSynchronizationWebApi1 172.19.78.90:5323 check inter 2000 rise 2 fall 3
200 
201 listen traefik 0.0.0.0:80
202 mode tcp
203 option tcplog
204 balance roundrobin
205 server traefik2 172.19.78.88:80 check inter 2000 rise 2 fall 3
206 server traefik1 172.19.78.83:80 check inter 2000 rise 2 fall 3
207 server traefik3 172.19.78.89:80 check inter 2000 rise 2 fall 3
208 
209 listen monitor 0.0.0.0:8100
210 mode http
211 option httplog
212 stats enable
213 stats uri /stats
214 stats refresh 5s
原文地址:https://www.cnblogs.com/sqbk/p/14168490.html