Saturday, June 16, 2012

Configuring mod_cluster to have JBoss nodes disabled by default on join


Configuring mod_cluster to have JBoss nodes disabled by default on join

Issue
  • When we start or restart a JBoss node, it joins with mod_cluster and mod_cluster automatically enables traffic to it.  Can we configure mod_cluster so that the node is disabled by default on join, and then enabled once we specify?
Environment
  • mod_cluster
  • JBoss Enterprise Web Server (EWS) 1.0.x
  • JBoss Enterprise Application Platform (EAP) 5.x
Resolution
  • This functionality specifically is not yet available.
  • You can workaround this default behavior to only manually turn on the node or connect it with mod_cluster when you desire through the following steps:
    • Turn off advertisement and communicate through the proxyList.
    • Once you've disabled advertisement on the httpd and JBoss end, set the proxyList to be some ip/port that is not a valid one for it to join mod_cluster.  You can set this in with the system property jboss.modcluster.proxyList or in deploy/mod-cluster.sar/META-INF/mod-cluster-jboss-beans.xml:
              <property name="proxyList">${jboss.modcluster.proxyList:127.0.0.1:6665}</property>
      
  • Now with apache/mod_cluster up, boot up your jboss instance.  It will start but throw an error about not being able to connect to this nonsense proxylist.
  • After JBoss is started and you want it to join mod_cluster and become accessible, you can change the proxyList to the correct value.  You can do this by going to the jmx-console and following the "service=ModCluster" link under the jboss.web section.  From here, invoke the addProxy option.  p1 should be the address and p2 the port.  It should then be able to successfully connect to mod_cluster and become accessible.  You should also then remove the initial dummy proxyList value through the removeProxy invocation.
  • Note that you can also invoke the addProxy and removeProxy operations through twiddle:
    • 
          twiddle.sh -s 127.0.0.1:1099 -u admin -p admin invoke "jboss.web:service=ModCluster" addProxy 127.0.0.1 6666
          twiddle.sh -s 127.0.0.1:1099 -u admin -p admin invoke "jboss.web:service=ModCluster" removeProxy 127.0.0.1 6665
      
    • Note that for this workaround to work you must use the ModClusterService listener and not the HAModClusterService listener.  If you use the HAModClusterService listener, then when you bring a node back up it will communicate with mod_cluster via the cluster master's valid proxyList, thus enabling it by default.
    Root Cause
    JBoss nodes are enabled by default upon joining with mod_cluster.

    Thanks,
    Kuldeep Sharma

No comments:

Post a Comment