Set up WebLogic Clusters
Introduction
Before beginning, review clustering concepts and verify you have a valid cluster license.Determine what cluster architecture best suits your needs. Key architectural decisions include:
- Should you combine all application tiers in a single cluster or segment your application tiers in separate clusters?
- How will you balance the load among server instances in your cluster? Will you:
- Use basic WebLogic Server load balancing,
- Implement a third-party load balancer, or
- Deploy the Web tier of your application on one or more secondary HTTP servers, and proxy requests to it?
- Should you define your Web applications De-Militarized Zone (DMZ) with one or more firewalls?
Consider Your Network and Security Topologies
Security requirements form the basis for designing the appropriate security topology. Some network topologies can interfere with multicast communication, such as clusters deployed across a WAN. Avoid deploying server instances in a cluster across a firewall.
Choose Machines for the Cluster Installation
Identify the machine or machines where you plan to install WebLogic Server - throughout this section we refer to such machines as "hosts" - and ensure that they have the resources required. Be sure you have satisfied system and software prerequisites.
WebLogic Server allows you to set up a cluster on a single, non-multihomed machine. This new capability is useful for demonstration or development environments.
Do not install WebLogic Server on machines that have dynamically assigned IP addresses.
WebLogic Server Instances on Multi-CPU machines
BEA WebLogic Server has no built-in limit for the number of server instances that can reside in a cluster. Large, multi-processor servers such as Sun Microsystems, Inc. Sun Enterprise 10000 can host very large clusters or multiple clusters.
In most cases, WebLogic Server clusters scale best when deployed with one WebLogic Server instance for every two CPUs. However, as with all capacity planning, you should test the actual deployment with your target Web applications to determine the optimal number and distribution of server instances.
Check Host Machines' Socket Reader Implementation
For best socket performance, configure the WebLogic Server host machine to use the native socket reader implementation for your operating system, rather than the pure-Java implementation.
Identify Names and Addresses
During the cluster configuration process, you supply addressing information - IP addresses or DNS names, and port numbers - for the cluster and its members.
When you set up your cluster, provide location information for:
- Administration Server
- Managed Servers
- Multicast location
Avoiding Listen Address Problems
As you configure a cluster, you can specify address information for the cluster, and the server instances that comprise it, using either IP addresses or DNS names.
DNS Names or IP Addresses?
Consider the purpose of the cluster when deciding whether to use DNS names or IP addresses. For production environments, the use of DNS names is generally recommended. The use of IP addresses can result in translation errors if:
- Clients will connect to the cluster through a firewall, or
- You have a firewall between the presentation and object tiers, for example, you have a servlet cluster and EJB cluster with a firewall in between.
You can avoid translation errors by binding the address of an individual server instance to a DNS name. Make sure that a server instance's DNS name is identical on each side of firewalls in your environment, and do not use a DNS name that is also the name of an NT system on your network.
When Internal and External DNS Names Vary
If the internal and external DNS names of a WebLogic Server instance are not identical, use the ExternalDNSName attribute for the server instance to define the server's external DNS name. Outside the firewall the externalDNSName should translate to external IP address of the server. Set this attribute in the Administration Console using the Server - >Configuration - >General tab.
If clients are accessing WebLogic Server over the default channel and T3, do not set the ExternalDNSName attribute, even if the internal and external DNS names of a WebLogic Server instance are not identical.
Localhost Considerations
If you identify a server instance's Listen Address as localhost, non-local processes will not be able to connect to the server instance. Only processes on the machine that hosts the server instance will be able to connect to the server instance. If the server instance must be accessible as localhost (for instance, if you have administrative scripts that connect to localhost), and must also be accessible by remote processes, leave the Listen Address blank. The server instance will determine the address of the machine and listen on it.
Assigning Names to WebLogic Server Resources
Make sure that each configurable resource in your WebLogic Server environment has a unique name. Each, domain, server, machine, cluster, JDBC connection pool, virtual host, or other resource must have a unique name.
Administration Server Address and Port
Identify the DNS name or IP address and Listen Port of the Administration Server you will use for the cluster.
The Administration Server is the WebLogic Server instance used to configure and manage all the Managed Servers in its domain. When you start a Managed Server, you identify the host and port of its Administration Server.
Managed Server Addresses and Listen Ports
Identify the DNS name or IP address of each Managed Server planned for your cluster.
Each Managed Server in a cluster must have a unique combination of address and Listen Port number. Clustered server instances on a single non-multihomed machine can have the same address, but must use a different Listen Port.
Cluster Multicast Address and Port
Identify the address and port you will dedicate to multicast communications for your cluster. A multicast address is an IP address between 224.0.0.0 and 239.255.255.255.
Server instances in a cluster communicate with each other using multicast - they use multicast to announce their services, and to issue periodic heartbeats that indicate continued availability.
The multicast address for a cluster should not be used for any purpose other than cluster communications. If the machine where the cluster multicast address exists hosts or is accessed by cluster-external programs that use multicast communication, make sure that those multicast communications use a different port than the cluster multicast port.
Multicast and Multiple Clusters
Multiple clusters on a network may share a multicast address and multicast port combination if necessary.
Multicast and Multi-Tier Clusters
If you are setting up the Recommended Multi-Tier Architecture, with a firewall between the clusters, you will need two dedicated multicast addresses: one for the presentation (servlet) cluster and one for the object cluster. Using two multicast addresses ensures that the firewall does not interfere with cluster communication.
Cluster Address
When you configure a cluster, you define a cluster address that identifies the Managed Servers in the cluster. The cluster address is used in entity and stateless beans to construct the host name portion of URLs. If the cluster address is not set, EJB handles may not work properly.
Cluster Address for Production Environments
In a production environment, specify the cluster address as a DNS name that maps to the IP addresses or DNS names of each WebLogic Server instance in the cluster. If you do not define the cluster address as a DNS name that maps to the Managed Servers in the cluster, failover will not work for entity beans and EJB handles.
If you define the cluster address as a DNS name, the Listen Ports for the cluster members are not specified in the cluster address - it is assumed that each Managed Server in the cluster has the same Listen Port number. Because each server instance in a cluster must have a unique combination of address and Listen Port, if a cluster address is a DNS name, each of the server instance in the cluster must have:
- a unique address and
- the same Listen Port number
When clients obtain an initial JNDI context by supplying the cluster DNS name, weblogic.jndi.WLInitialContextFactory obtains the list of all addresses that are mapped to the DNS name. This list is cached by WebLogic Server instances, and new initial context requests are fulfilled using addresses in the cached list with a round-robin algorithm. If a server instance in the cached list is unavailable, it is removed from the list. The address list is refreshed from the DNS service only if the server instance is unable to reach any address in its cache.
Using a cached list of addresses avoids certain problems with relying on DNS round-robin alone. For example, DNS round-robin continues using all addresses that have been mapped to the domain name, regardless of whether or not the addresses are reachable. By caching the address list, WebLogic Server can remove addresses that are unreachable, so that connection failures aren't repeated with new initial context requests.
The Administration Server should not participate in a cluster. Ensure that the Administration Server's IP address is not> included in the cluster-wide DNS name.
Cluster Address for Development and Test Environments
Use of a cluster DNS name for the cluster address, recommended for production environments in the previous section, is also fine for development and test environments.
Alternatively, you can define the cluster address as a list that contains the DNS name (or IP address) and Listen Port of each Managed Server in the cluster, as shown in the examples below:
DNSName1:port1,DNSName1:port2,DNSName1:port3
IPaddress1:port1,IPaddress2:port2;IPaddress3:port3
Note that each cluster member has a unique address and port combination.
Cluster Address for Single, Multihomed Machine
If your cluster runs on a single, multihomed machine, and each server instance in the cluster uses a different IP address, define the cluster address using a DNS name that maps to the IP addresses of the server instances in the cluster. If you define the cluster address as a DNS name, specify the same Listen Port number for each of the Managed Servers in the cluster.
Cluster Implementation Procedures
This section describes how to get a clustered application up and running, from installation of WebLogic Server through initial deployment of application components.
Configuration Roadmap
This section lists typical cluster implementation tasks, and highlights key configuration considerations. The exact process you follow is driven by the unique characteristics of your environment and the nature of your application. These tasks are described:
- Install WebLogic Server
- Create a Clustered Domain
- Configure Node Manager
- Configure Load Balancing Method for EJBs and RMIs
- Configure Server Affinity for Distributed JMS Destinations
- Configuring Load Balancers that Support Passive Cookie Persistence
- Configure Proxy Plug-Ins
- Configure Replication Groups
- Configure Migratable Targets for Pinned Services
- Configure Clustered JDBC
- Package Applications for Deployment
- Deploy Applications
- Deploying, Activating, and Migrating Migratable Services
- Configure In-Memory HTTP Replication
- Additional Configuration Topics
Not every step is required for every cluster implementation. Additional steps may be necessary in some cases.
Install WebLogic Server
If you have not already done so, install WebLogic Server.
- If the cluster will run on a single machine, do a single installation of WebLogic Server under the /bea directory to use for all clustered instances.
- For remote, networked machines, install the same version of WebLogic Server on each machine. Each machine:
- Must have permanently assigned, static IP addresses. You cannot use dynamically-assigned IP addresses in a clustering environment.
- Must be accessible to clients. If the server instances are behind a firewall and the clients are in front of the firewall, each server instance must have a public IP address that can be reached by the clients.
- Must be located on the same local area network (LAN) and must be reachable via IP multicast.
Do not use a shared filesystem and a single installation to run multiple WebLogic Server instances on separate machines. Using a shared filesystem introduces a single point of contention for the cluster. All server instances must compete to access the filesystem (and possibly to write individual log files). Moreover, should the shared filesystem fail, you might be unable to start clustered server instances.
Create a Clustered Domain
The are multiple methods of creating a clustered domain.
See also:
Starting a WebLogic Server Cluster
There are multiple methods of starting a cluster - available options include the command line interface, scripts that contain the necessary commands, and Node Manager.
Node Manager eases the process of starting local and remote Managed Servers, and restarting them after failure. (You cannot use Node Manager to start an Administration Server.) To use Node Manager, first configure a Node Manager process on each machine that hosts Managed Servers in the cluster.
Regardless of the method you use to start a cluster, start the Administration Server first, then start the Managed Servers in the cluster.
Follow the instructions below to start the cluster from a command shell. Note that each server instance is started in a separate command shell.
- Open a command shell.
- Change directory to the domain directory that you created with the Configuration Wizard.
- Type this command to start the Administration Server: StartWebLogic
- Enter the user name for the domain at the "Enter username to boot WebLogic Server" prompt.
- Enter the password for the domain at the "Enter password to boot WebLogic Server" prompt.
The command shell displays messages that report the status of the startup process.
- Open another command shell so that you can start a Managed Server.
- Change directory to the domain directory that you created with the Configuration Wizard.
- Type this command
StartManagedWebLogic ManagedServer AdminServerAddress:port
server_name is the name of the Managed Server you wish to start
address is the IP address or DNS name for the Administration Server for the domain
port is the listen port for the Administration Server for the domain
- Enter the user name for the domain at the "Enter username to boot WebLogic Server" prompt.
- Enter the password for the domain at the "Enter password to boot WebLogic Server" prompt.
The command shell displays messages that report the status of the startup process.
Note: After you start a Managed Server, it listens for heartbeats from other running server instances in the cluster. The Managed Server builds its local copy of the cluster-wide JNDI tree, and displays status messages when it has synchronized with each running Managed Server in the cluster. The synchronization process can take a minute or so.
- To start another server instance in the cluster, return to step 6. Continue through step 10.
- When you have started all Managed Servers in the cluster, the cluster startup process is complete.
Configure Node Manager
Node Manager is a standalone Java program provided with WebLogic Server that is useful for starting a Managed Server that resides on a different machine than its Administration Server. Node Manager also provides features that help increase the availability of Managed Servers in your cluster. See also Configuring, Starting, and Stopping Node Manager
Configure Load Balancing Method for EJBs and RMIs
Follow the instructions in this section to select the load balancing algorithm for EJBs and RMI objects.
Unless you explicitly specify otherwise, WebLogic Server uses the round-robin algorithm as the default load balancing strategy for clustered object stubs.
- Go to:
WebLogic Server Console | Clusters node | ClusterName
- Click the drop-down arrow next to the Default Load Algorithm to display load balancing algorithms.
- In the item list, select the desired load balancing algorithm.
- Enter the desired value in the Service Age Threshold field.
- Click Apply to save your changes.
Configure Server Affinity for Distributed JMS Destinations
To understand the server affinity support provided by WebLogic Server for JMS, see Load Balancing for JMS.
Configuring Load Balancers that Support Passive Cookie Persistence
Load balancers that support passive cookie persistence can use information from the WebLogic Server session cookie to associate a client with the WebLogic Server instance that hosts the session. The session cookie contains a string that the load balancer uses to identify the primary server instance for the session.
To configure the load balancer to work with your cluster, use the facilities of the load balancer to define the offset and length of the string constant.
Assuming that the Session ID portion of the session cookie is the default length of 52 bytes, on the load balancer, set:
- string offset to 53 bytes, the default Random Session ID length plus 1 byte for the delimiter character.
- string length to 10 bytes
If your application or environmental requirements dictate that you change the length of the Random Session ID from its default value of 52 bytes, set the string offset on the load balancer accordingly. The string offset must equal the length of the Session ID plus 1 byte for the delimiter character.
For vendor-specific instructions for configuring Big-IP load balancers, see Configuring BIG-IP Hardware with Clusters.
Configure Proxy Plug-Ins
Refer to the instructions in this section if you wish to load balance servlets and JSPs using a proxy plug-in. A proxy plug-in proxies requests from a web server to WebLogic Server instances in a cluster, and provides load balancing and failover for the proxied HTTP requests.
- If you use WebLogic Server as a web server, set up HttpClusterServlet using the instructions in Set Up the HttpClusterServlet.
- If you use a supported third-party web server, set up a product-specific plug-in.
Each web server that proxies requests to a cluster must have an identically configured plug-in.
Set Up the HttpClusterServlet
To use the HTTP cluster servlet, configure it as the default web application on your proxy server machine:
- If you have not already done so, configure a separate, non-clustered Managed Server to host the HTTP Cluster Servlet.
- Create the web.xml deployment descriptor file for the servlet. This file must reside in the \WEB-INF subdirectory of the web application directory.
- Define the name and class for the servlet in the <servlet> element in web.xml. The servlet name is HttpClusterServlet. The servlet class is weblogic.servlet.proxy.HttpClusterServlet.
- Identify the clustered server instances to which the proxy servlet will direct requests in the <servlet> element in web.xml, by defining the WebLogicCluster parameter.
- Create <servlet-mapping> stanzas to specify the requests that the servlet will proxy to the cluster, using the <url-pattern> element to identify specific file extensions, for example *.jsp, or *.html. Define each pattern in a separate <servlet-mapping> stanza.
You can set the <url-pattern> to "/" to proxy any request that cannot be resolved by WebLogic Server to the remote server instance. If you do so, also specifically map the following extensions: *.jsp, *.html, and *.html, to proxy files ending with those extensions.
- Define, as appropriate, any additional parameters.
- Create the weblogic.xml deployment descriptor file for the servlet. This file must reside in the \WEB-INF subdirectory of the web application directory.
Assign the proxy servlet as the default web application for the Managed Server on the proxy machine by setting the <context-root> element to a forward slash character (/) in the <weblogic-web-app> stanza.
- In the Administration Console, deploy the servlet to the Managed Server on your proxy server machine.
Sample web.xml
This section contains a sample deployment descriptor file (web.xml) for HttpClusterServlet.
web.xml defines parameters that specify the location and behavior of the proxy servlet:
- The DOCTYPE stanza specifies the DTD used by WebLogic Server to validate web.xml.
- The servlet stanza:
- Specifies the location of the proxy plug-in servlet class. The file is located in the weblogic.jar in your WL_HOME/server/lib directory. You do not have to specify the servlet's full directory path in web.xml because weblogic.jar is put in your CLASSPATH when you start WebLogic Server.
- Identifies the host name and listen port of each Managed Servers in the cluster, using the WebLogicCluster parameter.
- The three servlet-mapping stanzas specify that the servlet will proxy URLs that end in '/', 'htm', 'html', or 'jsp' to the cluster.
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";> <web-app> <servlet> <servlet-name>HttpClusterServlet</servlet-name> <servlet-class> weblogic.servlet.proxy.HttpClusterServlet </servlet-class> <init-param> <param-name>WebLogicCluster</param-name> <param-value> myserver1:7736|myserver2:7736|myserver:7736 </param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>HttpClusterServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>HttpClusterServlet</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>HttpClusterServlet</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>HttpClusterServlet</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> </web-app>
Sample weblogic.xml
This section contains a sample weblogic.xml file. The <context-root> deployment parameter is set to "/". This makes the proxy servlet the default web application for the proxy server.
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic 810-web-jar.dtd"> <weblogic-web-app> <context-root>/</context-root> </weblogic-web-app>
Proxy Servlet Deployment Parameters
Key parameters for configuring the behavior of the proxy servlet in web.xml are listed in Table 7-1.
The parameters for the proxy servlet are the same as those used to configure WebLogic Server plug-ins for Apache, Microsoft, and Netscape web servers.
The syntax for specifying the parameters, and the file where they are specified, is different for the proxy servlet and for each of the plug-ins.
For the proxy servlet, specify the parameters in web.xml, each in its own <init-param> stanza within the <servlet> stanza of web.xml. For example:
<init-param> <param-name>ParameterName</param-name> <param-value>ParameterValue</param-value>
</init-param>
WebLogicCluster <init-param>
<param-name>WebLogicCluster</param-name>
<param-value>WLS1.com:port|WLS2.com:port
</param-value>Where WLS1.com and WLS2.com are the host names of servers in the cluster, and port is a port where the host is listening for HTTP requests.If you are using SSL between the plug-in and WebLogic Server, set the port number to the SSL listen port and set the SecureProxy parameter to ON.SecureProxy <init-param>
<param-name>SecureProxy</param-name>
<param-value>ParameterValue</param-value>
</init-param>Valid values are ON and OFF.If you are using SSL between the plug-in and WebLogic Server, set the port number to the SSL listen port and set the SecureProxy parameter to ON.DebugConfigInfo <init-param>
<param-name>DebugConfigInfo</param-name>
<param-value>ParameterValue</param-value>
</init-param>Valid values are ON and OFF. If set to ON, you can query the HttpClusterServlet for debugging information by adding a request parameter of ?__WebLogicBridgeConfig to any request. (Note: There are two underscore ( _ ) characters after the ?.) For security reasons, it is recommended that you set the DebugConfigInfo parameter to OFF in a production environment.ConnectRetrySecs Interval in seconds that the servlet will sleep between attempts to connect to a server instance. Assign a value less than ConnectTimeoutSecs. The number of connection attempts the servlet makes before returning an HTTP 503/Service Unavailable response to the client is ConnectTimeoutSecs divided by ConnectRetrySecs. Syntax:<init-param> <param-name>ConnectRetrySecs</param-name> <param-value>ParameterValue</param-value>
</init-param>ConnectTimeoutSecs Maximum time in seconds that the servlet will attempt to connect to a server instance. Assign a value greater than ConnectRetrySecs. If ConnectTimeoutSecs expires before a successful connection, an HTTP 503/Service Unavailable response is sent to the client.Syntax:<init-param>
<param-name>ConnectTimeoutSecs</param-name> <param-value>ParameterValue</param-value>
</init-param>PathTrim String trimmed by the plug-in from the beginning of the original URL, before the request is forwarded to the cluster. Syntax:<init-param>
<param-name>PathTrim</param-name> <param-value>ParameterValue</param-value>
</init-param>Example:If the URLhttp://myWeb.server.com/weblogic/foois passed to the plug-in for parsing and if PathTrim has been set to/weblogic the URL forwarded to WebLogic Server is: http://myWeb.server.com:7001/fooTrimExt The file extension to be trimmed from the end of the URL.Syntax:<init-param>
<param-name>TrimExt</param-name> <param-value>ParameterValue</param-value>
</init-param>clientCertProxy Specifies to trust client certificates in the WL-Proxy-Client-Cert header. Valid values are true and false. The default value is false. This setting is useful if user authentication is performed on the proxy server - setting clientCertProxy to true causes the proxy server to pass on the certs to the cluster in a special header, WL-Proxy-Client-Cert. The WL-Proxy-Client-Cert header can be used by any client with direct access to WebLogic Server. WebLogic Server takes the certificate information from that header, trusting that is came from a secure source (the plug-in) and uses that information to authenticate the user. For this reason, if you set clientCertProxy to true, use a connection filter to ensure that WebLogic Server accepts connections only from the machine on which the plug-in is running. PathPrepend String that the servlet prepends to the original URL, after PathTrim is trimmed, before forwarding the URL to the cluster. <init-param>
<param-name>PathPrepend</param-name> <param-value>ParameterValue</param-value>
</init-param>
Cluster Configuration and Proxy Plug-ins
Two WebLogic Server configuration attributes can be set at the cluster level to control the behavior of the HttpClusterServlet.
- WeblogicPluginEnabled - If you set this attribute to true for a cluster that receives requests from the HttpClusterServlet, the servlet will respond to getRemoteAddr calls with the address of the browser client from the proprietary WL-Proxy-Client-IP header, instead of returning the web server address.
- ClientCertProxy Enabled - If you set this attribute to true for a cluster that receives requests from HttpClusterServlet, the plug-in sends client certs to the cluster in the special WL-Proxy-Client-Cert header, allowing user authentication to be performed on the proxy server.
For more information:
Console | Cluster | Configuration | General page
Accessing Applications Via the Proxy Server
Ensure that applications clients will access via the proxy server are deployed to your cluster. Address client requests to the listen address and listen port of the proxy server.
If you have problems:
- Make sure all servers instances have unique address/port combinations
Each of the server instances in the configuration must have a unique combination of Listen Address and Listen Port.
- Make sure that the proxy servlet is the default application for the proxy server
If you get a page not found error when you try to your application, make sure that weblogic.xml is in \WEB-INF for the application and that it sets the context-root deployment parameter to "/".
- When all else fails, restart
If you are having problems try rebooting all your servers, some of the changes you made while configuring your setup may not have been persisted to the configuration file.
- Verify Your Configuration
To verify the configuration of the HttpClusterServlet:
- Set the DebugConfigInfo parameter in web.xml to ON.
- Use a Web browser to access the following URL:
http://myServer:port/placeholder.jsp?__WebLogicBridgeConfig
Where:
- myServer is the Managed Server on the proxy machine where HttpClusterServlet runs,
- port is the port number on that server that is listening for HTTP requests, and
- placeholder.jsp is a file that does not exist on the server.
The plug-in gathers configuration information and run-time statistics and returns the information to the browser.
Configure Replication Groups
To support automatic failover for servlets and JSPs, WebLogic Server replicates HTTP session states in memory. You can further control where secondary states are placed using replication groups. A replication group is a preferred list of clustered instances to be used for storing session state replicas.
If your cluster will host servlets or stateful session EJBs, you may want to create replication groups of WebLogic Server instances to host the session state replicas.
Configure replication groups for each WebLogic Server instance:
To configure replication groups for a WebLogic Server instance:
- Open the WebLogic Server Console.
- Select the Servers node.
- Select the server to configure.
- Select the Cluster tab.
- Enter values for the following attribute fields:
- Replication Group: Enter the name of the replication group to which this server instance belongs.
- Preferred Secondary Group: Enter the name of the replication group you would like to use to host replicated HTTP session states for this server instance.
- Apply the changes.
Configure Migratable Targets for Pinned Services
WebLogic Server enables you to configure an optional migratable target, which defines a list of server instances in the cluster that can potentially host a migratable service, such as a JMS server or the JTA transaction recovery service/a> . If you want to use a migratable target, configure the target server list before deploying or activating the service in the cluster.
If you do not configure a migratable target in the cluster, migratable services can be migrated to any WebLogic Server instance in the cluster.
Configure Clustered JDBC
This section provides instructions for configuring JDBC components using the Administration Console. The choices you make as you configure the JDBC components are reflected in the config.xml file for the WebLogic Server domain that contains the cluster.
First you create the connection pools and optionally a multipool, then you create the data source. When you create a data source object, you specify a connection pool or multipool as one of the data source attributes. This associates that data source with one specific connection pool or multipool.
See also:
Clustering Connection Pools
Perform these steps to set up a basic connection pool in a cluster:
- Create a connection pool.
- Assign the connection pool to the cluster.
- Create the data source. Specify the connection pool created in the previous step in the Pool Name attribute.
- Assign the data source to the cluster.
Clustering Multipools
Perform these steps to create a clustered multipool for increased availability, and optionally, load balancing.
Multipools are typically used to provide increased availability and load balancing of connections to replicated, synchronized instances of a database.
- Create two or more connection pools.
- Assign each connection pool to the cluster.
- Create a multipool. Assign the connection pools created in the previous step to the multipool.
- Assign the Multipool to the cluster.
- Create the data source. Specify the multipool created in the previous step in the Pool Name attribute.
- Assign the data source to the cluster.
Package Applications for Deployment
You must package applications before you deploy them to WebLogic Server.
Deploy Applications
Clustered objects in WebLogic Server should be deployed homogeneously. To ensure homogeneous deployment, when you select a target use the cluster name, rather than individual WebLogic Server instances in the cluster.
The console automates deploying replica-aware objects to clusters. When you deploy an application or object to a cluster, the console automatically deploys it to all members of the cluster (whether they are local to the Administration Server machine or they reside on remote machines.)
All server instances in your cluster should be running when you deploy applications to the cluster using the Administration Console
Deploying to a Single Server Instance (Pinned Deployment)
Deploying a application to a server instance, rather than the all cluster members is called a pinned deployment. Although a pinned deployment targets a specific server instance, all server instances in the cluster must be running during the deployment process.
You can perform a pinned deployment using the Administration Console or from the command line, using weblogic.Deployer.
Pinned Deployment from the Command Line
From a command shell, use the following syntax to target a server instance:
java weblogic.Deployer -activate -name ArchivedEarJar -source C:/MyApps/JarEar.ear -target server1
Cancelling Cluster Deployments
You can cancel a deployment using the Administration Console or from the command line, using weblogic.Deployer.
Cancel Deployment from the Command Line
From a command shell, use the following syntax to cancel the deployment task ID:
java weblogic.Deployer -adminurl http://admin:7001 -cancel -id tag
Cancel Deployment Using the Administration Console
In the Administration Console, open the Tasks node to view and to cancel any current deployment tasks.
Viewing Deployed Applications
To view a deployed application in the Administration Console:
- In the Console, click Deployments.
- Click the Applications option.
- View a list of deployed applications in the table displayed in the Console.
Undeploying Deployed Applications
To undeploy a deployed application from the WebLogic Server Administration Console:
- In the Console, click Deployments.
- Click the Applications option.
- In the displayed table, click the name of the application you wish to undeploy.
- Click the Configuration tab, and deselect the Deployed check box.
- Click Apply.
Deploying, Activating, and Migrating Migratable Services
The sections that follow provide guidelines and instructions for deploying, activating, and migrating migratable services.
Deploying JMS to a Migratable Target Server Instance
The migratable target that you create defines the scope of server instances in the cluster that can potentially host a migratable service. You must deploy or activate a pinned service on one of the server instances listed in the migratable target in order to migrate the service within the target server list at a later time. Use the instructions that follow to deploy a JMS server on a migratable target, or activate the JTA transaction recovery system so that you can migrate it later.
If you did not configure a migratable target, simply deploy the JMS server to any WebLogic Server instance in the cluster; you can then migrate the JMS server to any other server instance in the cluster (no migratable target is used).
To deploy a JMS server to a migratable target using the Administration Console:
- Use the instructions in Configure Migratable Targets for Pinned Services to create a migratable target for the cluster, if you have not already done so.
- Start the Administration Server for the cluster and log in to the Administration Console.
- Select the Services-->JMS node in the left pane, then select the Servers node under JMS.
- Select the name of the configured JMS server that you want to deploy to the cluster. This displays the JMS server configuration in the right pane.
- Select the Targets->Migratable Targets tab in the right pane.
- Select the name of a server instance from the drop-down list. The drop-down list specifies server names that are defined as part of a migratable target.
- Click Apply to apply the JMS server to the select WebLogic Server instance.
Activating JTA as a Migratable Service
The JTA recovery service is automatically started on one of the server instances listed in the migratable target for the cluster; you do not have to deploy the service to a selected server instance.
If you did not configure a JTA migratable target, WebLogic Server activates the service on any available WebLogic Server instance in the cluster. To change the current server instance that hosts the JTA service, use the instructions in Migrating a Pinned Service to a Target Server Instance.
Migrating a Pinned Service to a Target Server Instance
After you have deployed a migratable service, you can use the Administration Console to migrate the service to another server instance in the cluster. If you configured a migratable target for the service, you can migrate to any other server instance listed in the migratable target, even if that server instance is not currently running. If you did not configure a migratable target, you can migrate the service to any other server instance in the cluster.
If you migrate a service to a stopped server instance, the server instance will activate the service upon the next startup. If you migrate a service to a running WebLogic Server instance, the migration takes place immediately.
To migrate a pinned service using the Administration Console:
- Use the instructions in Deploying JMS to a Migratable Target Server Instance to deploy a pinned service to the cluster, if you have not already done so.
- Start the Administration Server for the cluster and log in to the Administration Console.
- Select the Servers node in the left pane, then select a server instance that is a member of the cluster you want to configure.
- Select Control->Migrate if you want to migrate the JMS service, or Control->JTA Migrate to migrate the JTA transaction recovery service.
The Current Server field shows the WebLogic Server instance that currently hosts the pinned service. The Destination Server drop-down list displays server instances to which you can migrate the service.
- Use the Destination Server drop-down list to select the new server instance that will host the pinned service.
- Click Migrate to migrate the pinned service from the Current Server to the Destination Server.
- If the Current Server is not reachable by the Administration Server, the Administration Console displays this message:
Unable to contact server MyServer-1, the source server from which services are being migrated.
Please ensure that server MyServer-1 is NOT running! If the administration server cannot reach server MyServer-1 due to a network partition, inspect the server directly to verify that it is not running. Continue the migration only if MyServer-1 is not running. Cancel the migration if MyServer-1 is running, or if you do not know whether it is running.
Before bringing up MyServer-1 again after this migration, use the java weblogic.PurgeConfigCache utility to prevent redundant activation of the migrated service.
If this message is displayed, perform the procedure described in Migrating When the Currently Active Host is Unavailable.
- If the Destination Server is stopped, the Administration Console notifies you of the stopped server instance and asks if you would like to continue the migration. Click the Continue button to migrate to the stopped server instance, or click Cancel to stop the migration and select a different server instance.
- The migration process may take several minutes to complete, depending on the server instance configuration. However, you can continue using other Administration Console features while the migration takes place. To view the migration status at a later time, click the Tasks node in the left pane to display the currently-running tasks for the domain; then select the task description for the migration task to view the current status.
Migrating When the Currently Active Host is Unavailable
Use this migration procedure if a clustered Managed Server that was the active server for the migratable service crashes or becomes unreachable.
This procedure purges the failed Managed Server's configuration cache. The purpose of purging the cache is to ensure that, when the failed server instance is once again available, it does not re-deploy a service that you have since migrated to another Managed Server. Purging the cache eliminates the risk that Managed Server which was previously the active host for the service uses local, out-of-date configuration data when it starts up again.
- Disconnect the machine from the network entirely. It should not be accessible to the Administration Server or client traffic. If the machine has a dual ported disk, disconnect it.
- Migrate the migratable service(s) to a Managed Server instance on a different machine. The Administration Server must be running, so that it can coordinate the migration and update the activation table.
- If you use the command line for migration, use the -sourcedown flag.
- If you use the console, it will ask you to make sure the source server is not going to restart.
The migratable service is now available on a different Managed Server on a different machine. The following steps can be performed at leisure.
- Perform the necessary repair or maintenance on the failed machine.
- Reboot the machine, but do not connect it to the network.
Node Manager will start as a service or daemon, and will attempt to start the Managed Servers on the machine.
- If Managed Server Independence is enabled, the Managed Server will start, even though it cannot connect to the Administration Server.
- If Managed Server Independence is disabled, the Managed Server will not start, because it cannot connect to the Administration Server.
- Use the java weblogic.PurgeConfigCache utility to disable all Managed Servers that host migratable services on the machine. Run the utility from the WebLogic Server home directory on the machine. If there are multiple installations on the machine, each with different root directories, participating in the cluster, run the utility from each WebLogic Server home directory.
The utility will:
- Remove the Managed Servers' PIDs from the monitor process list - the list of server instances to be restarted after failure.
- Shut down any Managed Servers that started when the machine was rebooted, and prevent them from restarting again.
- Delete the replicated config.xml from the Managed Server's root directory.
- Reconnect the machine to the network and shared storage, including dual ported disk, if applicable.
- Restart the Node Manager daemon/service or reboot the machine, to start all remaining Managed Servers.
- Start the Managed Serves that was disabled in step 5. This is a normal start up, rather than a restart performed by Node Manager. The Administration Server must be reachable and running, so that the Managed Servers can synchronize with the migratable service activation table on the Administration Server - and hence know that it is no longer the active host of the migratable service.
Configure In-Memory HTTP Replication
To support automatic failover for servlets and JSPs, WebLogic Server replicates HTTP session states in memory.
WebLogic Server can also maintain the HTTP session state of a servlet or JSP using file-based or JDBC-based persistence.
In-memory HTTP Session state replication is controlled separately for each application you deploy. The parameter that controls it - PersistentStoreType - appears within the session-descriptor element, in the WebLogic deployment descriptor file, weblogic.xml, for the application.
domain_directory/applications/application_directory/Web-Inf/weblogic.xml
To use in-memory HTTP session state replication across server instances in a cluster, set the PersistentStoreType to replicated. The fragment below shows the appropriate XML from weblogic.xml.
<session-descriptor> <session-param> <param-name> PersistentStoreType </param-name> <param-value> replicated </param-value> </session-param></session-descriptor>
Additional Configuration Topics
The sections below contain useful tips for particular cluster configurations.
Configure IP Sockets
For best socket performance, BEA recommends that you use the native socket reader implementation, rather than the pure-Java implementation, on machines that host WebLogic Server instances.
If use the pure-Java socket reader implementation for host machines, you can still improve the performance of socket communication by configuring the proper number of socket reader threads for each server instance and client machine.
See also
- Peer-to-Peer Communication Using IP Sockets
- Client Communication via Sockets
- Determining Potential Socket Usage
- Configuration Considerations for Multi-Tier Architecture
Configure Native IP Sockets Readers on Machines that Host Server Instances
To configure a WebLogic Server instance to use the native socket reader threads implementation:
WebLogic Server Console | Servers node | ServerInstance | Tuning tab | Enable Native IO box
Set the Number of Reader Threads on Machines that Host Server Instances
By default, a WebLogic Server instance creates three socket reader threads upon booting. If you determine that your cluster system may utilize more than three sockets during peak periods, increase the number of socket reader threads:
- Go to:
WebLogic Server Console | Servers node | ServerInstance | Tuning tab- Edit the percentage of Java reader threads in the Socket Readers attribute field. The number of Java socket readers is computed as a percentage of the number of total execute threads (as shown in the Execute Threads attribute field).
Set the Number of Reader Threads on Client Machines
On client machines, you can configure the number socket reader threads in the Java Virtual Machine (JVM) that runs the client. Specify the socket readers by defining the -Dweblogic.ThreadPoolSize=value and -Dweblogic.ThreadPoolPercentSocketReaders=value options in the Java command line for the client.
Configure Multicast Time-To-Live (TTL)
If your cluster spans multiple subnets in a WAN, the value of the Multicast Time-To-Live (TTL) parameter for the cluster must be high enough to ensure that routers do not discard multicast packets before they reach their final destination. The Multicast TTL parameter sets the number of network hops a multicast message makes before the packet can be discarded. Configuring the Multicast TTL parameter appropriately reduces the risk of losing the multicast messages that are transmitted among server instances in the cluster.
To configure the Multicast TTL for a cluster, change the Multicast TTL value in the Multicast tab for the cluster in the Administration Console. The config.xml excerpt below shows a cluster with a Multicast TTL value of three. This value ensures that the cluster's multicast messages can pass through three routers before being discarded:
<Cluster Name="testcluster" ClusterAddress="wanclust" MulticastAddress="wanclust-multi" MulticastTTL="3" />
Configure Multicast Buffer Size
If multicast storms occur because server instances in a cluster are not processing incoming messages on a timely basis, you can increase the size of multicast buffers.
TCP/IP kernel parameters can be configured with the UNIX ndd utility. The udp_max_buf parameter controls the size of send and receive buffers (in bytes) for a UDP socket. The appropriate value for udp_max_buf varies from deployment to deployment. If you are experiencing multicast storms, increase the value of udp_max_buf by 32K, and evaluate the effect of this change.
Do not change udp_max_buf unless necessary. Before changing udp_max_buf, read the Sun warning in the "UDP Parameters with Additional Cautions" section in the "TCP/IP Tunable Parameters" chapter in Solaris Tunable Parameters Reference Manual at http://docs.sun.com/?p=/doc/806-6779/6jfmsfr7o&.
Configure Machine Names
Configure a Machine Name if:
- Your cluster will span multiple machines, and multiple server instances will run on individual machines in the cluster, or
- You plan to run Node Manager on a machine that does not host a Administration Server
WebLogic Server uses configured machine names to determine whether or not two server instances reside on the same physical hardware. Machine names are generally used with machines that host multiple server instances. If you do not define machine names for such installations, each instance is treated as if it resides on separate physical hardware. This can negatively affect the selection of server instances to host secondary HTTP session state replicas
Configuration Notes for Multi-Tier Architecture
If your cluster has a multi-tier architecture, see the configuration guidelines in Configuration Considerations for Multi-Tier Architecture.
Enable URL Rewriting
In its default configuration, WebLogic Server uses client-side cookies to keep track of the primary and secondary server instance that host the client's servlet session state. If client browsers have disabled cookie usage, WebLogic Server can also keep track of primary and secondary server instances using URL rewriting. With URL rewriting, both locations of the client session state are embedded into the URLs passed between the client and proxy server. To support this feature, ensure that URL rewriting is enabled on the WebLogic Server cluster.