Sunday, 2 January 2011

Installing GlassFish application Server cluster on Linux

GlassFish is a Java EE open source application server. The following instructions demonstrate how to install GlassFish 2.1.1 on any Linux platform. contains full information on downloading and installing glassfish clusters and load balancer plugin.

I am going to explain the steps I took to install glassfish clusters as I didn't require load balance support.

Please note all commands will require elevated privileges.

1. Download binary installer from 
save to /opt directory.

2. Ensure JAVA_HOME variable is set to JDK directory

3. Within the /opt directory run java -Xmx256m -jar glassfish-installer-v2.1.1-b31g-linux.jar

This UN-bundles glassfish and installs under a new directory 'glassfish'

4. Change to glassfish directory cd glassfish/

5. Change permissions on lib/ant/bin sub directory using chmod -R +x lib/ant/bin

6. Run lib/ant/bin/ant -f setup-cluster.xml . If successful you get BUILD SUCCESSFUL displayed

7. From /opt/glassfish/bin run ./asadmin start-domain domain1 to start to default domain.
Domain [domain1] is running is displayed

8. Browse to http://localhost:8080/ to confirm Enterprise server is now running.

9. Browse to http://localhost:4848/ to access admin console. Default user name and password are username: admin, password: adminadmin . You can change this from the Application Server settings on the web admin interface page.

The server is now running and now we are going to look at creating a one machine cluster.

10. Change to directory /opt/glassfish/samples/quickstart/clusterjsp

Run /opt/glassfish/bin/asant setup-one-machine-cluster

This does the following:

Creates a cluster with name cluster1
Creates a node-agent with name cluster1-nodeagent
Starts the above
Creates two instances under the cluster

You can change these default values under /opt/glassfish/samples/quickstart/clusterjsp/ before running


12. Start the cluster using glassfish/bin/asant start_cluster 

BUILD SUCCESSFUL is displayed again

13. View and confirm node with two instances is setup from http://localhost:4848/  select node agent then cluster1-nodeagent on the left pane

If you need to test the two instances you can simply deploy an application in glassfish and browse to the instance using http:localhost:PORT/appname 

If you continue reading the link below you can learn how to use the load balancer plugin and set up Sun Java System Web Server for this. - also a useful link for getting started

No comments:

Post a Comment