users@glassfish.java.net

clustering/failover

From: Glenn Holmer <gholmer_at_weycogroup.com>
Date: Wed, 13 Feb 2013 09:18:36 -0600

I'm so close...

I have our large app running on a cluster with Apache/mod_jk load
balancing, but failover doesn't work (DAS and Apache on one machine, two
instances on separate machines). If I connect to the machine running
Apache, find out that I'm on test_instance1, and then down that
instance, my next request gives me a blank page instead of failing over
to test_instance2. If I go directly to port 28080 on test_instance2, I
get the page. I've posted my configuration below.

What I'm noticing is that "nmap localhost" on the DAS/Apache machine
shows port 8009 open, but not 8010. I created the JK listener like this:

asadmin create-network-listener --jkenabled true --target test_cluster
--protocol http-listener-1 --listenerport "\${AJP_PORT}" jk-listener

The example in the GlassFish documentation gives just ${AJP_PORT} (as
opposed to "\${AJP_PORT}"), which gave me "Enter the value for the name
operand". I assumed it was a typo, but do I need one listener with port
8009 and one with 8010? Or is there something else wrong?

======================================================================

The web app's web.xml contains:
<distributable/>
and the app is deployed with --availability-enabled=true and the cluster
as target.

The web app's glassfish-web.xml contains:
<session-config>
   <session-manager persistence-type="replicated">
     <manager-properties>
       <property name="relaxCacheVersionSemantics" value="true"/>
     </manager-properties>
   </session-manager>
</session-config>

"asadmin validate-multicast" works as expected.

The cluster's config has a JVM property:
-DjvmRoute=${AJP_INSTANCE_NAME}
and the availability service is listed as enabled.

test_instance1 has the system properties:
AJP_INSTANCE_NAME: nod1test
AJP_PORT: 8009

test_instance2 has the system properties:
AJP_INSTANCE_NAME: nod2test
AJP_PORT: 8010

jk.conf looks like this:

<IfModule mod_jk.c>
   JkWorkersFile
/usr/share/glassfish-3.1.2.2/glassfish/domains/dastest/config/workers.properties
   JkLogFile /var/log/apache2/mod_jk.log
   JkLogLevel error
   JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
   JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
   JkRequestLogFormat "%w %V %T"
   JkMountCopy all
</IfModule>
JkMount /shop/* balancer
<Location "/shop/WEB-INF/">
   deny from all
</Location>
JkMount /csi/* balancer
<Location "/csi/WEB-INF/">
   deny from all
</Location>

workers.properties looks like this:

# see http://tomcat.apache.org/connectors-doc/reference/workers.html
worker.list=nod1test,nod2test,balancer
# nod1test
worker.nod1test.type=ajp13
worker.nod1test.host=nod1test
worker.nod1test.port=8009
worker.nod1test.lbfactor=50
worker.nod1test.connection_pool_size=10
worker.nod1test.connection_pool_timeout=600
worker.nod1test.socket_keepalive=False
worker.nod1test.socket_timeout=30
# nod2test
worker.nod2test.type=ajp13
worker.nod2test.host=nod2test
worker.nod2test.port=8010
worker.nod2test.lbfactor=50
worker.nod2test.connection_pool_size=10
worker.nod2test.connection_pool_timeout=600
worker.nod2test.socket_keepalive=False
worker.nod2test.socket_timeout=30
# balancer
worker.balancer.type=lb
worker.balancer.balance_workers=nod1test,nod2test

-- 
Glenn Holmer
Weyco Group, Inc.
phone: 414-908-1809
fax: 414-908-1601