tomcat7 hot-standby Node with mod-cluster and Apache HTTPD2.2 - apache

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

Related

server failover test issue from apache web server to jboss application

I have used the proxypass and reverse proxypass inside the httpd.conf in apache server to repoints requests to particular JVM in JBoss server.
I have 2 JBoss servers...during a failover test..one JBoss server is stopped abruptly...the apache cant identifies that the one JBoss server is stopped and hence cant redirect request to the other server.
Any help on this?
try
<Proxy balancer://BALANCER_NAME>
BalancerMember https://foo1.bar:443 ping=1 loadfactor=1
BalancerMember https://foo2.bar:443 status=+H ping=1
</Proxy>
ProxyPass / balancer://BALANCER_NAME/
ProxyPassReverse / balancer://BALANCER_NAME/
In this configuration all is sent to foo1 and foo2 is in hot standby (status=+H)

Endeca cluster setup with Apache load balancing

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..

Connections from Apache to Tomcat using proxypass are not closed after each request

I currently have apache2 configured so that requests on specific urls such as /myapp are directed to my internal tomcat server at tomcathost:8080/myapp.
All the requests to myapp to apache2 work as expected.
The problem that I'm facing is that whenever a request is sent to myapp trough apache2 it seems that apache2 is keeping the connection open to tomcat and after a while all the threads in tomcat are taken by apache and apparently not released.
Could somebody point me in the right direction to solve this issue ?
ProxyPass /myapp balancer://apps/myapp
ProxyPassReverse /myapp balancer://apps/myapp
<Proxy balancer://apps>
BalancerMember http://appserver01:8080 route=Node01 loadfactor=1
BalancerMember http://appserver02:8080 route=Node02 loadfactor=1
ProxySet lbmethod=byrequests
ProxySet stickysession=JSESSIONID|jsessionid
ProxySet nofailover=On
</Proxy>
You can set connectiontime out in server.xml so incase if any thread is open it get timedout.
connectionTimeout="120000"
Also you might use JConsole which is part of JDK installation to monitor threads via JMX for your tomcat to see if there is any loop of threads which causes increase in threads.

Apache Webserver configuration to multiple apache tomcat application

I have apache tomcat application which is configured to apache webserver, now I want to add another apache tomcat application to same Apache web server,all these servers (apache tomcat and apache web server (rhel)) are on same network, kindly provide me some ways for configuring it.
is there any other way without using mod_jk?
Apache can talk to Tomcat using either mod_jk or by using the standard proxy module, mod_proxy. Using the standard proxy module, it's very easy to put multiple instances of Tomcat behind a single Apache instance.
Assuming that you have a Tomcat instance listening on port 8080 and another on port 8081, you can do something as simple as this:
<Location /app1/>
ProxyPass http://localhost:8080/
ProxyPassReverse http://localhost:8080/
</Location>
<Location /app2/>
ProxyPass http://localhost:8081/
ProxyPassReverse http://localhost:8081/
</Location>
This places the first instance at /app1/ and the second instance at
/app2/.
The mod_proxy documentation is a good place to start, and the tomcat documentation covers this topic briefly.

Mapping address to multiple tomcat instances

I have 3 tomcat instances running on Windows Server 2008 machine. Each one with one app:
http://host:8080/app0
http://host:8081/app1
http://host:8082/app2
How I can configure my server to map an address without the port number?
http://host/app0
http://host/app1
http://host/app2
Is it a tomcat configuration or something with DNS?
Thanks.
Ok, I tried the following:
Set up the Apache 2.2
Configure httpd.conf loading proxy modules
And add a proxy module configuration:
ProxyRequests Off
ProxyPass /app1 http://machine:8081/app
ProxyPassReverse /app1 http://machine:8081/app
<Location "/app">
Order allow,deny
Allow from all
</Location>
Now the redirect works well local in the machine. But it doesn't works when I try access from another machine in the same network. (this another machine can ping 'machine' host. And I tried putting the ip number too).
You can use nginx (http://nginx.org/en/docs/) as proxy for example.
Try simply (no load balancing etc.):
server {
listen here.your.ip:80/YourApp;
location / {
root /path/to/your/webapp;
proxy_pass http://host:8080/YourApp;
}
}
Same way for other ports
It is quite common to use multiple Tomcats behind Apache to do load balancing. While this is not load balancing the principle is the same. Instead of having one application with 3 load-balanced Tomcat workers, you would have 3 applications with 1 tomcat worker each.
You can find the tomcat documentation here: http://tomcat.apache.org/connectors-doc/
Try mod proxy configuration on below code in httpd:
ProxyPass /app0 http://localhost:8080/app0/
ProxyPassReverse /app0 http://localhost:8080/app0/
ProxyPass /app1 http://localhost:8081/app1/
ProxyPassReverse /app1 http://localhost:8081/app1/
ProxyPass /app2 http://localhost:8082/app2/
ProxyPassReverse /app2 http://localhost:8082/app2/