Setup Requirements
Load balancer
Load balancer should be configured to know the IP address / Domain name of the application servers, and the ping URL of them.
Apache configuration
Recommended version Apache 2.4.21 and later
ServerName 127.0.0.1
Listen 0.0.0.0:8889
<VirtualHost *:8889>
ProxyHCExpr ok234 {%{REQUEST_STATUS} =~ /^[234]/}
<Proxy balancer://codebeamercluster>
BalancerMember http://localhost:8080 hcmethod=GET hcuri=/cb/hc/cluster/ping.spr hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=2
BalancerMember http://localhost:8081 hcmethod=GET hcuri=/cb/hc/cluster/ping.spr hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=2
ProxySet lbmethod=byrequests
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
Order allow,deny
allow from localhost
</Location>
ProxyPass /balancer-manager !
ProxyPass / balancer://codebeamercluster/
ProxyPassReverse / balancer://codebeamercluster/
</VirtualHost>
Name of the cluster could be any valid string, same value must be used in the ProxyPass and ProxyPassReverse configurations
hcuri must set to /cb/hc/cluster/ping.spr
hcinterval must be lower value than the checkServerStatusInterval (see below), recommended value is half of the checkServerStatusInterval
Required plugins
• lbmethod_byrequests
• proxy
• proxy_balancer
• proxy_hcheck
• proxy_http
Docker image
You can build a docker image from the following docker project
LoadBalancer.zip.
How to build:
Extract the LoadBalancer.zip, and go to the directory, you should see a Dockerfile
docker build --tag <imageName>:latest .
imageName could be any valid docker image name, for example, cbLoadBalancer
How to run:
docker run -p 80:8888 -e ACTIVE=http://codeBeamerActiveServer.com -e PASSIVE=http://codeBeamerPassiveServer.com <imageName>
Visit the
http://localhost/cb, load balancer information can be found here:
http://localhost/balancer-manager
Recommendation
• Balancer-manager is useful for debugging, it is recommended to strengthen the authentication of it, or remove it from the configuration
• Use domain names instead of IPs, it is much flexible solution
Shared file system
TODO