Overview
This document demonstrates how to configure the GlassFish ESB domain for clustering.
This includes the following information:
- Configuring the GlassFish Cluster: Provides the steps for configuring the cluster independent of the components.
- Adding a Component to a Cluster: Components are pre-installed on the GlassFish domain. This section provides steps for adding components to a cluster. This section applies to most components with a few exceptions, such as BPEL-SE and IEP-SE. These components are each covered specifically.
- Adding a Shared Library to a Cluster: Describes how to add components that are dependent upon a shared library, to a target cluster. These components must be added to the target cluster before they are installed.
- Service Assembly Deployment: Describes how to deploy a clustered application.
Configuring a GlassFish Cluster
This example demonstrates how to configure clustering for two server instances on the same computer. For this example we will use the Derby database, running on this computer.
- Download and install the GlassFish ESB v2.1 (Nightly build) from https://open-esb.dev.java.net/Downloads.html
. For more information see Using The Glass Fish ESB Installation GUI
.
Upon successful completion, you will have installed the GlassFish ESB environment with the GlassFish server configured in your developer profile.
- Start the GlassFish server. To do this, go to the NetBeans Servicess tab, expand the Servers node, right-click GlassFish V2, and select Start from the popup menu.
Once GlassFish startup is complete, log into the Admin Console at http://localhost:4848, using the default username:admin, and password:adminadmin.
- From the Admin Console, click Add Cluster Support. Review the Add Cluster Support page and click OK.
- Stop and start the GlassFish server. If you start GlassFish from a commandline the following message appears on the console: "Domain supports application server clusters and other standalone instances."
- Setup clustering with two server instances:
- Move to <GF_HOME>\samples\quickstart\clusterjsp.
- Execute ..\..\..\bin\asant.bat create_cluster.
- Execute ..\..\..\bin\asant.bat create_nodeagent.
- Execute ..\..\..\bin\asant.bat start_nodeagent.
Please note that the interface stop responding after the message "exec Command start-node-agent executed successfully" appears. To return to the prompt use ^c.
- Execute ..\..\..\bin\asant.bat create_instance1.
- Execute ..\..\..\bin\asant.bat create_instance2.
- Execute ..\..\..\bin\asant.bat start_cluster.
- Review the Admin Console
. If there are no issues it looks like the image below.
- You can start and stop the cluster using the following:
- To stop the cluster use ..\..\..\bin\asant.bat stop_nodeagent
- To start the cluster use ..\..\..\bin\asant.bat start_nodeagent
If the interface stops responding use ^c to return to prompt.
Adding a Component to a Cluster
Note: If you are adding a component that depends on a shared library, such as encoder or wsdl-ext, to a cluster, then add the shared library to the cluster before you add the component to avoid errors.
- In the Admin Console's Common Tasks pane, expand JBI > Components and select the component you want to add to a cluster.
- From the console's right pane, click the Targets tab, and click Manage Targets.
- Select the check-box next to appropriate cluster name and click OK
- By default the component is in a shutdown state. Select the check-box next to cluster name and click Start.
Adding a Shared Library to a Cluster
- In the Admin Console's Common Tasks pane, expand JBI > Shared Libraries and select the library you want to add to a cluster.
- From the console's right pane, click the Targets tab, and click Manage Targets.
- Select check-box next to appropriate cluster and click OK
Adding a BPEL Service Engine to a Cluster
BPEL Service Engines added to a cluster should point to a single database. Setup a database, connection pools (XA, non-XA), and data sources for the BPEL SEs. For more detailed configuration information see BPELSE Configuration
. Automatic table creation logic is not available in the cluster environment. Automatic connection pool and data source setup for Derby is not available in a cluster.
To configure a BPEL Service Engine in a cluster, we could go through a process of tedious setup and configuration. By doing the following, we can make the component do most of the configuration itself.
- GlassFish ESB installer leaves the BPEL SE in a shutdown state on "Server" (DAS). Start the BPEL SE:
- From the NetBeans IDE Services window, expand Servers > GlassFish V2 > JBI > Service Engines.
- Right-click sun-bpel-engine and select Start.
- Right-click the started BPEL SE and select Properties.
- From the Properties window, set PersistenceEnabled to true, then shutdown the BPEL SE.
- Start the Derby database from the NetBeans Services tab. You can only query the BPEL SE persistence database if Derby is started from Netbeans. After component's successful start, you will find a row in "Engine" table.
- Start the BPEL-Service Engine again. After the component has started, you can find a row in "Engine" table.
To enable data sources and make them available, create the component data source on the "Server" target using "Manage Targets" in the Admin Console.
Adding the BPEL SE to the cluster
- BPEL-SE depends on the shared libraries wsdl-ext, and Saxon. Install both of these shared libraries before you install the BPEL SE to avoid errors.
- In the Admin Console's Common Tasks pane, expand JBI > Components and select the BPEL Service Engine (sun-bpel-engine).
- From the console's right pane, click the Targets tab, and click Manage Targets.
- Under Persistance - Manage Persistance/Recovery, change PersistenceEnabled to true.
- Select the check-box next to the cluster name and click OK.
- Select the check-box next to the cluster name and click Start.
Configuration parameters for Cluster
- Persistence Enabled: : For clustering support, BPEL Service engine must be configured with persistence ON. The default setting is OFF.
- Lease Renewal Interval: Specifies the interval at which the BPEL Service Engine in each cluster instance renews its lease to continue to own the business process instances it is executing. When a BPEL Service Engine is not updating its lease, it is considered failed and its running instances are failed over to any of the live engines.
- Non XA Datasource Name: (Default - jdbc/bpelseNonXA): As configured above.
- XA Datasource Name: (Default - jdbc/bpelseXA): As configured above.
Verifying Successful Addition of a Component
After installation of BPEL Service Engine, verify the successful installation by checking the ENGINE table of the BPELSE Persistence Schema. You can use the Netbeans Database Tool to connect to BPEL SE Persistence schema and view ENGINE Table contents. The screenshot below shows two engine instances running on two cluster instances.
Note that by design the engine ID is the same as the cluster instance name (for cluster cases only).
Also, Note the value in the LASTUPDATETIME column. This corresponds to the Lease Renewal Interval configuration. Service engines participating in a cluster are expected to update the value of this column at least once during the interval, as defined by this configuration. Since the default value is 60 seconds, if you query the data again after 60 seconds you should see the LASTUPDATETIME values get updated. As a safeguard, you can confirm that the lease is being updated by the engine before moving to next step.
References
Service Assembly Deployment
The Deployment of Service Assembly defers at step-2, where the target needs to be chosen. Choose the given cluster name as target, Status enabled and click Finish as shown below.
Note: This document uses the GlassFish Admin Console to add and configure components and service assemblies. You can also use the command line interface (CLI) to add components and service assemblies. Refer to this
page 
for command line options. Please note that the NetBeans IDE does not support managing cluster instances.
Setting up IEP SE in cluster mode
Please refer to the
IEP SE cluster page
If you want to be independent of the GlassFish cluster, but need cluster support, refer to
Setting up IEP-SE cluster on independent GlassFish domains (No GlassFish cluster)