JBoss.orgCommunity Documentation

Chapter 17. Frequently Asked questions

17.1. What is Advertise
17.2. What to do if I don't want to use Advertise (multicast):
17.3. I am using Tomcat 7 / 6 what should I do:
17.4. It is not working what should I do:
17.4.1. No error
17.4.2. Error in server.log or catalina.out
17.4.3. Error in error_log
17.5. I have "HTTP/1.1 501 Method Not Implemented"
17.6. Redirect is not working:
17.7. I have more than one Connector mod_cluster does use the right one
17.8. Chrome can't diplay /mod_cluster_manager page
17.9. Using mod_cluster and SELinux.
17.10. System properties to modify behaviour

Advertise allows autodiscovery of httpd proxies by the cluster nodes. It is done by sending multicast messages from httpd to the cluster. The httpd specialized module: mod_advertise sends UDP message on a multicast group, both mod_advertise and the cluster listener joined the multicast group and the cluster receives the messages.

Example for mod_advertise message:

HTTP/1.0 200 OK
Date: Wed, 08 Apr 2009 12:26:32 GMT
Sequence: 16
Digest: f2d5f806a53effa6c67973d2ddcdd233
Server: 1b60092e-76f3-49fd-9f99-a51c69c89e2d
X-Manager-Address: 127.0.0.1:6666
X-Manager-Url: /bla
X-Manager-Protocol: http
X-Manager-Host: 10.33.144.3

The X-Manager-Address header value is used by the cluster logic to send information about the cluster to the proxy. It is the IP and port of the VirtualHost where mod_advertise is configured or URL parameter of the ServerAdvertise directive.

See Proxy Discovery in Configuration Properties and mod_advertise in Apache httpd configuration.

In the VirtualHost receiving the MCPM of httpd.conf don't use any Advertise directive or use:

ServerAdvertise Off

In mod_cluster-jboss-beans.xml add the addresses and ports of the VirtualHost to the proxyList property and set advertise to false, for example:

<property name="proxyList">10.33.144.3:6666,10.33.144.1:6666</property>
<property name="advertise">false</property>

In server.xml (with JBossweb/Tomcat)

<Listener className="org.jboss.modcluster.container.catalina.standalone.ModClusterListener" advertise="true"/>

See at the end of java configuration. You can't use the mod_cluster clustered mode with Tomcat so you get a loadbalancing logic similar to mod_jk but with a dynamic configuration.

Most likely you have a configuration problem. Check the log of the cluster nodes and error_log of httpd.

That happens when Advertise is not working: The nodes don't get the advertise messages from httpd.

  1. Check the modules are loaded and Advertise is started. In httpd.conf activate extended information display, add:

    AllowDisplay On

    When accessing to the mod_cluster_manager you should get something like:

    If not, go to the Minimal Example and add the missing directive(s).

  2. Check that Advertise message are received on the cluster node. A small Java utility could be used to check Advertise. It is in the mod_cluster repository and can be compiled using javac. A compiled version can be found under in /opt/jboss/httpd/tools in the bundles. Run it using java Advertise multicastaddress port. The output should be something like:

    [jfclere@jfcpc java]$ java Advertize 224.0.1.105 23364
    ready waiting...
    received: HTTP/1.0 200 OK
    Date: Mon, 28 Jun 2010 07:30:31 GMT
    Sequence: 1
    Digest: df8a4321fa99e5098174634f2fe2f87c
    Server: 1403c3be-837a-4e76-85b1-9dfe5ddb4378
    X-Manager-Address: test.example.com:6666
    X-Manager-Url: /1403c3be-837a-4e76-85b1-9dfe5ddb4378
    X-Manager-Protocol: http
    X-Manager-Host: test.example.com
  3. No Advertise messages

    Check firewall (don't forget the boxes firewall). Advertise uses UDP port 23364 and multicast addresse 224.0.1.105

  4. Can't get Advertise messages

    Use ProxyList property. In case Advertise can't work you put the address and port of the VirtualHost used in httpd to receive the MCMP. In server/profile/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml

    <property name="proxyList">test.example.com:6666</property>

    or in server.xml:

    <Listener className="org.jboss.modcluster.container.catalina.standalone.ModClusterListener" proxyList="test.example.com:6666"/>

You need to configure EnableMCPMReceive in the VirtualHost where you received the MCMP elements in the Apache httpd configuration. Something like:

<VirtualHost localhost:6666>
    <Directory />
     Order deny,allow
     Deny from all
     Allow from 127.0.0.1
    </Directory>
    ServerAdvertise on http://localhost:6666
    EnableMCPMReceive
</VirtualHost>

When using http/https instead AJP proxyname, proxyhost and redirect must be configured in the Connector. Something like:

    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000"
               proxyName="httpd_host_name"
               proxyPort="8000"
               redirectPort="443" />

Mod_cluster tries to use the first AJP connector configured. If there isn't any AJP connector it uses the http or https that has the biggest maxthreads value. That is "maxThreads" in Tomcat and JBossAS4/5/6:

    <Connector port="8080" protocol="HTTP/1.1" maxThreads="201" />

Or "max-connections" in AS7: (32 * processor + 1 for native and 512 * processor + 1 for JIO).

    <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" max-connections="513" />

When using chrome with mod_cluster_manager the page is not displayed and the following error is displayed:

 Error 312 (net::ERR_UNSAFE_PORT): Unknown error. 

you can change the port of the VirtualHost to 7777 or any value chrome accepts or add:

 --explicitly-allowed-ports=6666 

to the start parameters of chrome.

Mod_cluster needs to open port and create shared memory and files, therefore some permissions have to be added, you need to configure something like:

policy_module(mod_cluster, 1.0)

require {
        type unconfined_java_t;
        type httpd_log_t;
        type httpd_t;
        type http_port_t;
        class udp_socket node_bind;
        class file write;
}

#============= httpd_t ==============

allow httpd_t httpd_log_t:file write;
corenet_tcp_bind_generic_port(httpd_t)
corenet_tcp_bind_soundd_port(httpd_t)
corenet_udp_bind_generic_port(httpd_t)
corenet_udp_bind_http_port(httpd_t)

#============= unconfined_java_t ==============
allow unconfined_java_t http_port_t:udp_socket node_bind;

Put the above in a file for example mod_cluster.te and generate the mod_cluster.pp file (for example in Fedora 16):

[jfclere@jfcpc docs]$ make -f /usr/share/selinux/devel/Makefile
Compiling targeted mod_cluster module
/usr/bin/checkmodule:  loading policy configuration from tmp/mod_cluster.tmp
/usr/bin/checkmodule:  policy configuration loaded
/usr/bin/checkmodule:  writing binary representation (version 14) to tmp/mod_cluster.mod
Creating targeted mod_cluster.pp policy package
rm tmp/mod_cluster.mod.fc tmp/mod_cluster.mod

The mod_cluster.pp file should be proceeded by semodule as root:

root@jfcpc docs]# semodule -i mod_cluster.pp
[root@jfcpc docs]# 

org.jboss.modcluster.container.catalina.status-frequency (default: 1) send STATUS messages only 1/n periodic event (tomcat, jbossweb). The events occur every backgroundProcessorDelay (default 10 seconds).