我有x集群。 这个集群看起来像
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>
目前我正在代码中pipe理群集组configuration。 是否有可能有一个域名为使用haproxy而哪个redirect需要基于源IP? 例如
192.167.* request gets redirect to 192.167.3.1
和
192.168.* request gets redirect to 192.168.3.1
这可以通过HAProxy ACL来实现 。 您需要设置2个后端,每个块一个,然后在前端创build2个acls,每个后端一个。
你的前端块看起来像这样
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
然后用正确的redis服务器定义一个后端block_7_hosts和block_8_hosts 。
如果您不打算添加更多的Redis服务器,尽pipe您可能只想使用configurationpipe理工具,因为您并不真正进行负载平衡。