balancer-manager可以看到服務(wù)器信息最后將我做的全部配置拿出來(lái):
LoadModule proxy_module modules/mod_proxy.so#提供代理服務(wù)器功能
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so#提供負(fù)載均衡功能
LoadModule proxy_http_module modules/mod_proxy_http.so#請(qǐng)求支持http協(xié)議
LoadModule headers_module modules/mod_headers.so#設(shè)置response headers
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
ProxyRequests Off
<Proxy balancer://mycluster>
BalancerMember http://192.168.1.100:8080/ route=server1 # 分配的8080服務(wù)器
BalancerMember http://192.168.1.100:8089/ route=server2 #分配的8089服務(wù)器
</Proxy>
ProxyPass / balancer://mycluster/ stickysession=ROUTEID #根據(jù)sessionid請(qǐng)對(duì)到對(duì)應(yīng)服務(wù)器
ProxyPassReverse / balancer://mycluster/
<Location /balancer-manager>#調(diào)試
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from all
</Location>
8080服務(wù)器中放test項(xiàng)目 index.jsp test.jsp index.jsp中response.setRedirect("test.jsp")
8089服務(wù)器中放test項(xiàng)目index.jsp test.jsp