Load balancing and cluster configuration for WebLogic plus Apache

Source: Internet
Author: User
Tags connection pooling microsoft iis
WebLogic load Balancing can be achieved by means of software and hardware. Hardware can use F5 and other devices, software generally use Apache to achieve. Here's how to use Apache.

WebLogic load Balancing can be achieved by means of software and hardware. Hardware can use F5 and other devices, software generally use Apache to achieve. Here's how to use Apache.

1. Environmental preparedness

Apache 2.2 http://httpd.apache.org/download.cgi

Weblogic 9.2

Three machines, the use is as follows:


2. Configure WebLogic

2.3 Configuring Weblogic.xml Files

To support session replication, create a new Weblogic.xml file for the application and place it in the Meta-inf directory of the ear file. Content is:

<?xml version= "1.0" encoding= "GBK"?>

<weblogic-web-app xmlns= "HTTP://WWW.BEA.COM/NS/WEBLOGIC/90" >

<session-descriptor>

<persistent-store-type>replicated</persistent-store-type>

<sharing-enabled>true</sharing-enabled>

</session-descriptor>

</weblogic-web-app>

3. Configure Apache

From the {weblogic_home}/server/plugin/win/32 directory, copy mod_wl_22.so to the {apache_home}/modules directory.

Modify the httpd.conf file to add the following:

LoadModule Weblogic_module modules/mod_wl_22.so

<ifmodule mod_weblogic.c>

Weblogiccluster 192.168.10.101:7010,192.168.10.102:7011

MatchExpression *

Wllogfile "D:/program files/apache Software Foundation/apache2.2/logs/wlproxy.log"

Debug on

Debugconfiginfo on

Keepaliveenabled on

Keepalivesecs 15

</IfModule>

4. Deploying Applications

Start the admin server above Machine2, go to the console, deploy the application, and note that when you select Target, specify as Cluster_test.

5. Start WebLogic

5.1 Start the admin server above Machine2

On the Machine2 machine, run the command {Weblogic_home}/user_projects/domains/cluster_domain/bin/startweblogic.cmd

5.2 Start the Server1 on the Machine2.

On the Machine2 machine, run the command {weblogic_home}/user_projects/domains/cluster_domain/bin/startmanagedweblogic.cmd server1 192.168.10.101:7001

5.3 Start the Server2 on the Machine3.

On the Machine3 machine, run the command {weblogic_home}/user_projects/domains/cluster_domain/bin/startmanagedweblogic.cmd server2 192.168.10.101:7001

6. Start Apache Server

7. Related constraint conditions

7.1 The binding address for all managed servers must be a static address, not a dynamic address

7.2 If you need access to the WAN above, the machine on which the admin server resides must have an external IP address

8. Problem Diagnosis Method

Multicastmonitor Tools
Monitor the broadcast data in the group, generally to check whether the communication is normal in the group. Use the following methods:

1. Run {weblogic_home}/user_projects/domains/{domain_name}/bin/setdomain.cmd Set environment variables, such as Classpath,

2. Running Java weblogic.cluster.MulticastMonitor {Group broadcast address} {broadcast port} {domain name} {cluster names}

3. After running, you can see the broadcast data between the various managed servers in the group, so that you can determine whether the communication is normal for each server.

Multicasttest Tools
Sending data between individual managed servers is typically used to check that communication between servers within a cluster is normal. This command needs to be run on the same machine as each server. Use the following methods:

1. Run {weblogic_home}/user_projects/domains/{domain_name}/bin/setdomain.cmd Set environment variables, such as Classpath,

2. Run Java utils. MULTICASTTEST-N {message Name}-a {broadcast address}-p {broadcast Port} (these parameters cannot be duplicated already)

The name of the message running on each server cannot be the same.

The broadcast address cannot be a group broadcast address that has already been configured, that is, a broadcast address for testing purposes needs to be used separately.

Schedule-Common parameters for plug-ins (case sensitive):

Parameters

Default value

Describe

Weblogichost

(This parameter should be set if the proxy is to a single WebLogic server)

None

HTTP requests are submitted to the WebLogic Server host (or to a virtual host name similar to the Web server that is defined to run in WebLogic Server) if a cluster is used, You should use the Weblogiccluster parameter instead of the Weblogichost parameter.

Weblogicport

(This parameter should be set if the proxy is to a single WebLogic server)

None

The WebLogic server listens on the port of the WebLogic connection request. (If you use SSL between the plug-in and the WebLogic server, you should set this parameter to the SSL listening port (see "Configure Listening Port" on page 8-4) and set the Secureproxy parameter to ON).

If you are using the WebLogic cluster, you should set the Weblogiccluster parameter instead of the Weblogicport parameter.

Weblogiccluster

(if the proxy is to a WebLogic server cluster, you must set this parameter)

None

Cluster we Blogic a list of servers for load balancing purposes. The list consists of host:port separated by commas. For example:

Weblogiccluster myweblogic.com:7001,

yourweblogic.com:7001,theirweblogic.com:7001

If the SSL protocol is used between the plug-in and the WebLogic server, set the port number to the SSL listening port (see "Configure Listening Port" on page 8-3) and set the Secureproxy parameter to ON.

Should replace the Weblogichost and Weblogicport parameters with this parameter, WebLogic server first looks for the weblogiccluster parameter, if it is not found, It will look for and use Weblogichost and Weblogicport parameters. The

Plug-in polls all available cluster members. The list of clusters specified by this parameter is the initial value of the dynamic list maintained by the server and the plug-in. WebLogic servers and Plug-ins dynamically update the cluster list based on newly joined, failed, and restored cluster members.

If the Dynamicserverlist parameter is set to OFF (Microsoft Internet Information Server only), dynamic updates to the cluster list are disabled. The plug-in directs the request to the server that originally created the cookie in the cluster (requests for session information that contains cookies, url-encoded sessions, or stored in post data).

Pathtrim

None

A string that is cropped out of the original URL by the plug-in before the request is forwarded to the WebLogic server. For example, if the original URL is

Http://myWeb.server.com/weblogic/foo is passed to the plug-in for resolution and the Pathtrim parameter is set to/weblogic, the URL that is passed to the WebLogic server becomes: http:// Myweblogic.server.com:7001/foo

Pathprepend

Null

Prefix string that is added before the original URL, which occurs before the Pathtrim is cropped and the request is moved to the WebLogic server.

Connecttimeoutsecs

10

The maximum amount of time that a plug-in attempts to weblogic a server host connection. The value should be greater than the Connectretrysecs parameter. If the connection is not successful, the HTTP 503/service unavailable response is returned to the client, even if the appropriate number of connection retries (see Connectretrysecs parameter) is made.

You can use the ErrorPage parameter to customize the error response.

Connectretrysecs

2

This parameter is set two times in seconds WebLogic the server host (or all servers in the cluster) attempt to connect , the dormant time of the plug-in. The value of this parameter should be less than connecttimeoutsecs. Before the plug-in returns the HTTP 503/service unavailable response, it will make the number of connections Connecttimeoutsecs divided by the Connectretrysecs value.

If you do not want to retry the connection, the Connectretrysecs value should be equal to the connecttimeoutsecs. However, the plug-in will attempt to connect at least two times. The

Can customize the error response with the ErrorPage parameter.

Debug

Off

Set the log type when debugging operations. It is not recommended that you turn on these debugging options in a production system.

In UNIX systems, debug information is written to the/tmp/wlproxy.log file, and debugging information is written to the Windows NT system c:/temp/ Wlproxy.log file, through the Wllogfile parameter, you can use other files under other paths to overwrite file name, path parameters. You can set the following logging options (where HFC, HTW, HFW, HTC can be used jointly, separated by commas, such as "HFC, HTW");

On

Plug-in only records reporting and error messages

Off

Do not log debug information

Hfc

A message header that is logged from a client message, a reporting message, and an error message.

HTW

Record headers sent from WebLogic, reporting messages and error messages

HFW

Log message headers from WebLogic server messages, reporting messages and error messages

Htc

Records the headers of messages sent to client messages, reporting messages and error messages

All

The header of the message sent to the client and the client, sent to the WebLogic server and the WebLogic server, the message header, the reporting message, the error message

Wllogfile

See Debug parameters

Indicates that when the debug parameter is on, the path and file name of the log file are generated, and the corresponding directory must be created before the parameter is set.

Debugconfiginfo

Off

Enables the special query parameter "_weblogicbridgeconfig". This parameter can be used to understand the details of the plug-in's configuration parameters.

For example, if you set Debugconfiginfo to ON, then "_weblogicbridgeconfig" is enabled. Sends a request containing the query string _weblogicbridgeconfig, which collects the run-time statistics of the configuration information and returns the information to the browser. When processing the request, the plug-in is not connected to the WebLogic server.

This parameter should only be used strictly for debugging purposes. The output format of the message varies with the version. For security purposes, this parameter should be set to off in a production environment.

Statpath (The Microsoft Internet information Server plug-in does not have this parameter.) )

False

If you set this argument to true, the plug-in checks to see if the converted path exists or its access rights ("proxy-path-translated") before passing the request to the WebLogic server. If the file does not exist, the HTTP 404 File Not Found response is returned to the client. If the file exists, but its permissions are not world-readable, the HTTP 403/forbidden response is returned. In both cases, the default mechanism by which the Web server handles these responses is the body content that executes the response. This option is useful if the Web application of the WebLogic server has the same document root as the Web server.

You can use the ErrorPage parameter to customize the error response.

ErrorPage

None

You can make your own error response page, which is used when the Web server cannot delegate the request to the WebLogic server.

There are two ways to set this parameter: as a relative URI (file name). The plug-in automatically adds the context path of the Web application that returned the error to the URI. Whether a request to the wrong page is returned to the WebLogic server depends on your configuration of the proxy (MIME type proxy or path broker). As an absolute URI (recommended). Using the absolute path of the error page enables the request to always be delegated to the correct resource on the WebLogic server. For example: http://host:port/myWebApp/ErrorPage.html

Hungserverrecoversecs

300

Defines the time the plug-in waits for the WebLogic server to respond to requests. After waiting for the hungserverrecoversecs time, the plug-in has not yet received a response from the server, it will announce that the server has crashed and failed to transfer to the next server. The parameter should be set to a larger value. If you set a value that is less than the time that servlets is processing, you can get unexpected results.

The minimum value is: 10

The maximum value is: 600

Idempotent

On

If this parameter is set to ON, the plug-in will handle fault tolerance when the server does not respond at the specified hungserverrecoversecs time. If set to OFF, the plug-in will not fail over. If you are using a Netscape Enterprise server plug-in or Apache HTTP server plug-in, different URLs and MIME types can have different idempotent parameter settings.

CookieName

Jsessio

NID

If you change the name of the WebLogic Server session cookie in the WebLogic Server Web application, you should set the plug-in's cookiename parameter to the same value accordingly. The name of the WebLogic session cookie is defined in the <session-descriptor> element that is specific to the WebLogic distribution descriptor

Defaultfilename

None

If the URI is "/", the plug-in performs the following steps:

1. Crop off the path specified by the Pathtrim parameter

2. followed by the filename specified by defaultfilename

3. This process, preceded by the value specified by the Pathprepend parameter, prevents redirection of the WebLogic server. Set Defaultfilename as the default welcome page for the Web application of the proxy WebLogic server. For example, if Defaultfilename is set to welcome.html, the following HTTP request:

Http://somehost/weblogic

Into: http://somehost/weblogic/welcome.html. This parameter only works if all redirected Web applications specify the same welcome page. You can see the "Configuring Welcome Pages" section of the following page:

Http://e-docs.bea.com/wls/docs61/webapp/components

For Apache users, the stronghold or raven version is used, and the parameters are defined in the location block, not in the Ifmodule block

Maxpostsize

-1

The maximum allowable length of the post data. If the content is longer than maxpostsize, the plugin will return an error message. If set to-1, the length of the post data is not checked. Setting this parameter prevents denial of service attacks that overload the server by sending large amounts of data.

MatchExpression

(This parameter applies only to Apache HTTP servers)

None

If you use a MIME type proxy, you should set the filename pattern in a ifmodule block using the matchexpression parameter.

The following example illustrates a proxy that uses MIME types:

<ifmodule mod_weblogic.c>

MatchExpression *.jsp

Weblogichost=myhost|paramname=value

</IfModule>

The following example illustrates the proxy using the path method:

<ifmodule mod_weblogic.c>

Matchexpression/weblogicweblogichost=myhost|paramname=value

</IfModule>

Filecaching

On

When this parameter is set to ON, if the post data in the request is greater than 2,084 bytes, the post data is saved in a temporary file on the hard disk and then passed to the WebLogic server in 8192 bytes. However, setting filecaching to on may cause problems that a progress bar will be displayed on the browser to indicate that a download is under way. Even if the file is still being transmitted, the browser will display the following in the completed.

If this parameter is set to OFF, when the post data is greater than 2084 bytes, the data is saved in memory and sent to the WebLogic server in 8192 bytes. Setting the parameter to off may cause problems. Because the plug-in cannot fail over, the data will be lost if the WebLogic server is down when the request is processed.

Wlforwardpath

(only Microsoft IIS needs to define the singular)

Null

If Wlforwardpath is set to "/", all requests are delegated to the WebLogic server. If you only want the proxy to start with a specific string, you should set the Wlforwardpath parameter to this string. For example, if you set Wlforwardpath to/webogic, all requests starting with/weblogic will be delegated to the WebLogic server.

If you are using a path-mode proxy, you must set this parameter. You can set multiple strings for this parameter, separated by commas, for example: Wlforwardpath=/weblogic,/bea.

Keepalivesecs

(do not define this parameter for Apache HTTP Server version 1.3.x)

30

This parameter defines how long the inactive connection between the plug-in and the WebLogic server will be closed after the interval. For this parameter to take effect, the keepaliveenabled parameter should be set to true.

The value of this parameter should be less than or equal to the value of the Duration field in the Server/http tab of the management console, or the value of the Keepalivesecs property in the server Mbean.

Keepaliveenabled

True

Enable connection pooling between the plug-in and the WebLogic server.

Queryfromrequest

(Apache HTTP Server only)

Off

If this parameter is set to ON, then the Apache plug-in uses (REQUEST_REC *) R->the request to pass the query string to the WebLogic server. (For more information, see your Apache documentation.) This behavior is useful in the following situations:

The query string for the request made by the Netscape version 4.x browser contains spaces.

If you use the Raven Apache 1.5.2 on HP

If this parameter is set to OFF, the Apache plug-in uses (REQUEST_REC *) R->args to pass the query string to the WebLogic server.

Maxskips

(Not available in Apache 1.3)

10

The setting of this parameter takes effect only when Dynamicserverlist is set to OFF. If the list that is set by the Weblogiccluster parameter or the WebLogic server in the dynamic cluster list returned by the WebLogic server fails, the failed server is marked as "bad" and the plug-in is connected to the next server in the list.

Maxskip set the number of times the plug-in retries the "bad" server. Whenever the plug-in receives a unique request (that is, a request that does not contain a cookie), it connects to a new server in the list

Dynamicserverlist

(This parameter can only be set in Microsfot IIS)

On

If this parameter is set to OFF, the dynamic cluster list is not used when the request that is represented by the plug-in is load balanced, but instead uses the static list specified by the Weblogiccluster parameter. Typically, this parameter should be set to on. Setting this parameter to on may have the following effects: if one or more of the servers in the static list fails, the plug-in may degrade performance by retrying connecting to the failed server. When you add a server to the cluster, the plugin cannot delegate the request to the new server without redefining the parameter. The WebLogic server automatically adds a new server to the list of dynamic servers, making the new server part of the cluster.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.