Creating and Configuring a WebLogic Cluster


Now that you have gained an understanding of the types of clustering architectures you can employ with the WebLogic cluster, the next logical step is to create an actual WebLogic cluster. To methodically assist you in this process, the following sections focus on

  • How you can create and configure a WebLogic cluster using the tools provided with WebLogic Server

  • The guidelines you should adhere to when configuring your WebLogic cluster

  • How to configure a WebLogic cluster from existing managed servers within a domain

  • How to start your WebLogic cluster after you have configured it

  • How to monitor server participation in your WebLogic cluster

The Tools for Creating and Configuring a WebLogic Cluster

The primary tools you have available to create or configure a WebLogic cluster are the Domain Configuration Wizard and the Administration Console. Which tool you use depends on the type of clustering architecture you want to employ and the capabilities of these tools to support your efforts.

The Domain Configuration Wizard is an excellent tool if you are creating a WebLogic cluster from scratch. This tool presents you with options on the type of WebLogic domain you want to create. One such option is a domain with an administration server and one or more managed servers that are clustered. However, this option creates the administration server and the clustered WebLogic Server instances on the same single server machine.

The Administration Console is a tool that you can use to configure a WebLogic cluster from existing managed servers in a domain. For example, if your clustering architecture warrants the clustered servers to be on separate server machines, the best approach would be to create the administration server and managed servers independently on each of those machines using the Domain Configuration Wizard. After the managed servers are created and registered with the domain's administration server, you could use the Administration Console to graphically configure a cluster from the existing managed servers.

You can also use the Administration Console to do the following:

  • Clone a cluster to form a new cluster

  • Assign additional managed servers to a cluster

  • Delete a cluster, which does not remove the managed servers from the domain

Guidelines for Configuring Your WebLogic Cluster

Before you start creating your WebLogic cluster, it is worth reviewing the following guidelines for creating a cluster:

  • You should try to use DNS names in a production environment to specify the location of the managed servers that will comprise a WebLogic cluster. The use of IP addresses can result in IP address translation errors if you are using a firewall to form a DMZ. However, if you do use IP addresses, they should be permanently assigned to the server machine (static) and not dynamically assigned.

  • The WebLogic cluster must have a unique IP address and listen port combination for each of its managed server instances. The following are some examples:

    • If managed server instances in a cluster share an IP address, as in the case of a non- multihomed single server, a unique listen port number is assigned to each server instance in the cluster.

      Note

      A non-multihomed server machine has only one IP address assigned to its network card (NIC).


    • If managed server instances in a cluster have different IP addresses, they may use the same or different listen port numbers . This is applicable if managed servers exist on a multihomed machine or are physically located on separate server machines.

  • Each WebLogic Server instance in a cluster must run the same version of WebLogic Server software, including service packs .

  • You should use a dedicated multicast address and port for the sole purpose of enabling cluster communications. Also, each server machine must be able to receive multicast traffic. As you can see in Figure 25.7, you can test the capability of a server machine to receive and respond to multicast traffic by using the MulticastTest utility and typing the following at the command prompt:

    Figure 25.7. Testing the multicast network capabilities of a server machine using the MulticastTest utility.

    graphics/25fig07.gif

     
     java utils .MulticastTest -N Test -A <  multicast address  > 
  • Ideally, all managed servers should be located on the same network subnet. Avoid WAN tunneling if you can.

  • Do not cluster the administration server because the administration objects cannot be clustered and take advantage of any failover mechanisms.

Tip

As a general rule, the administration server should not handle incoming client requests because this will obstruct administration tasks from occurring in a timely fashion.


Configuring a Cluster Using the Administration Console

This section provides a step-by-step guide showing how you can configure a WebLogic cluster using the Administration Console. The assumptions for this exercise are that you already have a WebLogic domain set up with two managed servers, and the network configuration for the WebLogic domain adheres to the clustering guidelines discussed in the preceding section. The name of the WebLogic domain, cluster and managed servers, and their network configurations can differ from those used in the example because the steps to configure the WebLogic cluster still remain the same.

To learn how to set up and configure a WebLogic domain, see "Understanding WebLogic Domains," p. 777 , "Creating and Extending WebLogic Domains," p. 785 , and "Configuring the Network Resources for a WebLogic Domain," p. 798 .


As illustrated in Figure 25.8, the WebLogic cluster to be configured (mycluster) will be hosted on a single, non-multihomed server machine, which implies that the same IP address will be used for each managed server, with differing listen port numbers. The attributes of the managed servers that will be used to form the mycluster WebLogic cluster are described in Table 25.1.

Figure 25.8. The mycluster WebLogic cluster on a single, non-multihomed server machine.

graphics/25fig08.gif

Tip

It is good practice to visualize and document the attributes of your cluster before you create it.


Table 25.1. The Attributes of the Managed Servers in the mycluster WebLogic Cluster

Managed Server Name

Listen Address (DNS)

Listen Port

NodeA

EINSTEIN

7003

NodeB

EINSTEIN

7005

Tip

If your server machines are dynamically assigned IP addresses, you should use the server DNS names as the listen addresses.


To configure the mycluster WebLogic cluster using the Administration Console, follow these steps:

  1. Launch the Administration Console in a Web browser using the appropriate URL for your administration server.

  2. From the left pane in the Administration Console, select the Clusters node.

  3. In the right pane of the Administration Console, click Configure a New Cluster.

  4. On the Create a New Cluster screen (the Configuration, General tab), enter the following information, as shown in Figure 25.9:

    Figure 25.9. The Create a New Cluster screen in the Administration Console.

    graphics/25fig09.gif

    • Name Enter a name to identify the WebLogic clusterfor example, mycluster .

    • Cluster Address Define the address to be used by clients to connect to your cluster as a list that contains the DNS name (or IP address) and listen port for each managed server that will comprise the clusterfor example,

       
       DNSName1:port1,DNSName2:port2,DNSName3:port3 DNSName1:port1,DNSName1:port2,DNSName1:port3 

    Note

    The cluster address is used in entity and stateless beans to construct the hostname portion of URLs.

    You can also specify just the DNS name that maps to the IP addresses for each WebLogic Server instance in the cluster. However, this assumes that each managed server has a unique IP address and the same portfor example,

     
     DNSName1:port1,DNSName1:port2,DNSName1:port3 

    From Table 25.1, the cluster address for the mycluster WebLogic cluster is as follows :

     
     EINSTEIN:7003,EINSTEIN:7005 

    Each WebLogic Server instance in a cluster must have a unique combination of IP address and listen port number.

    • Default Load Algorithm Select the algorithm to be used for load-balancing method calls between replicated EJBs and RMI classes; your choices are Round-Robin, Weight-Based, or Random. (The default is Round-Robin.)

    • WebLogic Plug-in Enabled Select this option if you are using a WebLogic plug-in for a third-party Web server.

    • Service Age Threshold Enter the number of seconds by which the age of two conflicting services must differ before one is considered older than the other. (The default is 180 seconds.)

    • Client Cert Proxy Enabled Select this option if you are using the HttpClusterServlet proxy because it enables the client certificate to be securely proxied using a special header.

  5. Click Create to configure your new cluster.

  6. Select the Configuration, Multicast tab to configure the Multicast parameters for your new WebLogic Server. Enter the following Multicast information for your new WebLogic cluster, as shown in Figure 25.10:

    Figure 25.10. Entering the multicast information for your new WebLogic cluster.

    graphics/25fig10.gif

    • Multicast Address Enter the multicast address to be used by cluster members to broadcast messages and communicate between each other. (The default is 237.0.0.1.)

    • Multicast Port Enter the multicast port number to be used in conjunction with the multicast address. The default is 7001, but if it conflicts with your other ports, you should change it to a value between 1 and 65535.

    • Multicast Send Delay Enter the number of milliseconds to delay broadcasting message fragments over multicast to avoid an OS-level buffer overflow. (The default is 12 seconds.)

    • Multicast TTL Enter the number of network hops that a multicast message is allowed to travel. (The default is 1, which restricts the cluster to multicast within the local subnet.)

    • Multicast Buffer Size Enter the multicast socket send/receive buffer size. (The default is 64KB.)

  7. Click Apply to save your multicast settings.

  8. Click the Servers tab and select the managed servers that will be assigned into your WebLogic cluster, as shown in Figure 25.11.

    Figure 25.11. Selecting the managed servers for your WebLogic cluster.

    graphics/25fig11.gif

  9. Click Apply to save your clustered server settings.

This completes the tasks related to configuring a WebLogic cluster using the Administration Console. The next section describes how you can now start your WebLogic cluster.

Starting Your WebLogic Cluster

You can start a WebLogic cluster using the following methods :

  • Using the command shell, where each clustered server is manually started in a separate command shell

  • Using the Administration Console in conjunction with the Node Manager

To start any clustered managed server, you first need to start the administration server for the domain, which will copy the clustered configuration information to the clustered managed servers upon startup. The general steps for starting an administration server are as follows:

  1. From a command shell, set the environment for your domain by executing the setEnv command.

  2. Execute the startWebLogic command.

The following sections describe how to start the mycluster WebLogic cluster created previously using both of these methods.

Starting a WebLogic Cluster Using the Command Shell

You start managed servers that participate in a WebLogic cluster in the same manner as you would start them if they were not clustered. The command syntax for starting a managed server is

 
 StartManagedWebLogic  server_name address:port  

where

  • server_name is the name of the managed server you need to start

  • address is the IP address or DNS name for the administration server for your domain

  • port is the listen port for the administration server for the domain

For example, to start the clustered managed servers in mycluster, you enter the following commands in separate command shells :

 
 StartManagedWebLogic NodeA EINSTEIN:7001 StartManagedWebLogic NodeB EINSTEIN:7001 

As shown in Figure 25.12, during the startup process, a clustered managed server joins its WebLogic cluster and tries to synchronize information with other online managed servers in the cluster.

Figure 25.12. Starting the WebLogic cluster using the command shell.

graphics/25fig12.gif

Starting a WebLogic Cluster Using the Administration Console

The primary advantage of using the Administration Console to start a WebLogic cluster is that you can start all constituent clustered managed servers at the same time. Alternatively, you can start the clustered managed servers individually, if required.

The Administration Console can, by default, be used to kill managed servers without the Node Manager. However, the Administration Console can only start managed servers in conjunction with the Node Manager. For this reason, even if the clustered managed servers are located on the same machine as the administration server, you need to perform the following tasks to enable the Administration Console to start a clustered managed server or a cluster of managed servers:

  • Configure and run the Node Manager on each server machine where a clustered managed server resides. For example, if you have configured a WebLogic cluster on a single non-multihomed machine (such as mycluster), you still need to configure and run the Node Manager on that machine.

  • Configure machine definitions for each managed server in the WebLogic cluster.

  • Configure the Node Manager's listen address and port for each machine definition.

  • Configure SSL communication for all managed servers in the WebLogic cluster. (Node Manager uses SSL for all communication between the administration server and managed servers.)

Even though these procedures may appear to be very complicated, they are relatively easy to perform and are methodically explained in Chapter 4.

After you configure your administration server to remotely start managed servers using the Node Manager, you can follow these steps to start a WebLogic cluster:

  1. Expand the Clusters node in the left pane of the Administration Console.

  2. Right-click the WebLogic cluster you want to start (mycluster) and select the Start This Cluster option.

  3. On the next screen, confirm you want to start the WebLogic cluster.

As shown in Figure 25.13, this procedure initiates WebLogic tasks to start all the managed servers assigned to your WebLogic cluster.

Figure 25.13. The Tasks screen in the Administration Console illustrating the startup of all clustered managed servers in the mycluster WebLogic cluster.

graphics/25fig13.gif

Monitoring Server Participation in Your WebLogic Cluster

After you set up a WebLogic cluster, the next administration task is to adopt a technique that allows you to monitor the number of active servers participating in it. This task is important because in a production environment the capability to provide performance-based high availability and workload load balancing is directly influenced by the number of active managed servers that constitute a WebLogic cluster.

The most immediate technique to accomplish this task is via the Administration Console using the following steps:

  1. Select the WebLogic cluster you want to monitor in the left pane of the Administration Console.

  2. Select the Monitoring tab in the right pane, which will display a high-level view of the servers participating in your cluster.

  3. Click the Monitor Server Participation in This Cluster link to open a detailed view of your clustered managed servers, as shown in Figure 25.14.

    Figure 25.14. Monitoring the server participation of your WebLogic cluster using the Administration Console.

    graphics/25fig14.gif

Alternatively, you can create a servlet or JavaServer Page to access WebLogic Server's Runtime MBeans to display customized and consolidated information about your WebLogic domain and its managed resources, including nonclustered and clustered servers. To programmatically retrieve information about a WebLogic cluster, you must access the APIs of an instance of the ClusterRuntimeMBean, which are hosted only on those managed servers actively participating in a WebLogic cluster.

To assist you in creating such a servlet or JavaServer Page, Listing 25.1 provides the fully commented Java code for the infoCluster servlet, which performs the following tasks:

  • Retrieves the Administration MBeanHome, which runs on the administration server and provides access to all ClusterRuntimeMBeans in the domain

  • Retrieves the name of the active domain

  • Retrieves the name, listen address, and port information of the WebLogic Servers in the domain

  • Retrieves the name of the managed servers where the instance of the ClusterRuntimeMBean has been accessed

  • Retrieves the number and names of the active managed servers in a WebLogic cluster

Listing 25.1 The infoCluster Servlet for Accessing Runtime Information about Your WebLogic Domain and Cluster
 import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.Set; import java.util.Iterator; import javax.naming.*; import weblogic.jndi.Environment; import weblogic.management.MBeanHome; import weblogic.management.configuration.ServerMBean; import weblogic.management.runtime.ClusterRuntimeMBean; import weblogic.management.WebLogicObjectName; public class infoCluster extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) throws IOException { // Declare MBean and other variables MBeanHome home = null; ServerMBean server = null; ClusterRuntimeMBean clusterRuntime = null; String name=""; String[] aliveServerArray = null; // Initialize Set mbeanSet = null; Iterator mbeanIterator = null; // Set the content type for the response res.setContentType("text/html"); // Obtain a PrintWriter to insert HTML into PrintWriter out = res.getWriter(); // Setup the start of the HTML page out.println("<HTML><HEAD><TITLE>infoCluster Servlet Example</TITLE>"); out.println("<BODY><H1><strong><font size=5>Your WebLogic Cluster" + "Information:</font></strong></H1>"); // Set the initial context try { Environment env = new Environment(); Context ctx = env.getInitialContext(); // Get the Administration MBeanHome home = (MBeanHome) ctx.lookup("weblogic.management.adminhome"); } catch (Exception e) { out.println("<br>Exception caught: " + e); } try { out.println("<p><BR><strong><u>Your Active Domain is " + "<font color=#000000>"+ home.getActiveDomain().getName() + "</font></u></strong></p>"); } catch (Exception e) { out.println("<br>Exception: " + e); } out.println("<p><strong> <u>The WebLogic Servers in your Domain are:" + "</u></strong></p>"); try { mbeanSet = home.getMBeansByType("Server"); mbeanIterator = mbeanSet.iterator(); while(mbeanIterator.hasNext()) { server = (ServerMBean)mbeanIterator.next(); out.println("<p><strong> <u> Server Name</u>:" + "<font color =#000000>" + server.getName() + "</font> <BR>"); out.println("ListenAddress: " + server.getListenAddress() + "<BR>"); out.println("ListenPort: " + server.getListenPort() + "<BR>"); } } catch (Exception e) { out.println("<br>Exception: " + e); } // Retrieving a list of ClusterRuntime MBeans in the domain. out.println("<p><strong><u>Your WebLogic Clustering Information:" + "</u> <BR>"); try { mbeanSet = home.getMBeansByType("ClusterRuntime"); mbeanIterator = mbeanSet.iterator(); while(mbeanIterator.hasNext()) { // Retrieving one ClusterRuntime MBean from the list. clusterRuntime = (ClusterRuntimeMBean)mbeanIterator.next(); // Get the name of the ClusterRuntime MBean. name = clusterRuntime.getName(); out.println("Cluster information retrieved from the " + "ClusterRuntime MBean on server " + name + "<BR>"); // Using the current ClusterRuntimeMBean to retrieve the number // of servers in the cluster. out.println("Number of active servers in the cluster: " + clusterRuntime.getAliveServerCount() + "<BR>"); // Retrieving the names of servers in the cluster. aliveServerArray = clusterRuntime.getServerNames(); break; } } catch (Exception e) { out.println("<br>Exception: " + e); } if(aliveServerArray == null) { out.println("<br>There are no running servers in the cluster"); } else { out.println("The running Managed Servers in the cluster are: "); for (int i=0; i < aliveServerArray.length; i++) { out.println("("+ aliveServerArray[i] + ")" +" "); } } out.println("</strong> </p></BODY></HTML>"); } } 

Note

You can find the full list of APIs for the ClusterRuntimeMBean in WebLogic Server's JavaDoc documentation, which you can download from e-docs.bea.com .


The infoCluster servlet should be deployed to your administration server to ensure you are monitoring your WebLogic cluster from an external server. The output of the infoCluster servlet is shown in Figure 25.15.

Figure 25.15. The output of the infoCluster servlet in a browser.

graphics/25fig15.gif



BEA WebLogic Platform 7
BEA WebLogic Platform 7
ISBN: 0789727129
EAN: 2147483647
Year: 2003
Pages: 360

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net