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

Paul Ferraro paul.ferraro at redhat.com
Wed Jul 22 09:44:10 EDT 2009


On Wed, 2009-07-22 at 12:42 +0200, Bela Ban wrote: 
> Thanks for the explanation !
> 
> So I switched to placing the property inside of HAModClusterConfig, and 
> this seems to work. However, mod_cluster_manager does *not* show the 
> domain ! Does it only show the domain when it is configured in 
> ModClusterListener in server.xml ?

I think I see where the confusion is...
The entry point for the configuration of mod_cluster is the lifecycle
listener in server.xml.  There are two types of listeners you can use:

1. ModClusterListener - configures mod_cluster directly inside
server.xml via java bean properties.  If you use ModClusterListener in
server.xml, everything in mod-cluster-jboss-beans.xml is ignored.  This
also limits your load balancing options to a single metric.

2. MicrocontainerIntegrationLifecycleListener - delegates the
configuration of mod_cluster to a microcontainer bean.  There are 2
values you can use for this bean (if you are to using the stock
-jboss-beans.xml config):
  a. ModClusterService - configuration properties are java bean
properties of this object
  b. HAModClusterService - configuration properties reside in
HAModClusterConfig delegate.  The differing location is due to an
implementation detail to which, because of the dual responsibilities
(configuration and IOC) of the microcontainer, the user is unfortunately
exposed.

> Another question: what's the advantage of defining a domain in 
> HAModClusterConfig over ModClusterListener ? I assume ModClusterListener 
> works in clustered AS mode, too ?

I think the above explanation already answers this question.
 
> Paul Ferraro wrote:
> > 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