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.
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.
- From the left tree panel expand the Environment option and select Clusters.
- From the Cluster Summary page, click on the New button.
- 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.
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.
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:
Each listen address:listen port combination in the cluster address, corresponds to the single Managed servers and the network channel that received the request.
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:
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.