Load balancing and proxy for Riak-CS

From the basho.com official website – on their technical documentation – we are recommended to place Riak CS behind a load-balancing or proxy solution. Riak CS should not directly expose to public-facing network interfaces.

Today I have managed to make HAPROXY work together with Riak CS as my load-balancing and proxy.

For detail documentation please refer to this link:


You can use my configuration as a reference too.

Please do not forget to edit your /etc/haproxy/gip.lst by inserting your allowed IPs

log local0
log local1 notice
maxconn 256000
spread-checks 5

log global
option dontlognull
option redispatch
option allbackups
no option httpclose
retries 3
maxconn 256000
timeout connect 5000
timeout client 5000
timeout server 5000

frontend riak_cs
# Example bind for SSL termination
# bind ssl crt /opt/local/haproxy/etc/data.pem
mode http
option httplog
capture request header Host len 64
acl good_ips src -f /etc/haproxy/gip.lst
block if !good_ips
use_backend riak_cs_backend if good_ips

backend riak_cs_backend
mode http
balance roundrobin
# Ping Riak CS to determine health
option httpchk GET /riak-cs/ping
timeout connect 60s
timeout http-request 60s
server riak-cs weight 1 maxconn 1024 check
server riak2 r1s02.example.com:8081 weight 1 maxconn 1024 check
server riak3 r1s03.example.com:8081 weight 1 maxconn 1024 check
server riak4 r1s04.example.com:8081 weight 1 maxconn 1024 check
server riak5 r1s05.example.com:8081 weight 1 maxconn 1024 check