Skip to content

Instantly share code, notes, and snippets.

@tebeka
Last active July 5, 2024 13:28
Show Gist options
  • Save tebeka/c96887c2ddcebb752a81 to your computer and use it in GitHub Desktop.
Save tebeka/c96887c2ddcebb752a81 to your computer and use it in GitHub Desktop.
HAProxy in front of Elasticsearch
elastic:
image: elasticsearch
haproxy:
image: haproxy
volumes:
- ${PWD}:/usr/local/etc/haproxy
links:
- elastic
ports:
- "9200:9200"
# Based on http://j.mp/1YHQFgZ
# vim: ft=haproxy
defaults
timeout connect 5000
timeout client 10000
timeout server 10000
frontend elastic
bind :9200
mode http
acl is_delete method DELETE
http-request deny if is_delete
default_backend elastic
backend elastic
mode http
option forwardfor
balance source
option httpclose
server es1 elastic:9200 weight 1 check inter 1000 rise 5 fall 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment