blob: d25f80425a93c5913712732a502be092324b06d3 [file] [log] [blame]
Filip Pytloun48d38302015-10-06 16:28:31 +02001=======
2HAproxy
3=======
4
5The Reliable, High Performance TCP/HTTP Load Balancer.
6
Jiri Konecny371c6de2016-03-02 11:32:46 +01007
8Sample pillars
9==============
10
11Simple admin listener
12
13.. code-block:: yaml
14
15 haproxy:
16 proxy:
17 enabled: True
18 listen:
19 admin_page:
20 type: admin
21 binds:
22 - address: 0.0.0.0
23 port: 8801
24 user: fsdfdsfds
25 password: dsfdsf
26
Jiri Konecny371c6de2016-03-02 11:32:46 +010027Simple stats listener
28
29.. code-block:: yaml
30
31 haproxy:
32 proxy:
33 enabled: True
34 listen:
35 admin_page:
36 type: stats
37 binds:
38 - address: 0.0.0.0
39 port: 8801
40
41
42
43Sample pillar with admin
Filip Pytloun48d38302015-10-06 16:28:31 +020044
45.. code-block:: yaml
46
47 haproxy:
48 proxy:
49 enabled: True
50 mode: http/tcp
Jiri Konecny371c6de2016-03-02 11:32:46 +010051 logging: syslog
Filip Pytloun48d38302015-10-06 16:28:31 +020052 max_connections: 1024
53 connect_timeout: 5000
54 client_timeout: 50000
55 server_timeout: 50000
56 listens:
57 - name: https-in
58 bind:
59 address: 0.0.0.0
60 port: 443
61 servers:
62 - name: server1
63 host: 10.0.0.1
64 port: 8443
65 - name: server2
66 host: 10.0.0.2
67 port: 8443
68 params: 'maxconn 256'
69
Jiri Konecny371c6de2016-03-02 11:32:46 +010070
Filip Pytloun48d38302015-10-06 16:28:31 +020071Sample pillar with custom logging
Filip Pytloun48d38302015-10-06 16:28:31 +020072
73.. code-block:: yaml
74
75 haproxy:
76 proxy:
77 enabled: True
78 mode: http/tcp
79 logging: syslog
80 max_connections: 1024
81 connect_timeout: 5000
82 client_timeout: 50000
83 server_timeout: 50000
84 listens:
85 - name: https-in
86 bind:
87 address: 0.0.0.0
88 port: 443
89 servers:
90 - name: server1
91 host: 10.0.0.1
92 port: 8443
93 - name: server2
94 host: 10.0.0.2
95 port: 8443
96 params: 'maxconn 256'
97
98.. code-block:: yaml
99
100 haproxy:
101 proxy:
102 enabled: true
103 mode: tcp
104 logging: syslog
105 max_connections: 1024
106 listens:
107 - name: mysql
108 type: mysql
109 binds:
110 - address: 10.0.88.70
111 port: 3306
112 servers:
113 - name: node1
114 host: 10.0.88.13
115 port: 3306
116 params: check inter 15s fastinter 2s downinter 1s rise 5 fall 3
117 - name: node2
118 host: 10.0.88.14
119 port: 3306
120 params: check inter 15s fastinter 2s downinter 1s rise 5 fall 3 backup
121 - name: node3
122 host: 10.0.88.15
123 port: 3306
124 params: check inter 15s fastinter 2s downinter 1s rise 5 fall 3 backup
125 - name: rabbitmq
126 type: rabbitmq
127 binds:
128 - address: 10.0.88.70
129 port: 5672
130 servers:
131 - name: node1
132 host: 10.0.88.13
133 port: 5673
134 params: check inter 5000 rise 2 fall 3
135 - name: node2
136 host: 10.0.88.14
137 port: 5673
138 params: check inter 5000 rise 2 fall 3 backup
139 - name: node3
140 host: 10.0.88.15
141 port: 5673
142 params: check inter 5000 rise 2 fall 3 backup
143 -name: keystone-1
144 type: general-service
145 bins:
146 - address: 10.0.106.170
147 port: 5000
148 servers:
149 -name: node1
150 host: 10.0.88.13
151 port: 5000
152 params: check
153
154.. code-block:: yaml
155
156 haproxy:
157 proxy:
158 enabled: true
159 mode: tcp
160 logging: syslog
161 max_connections: 1024
162 listens:
163 - name: mysql
164 type: mysql
165 binds:
166 - address: 10.0.88.70
167 port: 3306
168 servers:
169 - name: node1
170 host: 10.0.88.13
171 port: 3306
172 params: check inter 15s fastinter 2s downinter 1s rise 5 fall 3
173 - name: node2
174 host: 10.0.88.14
175 port: 3306
176 params: check inter 15s fastinter 2s downinter 1s rise 5 fall 3 backup
177 - name: node3
178 host: 10.0.88.15
179 port: 3306
180 params: check inter 15s fastinter 2s downinter 1s rise 5 fall 3 backup
181 - name: rabbitmq
182 type: rabbitmq
183 binds:
184 - address: 10.0.88.70
185 port: 5672
186 servers:
187 - name: node1
188 host: 10.0.88.13
189 port: 5673
190 params: check inter 5000 rise 2 fall 3
191 - name: node2
192 host: 10.0.88.14
193 port: 5673
194 params: check inter 5000 rise 2 fall 3 backup
195 - name: node3
196 host: 10.0.88.15
197 port: 5673
198 params: check inter 5000 rise 2 fall 3 backup
199 -name: keystone-1
200 type: general-service
201 bins:
202 - address: 10.0.106.170
203 port: 5000
204 servers:
205 -name: node1
206 host: 10.0.88.13
207 port: 5000
208 params: check
209
Filip Pytloune1a6f062016-08-26 15:13:38 +0200210Custom more complex listener (for Artifactory and subdomains for docker
211registries)
212
213.. code-block:: yaml
214
215 haproxy:
216 proxy:
217 listen:
218 artifactory:
219 mode: http
220 options:
221 - forwardfor
222 - forwardfor header X-Real-IP
223 - httpchk
224 - httpclose
225 - httplog
226 acl:
227 is_docker: "path_reg ^/v[12][/.]*"
228 http_request:
229 - action: "set-path /artifactory/api/docker/%[req.hdr(host),lower,field(1,'.')]%[path]"
230 condition: "if is_docker"
231 balance: source
232 binds:
233 - address: ${_param:cluster_vip_address}
234 port: 8082
235 servers:
236 - name: ${_param:cluster_node01_name}
237 host: ${_param:cluster_node01_address}
238 port: 8082
239 params: check
240 - name: ${_param:cluster_node02_name}
241 host: ${_param:cluster_node02_address}
242 port: 8082
243 params: backup check
244
Filip Pytloun48d38302015-10-06 16:28:31 +0200245Read more
246=========
247
248* https://github.com/jesusaurus/hpcs-salt-state/tree/master/haproxy
249* http://www.nineproductions.com/saltstack-ossec-state-using-reactor/ - example reactor usage.
250* https://gist.github.com/tomeduarte/6340205 - example on how to use peer from within a config file (using jinja)
251* http://youtu.be/jJJ8cfDjcTc?t=8m58s - from 9:00 on, a good overview of peer vs mine
252* https://github.com/russki/cluster-agents