我正在使用RESTful架构.我有两个运行的应用服务器.一个应该只服务GET请求而其他应该只服务POST请求.我想配置HAProxy以根据上述条件对请求进行负载均衡.请帮我
小智 26
这是一个部分HAProxy配置,可以为您执行此操作:
frontend webserver
bind :80
mode http
acl is_post method POST
use_backend post_app if is_post
default_backend get_app
backend post_app
mode http
option forwardfor
balance source
option httpclose
option httpchk HEAD / HTTP/1.0
server post_app1 172.16.0.11:80 weight 1 check inter 1000 rise 5 fall 1
server post_app2 172.16.0.12:80 weight 1 check inter 1000 rise 5 fall 1
server post_app3 172.16.0.13:80 weight 1 check inter 1000 rise 5 fall 1 backup
backend get_app
mode http
option forwardfor
balance source
option httpclose
option httpchk HEAD / HTTP/1.0
server get_app1 172.16.0.21:80 weight 1 check inter 1000 rise 5 fall 1
server get_app2 172.16.0.22:80 weight 1 check inter 1000 rise 5 fall 1
server get_app3 172.16.0.23:80 weight 1 check inter 1000 rise 5 fall 1 backup
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13171 次 |
| 最近记录: |