Security

How do you make HAProxy load balance for Search Head Pooling?

rayutsw
Engager

I'd like to use HAProxy for Search Head Pooling with SSL.

1 Solution

rayutsw
Engager

This solution relies on HAProxy to terminate the SSL connection and the Search Heads to run in non-SSL Mode.

Download HAProxy from source (Currently only 1.5 supports SSL).

Build with SSL:

make TARGET=linux2628 USE_STATIC_PCRE=1 USE_OPENSSL=1

haproxy.cfg:

global
  maxconn     4096
  nbproc      1
  debug
  daemon
  log         127.0.0.1    local0
defaults
  mode        http
  option      httplog
  log         global
  timeout connect 5000ms
  timeout client 50000ms
  timeout server 50000ms

frontend splunk_secured
  mode http
  bind :443 ssl crt /etc/haproxy/splunk.pem # Includes Cert/Root/Intermediate/PrivateKey
  bind :80
  reqadd X-Forwarded-Proto:\ https
  redirect scheme https if !{ ssl_fc }
  default_backend splunk_search_heads


backend splunk_search_heads
        mode http
        balance roundrobin # Load Balancing algorithm
        cookie SRV insert indirect nocache # Allows sticky sessions
        ## Define your servers to balance
        server splnksh1 192.168.0.1:8000 cookie splnksh1 weight 1 maxconn 512 check port 8000
        server splnksh2 192.168.0.2:8000 cookie splnksh2 weight 1 maxconn 512 check port 8000
        server splnksh3 192.168.0.3:8000 cookie splnksh3 weight 1 maxconn 512 check port 8000

Restart HAProxy. Connect to HAProxy via https and verify everything works.

View solution in original post

rayutsw
Engager

This solution relies on HAProxy to terminate the SSL connection and the Search Heads to run in non-SSL Mode.

Download HAProxy from source (Currently only 1.5 supports SSL).

Build with SSL:

make TARGET=linux2628 USE_STATIC_PCRE=1 USE_OPENSSL=1

haproxy.cfg:

global
  maxconn     4096
  nbproc      1
  debug
  daemon
  log         127.0.0.1    local0
defaults
  mode        http
  option      httplog
  log         global
  timeout connect 5000ms
  timeout client 50000ms
  timeout server 50000ms

frontend splunk_secured
  mode http
  bind :443 ssl crt /etc/haproxy/splunk.pem # Includes Cert/Root/Intermediate/PrivateKey
  bind :80
  reqadd X-Forwarded-Proto:\ https
  redirect scheme https if !{ ssl_fc }
  default_backend splunk_search_heads


backend splunk_search_heads
        mode http
        balance roundrobin # Load Balancing algorithm
        cookie SRV insert indirect nocache # Allows sticky sessions
        ## Define your servers to balance
        server splnksh1 192.168.0.1:8000 cookie splnksh1 weight 1 maxconn 512 check port 8000
        server splnksh2 192.168.0.2:8000 cookie splnksh2 weight 1 maxconn 512 check port 8000
        server splnksh3 192.168.0.3:8000 cookie splnksh3 weight 1 maxconn 512 check port 8000

Restart HAProxy. Connect to HAProxy via https and verify everything works.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...