Setup Glassfish Cluster (ENG)

Glassfish Cluster
G.Morreale
Introduction:

A cluster usually consists of a machine that acts as an administrator and a set of nodes that perform the work of the applications installed on them.
The objective of a cluster is usually to improve the system scalability and high availability .

The machine acting as an administrator in Glassfish clustering is called DAS (Domain Administrator Server).

Each node is made up of 2 elements:

1) Node Agent: It manages the life cycle of the application to which it is associated.
2) Application: Application server ..

The applications are installed on the DAS and are automatically propagated in nodes.

Cluster Support

Support cluster must be installed only on the DAS machine.



The Glassfish can be installed directly with the active cluster support or you can activate after a standard installation.

  • To enable support during installation use the following command:% libantbinant-f setup-cluster.xml instead of% libantbinant-f setup.xml

  • To enable the support afterwards (see picture above):
    • - Open the admin console
    • - Select from the common task: Enable Cluster Support
    • - Click Ok


Now it is prepared in this way the machine will be the DAS.

Cluster setup with a node

Suppose you want to create a cluster minimal (no sense in real situations):

A single machine is the DAS and also it is the node(later we add the second node).

In The  DAS machine, which have enabled cluster support will create the first node.

Note: The nodes can be created only from the command line. From the panel you can add a node but it is just a placeholder .. or a predisposition to create real

Creating Node Agent

From the command line type:

asadmin create-node-agent nodoDAS

nodoDAS is the name that was chosen for the node agent on DAS machine.
This command creates a node agent on DAS machine.

After you create must be started with the following command:

asadmin start-node-agent nodoDAS

Cluster Creation

Panel will now proceed with the creation of the cluster.

Clusters go on and click the button to create a new cluster.

About configuring the cluster that will leave the options on "Configuration" is unchanged will create a configuration
default-config, the system will call the copy "cluster-config". From this moment you can configure differently as regards the cluster different from that which concerns the application stand-alone acting on the different configurations.

Instance creation

Once the cluster is carried by adding the first instance and associating the nodoDAS.
You call this instance istanzaDAS.
In order to proceed with the creation, click the cluster you just created (it is located inside the item Clusters, in the previous image there is already called a cluster), then click on the Instances tab and then click New.
Enter the name and associate it instanzaDAS to NodeAgent nodoDAS after click on ok.

We have just created an instance associated with the node created by default at each stop and start the node corresponding similar operation The application is created.

State of Cluster

Making a summary on what has been achieved so far, we have a machine that acts as a DAS which is the main controlling nodeAgent one instance (instanceDAS).


Adding Second Node

To give meaning to the cluster will add a second node.

Note: You do not need the media cluster on the second machine.

The steps needed to achieve this objective are:

1) create a node agent

use the command asadmin on the machine where we want to create the second node: 

asadmin create-node-agent - host macchinaDAS nodo1 

command is equivalent to the one used to create nodoDAS but this time you must add the parameters to indicate the function of creation 
(create-node-agent) of the node that the agent machine where resides the DAS is not localhost (default value) but it is another machine.
The command used is assumed that the machine on which you installed the DAS has the hostname macchinaDAS. 

NOTE: E 'advisable to use a hostname rather than the ip, the JMX API can create some problems. 
Do not forget about linux to edit the file / etc / hosts / hostname with the choice. 

NOTE: When prompted admin admin user name and password when creating the node, enter the credentials for the login to DAS. 

The node has been created called nodo1. 

2) start the node

run from the console of the machine with the command nodo1 

asadmin start-node-agent nodo1 

in order to start the new node agent. 


3) create the istanza1 on the machine with nodo1

This can be done by hand panel. 
Going on the cluster and adding as done previously for instanzaDAS a new instance associating the node agent nodo1. 

the application created the call istanza1 

4) start istanza1

Click on the cluster, click istanza1, click on "start instance". 


Now we have two machines

DAS machine with the DAS, an instance (istanzaDAS), the main node Agent (nodeAgentDAS).
1 car with an instance (instanza1), the corresponding node Agent nodo1.

Start the Cluster

Feasible operation panel of DAS.

Click on the cluster and on the "Start Cluster".

The Cluster Test

To test the cluster, you can use a sample application provided with the same Glassfish.
Ear file should reside in the folder samples / quickstart / clusterjsp.

Effettauare deploy the panel by paying attention to the target on which you install the application.
We must remove the target server and instead add the target cluster.

Select the Availability flag if the application makes use of sessions and these sessions must be replicated in different nodes in the cluster.

If all went well, the application should be installed on both machines.
To check this in your browser, type the following url:

http://localhost:38080/clusterjsp

DAS is the machine that the machine 1.

NOTE: As you can see the URL of the cluster instances listen on port 38080 and not 8080. 8080 is about listening to standalone application server that despite the cluster is still running. Obviously not necessary if you can stop it and use only those instances configured in the cluster.

Conlcusion:
The article was translated from the italian version i'm wrote before.
I translate it with google translate service and after a fast review and some correction I think that it is a bad english too(I'm sorry).
The article that I wrote directly in english are a little bit better.
however I hope it is helpful.
If you want to correct any sentences please contact me through a comment, don't hesitate!



Link:



No comments: