Skip to content

Instantly share code, notes, and snippets.

@rkaldung
Forked from mrlesmithjr/haproxy.cfg
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkaldung/9e16191bd54750dff4db to your computer and use it in GitHub Desktop.
Save rkaldung/9e16191bd54750dff4db to your computer and use it in GitHub Desktop.
global
log logstash local0 #Change logstash to your naming
log-send-hostname
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
maxconn 4000
defaults
log global
mode http
option httplog
option dontlognull
option redispatch
retries 3
timeout client 35s
timeout server 60s
timeout connect 5s
timeout http-keep-alive 10s
# contimeout 5000
# clitimeout 50000
# srvtimeout 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
listen stats :9090
balance
mode http
stats enable
stats auth admin:admin
listen logstash-syslog-TCP-514 10.0.101.60:514
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server logstash-1 logstash-1:514 check
server logstash-2 logstash-2:514 check
listen logstash-VMware-TCP-1514 10.0.101.60:1514
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server logstash-1 logstash-1:1514 check
server logstash-2 logstash-2:1514 check
listen logstash-vCenter-TCP-1515 10.0.101.60:1515
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server logstash-1 logstash-1:1515 check
server logstash-2 logstash-2:1515 check
listen logstash-Netscaler-TCP-1517 10.0.101.60:1517
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server logstash-1 logstash-1:1517 check
server logstash-2 logstash-2:1517 check
listen logstash-eventlog-TCP-3515 10.0.101.60:3515
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server logstash-1 logstash-1:3515 check
server logstash-2 logstash-2:3515 check
listen logstash-iis-TCP-3525 10.0.101.60:3525
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server logstash-1 logstash-1:3525 check
server logstash-2 logstash-2:3525 check
listen logstash-redis-TCP-6379 10.0.101.60:6379
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server logstash-1 logstash-1:6379 check
server logstash-2 logstash-2:6379 check
listen elasticsearch-TCP-9200 10.0.101.60:9200
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server logstash-1 logstash-1:9200 check
server logstash-2 logstash-2:9200 check
listen elasticsearch-TCP-9300 10.0.101.60:9300
mode tcp
option tcpka
option tcplog
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance roundrobin
server es-1 es-1:9300 check
server es-2 es-2:9300 check
listen kibana-http 10.0.101.60:80
mode http
stats enable
stats auth admin:password # Change this to your own username and password!
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance source
option httpclose
option forwardfor except 10.0.101.61 # Change this to 10.0.101.62 (Or IP of second node) when setting up second node
cookie JSESSIONID prefix indirect nocache
server logstash-1 logstash-1:80 check cookie L1
server logstash-2 logstash-2:80 check cookie L2
listen kibana-https 10.0.101.60:8443
mode http
stats enable
stats auth admin:password # Change this to your own username and password!
#balance leastconn - The server with the lowest number of connections receives the connection
#balance roundrobin - Each server is used in turns, according to their weights.
#balance source - Source IP hashed and divided by total weight of servers designates which server will receive the request
balance source
#option httpchk
option httpclose
option forwardfor except 10.0.101.61 # Change this to 10.0.101.62 (Or IP of second node) when setting up second node
cookie JSESSIONID prefix indirect nocache
server logstash-1 logstash-1:8080 check cookie L1
server logstash-2 logstash-2:8080 check cookie L2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment