I configured apache http server to act as load balancer using mod-proxy module
<Proxy balancer://clusterABCD>
BalancerMember http://192.168.0.222:8080/geoserver/wms loadfactor=8
BalancerMember http://192.168.0.14:8081/geoserver/wms loadfactor=8
BalancerMember http://192.168.0.222:8082/geoserver/wms status=+H
ProxySet lbmethod=bytraffic
Order allow,deny
Allow from all
</Proxy>
ProxyPass /LGroup balancer://clusterABCD/
Is there any way to monitor the load balancer functionality
My question is
is there any way to find from which BalanceMember the request is processing
is there any settings available to increase functionality
Thanks IN Advance
In response to your both your questions, yes it is possible but you will need to enhance your configuration for Apache Load Balancing via Mod Proxy to have this functionality available.
I suggest you use the sample setup below:
<VirtualHost *:80>
ProxyRequests off
ServerName servername.local
<Proxy balancer://mycluster>
# TomcatA
BalancerMember http://172.20.20.101:8080 route=tomcatA
# TomcatB
BalancerMember http://172.20.20.102:8080 route=tomcatB
# TomcatC
BalancerMember http://172.20.20.103:8080 route=tomcatC
# Security – to determine who is allowed to access
# Currently all are allowed to access
Order Deny,Allow
Deny from none
Allow from all
# Load Balancer Settings
# We will be configuring a simple Round
# Robin style load balancer. This means
# that all nodes take an equal share of
# of the load.
ProxySet lbmethod=byrequests
</Proxy>
# balancer-manager
# This tool is built into the mod_proxy_balancer
# module and will allow you to do some simple
# modifications to the balanced group via a gui
# web interface.
<Location /balancer-manager>
SetHandler balancer-manager
# I recommend locking this one down to your
# administering location
Order deny,allow
Allow from all
</Location>
# Point of Balance
# This setting will allow to explicitly name the
# location in the site that we want to be
# balanced, in this example we will balance "/"
# or everything in the site.
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=Off scolonpathdelim=On
To view the Balance Request you need to have the module
mod_proxy_balancer
installed and then use the configuration from above.
In regards to availability, it depends on the Load Balancer Settings the Round Robin approach share the traffic equally between the nodes, and is seen as possibly the best option for availabilty:
ProxySet lbmethod=byrequests
Also, if you are considering sharing sessions with your request from Apache to app servers, then configuration to the AJP instead of the HTTP port is needed along with changes needed on the Application Servers (such as Tomcat). More details are available at:
Load Balancing: Apache versus Physical Appliance
May be too simple, but what about monitoring the (access-) logs of your balancer members? This should show you, which member is processing the request.
Related
I have regular load balancing working in Apache. I want to change that to use path based routing and load balancing
I am looking for some guidance on path based routing in Apache
Currently I have 3 servers running Apache.
I have load balancer, which has configuration as follows
What I want to change this is path based routing /load balancing
For ex: if someone types url/app , it should automatically be redirected app server on port 3000
if someone types url/rpt , it should automatically be redirected 3230
if someone types url/azn , it shoudl be redirected to 4010
<Proxy balancer://app0108>
#BalancerMember https://app01.us.ray.com route=1
BalancerMember https://p.q.r.s route=1
#BalancerMember https://app02.us.ray.com route=2
BalancerMember https://a.b.c.d route=2
#BalancerMember https://app03.us.ray.com route=3
BalancerMember https://x.y.a.sd route=3
ProxySet stickysession=ROUTEID
ProxyPass / "balancer://app0108/" failonstatus=503 maxattempts=10 timeout=2400
ProxyPassReverse / "balancer://app0108"
ProxyStatus On
ServerName xxxxx:443
ServerAlias xxxxxx
ErrorLog logs/alb.errors.log
thanks
I'm trying to use ModCluster to load balance some servers. We have one single EAR that need to be load balanced by different DNSs.
We have this scenario. We need to maintain the same context 'system1' because of backward compatibility
4 servers for urla.com.br/system1/
2 servers for urlb.com.br/system1/
Using Wildfly 10.1.0 in domain mode, they are separated by two server groups: URLA and URLB. They share the same profile (URL-HA) and socket bindings (URL-HA-SOCKET).
I have an Apache with mod_cluster with a minimal configuration.
LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so
Listen 10.90.0.13:7777
<VirtualHost 10.90.0.13:7777>
<Directory />
Require all granted
</Directory>
<Location />
Order deny,allow
Allow from all
</Location>
ManagerBalancerName mybalancer
ServerAdvertise on
EnableMCPMReceive On
<Location /mod_cluster-manager>
SetHandler mod_cluster-manager
Order deny,allow
Allow from all
</Location>
</VirtualHost>
When I access http://10.90.0.13:7777/mod_cluster-manager, I see the 6 servers registered with the context system1/. They use the same EAR file, by the way.
But this is not the ideal scenario for us. The users accessing urla.com.br/system1/ cannot use the machines of urlb.com.br/system1/ and vice versa.
The only way that I can found to do this (I not tested yet...) is create one profile for each server group, so I can configure a different load balance group in:
Profile > URLA-HA / URLB-HA > Subsystems > ModCluster.
But in this case, we duplicated all configurations that exists in profile (DataSources, Queues, MailSession, etc). This is painful to maintain.
So, what options we have in my case? Thanks!
I've found the solution for my problem using only one Wildfly's profile.
For this, I have used two balancers and used ProxyPass to use the specific balancer.
Wildfly: At the Domain Controller's Console admin url, go to:
Configuration: Profiles Profile: URL-HA Subsystem: ModCluster
On the Advertising tab, change the Balancer value:
${projectcluster.modcluster.balancer:mybalancer}
Add System Properties to both the server-groups
Runtime -> Server Groups -> URLA -> View
On the System Properties tab, add:
Key 'projectcluster.modcluster.balancer' value 'first'
Key 'jboss.modcluster.multicast.address' value '224.0.2.108'
Runtime -> Server Groups -> URLB -> View
On the System Properties tab, add:
Key 'projectcluster.modcluster.balancer' value 'second'
Key 'jboss.modcluster.multicast.address' value '224.0.2.108'
After this, restart your server-groups URLA and URLB
Apache
Using the example Apache conf on the question:
...
...
ManagerBalancerName mybalancer
ServerAdvertise on
EnableMCPMReceive On
# Defined on Wildfly
AdvertiseGroup 224.0.2.108:23364
<Location /mod_cluster-manager>
SetHandler mod_cluster-manager
Order deny,allow
Allow from all
</Location>
</VirtualHost>
Listen 10.90.0.13:8001
<VirtualHost 10.90.0.13:8001>
ProxyPass / balancer://first stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / balancer://first
</VirtualHost>
Listen 10.90.0.13:8002
<VirtualHost 10.90.0.13:8002>
ProxyPass / balancer://second stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / balancer://second
</VirtualHost>
All the request on 10.90.0.13:8001/system1 will be sent to first balancer and on the 10.90.0.13:8002/system1 will be sent to second balancer
And that is it.
I have 1 load balancer server and 2 app servers which do load distribution. Now i have a strange problem that the
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
rule dous not get triggerd when the request gets forwarded to the app servers.
Setup is:
<Proxy balancer://catdefault>
BalancerMember http://xx.xxx.xxx:8081
BalancerMember http://xx.xxx.yyy:8081
</Proxy>
And in the virtual host i get it included like this:
ProxyPass / balancer://catdefault/
ProxyPassReverse / balancer://catdefault/
The strange thing is that when i apply the Files rule in the app server which is a balance memger ex. http://xx.xxx.xxx:8081 then the rule gets respected.
Now we agreed not to makie rew rulles on the app server because they will be later or many of them and administration will be heavy.
Any idea how i can make the files work from the load balancer server and not the http://xx.xxx.xxx:8081 servers???
<Directory> or <Files> directives will only apply to objects that reside in the filesystem.
Perhaps something like this can help (untested):
ProxyPassMatch "(?i)\.ht([^/]*)$" !
ProxyPass / balancer://catdefault/
ProxyPassReverse / balancer://catdefault/
I have an Endeca cluster setup with 3 dgraph(1 EAC Central Server and 2 EAC agent only instances). I am trying to put an Apache mod_proxy load balancer for testing purpose before the MDEX engines(I am using presentation API to hit the MDEX engine(we are working on assembler API also)). We shall be having an F5(or Nginx, which one shall be better?) hardware load balancer when we'll shall do the actual deployment. My apache server is listening at port 5555, All my Dgraphs are running at port 15000 on three different host. I'm directing the all my queries to apache load balancer.
MDEX_HOST = localhost
MDEX_PORT = 5555
private static ENEConnection createConnection() {...}
And here is my Apache Load balancer configuration. Load balancer modules included in httpd.conf file mod_proxy, mod_proxy_balancer, mod_proxy_connect, mod_proxy_http, mod_negotiation. I have put the load balancer configuration in httpd-vhosts.conf file.
NameVirtualHost *:5555
<VirtualHost *:5555>
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
env=BALANCER_ROUTE_CHANGED
ServerName localhost
ProxyPass / balancer://cluster/
<Proxy balancer://cluster>
BalancerMember http://172.16.26.129:15000 loadfactor=1 retry=0 route=1
BalancerMember http://172.16.26.210:15000 loadfactor=1 retry=0 route=2
BalancerMember http://172.16.27.87:15000 loadfactor=1 retry=0 route=3
Order Deny,Allow
Deny from none
Allow from all
ProxySet lbmethod=byrequests
ProxySet stickysession=ROUTEID
</Proxy>
</VirtualHost>
<Location /balancer-manager>
SetHandler balancer
</Location>
When I do a query(Type ahead service) I'm getting the following error..
** Error Fri Apr 10 20:05:53 IST 2015 1428676553858 /atg/rest/processor/RestActorManager Caused by (#6):com.endeca.navigation.ENEException: HTTP Error 404 - Navigation Engine not able to process request 'http://localhost:5555/search?terms=je&rank=0&offset=0&irversion=640'.
Can anyone please see my load balancer configuration what I'm doing wrong? Thanks
All,
I have a jboss and apache setup hosting my .war file. I have enabled session stickiness to forward requests from apache to jboss . Assume i have 2 apache and 2 jboss instances.
Is the below setting correct ? Currently session stickyness is not working and each time request is appended with a new JSESSSION ID.
<Proxy balancer://cluster>
Order deny,allow
Allow from all
BalancerMember ajp://1.1.1.1:8010/testing keepalive=On loadfactor=1 ping=10 ttl=600
BalancerMember ajp://2.2.2.2:8010/testing keepalive=On loadfactor=1 ping=10 ttl=600
</Proxy>
ProxyPass /testing balancer://cluster timeout=60 stickysession=JSESSIONID nofailover=On
Do i need to add route variable to the balancer member configuration ??? and do i need to enable useJK flag in jboss.
YES, you need to add route to each balancer member.
route=member1
route=member2
That is how Apache knows which way to direct later requests. Look at your cookies in your browser.