Sun Java System Web Server 7.0 Update 4 Administrator's Guide

Chapter 3 Server Farms and Clusters

The earlier chapters introduced Configuration and how Configuration can be deployed to nodes. In this chapter, you will set up a simple server farm and a cluster.

Cluster Support in Web Server

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 with which we can manage the servers installed in their respective clusters.

Note –

All the instances in a cluster are required to be homogeneous. For example they run on an identical operating system version, use identical patches and service packs, run an identical web server configuration, and offer identical services.

Setting Up a Server Farm

To set 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.

ProcedureTo Set Up a Server Farm

  1. Installing Administration Server and Administration Nodes

    Install the administration server. You can install the administration server through 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.

    Note –

    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 because all communication between administration server and administration node is through a secure channel. During 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.

    Note –

    You cannot install administration nodes through express installation.

  2. 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 unless they are registered to an administration server. To register 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. The host is the hostname of the node where the administration server is installed.

    This action will register the node to the administration server.

    Note –

    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.

    To set session replication for the created cluster, seeConfiguring Session Replication.

Setting Up a Simple Cluster

As part of this example you will 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:

A typical cluster setup

ProcedureTo Configure the Cluster

Before You Begin

Identify the following machines:

  1. 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.

  2. Install the Administration Node on MachineB, MachineC, MachineD and MachineE.

    Install the administration node on all four machines. Register the administration nodes with the administration server.

  3. Configure the Web Application.

    Enable session replication for the web application. Modify the WEb-INF/sun-web.xml file as follows:

    <session-manager persistence-type="replicated"/>
  4. Configure the Instances.

    • Launch wadm.

      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 the reverse proxy (Load balancer).

      wadm> create-reverse-proxy --config=lb --vs=lb 
      -uri-prefix=/ --server="http://MachineB:8080,http://MachineC:8080,
    • Create an instance.

      wadm> create-instance --config=lb MachineA
    • Deploy the Configuration.

      wadm> deploy-config lb
      wadm> start-instance --config=lb
  5. 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 the 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

      Note –

      If the host name is not specified for the start-instance command, this action will start instances on all the nodes where the configuration is deployed.