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.

2 Responses to “Configuring a Glassfish/Sunapp CLUSTER Server on Windows”

  1. Silvio Says:

    I’m waiting for the load balancing…

    Thanks very much :)

  2. Thasia Says:

    Great article. Helped a lot.
    Thank you!

Leave a Reply