Last active
January 16, 2020 09:07
-
-
Save SEJeff/7310830 to your computer and use it in GitHub Desktop.
Apache config to load balance across a cluster of elasticsearch instances on 2 different servers, "es-cluster-1", and "es-cluster-2".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName balancer.local | |
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED | |
<Location /balancer-manager> | |
ProxyPass ! | |
SetHandler balancer-manager | |
#Require host example.com | |
Require host localhost | |
</Location> | |
<Proxy balancer://elasticsearch/*> | |
BalancerMember http://es-cluster-1:9200 route=1 | |
BalancerMember http://es-cluster-1:9201 route=2 | |
BalancerMember http://es-cluster-2:9200 route=3 | |
BalancerMember http://es-cluster-2:9201 route=3 | |
ProxySet stickysession=ROUTEID | |
</Proxy> | |
ProxyPass / balancer://elasticsearch/ | |
ProxyPassReverse / balancer://elasticsearch/ | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment