2 Machine Cluster Setup - CLI mode


Build : GlassFish V2 b58c on Solaris

Namesake names of machines : Tiger.cat.com, Cactus.plant.com

Using the Command Line Interface of GlassFish, a cluster can be setup with ease across 2 machines. Heres how it can be done:

1. Download GF v2 b58c from https://glassfish.dev.java.net/downloads/v2-b58c.html

2. Unbundle GlassFish following the instructions and do a ant -f setup-cluster.xml to enable clustering support on the installation.

Do Step2 on both Tiger.cat.com and Cactus.plant.com

3. On Tiger.cat.com, do the following:

  • Under {GF_install}/bin, do "asadmin start-domain" which will start up the default domain "domain1".
  • Create a node-agent as using the command "asadmin create-node-agent --host localhost --port 4848 man-agent"
  • Create a cluster with the command "asadmin create-cluster --host localhost --port 4848 cat-cluster"
  • Create an instance with the command "asadmin create-instance --host localhost --port 4848 --nodeagent man-agent --cluster cat-cluster instance1"

Note that in all the above steps, 4848 is the admin port of the domain domain1.

  • Start the node-agent : "asadmin start-node-agent --syncinstances=true man-agent"

The "syncinstances" flag starts up the cluster and instance as well. Its default value is false.


4. On Cactus.plant.com, do the following:

  • Under {GF_install}/bin, execute "asadmin create-node-agent --host Tiger.cat.com --port 4848 animal-agent" to create a node-agent on this machine pointing to the DAS (Tiger.cat.com).

After this step, observe in the /nodeagents directory that animal-agent is created.

  • Create an instance on this machine as "asadmin create-instance --host Tiger.cat.com --port 4848 --nodeagent animal-agent --cluster cat-cluster instance2"

  • Start node-agent, while the other node-agent is running: "asadmin start-node-agent --syncinstances=true animal-agent"

 2 machine cluster is successfully setup !!!

Comments:

If you look at the <a href="http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV2Architecture">GlassFish V2 architecture</a>, we have a Domain Administration Server (DAS) to manage a domain. Each remote host has a node-agent that acts as a proxy for DAS. DAS talks to node-agent to manage the lifecycle of remote server instances.

So far, people had to run "ant -f setup-cluster.xml" to install GlassFish V2. So, we were ending up with multiple DASs (one on every machine) eventhough we only need node-agents on the remote instances. Thankfully, Harpreet fixed the issue (<a href="https://glassfish.dev.java.net/issues/show_bug.cgi?id=3494"3494</a>) in time for GlassFish V2 release.

With the following command, one can now install only the node-agent on the remote hosts:
<install-root>/glassfish/lib/ant/bin/ant -f setup-cluster.xml create-node-agent -Ddas.host="Tiger.cat.com"

To summerize, here are the two commands:

1. To Install GF V2 and Create a Domain with DAS:
Run "ant -f sestup-cluster.xml" on the host (example Tiger.cat.com) where you want to run your Domain Administration Server (DAS).

2. Install GF V2 and Create a Node-Agent:
Run '<install-root>/glassfish/lib/ant/bin/ant -f setup-cluster.xml create-node-agent -Ddas.host="Tiger.cat.com"' (on Cactus.plant.com) where you want a node-agent.

Posted by Nazrul on September 13, 2007 at 07:32 PM IST #

Shalini, I have followed your blog step by step but to no avail. Please see my java.net thread at http://forums.java.net/jive/forum.jspa?forumID=56&start=15 and lend any advice you may have. Thanks!

Posted by Ryan on November 05, 2007 at 11:49 PM IST #

The configuration in this blog have a mistake:
In step 4.2 asadmin create-instance --host Tiger.cat.com --port 4848 --nodeagent man-agent --cluster cat-cluster instance2
should be :
asadmin create-instance --host Tiger.cat.com --port 4848 --nodeagent animal-agent --cluster cat-cluster instance2

then it works in my test. :-)

Posted by Ed Xu on November 06, 2007 at 07:20 AM IST #

@Ed Xu
Thanks for that. I have changed it.

@Ryan
http://forums.java.net/jive/thread.jspa?messageID=244020 has the solution.

Posted by Shalini on November 06, 2007 at 07:32 AM IST #

Hello Shalini..

Nice Articles..

I want t ask about setup 2 machine with load balancing and fail over. How to setup the machine??

I want to make a cluster with 2 computer.
1. Computer with Windows XP Prof SP2, installed, SJAS 9.1 (standard), SJWS 6.1, ASLB plugin load balancer
2. Computer with Solaris 10, Installed SJAS 9.1 or Glassfish

DAS Machine / host in Windows XP, node agent=node1 in Solaris, Server Instance= instance1 from solaris, server instance from Windows XP.

can it works??

or it is wrong??

Thanx ver much for reply..

Posted by The Curious on January 09, 2008 at 11:23 AM IST #

I follow the step-by-step processes and whem I was execute the lest command "asadmin start-node-agent --syncinstances=true animal-agent" a stack trace apear in my second machine. These machines are in DNS, so I can ping by your names.
This is the stack:

com.sun.enterprise.ee.synchronization.DASCommunicationException: Unable to communicate with Domain Administration Server.
at com.sun.enterprise.ee.synchronization.BaseSynchronizationDriver.synchronizeInternal(BaseSynchronizationDriver.java:277)
at com.sun.enterprise.ee.synchronization.BaseSynchronizationDriver.synchronize(BaseSynchronizationDriver.java:129)
at com.sun.enterprise.ee.synchronization.SynchronizationMain.main(SynchronizationMain.java:126)
[#|2008-07-09T14:45:04.605-0400|SEVERE|sun-appserver9.1|javax.ee.enterprise.system.nodeagent|_ThreadID=10;_ThreadName=main;instance2;FAILED!;366;|NAGT0039:Synchonization for instance2 - FAILED! and took 366 milliseconds|#]

[#|2008-07-09T14:45:04.608-0400|INFO|sun-appserver9.1|javax.ee.enterprise.system.nodeagent|_ThreadID=11;_ThreadName=Thread-13;instance2;|NAGT0018:The nodeagent is starting the server instance instance2|#]

com.sun.enterprise.ee.synchronization.DASCommunicationException: Unable to communicate with Domain Administration Server.
at com.sun.enterprise.ee.synchronization.BaseSynchronizationDriver.synchronizeInternal(BaseSynchronizationDriver.java:277)
at com.sun.enterprise.ee.synchronization.BaseSynchronizationDriver.synchronize(BaseSynchronizationDriver.java:129)
at com.sun.enterprise.ee.synchronization.SynchronizationMain.main(SynchronizationMain.java:126)
[#|2008-07-09T14:45:05.046-0400|SEVERE|sun-appserver9.1|javax.ee.enterprise.system.nodeagent|_ThreadID=11;_ThreadName=Thread-13;instance2;FAILED!;437;|NAGT0039:Synchonization for instance2 - FAILED! and took 437 milliseconds|#]

[#|2008-07-09T14:45:05.063-0400|SEVERE|sun-appserver9.1|javax.enterprise.tools.launcher|_ThreadID=11;_ThreadName=Thread-13;|LAUNCHER003:The Launcher encountered a problem with the configuration data from either domain.xml or processLauncher.xml. The launcher could not continue processing the request.
com.sun.enterprise.config.ConfigException: Error refreshing ConfigContext:/appl/glassfish/nodeagents/node2/instance2/config/domain.xml
cause: /appl/glassfish/nodeagents/node2/instance2/config/domain.xml (No such file or directory)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:399)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:481)
at com.sun.enterprise.config.impl.ConfigContextImpl.getRootConfigBean(ConfigContextImpl.java:272)
at com.sun.enterprise.config.serverbeans.ServerBeansFactory.getDomainBean(ServerBeansFactory.java:89)
at com.sun.enterprise.config.serverbeans.ConfigAPIHelper.getDomainConfigBean(ConfigAPIHelper.java:75)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.buildInternalCommand(ASLauncher.java:755)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.buildCommand(ASLauncher.java:714)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.process(ASLauncher.java:418)
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstanceAllJava(PEInstancesManager.java:283)
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstance(PEInstancesManager.java:160)
at com.sun.enterprise.ee.admin.servermgmt.EEInstancesManager.startInstance(EEInstancesManager.java:228)
at com.sun.enterprise.ee.nodeagent.ProcessInstanceInternal.startInstance(ProcessInstanceInternal.java:82)
at com.sun.enterprise.ee.nodeagent.ProcessManager.startProcess(ProcessManager.java:117)
at com.sun.enterprise.ee.nodeagent.NodeAgent.startInstance(NodeAgent.java:797)
at com.sun.enterprise.ee.nodeagent.NodeAgent$StartServerTask.run(NodeAgent.java:1967)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.FileNotFoundException: /appl/glassfish/nodeagents/node2/instance2/config/domain.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:374)
... 15 more
|#]

com.sun.enterprise.config.ConfigException: Error refreshing ConfigContext:/appl/glassfish/nodeagents/node2/instance2/config/domain.xml
cause: /appl/glassfish/nodeagents/node2/instance2/config/domain.xml (No such file or directory)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:399)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:481)
at com.sun.enterprise.config.impl.ConfigContextImpl.getRootConfigBean(ConfigContextImpl.java:272)
at com.sun.enterprise.config.serverbeans.ServerBeansFactory.getDomainBean(ServerBeansFactory.java:89)
at com.sun.enterprise.config.serverbeans.ConfigAPIHelper.getDomainConfigBean(ConfigAPIHelper.java:75)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.buildInternalCommand(ASLauncher.java:755)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.buildCommand(ASLauncher.java:714)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.process(ASLauncher.java:418)
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstanceAllJava(PEInstancesManager.java:283)
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstance(PEInstancesManager.java:160)
at com.sun.enterprise.ee.admin.servermgmt.EEInstancesManager.startInstance(EEInstancesManager.java:228)
at com.sun.enterprise.ee.nodeagent.ProcessInstanceInternal.startInstance(ProcessInstanceInternal.java:82)
at com.sun.enterprise.ee.nodeagent.ProcessManager.startProcess(ProcessManager.java:117)
at com.sun.enterprise.ee.nodeagent.NodeAgent.startInstance(NodeAgent.java:797)
at com.sun.enterprise.ee.nodeagent.NodeAgent$StartServerTask.run(NodeAgent.java:1967)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.FileNotFoundException: /appl/glassfish/nodeagents/node2/instance2/config/domain.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:374)
... 15 more
com.sun.enterprise.config.ConfigException: Error refreshing ConfigContext:/appl/glassfish/nodeagents/node2/instance2/config/domain.xml
cause: /appl/glassfish/nodeagents/node2/instance2/config/domain.xml (No such file or directory)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:399)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:481)
at com.sun.enterprise.config.impl.ConfigContextImpl.getRootConfigBean(ConfigContextImpl.java:272)
at com.sun.enterprise.config.serverbeans.ServerBeansFactory.getDomainBean(ServerBeansFactory.java:89)
at com.sun.enterprise.config.serverbeans.ConfigAPIHelper.getDomainConfigBean(ConfigAPIHelper.java:75)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.buildInternalCommand(ASLauncher.java:755)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.buildCommand(ASLauncher.java:714)
at com.sun.enterprise.admin.servermgmt.launch.ASLauncher.process(ASLauncher.java:418)
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstanceAllJava(PEInstancesManager.java:283)
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstance(PEInstancesManager.java:160)
at com.sun.enterprise.ee.admin.servermgmt.EEInstancesManager.startInstance(EEInstancesManager.java:228)
at com.sun.enterprise.ee.nodeagent.ProcessInstanceInternal.startInstance(ProcessInstanceInternal.java:82)
at com.sun.enterprise.ee.nodeagent.ProcessManager.startProcess(ProcessManager.java:117)
at com.sun.enterprise.ee.nodeagent.NodeAgent.startInstance(NodeAgent.java:797)
at com.sun.enterprise.ee.nodeagent.NodeAgent$StartServerTask.run(NodeAgent.java:1967)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.FileNotFoundException: /appl/glassfish/nodeagents/node2/instance2/config/domain.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at com.sun.enterprise.config.impl.ConfigContextImpl.refresh(ConfigContextImpl.java:374)
... 15 more
[#|2008-07-09T14:48:05.444-0400|WARNING|sun-appserver9.1|javax.ee.enterprise.system.nodeagent|_ThreadID=11;_ThreadName=Thread-13;|NAGT0008:Node Agent could not START instance instance2.
com.sun.enterprise.ee.nodeagent.ProcessManagerException: com.sun.enterprise.admin.servermgmt.InstanceException: Timeout waiting for server instance instance2 to go to starting state.
at com.sun.enterprise.ee.nodeagent.ProcessInstanceInternal.startInstance(ProcessInstanceInternal.java:86)
at com.sun.enterprise.ee.nodeagent.ProcessManager.startProcess(ProcessManager.java:117)
at com.sun.enterprise.ee.nodeagent.NodeAgent.startInstance(NodeAgent.java:797)
at com.sun.enterprise.ee.nodeagent.NodeAgent$StartServerTask.run(NodeAgent.java:1967)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.sun.enterprise.admin.servermgmt.InstanceException: Timeout waiting for server instance instance2 to go to starting state.
at com.sun.enterprise.ee.admin.servermgmt.EEInstancesManager.startInstance(EEInstancesManager.java:230)
at com.sun.enterprise.ee.nodeagent.ProcessInstanceInternal.startInstance(ProcessInstanceInternal.java:82)
... 4 more
Caused by: com.sun.enterprise.admin.servermgmt.InstanceException: Timeout waiting for server instance instance2 to go to starting state.
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.waitUntilStarting(PEInstancesManager.java:660)
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.waitUntilStarting(PEInstancesManager.java:639)
at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstance(PEInstancesManager.java:170)
at com.sun.enterprise.ee.admin.servermgmt.EEInstancesManager.startInstance(EEInstancesManager.java:228)
... 5 more

Anybody can help me?
Thanks,
Enéias

Posted by Enéias on July 09, 2008 at 05:30 PM IST #

Enéias,

Are these Linux machines? It appears that because of some problem the syncrhonization code is not able to see DAS from the second machine (at least on RMI path). Do the machines have static IP's?

- Kedar

Posted by Kedar Mhaswade on July 10, 2008 at 10:32 AM IST #

Kedar,
Thanks for your help,

yes, these machines are linux and their ip's are hot(static). So, I think must be something like network configuration...I alread put these real ip's in their hosts file, but it not solve yet.

Enéias

Posted by Enéias on July 10, 2008 at 10:39 AM IST #

Hello,

I was trying to install glassfish application server on my OPEN Suse 11.0. I am getting the error saying that domain.xml no such file or directory. The installation wizard fails without installing the application server.Can anybody give some pointers of how to proceed from here.
Thanks,
//Nachiappan

[stdout]: cause: /usr/local/glassfishv2ur2/domains/domain1/config/domain.xml (No such file or directory)

Posted by Nachiappan on September 14, 2008 at 01:56 AM IST #

getting the same problem, just running a simple cluster with one DAS, one node agent, one server instance on Mac OSX.

asadmin> start-instance macinstance
com.sun.enterprise.config.ConfigException: Error refreshing ConfigContext:/workspace/publish/glassfish/nodeagents/macagent/macinstance/config/domain.xml
cause: /workspace/publish/glassfish/nodeagents/macagent/macinstance/config/domain.xml (No such file or directory)

I had had seen this problem before, suddenly it disappeared, now it's there again. Please someone let me know if you know how to fix it. I think it must be related to IP address settings somehow... if I find a solution I will post it here.

Posted by Yvo Bogers on October 09, 2008 at 03:50 PM IST #

Please post your queries to users@glassfish.dev.java.net.

Thanks,
Shalini.

Posted by Shalini on October 10, 2008 at 06:13 AM IST #

HI ,

I want to configure two glass fish servers on two machines with DAS server on third machine, I want this for Load balancing and high availability. Please help me out

Thanks
Rams

Posted by Rambabu on November 04, 2009 at 01:40 AM IST #

Hi
I am having trouble in starting NodeAgent eventhough the nodeagent started local it is not reflecting on DAS. In DAS nodeagent status always
shows STOP.

Please help me

By
Glassfish Beginner.

Posted by AnasAbubacker on February 02, 2010 at 11:38 AM IST #

Hi AnasAbubacker!

I am also facing the same problem, have you found a solution?

Posted by Gautam on April 29, 2010 at 03:40 PM IST #

I am trying to do the same steps on 64bit windows and stuck at this error

Caused by: java.lang.NoClassDefFoundError: sun/security/pkcs11/SunPKCS11

Any suggestions?

Posted by Sachin Joshi on February 20, 2011 at 01:49 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

shalini_m

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today