Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

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:

  • java utils.MulticastTest -N Test -A <multicast address>

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

  • 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," "Creating and Extending WebLogic Domains," and "Configuring the Network Resources for a WebLogic Domain."

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.

TIP

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

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

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:

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

    • Name—Enter a name to identify the WebLogic cluster—for 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 cluster—for 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 port—for 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.

  6. Click Create to configure your new cluster.

  7. 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:

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

    • 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.)

  9. Click Apply to save your multicast settings.

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

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

  12. 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.

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.

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

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.13Figure 25.13 The Tasks screen in the Administration Console illustrating the startup of all clustered managed servers in the mycluster WebLogic cluster.

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.14Figure 25.14 Monitoring the server participation of your WebLogic cluster using the Administration Console.

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.15Figure 25.15 The output of the infoCluster servlet in a browser.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020