Akshay,

On 12/9/15 5:33 AM, Kernel freak wrote:
> @Andre : Yes, the material is quite enough, I am using a AJP connector and
> as Spring-security automatically rewrites/redirects to https, that is not
> the problem I am having. The problem is that even if *one* Tomcat is going
> down, the whole setup is dying, Not the point of this task. I want to keep
> one alive and it should keep working.

>From your configuration, you were pretty clearly using mod_proxy_http,
so you weren't using AJP at all.

> @Chris : I have no option other then Apache httpd as I see it now, I have
> already configured some stuff, which I will be posting below. What I want
> is to load-balance between both the Tomcat's, but if one goes down, the
> other one should still work. I have already put the JSESSIONID(consumed by
> Spring-security), in the config. The problem I am having right now is that
> even if *one* tomcat goes down, then I get a 503, service not available.
> What am I doing wrong?

I don't know. Using mod_jk, if one node goes down the others pick-up the
slack. I have much less experience with mod_proxy_*.

> Also, is there any way to detect which Tomcat is being used by the user
> right now?

On which end? You want to check from the client end? If you look at the
session id, it will have the jvmroute in it, appended onto the end. Your
session id will be something like "37680235094857.node1".

> Here are the changes I made :
> 
> For apache2 in sites-enabled/000-default  :
> 
> 
> <Proxy balancer://mycluster>
>     BalancerMember ajp://localhost:8010 route=jvmroute-first
> connectiontimeout=10
>     BalancerMember http://localhost:8011 route=jvmroute-second
> connectiontimeout=10

Why are you using AJP for one connection and HTTP for the other? That's
going to get confusing.

>    ProxySet stickysession=JSESSIONID
> 
>    Order Deny,Allow
>    Deny from none
>    Allow from all
> 
> </Proxy>

Other than the protocol games, this looks good so far.

> <VirtualHost *:80>
> ProxyPass / balancer://mycluster/
> ProxyPassReverse / balancer://mycluster/
> </VirtualHost>
> 
> 
> 
> First Apache tomcat instance :
> 
> <Connector port="8080" proxyPort="80" protocol="HTTP/1.1"
> compression="force" compressionMinSize="1024"
>                connectionTimeout="20000"
>                redirectPort="443" URIEncoding="utf-8"
>  compressableMimeType="text/html,text/xml,text/plain,text/css,text/
> javascript,application/x-javascript,application/javascript"/>
> 
> 
> <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
> maxThreads="200" compression="force"
>               compressionMinSize="1024" scheme="https" secure="true"
> clientAuth="false"  sslProtocol="TLS"
>                 keystoreFile="domain.keystore" keystorePass="password"
> URIEncoding="utf-8"
>  compressableMimeType="text/html,text/xml,text/plain,text/css,text/
> javascript,application/x-javascript,application/javascript"
> />
> Connector port="8010" protocol="AJP/1.3" redirectPort="443"
> URIEncoding="utf-8"
>  compressableMimeType="text/html,text/xml,text/plain,text/css,text/
> javascript,application/x-javascript,application/javascript"
> />
>   <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvmroute-first">
>  // No modifications inside
> </Engine>
> 
> Second tomcat instance :
> 
> <Connector port="8081" proxyPort="80" protocol="HTTP/1.1"
> compression="force" compressionMinSize="1024"
>                connectionTimeout="20000"
>                redirectPort="443" URIEncoding="utf-8"
>  compressableMimeType="text/html,text/xml,text/plain,text/css,text/
> javascript,application/x-javascript,application/javascript"/>
> 
> 
> <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
> maxThreads="200" compression="force"
>               compressionMinSize="1024" scheme="https" secure="true"
> clientAuth="false"  sslProtocol="TLS"
>                 keystoreFile="keystore" keystorePass="password"
> URIEncoding="utf-8"
>  compressableMimeType="text/html,text/xml,text/plain,text/css,text/
> javascript,application/x-javascript,application/javascript"
> />
>   <Connector port="8011" protocol="AJP/1.3" redirectPort="443"
> URIEncoding="utf-8"
>  compressableMimeType="text/html,text/xml,text/plain,text/css,text/
> javascript,application/x-javascript,application/javascript"
> />
>     <Engine name="Catalina" defaultHost="localhost"
> jvmRoute="jvmroute-second">
>     // No modifications inside
>     </Engine>
> 
> So if I shut down one tomcat, then I cannot access the site. What is the
> mistake I am making. Kindly let me know. Thank you.

Consider configuring the balancer manager within httpd to see what's
going on:
http://httpd.apache.org/docs/current/mod/mod_proxy_balancer.html#balancer_manager

-chris


-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to