[mod_cluster-dev] mod-cluster and domains with sticky sessions

Paul Ferraro paul.ferraro at redhat.com
Tue Jul 21 09:26:00 EDT 2009


Is the mod_cluster-dev list still not working for you?

On Tue, 2009-07-21 at 14:46 +0200, Bela Ban wrote:
> OK, I read through the archives of this list and came up with a solution 
> for mod-jk, but apparently nobody has so far used domains/sticky 
> sessions with *mod-cluster* !
> 
> I found 2 different ways of doing this:
> 
> #1 server.xml:
> ---------------------
> 
> <Listener className="org.jboss.modcluster.ModClusterListener"
>           advertize="true" domain="${jboss.Domain:DefaultDomain}" />
> 
> #2 and in mod-cluster-jboss-beans.xml:
> ---------------------------------------------------------
> 
> <bean name="HAModClusterService" ...>
>     <property name="domain">${jboss.Domain:DefaultDomain}</property>
> </bean>

Configuration properties for the HA service are defined in a separate
config bean, as documented here:
http://www.jboss.org/mod_cluster/java/config.html#ha

This should read:

<bean name="HAModClusterService" mode="On Demand"
      class="org.jboss.modcluster.ha.HAModClusterService">
  <constructor>
    <parameter><inject bean="HAPartition"/></parameter>
    <parameter><inject bean="HAModClusterConfig"/></parameter>
    <parameter><inject bean="DynamicLoadBalanceFactorProvider"/></parameter>
    <parameter><bean class="org.jboss.ha.singleton.HASingletonElectionPolicySimple"/></parameter>
  </constructor>
</bean>
<bean name="HAModClusterConfig" mode="On Demand"
      class="org.jboss.modcluster.config.ha.HAModClusterConfig">
  <!-- Configuration properties go here -->
  <parameter name="domain">${jboss.Domain:DefaultDomain}</parameter>
</bean>

> and then started several instances:
> 
> ./run.sh -b 192.168.1.5 -c all -g *D1* -u 230.1.1.1 -m 10500 
> -Djboss.jvmRoute=*node1* -Djboss.Domain=*D1*
> ./run.sh -b 192.168.1.9 -c all -g *D1* -u 230.1.1.1 -m 10500 
> -Djboss.jvmRoute=*node2* -Djboss.Domain=*D1*
> 
> and
> 
> ./run.sh -b 192.168.1.10 -c all -g *D2* -u 230.2.2.2 -m 11500 
> -Djboss.jvmRoute=*node3* -Djboss.Domain=*D2*
> 
> 
> So we have domains D1 (cluster D1 with node1 and node2) and D2 (cluster 
> D2 with node3).
> 
> #1 above seems to work half way, #2 doesn't.
> 
> Questions
> ========
> 
>     * What is the recommended way of setting of domains ?
>           o I assume #1, but that's not documented anywhere, I just
>             found out accidentally through a port via google

The location of the domain property depends on how you've configured
mod_cluster.

Config #1 uses ModClusterListener, defined in server.xml, and is primary
used with JBoss Web standalone and Tomcat, where you don't have the
benefit of MC configuration.
http://www.jboss.org/mod_cluster/java/config.html#web

Config #2, uses HAModClusterService, configured via the microcontainer,
and is used for configuration in JBoss AS, where all proxy communication
goes through an HASingleton.
http://www.jboss.org/mod_cluster/java/config.html#ha

The third option, not yet mentioned, uses ModClusterService, configured
via the microcontainer, where each AS node communicates directly with
the proxy.  Using this method, the "domain" property is defined within
the ModClusterService bean, like you tried to do initially.
http://www.jboss.org/mod_cluster/java/config.html#as

>     * Sometimes, a webapp on node2 fails over to node3 rather than node1

Have you verified that node1 is enabled when this happens?
If so, can you file a JIRA?

> Can someone look into this ? This information should be available via a 
> web page, similar to the one for mod-jk !

Is this what you're looking for?
http://www.jboss.org/mod_cluster/java/properties.html



More information about the mod_cluster-dev mailing list