Configuring a Glassfish/Sunapp CLUSTER Server on Windows

Ok, I know, in an ideal world we’d do this on Solaris but I have customers with a pile of windows boxes so we have to work with what they have.

Server 1 – The “Controller” (machine 1, 192.168.100.10)

1. Install the SUN Application server make sure you select

– Do not require username/password
– Create a windows service (otherwise it wont stay running)
– Do not start the server from the INSTALLATION PROGRAM, use control panel, administration tools, services and start the service from there.

2. Login to the GUI http://localhost:4848

3. Select ADD CLUSTER SUPPORT – you will have to restart the server. Do NOT do this through the windows instead restart the service – Start, Control Panel, Admin Tools, Services, find SUN APPLICATION SERVER and RESTART

4. Login to the GUI http://localhost:4848 – Click on CREATE NEW CLUSTER

Enter the name and click OK now the cluster has been created (in this case i’ll use cluster1)

5. Create the first NODE. (this has to be done at the dos prompt)

Start, RUN, CMD, OK

cd \Sun\appserver\bin<ENTER>

asadmin<ENTER>

You will get a asadmin> prompt.

on each machine in the cluster you have to create and start a node agent

create-node-agent –host localhost –port 4848 nodeagent1

create an instance for this node agent

create-instance –host localhost –port 4848 –nodeagent nodeagent1 –cluster cluster1 instance1

now start the node agent

start-node-agent –syncinstances=true nodeagent1
(just hit enter on the master password)

at this point you have created and set up the first cluster machine which will control the cluster – so all your cluster admin will be done from this machine.

Exit asadmin

exit

then exit the command box

exit

Setting up Cluster Server clients (machine 2, 192.168.100.11)

1. Install the SUN Application server make sure you select

– Do not require username/password
– Create a windows service (otherwise it wont stay running)
– Do not start the server from the INSTALLATION PROGRAM, use control panel, administration tools, services and start the service from there.

2. Login to the GUI http://localhost:4848

3. Select ADD CLUSTER SUPPORT – you will have to restart the server. Do NOT do this through the windows instead restart the service – Start, Control Panel, Admin Tools, Services, find SUN APPLICATION SERVER and RESTART

4. Create a node agent, start, run cmd ok

Start, RUN, CMD, OK

cd \Sun\appserver\bin<ENTER>

asadmin<ENTER>

You will get a asadmin> prompt.

on each machine in the cluster you have to create and start a node agent

create-node-agent –host 192.168.100.10 –port 4848 nodeagent2

create an instance for this node agent

create-instance –host 192.168.100.10 –port 4848 –nodeagent nodeagent2 –cluster cluster1 instance2

now start the node agent

start-node-agent –syncinstances=true nodeagent2
(just hit enter on the master password)

at this point you have created and set up a cluster “client”

Exit asadmin

exit

then exit the command box

exit

Now you have your two cluster machines working.

Deploying a Netbeans Project to the Cluster

1. Make sure it’s running locally
2. Change the database settings in netbeans to point to the LIVE database if it is different and make sure it runs still
3. Deploy the app to the main server in the cluster
4. Login to the GUI and go through the JDBC connectors and enable them for the cluster
5. Test the application in SINGLE USER mode (normally port 8080) and make sure it all works.
6. Go into APPLICATIONS, MANAGE TARGETS for your app and deploy it to the cluster

I will be putting up a tutorial on load balancing as well shortly.

Advertisements

About Paul C

I am a Senior Java programmer/Web Technologies, Play in a band called Mandolin Monday, I have a cat and I live on a boat.

Posted on September 24, 2008, in Howto and tagged , , , , . Bookmark the permalink. 6 Comments.

  1. I’m waiting for the load balancing…

    Thanks very much 🙂

  2. Great article. Helped a lot.
    Thank you!

  3. great article, but I’m wondering what MS OS version you are using. I tried this on Server 2008 and after I clicked add cluster support and restarted, I was no longer able to start the domain. I get the following error
    java.io.FileNotFoundException:H:\Sun\AppServer\domains\domain1\config\domain-registry (Access is denied)

  4. Great Article, Its help me and I was search about this from a long time, but I did your steps and every thing done successfully BUT in Machine 1 , in GUI Admin http://localhost:4848 , instance2 status is stopped !!! why? its running !!!

    asadmin> start-node-agent –syncinstances=true nodeagent2
    Please enter the admin user name>admin
    Please enter the admin password>
    Please enter the master password [Enter to accept the default]:>
    Redirecting output to /opt/glassfish2/nodeagents/nodeagent2/agent/logs/server.log
    Redirecting application output to /opt/glassfish2/nodeagents/nodeagent2/agent/logs/server.log
    Redirecting output to /opt/glassfish2/nodeagents/nodeagent2/instance2/logs/server.log
    Command start-node-agent executed successfully.
    asadmin> start-node-agent –syncinstances=true nodeagent2
    nodeagent2 is already running.
    asadmin>

    What the problem is ?

    note : I using VMware as machine 2, please replay me ASAP

  5. Hi
    I just solve this problem, I disable the firewall completely, But now I have a question, why you enabled cluster on machine 2 , or generally why you start domain primarily?
    step 1, 2 and 3 its additional steps you don’t need to do that !

    Anyway I have a problem now, I deployed clusterjsp to test , I have a 2 nodes on each machine (node1,node2 in m1 and node3,node4 in m2) , the session what I added to node1 passed to node2 but not to node3 and node4 , and what I added to node3 passed to node4 but not to node1 and node2.!

    the session ID is different !

    I see the log file in node2 and its says something wrong in pipes !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: