Viv*_*oel 4 routing load-balancing haproxy
我有 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>
Run Code Online (Sandbox Code Playgroud)
目前我正在用代码管理集群组配置。是否有可能使用 haproxy 调用一个域,并且根据源 ip 需要哪些重定向?例如
192.167.* request gets redirect to 192.167.3.1
Run Code Online (Sandbox Code Playgroud)
和
192.168.* request gets redirect to 192.168.3.1
Run Code Online (Sandbox Code Playgroud)
Phi*_*ano 10
这可以通过HAProxy ACL 实现。您需要设置 2 个后端,每个块一个,然后在前端创建 2 个 acl,每个后端一个。
你的前端块看起来像这样
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
Run Code Online (Sandbox Code Playgroud)
然后定义一个后端block_7_hosts
并block_8_hosts
在其中使用正确的 redis 服务器。
如果您不打算添加更多 Redis 服务器,尽管您可能只想使用配置管理工具,因为您并没有真正实现负载平衡。
归档时间: |
|
查看次数: |
19421 次 |
最近记录: |