Java Reference
In-Depth Information
Starting a cluster of standalone nodes
A standalone server starts as a single JVM process; therefore, we need to start each server
using the
standalone.bat/standalone.sh
command, passing all the required
parameters. In the following example, we are starting a cluster of two server nodes on two
different boxes that are bound to the IP addresses
192.168.1.10
and
192.168.1.11
,
respectively:
./standalone.sh -c standalone-ha.xml -b 192.168.1.10
./standalone.sh -c standalone-ha.xml -b 192.168.1.11
The
-c
parameter specifies the server configuration to be used; out of the box, the applica-
tion server includes two standalone clustering configurations:
standalone-ha.xml
and
standalone-full-ha.xml
. The latter one also includes the messaging subsys-
tem and other elements of the Java EE full profile; therefore, it has been named the
full
configuration.
The other parameter (
-b
) should sound familiar to older JBoss users, as it's still used to
specify the server-binding address, which needs to be unique in order to avoid port con-
flicts.
In this other example, we are starting another cluster of two nodes on the same box using
some additional parameters in order to avoid port conflicts:
./standalone.sh -c standalone-ha.xml
-Djboss.node.name=node1
./standalone.sh -c standalone-ha.xml -Djboss.node.name=node2
-Djboss.socket.binding.port-offset=200
As you can see, we had to specify two additional parameters:
jboss.node.name
in or-
der to assign a unique server name to each node and a socket-binding port, which uses an
offset of
200
. So, for example, the second node would respond to the HTTP channel on
port
8280
instead of port
8080
.
Note
Don't be surprised if you don't see any message about clustering on your server console.
Clustering modules are activated on demand, so first you need to deploy an application that
is cluster-aware. In a few minutes, we will show you how.