The earlier chapters introduced Configuration and how Configuration can be deployed to nodes. In this chapter, let us set up a simple server farm and a cluster.
A cluster is a set of instances, spanning across one or more nodes, all running identical configuration and offering an identical set of runtime services. Each cluster must include one server designated as the administration server. If you have more than one cluster, you can administer all clusters from a single master administration server. The master administration server retrieves the information about all the clusters and provides the interface for managing the Sun Java System Web Servers installed in their respective clusters.
All the instances in a cluster are required to be homogeneous. For example they run on an identical operating system version (and patches) and service packs, run an identical web server configuration and offer identical services.
For setting up a cluster, you need to first install one administration server and one or more administration nodes. The administration nodes have to be registered to the administration server individually for them to be administered. This action can be performed either during installation of the nodes or after installation through wadm CLI.
Installing Administration Server and Administration Nodes
Install the administration server. You can install the administration server through Sun Java System Web Server Installer GUI or through the wadm CLI.
You can choose the Express installation option, which will install an administration server on port 8989. Alternatively, choose Custom Installation option for setting your preferences. To install the administration server, choose the option Install server as Administration Server in the installer setup screen. You need to specify the SSL port but may or may not specify a non SSL port.
If a non SSL port is specified, an administration node is created in the administration server node and this need not be registered with the administration server explicitly.
To install the administration node , choose Custom Installation and then Install server as administration node. Specify a port for installation. You do not have an option to select non SSL port as all communication between administration server and administration node is through a secure channel. During the installation, you will be asked if you need to register the node with the administration server. If you choose not to register the node during installation, you can use the wadm CLI to perform this action.
You cannot install administration nodes through express installation.
Register the Administration Node with the Administration Server
The administration nodes have to be registered to the administration server for them to be part of the cluster or the server farm. The administration nodes will not start up unless they are registered to an administration server. For registering the administration node execute the following command through wadm CLI.
wadm> register-node --user <admin-user> --port <SSL Port> --host <node name>
This port is the one specified during the administration server installation. Host is the hostname of the node where the administration server is installed.
This action will register the node to the administration server.
A node can be registered only from the same node . You cannot go to the CLI of the administration server and register any node. Also the registration of node with the administration server can be done in SSL mode only.
For setting up session replication for the created cluster, seeConfiguring Session Replication.
As part of this example let us set up a cluster with one load balancer, one administration server and four web server instances with session replication enabled. Session replication provides high availability for Java web application sessions. It does so by making copies of sessions resident in memory of one web server instance to another web server instance. So, in normal operational conditions, there are at least 2 copies of every session each residing in a separate JVM and, optimally, on a separate machine.
The following figure depicts a simple cluster:
Identify the following machines:
MachineA — Has both the load balancer and the administration server.
MachineB, MachineC, MachineD and MachineE — Has the administration node and the web server instances running.
Install Administration Server on MachineA.
See To Set Up a Server Farm for information on installing an administration server. The typical installation process will also install a web server instance. For this scenario, we will not be using that instance.
Install the Administration Node on MachineB, MachineC, MachineD and MachineE.
Install the administration node on all the 4 machines. Register the administration nodes with the administration server.
Configure the Web Application.
Enable session replication for the web application. Modify WEb-INF/sun-web.xml file as follows:
Configure the Instances.
wadm --host MachineA --port 8089
Create a new configuration for the load balancer.
wadm> create-config --http-port=8080 --server-name=SampleCluster lb
Set up reverse proxy (Load balancer).
wadm> create-reverse-proxy --config=lb --vs=lb -uri-prefix=/ --server="http://MachineB:8080,http://MachineC:8080, ttp://MachineD:8080,http://MachineE:8080"
Create an instance.
wadm> create-instance --config=lb MachineA
Deploy the Configuration.
wadm> deploy-config lb wadm> start-instance --config=lb
Create and Start The Cluster.
Create a new Configuration with four instances.
Create a new configuration for the cluster.
wadm> create-config --http-port=8080 --server-name=SampleCluster clusterOf4
Enable Session Replication.
wadm> set-session-replication-prop --config=clusterOf4 enabled=true
Add your web application.
wadm> add-webapp --config=clusterOf4 --uri=/simple webapps-simple.war
Create the instances.
wadm> create-instance --config=clusterOf4 MachineB MachineC MachineD MachineE
Start the cluster.
wadm> start-instance --config=clusterOf4
If host name is not specified for the start-instance command, this action will start instances on all the nodes where the configuration is deployed.