Haproxy通过acl';s实现不同后端的负载平衡web集群
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Haproxy通过acl';s实现不同后端的负载平衡web集群相关的知识,希望对你有一定的参考价值。
How to send load-balanced requests to a web cluster and split the requests to different server pools based on specific ACL rules.This configuration sends files ending with .php to a pool of "dynamic" web servers (running Apache).
It sends all other files (.js, .jpg, .css, .html) to a pool of "static" web servers (running Lighttpd).
# HTTP web cluster frontend cluster_http bind :80 mode http option forwardfor acl content_php path_end .php use_backend dynamic_cluster_http if content_php default_backend static_cluster_http # Static cluster serving every file EXCEPT those ending with .php backend static_cluster_http mode http option forwardfor balance source option httpclose option httpchk HEAD / HTTP/1.0 server staticweb1 192.168.0.100:80 weight 1 check inter 1000 rise 5 fall 1 server staticweb2 192.168.0.101:80 weight 1 check inter 1000 rise 5 fall 1 # Dynamic cluster serving files ending with .php backend dynamic_cluster_http mode http option forwardfor balance source option httpclose option httpchk HEAD / HTTP/1.0 server dynweb1 192.168.0.102:80 weight 1 check inter 1000 rise 5 fall 1 server dynweb2 192.168.0.103:80 weight 1 check inter 1000 rise 5 fall 1
以上是关于Haproxy通过acl';s实现不同后端的负载平衡web集群的主要内容,如果未能解决你的问题,请参考以下文章
使用HAPROXY的ACL实现基于文件后缀名的动态和静态资源分离