I want to configure Apache Web Server to meet the following requirement:
Access server1 while it's working.
Access server2 only when server1 does not respond. When server1 responds, access server1 again.
To do so, i tried configuring Apache Web Server (2.2) using mod_proxy_balancer. My problem is that session stickyness seems to be enabled by default. When server1 is not responding, the balancer redirects to server2, but when server1 recovers, the balancer does not access server1 until i clear sessions in my browser.
My balancer configuration:
ProxyPass /test balancer://mycluster
<Proxy balancer://mycluster>
BalancerMember server1-url retry=10 loadfactor=100
BalancerMember server2-url status=+H retry=10
</Proxy>
Is there any option to disable stickyness?
Thanks in advance.
You can do this with Mod_JK with below properties. Reference configuration can be found at Apache httpd 2.2.x + mod_jk 1.2.30 + tomcat 6 Error: Could not find worker with name 'XXXXX' in uri map post processing
# Disable Sticky Session
worker.loadbalancer.sticky_session=0
# Define preferred failover node for worker1
worker.worker1.redirect=worker2
# Disable worker2 for all requests except failover
worker.worker2.activation=disabled
Related
I configured endeca cluster with Apache load balancing of 2 dgraph.. both dgraph are running in different machine... Apache port 5555 used for load balancing...I have two application servers... I'm getting endeca response from only one dgraph not able to get the response from another dgraph and it give no record.... In which machine 5555 port must be running??? It should run both dgraph machine or web server machine???? Can you guys me for getting response from both dgraph.... I need to finish it quickly....
Thanks in advance,
thank you...
DgraphA1 - running in machine A
DgraphB1 - running in machine B (ITL Host)
App server1 pointing to DgraphA1 and Appserver2 pointing to DgraphB1.
Below things are configured in apache for endeca load balancing.I configured the listen port 5555 in Machine A apache..
For App servers, apache are configured in Machine A httpd.conf file.
NameVirtualHost *:5555
<VirtualHost *:5555>
ServerName MachineA
ProxyPass / balancer://dgraphs/
ProxyPassReverse / balancer://dgraphs/
<Proxy balancer://dgraphs>
BalancerMember http://MachineA:15000 loadfactor=1 retry=0
BalancerMember http://MachineB:15000 loadfactor=1 retry=0
</Proxy>
</VirtualHost>
<Location /balancer-manager>
SetHandler balancer-manager
</Location>
Figured it out myself.
Apache 5555 port need to Run in ITLHost(DgraphB1)
Both App server need to point the ITL Host(DgraphB1) and Port 5555.
Everything working fine..
We have a web application hosted on Tomcat server (clustered), with two Apache web servers sitting in front and F5 load balance5 in front of apache. SSL is configured in F5 load balancer. Now whenever someone accesses our application using the load balancer's secure url, our java web application does not evaluate request.isSecure to be true. Is there any setting I need to do enable this.
In our apache web server we have the following configuration using proxy balancer
ServerName ip:80
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID nofailover=Off
ProxyPassReverse / balancer://mycluster/
<Proxy balancer://mycluster>
BalancerMember ajp://ipapp1:8009 route=jvm1 loadfactor=1
BalancerMember ajp://ipapp2:8009 route=jvm2 loadfactor=1 status=+H
ProxySet lbmethod=byrequests
</Proxy>
I tried to change the connector details in server.xml of tomcat by adding scheme= "https", secure="true" and proxyPort="443" for 8080 but it did not work.
What am I missing here?
You'd need to check your app to see if it is supported, but typically a header is forwarded communicating the request protocol. Traditionally this was the X-Forwarded-Proto header, but X-... nomenclature has been deprecated. The Forwarded header now supports what was X-Forwarded-For, X-Forwarded-Proto, etc... in one header. There is still wide support for the deprecated method however, so either approach should work pending app support.
X-Forwarded-Proto: https
or
Forwarded: proto=https
The new standards are described in RFC 7239
Maybe I'm a bit late here, but I had the same situation. I added
scheme= "https", secure="true" and proxyPort="443"
on port 8009 , not on port 8080 like the original question. That's because from Apache the request is made via AJP on port 8009.
Also, Apache must have http-ssl.conf enabled from http.conf and it has to be listening on port 443.
I tried this configuration and it worked, the request sent through the Load Balancer in front of the Apache reported the tomcat webapp in https correctly.
I hope this helps who has the same problem, it took me days to understand this.
I'm using tomcat7.0.63 with mod-cluster1.2.9 and Apache HTTPD2.2 on RHEL6.7
Multiple Tomcat-instances with dedicated balancer configurations are sharing the Apache HTTPD using dedicated Virtualhost:6666.
Only one Tomcat instance should have a Master-Node and a Hot-Standby Node.
I tried with mod-proxy-balancer, BalancerMember, with and without ModClusterListener in server.xml. But it seens the coexistence with mod-cluster on a shared Apache HTTPD is not working...or I make a mistake.
ProxyPass / balancer://mycl/
ProxyPassReverse / balancer://mycl/
<Proxy balancer://mycl>
BalancerMember ajp://1.2.3.9:8009 route=master retry=30
# The server below is on hot standby
BalancerMember ajp://1.2.3.4:8009 route=standby status=+H
</Proxy>
For JBoss EAP and Wildfly there is the lbfactor/loadfactor:
<simple-load-provider factor="0"/>
which makes one node to a hot-standby node.
Is there a way to do so with tomcat7, e.g. a mod-cluster Tomcat system-property which sends a load = 0 (standby) to Virtualhost:6666 ?
kind regards, hplar
We are using apache version 2.2.23 in our environment.We have configured apache in such a way that it should load balance between two applications servers for the same home page.
BalancerMember abc:8101
BalancerMember abc:8102 status=+H
we need to know how the apache web server is detecting that the server 8101 is down???
is it a ping or Telnet or something other then this.
Apache HTTPd does not have out of band healthcheck for BalancerMember. It will detect that a given server is down when a proxyfied request to this server fails.
The documentation can be found here : http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
I have an apache httpd server, say server1* (publicly exposed) that is acting as load balancer for some jboss servers(behind firewall) using mod_cluster. Now I want to install my static content (images/css/htmls) and probably some cg-scripts on a couple of apache servers, say **server2 and server3 (behind firewall).
Now I want server1 to act as load balancer for these server2 and server3 as well along with the jboss servers.
With this arrangement, any request for applications deployed on jboss need to be routed to jboss and any static content request should go to server2 or server3.
Here are the versions I am using
Linux Server
apache httpd - 2.2.22
JBOSS-EAP-6
What mechanism/configuration do I need to use in server1 to make it possible?
Please see if someone can help with this.
Well, you just add a ProxyPass setting. mod_cluster is compatible with ProxyPass, so you can use both.
For instance, if I would like gif images to be served by httpd, not by AS7, I can add:
ProxyPassMatch ^(/.*\.gif)$ !
Furthermore, if you set
CreateBalancers 1
mod_cluster won't create proxies for you and you have to do it yourself. This gives you an additional control. For instance:
ProxyPassMatch ^/static/ !
ProxyPass / balancer://qacluster stickysession=JSESSIONID|jsessionid nofailover=on
ProxyPassReverse / balancer://qacluster
ProxyPreserveHost on
In the aforementioned example, we proxy anything but /static/ content to the workers.
Note:If you encounter any cookies related issues, you might want to play with ProxyPassReverseCookieDomain and ProxyPassReverseCookiePath.
Note qacluster in my config. The default is mycluster, so for naming my balancer qacluster, I added this to mod_cluster config (outside VirtualHost):
ManagerBalancerName qacluster
If it is not clear, just reply and I can try to elaborate further.
I had the same issue where in we were using Apache HTTP server for static content and JBOSS AS 7 server for dynamic contents (the JSF web app).
So adding the below property at the end of Load modules tells
CreateBalancers 0
Tells to "0: Create in all VirtualHosts defined in httpd."
More at: http://docs.jboss.org/mod_cluster/1.2.0/html/native.config.html#d0e485
And the below config solved the issues of images and styel sheets not getting displayed.
<VirtualHost *:80>
ServerName dev.rama.com
DocumentRoot "/var/www/assests"
UseAlias 1
ProxyPassMatch ^(.*\.bmp)$ !
ProxyPassMatch ^(.*\.css)$ !
ProxyPassMatch ^(.*\.gif)$ !
ProxyPassMatch ^(.*\.jpg)$ !
ProxyPassMatch ^(.*\.js)$ !
ProxyPassMatch ^(.*\.png)$ !
<Directory /var/www/assests>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Note:
All our assests for the web app was on HTTP server at
/var/www/assests and the url I was accessing was dev.rama.com on port 80
So when it sees this ProxyPassMatch ^(.*.css)$ !
The webserver knows that the css files are local to the http server and we dont need to go to Jboss App server.
More info at http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass