Custering Oracle Weblogic

A WebLogic Server cluster consists of multiple Managed servers running simultaneously the same applications and working together to provide increased scalability and reliability.

There are a variety of options which you can use to configure a cluster:

  • From within the domain installation wizard, (See Chapter 1, “Creating a WebLogic domain”) you have the option to create a domain made up of a set of Managed nodes which are part of a cluster.
  • If you want to defer the creation of your cluster at a later time, a common option for creating it is by means of the Administration console.
  • If you are an experienced user, then you might try the WLST scripting shell to automate the creation of your cluster. (See Chapter 11, “Creating a cluster with WLST”)

In this chapter we will at first learn how to set up a cluster using the Administration Console and the Managed servers that we have created at the beginning of this book. Then we will learn how to achieve Load Balancing and High Availability for your applications.

Create a cluster from the Admin console

Start up the Administration server and (if you want to control servers from the Web console) the Node Manager. If any of the Managed servers of the domain are running, shut them down, using the Control tab of each server.

  1. From the left tree panel expand the Environment option and select Clusters.
  2. From the Cluster Summary page, click on the New button.
  3. In the Create a New Cluster screen, enter the Cluster Name and select a Messaging Mode as depicted by the following picture:

 

As you can see, we have chosen “WLSCluster” as Name and left the default options for Messaging Mode (Unicast) and Unicast Broadcast Channel (blank).

Note: the Multicast fields are disabled if you choose Unicast as messaging mode. In the section named “Configuring clustering transport” we detail some more information about Unicast and Multicast modes.

Click Ok. A message will inform you that the cluster was created successfully.

Configuring the cluster address

So far we have defined just a Name and a Messaging Mode for our cluster. You might wonder how your clients (for example a remote EJB client) can access an application running in a cluster of nodes. The answer is the Cluster Address which is used to construct the host name portion of request URLs. You can explicitly define the cluster address when you configure the cluster; otherwise, WebLogic Server dynamically generates the cluster address for each new request.

Dynamic cluster address

If you have not explicitly defined a cluster address, then when a Managed Server receives a remote request, WebLogic Server generates the cluster address, in the form:

listenaddress1:listenport1,listenaddress2:listenport2;listenaddress3:listenport3

Each listen address:listen port combination in the cluster address, corresponds to the single Managed servers and the network channel that received the request.

Explicitly Defining Cluster Address

You can explicitly define a cluster address for a cluster in a production environment by specifying the cluster address as a DNS name that maps to the IP addresses or host names of each WebLogic Server instance in the cluster. In order to do that, select the Configuration | General sub tab of your Cluster definition:

You can specify the cluster address using a comma-separated list of hostnames and port numbers or (highly suggested) as DNS name that is mapped externally to the addresses of all servers that belong to the WebLogic cluster.

Both of these are valid examples of the cluster address for a WebLogic cluster:

192.168.1.1:7003, 192.168.1.1:7005, 192.168.1.1:7007

DNS1:7001,DNS2:7001

Remember that any address/port combination in the cluster address must be unique. This means that if you need to run a WebLogic cluster on a single machine, you must ensure all server instances participating in the cluster are assigned a unique port number.

 

 

Adding server nodes to the cluster

In order to add Managed Servers to your cluster definition, select the Configuration | Server sub tab of your Cluster definition:

Click on the Add button. On the next page, select an existing server and add it as a member of the cluster. (If you need adding some more servers, the second option “Create a new server and add it to this cluster” is fit for this purpose)

Once done, click the Finish button. Repeat that process to add the remaining Managed servers to the cluster. If you are running in Production mode, activate changes in Change Control panel.

Configuring the clustering transport

WebLogic server instances in a cluster communicate with each another using two basic network technologies:

  • IP sockets, which are the conduits for peer-to-peer communication between clustered server instances.
  • IP unicast or multicast, which are used by server instances to broadcast availability of services and heartbeats that indicate continued availability.

Difference between Unicast and Multicast

Unicast packets are sent from host to host. The communication is from a single host to another host. There is one device transmitting a message destined for one receiver.

Multicast is a special protocol for use with IP packets. Multicast enables a single device to communicate with a specific set of hosts, not defined by any standard IP address and mask combination. This allows for communication that resembles a conference call. The speaker's message isn't broadcasted everywhere, but only to those in the conference call itself. A special set of addresses is used for multicast communication.

Note: Oracle recommends that you use Unicast for messaging within a cluster, leaving multicast for backward compatibility with previous versions.

As a matter of fact, IP multicast broadcasts messages to applications but it does not guarantee that messages are actually received. If an application’s local multicast buffer is full, new multicast messages cannot be written to the buffer and the application is not notified when messages are dropped. Because of this limitation, there’s a chance that you may occasionally miss messages that were broadcasted over IP multicast. If multicast is your only option, then choose an appropriate address.

The default multicast value used by WebLogic Server is 239.192.0.0 but you are allowed to use an IP address in the range from 224.0.0.0 to 239.255.255.255. If you are running instances of JBoss EAP in your network, consider that this server uses the 224.0.1.105 address as default multicast address.

Besides this, if you run several clusters on your network, you need to check that the combination of multicast address and port must be unique. If two clusters on a network use the same multicast address, they should use different ports.

Troubleshooting Multicast:

In order to solve multicast issues, Oracle WebLogic server ships with a multicast test tool which can show evidence of most common cluster issues:

The Syntax is:

java utils.MulticastTest –n name -a address [-p portnumber]    [-t timeout]   [-s send]

For example, if running the cluster on the default 239.192.0.0 address:

java utils.MulticastTest –A 239.192.0.0

 

 

Starting and Stopping the WLS cluster

Starting your cluster nodes requires starting all your Managed servers. Just select the Control tab of your cluster and choose the Start/Shutdown submenu. This will allow starting all your Managed servers:

Remember that you can start as well your Managed servers using a Terminal window, by entering the commands:

$ ./startManagedWebLogic.sh WLSNode1 http://domain.server.7001

$ ./startManagedWebLogic.sh WLSNode2 http://domain.server.7001

Are we living in a simulated reality? Check it here!
Francesco Google+