Sun Java System Application Server 9.1 Quick Start Guide

Chapter 2 Setting Up a Cluster

This chapter describes how to create and set up clusters. A cluster is a group of server instances (typically on multiple hosts) that share the same configurations, resources, and applications. A cluster facilitates load balancing across server instances and high availability through failover. You can create clusters spanning multiple machines and manage them with the help of the node agent process on each machine.

This chapter assumes that you are running a domain with cluster or enterprise profile. This chapter has the following sections:

Creating a Cluster

This section explains how to create a cluster that contains two Application Server instances.

ProcedureTo Create a Cluster using the Admin Console

For simplicity, the cluster runs completely within one machine. This procedure creates the sample cluster one the same host on which the DAS is running.

Before You Begin

You must have already started the node agent, as described in To Start the Node Agent. When you specify instances during cluster creation, associate the instance with a running node agent for the machine on which you want the instance to run. If the node agent is not running, the instance will not start. Node agent and instance names must be unique across clusters that are created in a domain.

  1. Log in to the Administration Console at http:// localhost:portnumber if you have not already done so.

    Replace the localhost variable with the name of the system that the Domain Administration Server is running on. Replace portnumber with the port number of the cluster or enterprise domain.

  2. On the right pane, under Common Tasks, click Create New Cluster to display the New Cluster page.

  3. Type cluster1 as the name of the new cluster.

  4. From the drop-down list of available configuration templates, select the default-config configuration and choose Make a copy of the selected Configuration.

  5. Click the New button twice to create two entries to specify two instances for the cluster.

  6. Type instance1 and instance2 as instance names.

    Alternatively, you can specify the name of a node agent that you created and started. To create a node agent and start it, use the asadmin create-node-agent(1) command.

  7. Click OK.

    The Cluster Created Successfully page appears, and cluster1 appears in the tree in the left pane. A copy of the configuration template default-config was made for this cluster, and the name cluster1-config was assigned to it.

  8. Start cluster1 Cluster.

ProcedureTo Create a Cluster using CLI Commands

  1. Create a cluster called cluster1 by running the following asadmin command: asadmin create-cluster --user admin --passwordfile adminpassword.txt --host localhost -port 4848 cluster1

  2. Creates a cluster called cluster1 by running the following asadmin command: asadmin create-cluster --user admin --passwordfile adminpassword.txt --host localhost -port 4848 cluster1

  3. Create a node-agent called cluster1-nodeagent by running the following command: asadmin create-node-agent --user admin --passwordfile adminpassword.txt --host localhost --port 4848 cluster1-nodeagent

  4. Start this node-agent by running the following command: asadmin start-node-agent --user admin --passwordfile adminpassword.txt --host localhost --port 4848 cluster1-nodeagent

  5. Create two instances under the cluster by running the following commands:

    • asadmin create-instance --user admin --passwordfile adminpassword.txt --host localhost -port 4848 --cluster cluster1 --nodeagent cluster1-nodeagent --systemproperties "JMX_SYSTEM_CONNECTOR_PORT=8687:IIOP_LISTENER_PORT=3330:IIOP_SSL_LISTENER_PORT=4440:IIOP_SSL_ MUTUALAUTH_PORT=5550:HTTP_LISTENER_PORT=1110:HTTP_SSL_LISTENER_PORT=2220" instance1

    • asadmin create-instance --user admin --passwordfile adminpassword.txt --host localhost -port 4848 --cluster cluster1 --nodeagent cluster1-nodeagent --systemproperties "JMX_SYSTEM_CONNECTOR_PORT=8688:IIOP_LISTENER_PORT=3331:IIOP_SSL_LISTENER_PORT=4441:IIOP_SSL_ MUTUALAUTH_PORT=5551:HTTP_LISTENER_PORT=1111:HTTP_SSL_LISTENER_PORT=2221" instance2

  6. Start the cluster by running the following command: asadmin start-cluster --user admin --passwordfile adminpassword.txt --host localhost --port 4848 cluster1

    See Chapter 6, Using Application Server Clusters, in Sun Java System Application Server 9.1 High Availability Administration Guide for detailed information on creating and configuring clusters.

    SeeChapter 8, Configuring Node Agents, in Sun Java System Application Server 9.1 High Availability Administration Guide for detailed information on creating and configuring node agents.

Viewing Ports for Clustered Server Instances

ProcedureTo View Ports for Clustered Server Instances

You can view the ports numbers and override the default values for the clustered server instance you created in the previous section, Creating a Cluster. By default, the HTTP ports are 38081 for instance1 and 38080 for instance2. If these ports were busy on your machine when you created these clusters, or if you had already assigned these ports to other instances and clusters, different port numbers were assigned.

To view the port numbers and optionally override the default values, follow these steps:

  1. In the left pane, expand Clusters and click cluster1 to display the General Information page for clusters.

  2. Click the Instances tab to display instance1 and instance2, the instances that you created.

    1. Click instance1 to examine this instance.

      The HTTP and HTTPS ports assigned to the instance are displayed in the HTTP Ports field.

    2. Repeat these steps for instance2.

Next Steps

In this section you have created a simple cluster on a single machine. You can also create clusters spanning multiple machines using the same basic steps (as long as you have the software installed and a node agent running on each machine).