1. 程式人生 > >haproxy原理理解

haproxy原理理解

ces asc BE lin SQ -i frontend def 監聽

frontend webserver
bind 0.0.0.0:80 #在本機的所有接口監聽訪問 80 端口的請求

MySQL集群在HAproxy之後運行,HAproxy對進來請求進行負載均衡,對外只暴露一個IP地址。

根據用戶訪問內容實現動靜分離:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 frontend http-in bind *:80 mode http log global option httpclose acl url_static path_beg -i /static /images /javascript /stylesheets
acl url_static path_end -i .jpg .jpeg .gif .png .css .js use_backend static_servers if url_static default_backend dynamic_servers backend static_servers balance roundrobin server imgsrv1 172.18.64.7:80 check maxconn 6000 server imgsrv2 172.18.64.107:80 check maxconn 6000 backend dynamic_servers
balance source server websrv1 172.18.64.17:80 check maxconn 1000 server websrv2 172.18.64.106:80 check maxconn 1000

http://www.cnblogs.com/heiye123/articles/7928292.html

haproxy原理理解