Skip to content

Instantly share code, notes, and snippets.

@feniix
Created March 4, 2012 19:26
Show Gist options
  • Save feniix/1974460 to your computer and use it in GitHub Desktop.
Save feniix/1974460 to your computer and use it in GitHub Desktop.
simple haproxy config for solr with multiple nodes
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
errorfile 503 /etc/haproxy/errors/503.http
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 query-solrdev QUERYIP:80 # here we put the url we are using for the query url
mode http
balance roundrobin
cookie JSESSIONID prefix
option httpclose # disable keep-alive
option forwardfor
option httpchk HEAD /solr/admin/ping HTTP/1.0
server solrdev1 192.168.1.1:8080 cookie A check
server solrdev2 192.168.1.2:8080 cookie B check
server solrdev3 192.168.1.3:8080 cookie C check
listen master-solrdev FRONTMASTERIP:80 # here we put the url we are using for the master url (index push)
mode http
balance roundrobin
cookie JSESSIONID prefix
option httpclose # disable keep-alive
option forwardfor
#only one active at the same time
option httpchk HEAD /solr/master/ping HTTP/1.0
server solrdev1 192.168.1.1:8080 cookie A check
server solrdev2 192.168.1.2:8080 cookie B check
server solrdev3 192.168.1.3:8080 cookie C check
rspidel ^Set-cookie:\ IP= # do not let this cookie tell our internal IP address
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment