This article provides steps that are needed to configure load balancer while setting up a clustered environment in a distributed network. However, this should not be considered a full and final configuration for a full-fledged production stable configuration. To make a production stable load balancing server, several configurations need to be done.
This is just an illustration of how the basic configuration can be carried out with limited resource availability.
Assumption
Prerequisites
Sequence of operation
Detailed Steps to setup LB
Create and run web service on Server 1(in this case it is on 10.0.1.43)
<flow name="soap-web-serviceFlow1" doc:name="soap-web-serviceFlow1">
<http:inbound-endpoint address="http://localhost:8091/hello"
exchange-pattern="request-response" doc:name="HTTP">
<cxf:jaxws-service serviceClass="org.example.HelloWorld" />
</http:inbound-endpoint>
<component class="org.example.HelloWorldImpl" doc:name="Java" />
</flow>
Create and run another web service on Server 2 (in this case it on 10.0.1.86)
Now that we have 2 services running on 2 different servers, configuration of LB for these servers can be done.
Install and configure HTTPD Server as LB instance
<IfModule mod_proxy_balancer.c>
ServerName www.mycompany.com
ProxyRequests off
<Location /balancer-manager>
Set Handler balancer-manager
Order deny,allow
Allow from all
</Location>
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=SESSION_ID
<Proxy balancer://mycluster >
BalancerMember http://10.0.1.86:8091 loadfactor=4 route=node1
BalancerMember http://10.0.1.43:8091 loadfactor=6 route=node2
# Load Balancer Settings
# We will be configuring a simple Round
# Robin style load balancer. This means
# that all webheads take an equal share of
# of the load.
ProxySet lbmethod=byrequest
</Proxy>
</IfModule>
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule proxy_module modules/mod_proxy.so
Include conf/extra/httpd-proxy-balancer.conf
Assert LB activity
If you would like to find out more about how APIs could help you make the most out of your current infrastructure while enabling you to open your digital horizons, do give us a call at +44 (0)203 475 7980 or email us at Salesforce@coforge.com
Other useful links:
API Recipes with MuleSoft Anypoint Platform