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

Enable friendly access log times in Apache and JBoss


How do I enable friendly access log times in Apache and JBoss?

Hi All,

For every troubleshooter, it will be great if provided logs have well identified Time Stamps. With well mentioned time stamps, we can analyse the issues easy and come to solution within less time and comfotably.

Environment
  • JBoss Enterprise Application Platform (EAP)
    • 4.x
    • 5.x
  • Apache Web Server
The default access log timing in Apache and JBoss are in milliseconds and are not conducive to quickly identifying high access times, or for easily tracing through the flow of a request from Apache to JBoss using mod_jk for example.  One approach that has worked well in modifying the default configuration is to add a Time Taken string to the beginning of the log pattern followed by the request time in seconds, not milliseconds.
To enable the Time Taken in JBoss locate the following piece of code in $JBOSS_HOME/server/$CONFIG/deploy/$JBOSSWEB/server.xml
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve"
       prefix="localhost_access_log." suffix=".log"
       pattern="common" directory="${jboss.server.home.dir}/log"
       resolveHosts="false" />
-->
and change the pattern="common" to pattern="Time Taken: %T %h %l %u %t %r %s %b"   The resulting xml, will look like
<Valve className="org.apache.catalina.valves.AccessLogValve"
       prefix="localhost_access_log." suffix=".log"
       pattern="Time Taken: %T %h %l %u %t %r %s %b" directory="${jboss.server.home.dir}/log"
       resolveHosts="false" />
 
Now, in Apache's httpd.conf, on RHEL /etc/httpd/conf/httpd.conf, change  LogFormat "%h %l %u %t \"%r\" %>s %b" common  to  LogFormat "Time Taken: %T %h %l %u %t \"%r\" %>s %b" common
After these changes, the access logs generated will be in a format that is much easier to digest at first sight.
%T logs response time in seconds. When greater precision is needed, use the %D option to log response time in microseconds.


!Hope This will Help
Kuldeep Sharma