Earlier JBoss users used to start a clustered server configuration by feeding the -c all parameter to the application server starter shell.
The AS 7 is pretty different from other server releases as it does not contain multiple server configuration directories (all, default, minimal ..). It just contains a set of configuration files each one including a different set of server modules.
The built-in cluster configuration file are standalone-ha.xml and standalone-full-ha.xml (the latter one including Corba support). So let’s start a demo cluster configuration composed of two nodes on the same machine.
So unzip two AS 7 distribution on a path of your choice, for example:
In order to start your cluster nodes you need to provide an unique node name and, since you are running multiple servers on the same machine specify a port offset so that you don’t have port conflicts between servers.
So we will start up NodeA with:
standalone -c standalone-ha.xml -Djboss.node.name=nodeA
and NodeB with:
standalone -c standalone-ha.xml -Djboss.socket.binding.port-offset=100 -Djboss.node.name=nodeB
Configuring Apache Web server to reach JBoss AS 7 cluster
There are more than one available choice to connect a Web server in front of JBoss AS 7 cluster. You can either choose the older mod_jk approach which provides a static view of your AS 7 cluster or, as we suggest, configure mod_cluster which provides additional advantages such as:
- Dynamic configuration of httpd workers
- Server-side load balance factor calculation
- Fine grained web-app lifecycle control
Mod_cluster Java libraries are built-in into JBoss AS 7 distribution so you don't need to hack your server release. On the other hand, you need to add to your Apache server the native libraries required to proxy calls to JBoss AS. Download the latest mod_cluster binaries at:
The above modules can be found into the mod_cluster distribution under httpd/modules path. You have to place them into the Apache's module folder.
Then we edit httpd.conf. We should add the modules:
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so
Also, please note we should comment out:
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
This one conflicts with cluster module. And then we need to make httpd to listen to public address so we could do the testing. Because we installed httpd on 192.168.1.0 host we will use the following available port:
Deny from all
Allow from 192.168.1.
Now verify that the Apache JBoss connection works properly by typing: http://192.168.1.0:6666