Deploying the Sample Enterprise Application to a
Cluster
These procedures assume that you are running a domain with cluster profile.
The procedures in this chapter assume that you have already created a cluster
called cluster1, as described in Chapter 2, Setting Up a Cluster.
This sample application is provided
to demonstrate the clustering capabilities using session information. One
has to exercise caution for use in production.
To Deploy the Sample Enterprise Application Using
Admin Console
-
Click the Home button or click Common Tasks on the left pane to
go to the Common Tasks page, if you are not there already.
-
On the right pane, under Common Tasks, click Deploy Enterprise
Application (.ear).
-
If application server is installed on your local machine, click
Browse in the Packaged File to Upload text box, and navigate to as-install/samples/ee-samples/highavailability/apps/clusterjsp/clusterjsp.ear. If you are accessing Admin Console remotely with application server
installed on another machine, click Browse in the Local packaged file or directory
that is accessible from the Application Server text box. Navigate to as-install/samples/quickstart/clusterjsp/clusterjsp.ear.
-
In the Targets section of the page, select cluster1 from
the Available list, and click Add to move it to the Selected list.
-
Click OK.
The clusterjsp application
is now deployed to cluster1. Before you launch this application,
you need to start the instances in the cluster. See To Start the Instances in a Cluster
Deploying Applications Using CLI Commands
You can deploy applications using the asadmin deploy command.
See deploy(1) in
the Sun Java System Application Server 9.1 Reference Manual. You can also
use the asant commands for deployment. For
detailed information on deploying applications see Deploying Modules and Applications in Sun Java System Application Server 9.1 Application Deployment Guide.
To Start the Instances in a Cluster
Before you launch the deployed application, you need to start the instances
in the cluster.
-
In the tree on the left pane, click Clusters, and click the cluster1 node.
-
In the right pane, navigate to the General tab if it is not already
active.
-
If the instances are not already running, the Start Instances
button is active. Click it to start the cluster's instances.
-
Verify that they have started by checking the Status field, which
indicates how many instances are running.
You are now ready to
launch the application. See To Start the Instances in a Cluster
Starting Instances Using CLI Command
You can start instances by using the asadmin start-intance command.
See in the Sun Java System Application Server 9.1 Reference Manual.
To Verify Application Deployment
-
Type the following URL in your browser:
http://localhost:port/clusterjsp
Replace the localhost variable
with the name of the system that the Domain Admin Server is running on.
Replace the port variable with the value
of HTTP-LISTENER-PORT for instance1.
This example uses http://localhost:38081/clusterjsp.
-
Add some session attribute data.
-
Examine the Session and Host information displayed. For example:
-
Executed From Server: localhost
-
Server Port Number: 38081
-
Executed Server IP Address: 198.19.255.255
-
Session Created: Tue Aug 23 15:26:07 PDT 2005
-
Add some session data and click the Add to Session button.
-
Repeat this procedure for instance instance2 by
typing this URL in your browser:
http://localhost :38080/clusterjsp
Next Steps
Congratulations! You have completed this section of the Quick Start Guide. You can stop the Quick Start trail here if you do not wish to
proceed to the steps on load balancing.