6

I have x cluster. This cluster look like

Cluster 1
192.168.1. (Server type 1)
192.168.2. (Server type 2)
192.168.3.1 (Server type 3) <Redis server> 

Cluster 2
192.167.1. (Server type 1)
192.167.2. (Server type 2)
192.167.3.1 (Server type 3) <Redis server> 

Currently I am managing cluster group configuration in code. Is it possible to have a domain called as using haproxy And which redirect require based on source ip? For example

192.167.* request gets redirect to 192.167.3.1

and

192.168.* request gets redirect to 192.168.3.1

1 Answer 1

12

This is possible with HAProxy ACLs. You need to setup 2 backends, one for each block, then in the frontend create 2 acls, one for each backend.

Your frontend block would look something like this

   acl block_7 src 192.167.0.0/16
   acl block_8 src 192.168.0.0/16

   use_backend block_7_hosts if block_7 
   use_backend block_8_hosts if block_8

Then define a backends block_7_hosts and block_8_hosts with the correct redis server in them.

If you don't plan on adding more Redis servers though you may just want to use a configuration management tool since you aren't really load balancing.

2
  • ya I want to do static routing and distribute load manually
    – Vivek Goel
    Apr 25, 2013 at 15:52
  • 1
    use_backend :)
    – uav
    Feb 9, 2020 at 22:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .