 
 
| Раздел 10. Apache modules Пункты: 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 163 164 165 166 167 168 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 203 204 205 206 207 208 209 210 211 212 213    RU           EN   Пункт 171. Apache Module mod_proxy_balancer 
 SummaryThis module requires the service of  
 The Load balancing scheduler algorithm is not provided by this module but from other ones such as: 
 Thus, in order to get the ability of load balancing,
  WarningDo not enable proxying until you have secured your server. Open proxy servers are dangerous both to your network and to the Internet at large. Load balancer scheduler algorithmAt present, there are 3 load balancer scheduler algorithms available
 for use: Request Counting, Weighted Traffic Counting and Pending Request
 Counting. These are controlled via the  Load balancer stickynessThe balancer supports stickyness. When a request is proxied to some back-end, then all following requests from the same user should be proxied to the same back-end. Many load balancers implement this feature via a table that maps client IP addresses to back-ends. This approach is transparent to clients and back-ends, but suffers from some problems: unequal load distribution if clients are themselves hidden behind proxies, stickyness errors when a client uses a dynamic IP address that changes during a session and loss of stickyness, if the mapping table overflows. The module  Examples of a balancer configurationBefore we dive into the technical details, here's an example of
 how you might use  <Proxy "balancer://mycluster"> BalancerMember "http://192.168.1.50:80" BalancerMember "http://192.168.1.51:80" </Proxy> ProxyPass "/test" "balancer://mycluster" ProxyPassReverse "/test" "balancer://mycluster" Another example of how to provide load balancing with stickyness
 using  Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy "balancer://mycluster">
 BalancerMember "http://192.168.1.50:80" route=1
 BalancerMember "http://192.168.1.51:80" route=2
 ProxySet stickysession=ROUTEID
</Proxy>
ProxyPass "/test" "balancer://mycluster"
ProxyPassReverse "/test" "balancer://mycluster"Exported Environment VariablesAt present there are 6 environment variables exported: 
 Enabling Balancer Manager SupportThis module requires the service of
  Thus, in order to get the ability of load balancer management,
  To enable load balancer management for browsers from the example.com
 domain add this code to your  <Location "/balancer-manager"> SetHandler balancer-manager Require host example.com </Location> You can now access load balancer manager by using a Web browser
 to access the page
  Details on load balancer stickynessWhen using cookie based stickyness, you need to configure the
 name of the cookie that contains the information about which back-end
 to use. This is done via the stickysession attribute added
 to either  Some back-ends use a slightly different form of stickyness cookie,
 for instance Apache Tomcat. Tomcat adds the name of the Tomcat instance
 to the end of its session id cookie, separated with a dot (  The second way of implementing stickyness is URL encoding.
 The web server searches for a query parameter in the URL of the request.
 The name of the parameter is specified again using stickysession.
 The value of the parameter is used to lookup a member worker with route
 equal to that value. Since it is not easy to extract and manipulate all
 URL links contained in responses, generally the work of adding the parameters
 to each link is done by the back-end generating the content.
 In some cases it might be feasible doing
 this via the web server using  The Java standards implement URL encoding slightly different. They use
 a path info appended to the URL using a semicolon (  Finally you can support cookies and URL encoding at the same time, by
 configuring the name of the cookie and the name of the URL parameter
 separated by a vertical bar (  ProxyPass "/test" "balancer://mycluster" stickysession=JSESSIONID|jsessionid scolonpathdelim=On <Proxy "balancer://mycluster"> BalancerMember "http://192.168.1.50:80" route=node1 BalancerMember "http://192.168.1.51:80" route=node2 </Proxy> If the cookie and the request parameter both provide routing information for the same request, the information from the request parameter is used. Troubleshooting load balancer stickynessIf you experience stickyness errors, e.g. users lose their application sessions and need to login again, you first want to check whether this is because the back-ends are sometimes unavailable or whether your configuration is wrong. To find out about possible stability problems with the back-ends, check your Apache error log for proxy error messages. To verify your configuration, first check, whether the stickyness
 is based on a cookie or on URL encoding. Next step would be logging
 the appropriate data in the access log by using an enhanced
  
 Common reasons for loss of session are session timeouts, which are usually configurable on the back-end server. The balancer also logs detailed information about handling
 stickyness to the error log, if the log level is set to
  Пункты: 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 163 164 165 166 167 168 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 203 204 205 206 207 208 209 210 211 212 213 |  |