WebLogic configuration Cluster

Source: Internet
Author: User
Tags xml file example
Configure WebLogic Server Cluster
 
Author: sucretiger Source: BEA dev2dev hits: 187 updated:

Prerequisites

What are domain and server?

Domain

Domain is the basic management unit of the Weblogic server instance. The so-called domain is the logical unit managed by the Weblogic server instance configured as the administrator server. This unit is a collection of all relevant resources.

Server

Server is a relatively independent unit that is combined to implement certain functions.

Relationship between domain and Server

A domain can contain one or more WebLogic Server instances or even Server clusters. One and only one server in a domain can act as the Management Server. Other servers implement a specific logic function.

Environment

  • Platform: Windows 2000
  • Software: BEA WebLogic Server 8.1 SP2

Configure WebLogic Server Cluster

WebLogic cluster architecture

Single-layer hybrid cluster architecture)

This architecture places all web applications and related service applications in a single WLS instance in the cluster. The advantages of this architecture are:

  • Easy to manage
  • Flexible Load Balancing Mechanism
  • Stronger Security Control

Multi-layer cluster architecture)

This architecture uses two WLS clusters, one for static table content and cluster servlet, and the other for cluster EJB. It is generally used in the following situations:

  • When the load balancing mechanism needs to call methods in the cluster EJB;
  • When more mobility is required between providing content and providing services for objects;
  • When higher system stability is required;

 

Necessary Conditions for configuring cluster applications

  • All servers in the cluster must be in the same network segment and must be accessible by IP broadcast (UDP ).
  • All servers in the cluster must use the same version, including the service pack.
  • The server in the cluster must use a permanent static IP address. Dynamic IP Address allocation cannot be used in the cluster environment. If the server is behind the firewall and the client is outside the firewall, the server must have a public static IP address. Only in this way can the client access the server.
  • To run in cluster mode, you must have a license containing the cluster license. (You can configure the cluster by downloading the trial version from the BEA website)

Preparations before configuration

Before configuring cluster applications, you must have a good design for cluster configuration information. The following is the cluster information we configured this time:

Configure clusters on the same machine

Machine Type

Operating System

Hardware configuration

Role

Dell PC

Win2000 professional

IP: 10.16.92.33port: 7080

Administrator Server

Dell PC

Win2000 professional

IP: 10.16.92.33port: 8080

Proxy Server

Dell PC

Win2000 professional

IP: 10.16.92.33port: 7082

Managed Server

Dell PC

Win2000 professional

IP: 10.16.92.33port: 7084

Managed Server

Dell PC

Win2000 professional

IP: 10.16.92.33port: 7086

Managed Server

Configure clusters on different machines in the same network segment

Machine Type

Operating System

Hardware configuration

Role

Dell PC

Win2000 Server

IP: 10.16.92.7port: 7080

Administrator Server

Dell PC

Win2000 Server

IP: 10.16.92.7port: 8080

Proxy Server

Dell PC

Win2000 Server

IP: 10.16.92.7port: 7082

Managed Server

Dell PC

Win2000 Server

IP: 10.16.92.33port: 7084

Managed Server

Use Domain Configuration Wizard for configuration

Create a new domain

Select "Create a New WebLogic configuration" and click "Next ".

Select the installation type

Select "Basic WebLogic Server domain" and click "Next ".

Select custom installation

Select "Custom" to install and click "Next ".

Enter the Administrator Server Information

Enter the name, listening address, and listening port of the Administrator server. If you need SSL support, you can check the "SSL enabled" option and configure the SSL listening port, click "Next ".

Whether to configure Server, cluster, and machine information

Select "yes" to configure the server, cluster, and machine information, and click "Next ".

Configure managed Server Information

Enter the name, listening address, and listening port of the managed server. If you need SSL support, check the "SSL enabled" check box to configure the SSL listening port. You can configure multiple managed servers. Click "Next ".

Configure cluster information

Enter the cluster name, multicast address, and port of the Cluster. You can enter the cluster address. Click "Next ".

Add the managed server to the Cluster

Select the managed server in the left-side list, add it to the list on the right, and click "Next ".

Configure machine information

Do not configure the machine here. Click "Next ".

Configure JDBC information?

Do not configure the JDBC data source and connection pool here. Click "Next"

Configure JMS Information

Do not configure JMS here, click "Next"

Configure the default system administrator username and password

Enter the user name and password of the system administrator. You can also configure other system management users without configuring them. Click "Next ".

Configure Additional Windows options

You can choose whether to create a shortcut in the Start menu and whether to use the service as a Windows system service. Here we select "no" and click "Next ".

Configure the Service Startup Mode and select Java SDK

Select the "development mode" mode and select the standard Java SDK 1.4. In the development mode, there will be a wealth of debugging information, which is very helpful to us. Click "Next ".

Confirm configuration information and select the installation path

The system lists your configuration information and specifies the default installation path (D:/BEA/user_projects/domains/mydomain). Here, we locate the installation path in D: /BEA/user_projects/clusterdomain, click "CREATE"

System creation domain

The system creates default directories and files based on the configuration information.

Start WebLogic Service

  • Start administrator Server

    Run the startweblogic command to start the Administrator server.

  • Start managed Server

    Run the startmanagedweblogic command to start the managed server. The command format is as follows:

    Startmanagedweblogic. Managed managed Server Name Administrator server address

    Similarly, you can start NodeB, nodec, and proxy server.

Use httpclusterservlet to automatically distribute requests

Httpclusterservlet uses a WebLogic Server proxy to send HTTP requests to other server members in the Weblogic cluster. At the same time, httpclusterservlet also provides load balancing and fault tolerance for HTTP requests.

In fact, the implementation is very simple. follow the steps below to easily implement the automatic request distribution function:

  • Create a proxy server (here we call this proxyserver)
  • Generate the configuration file web. xml
  • Generate the weblogic. xml configuration file
  • Package and generate Web Applications
  • Deploy the application on proxyserver and use the application as the default web application

Create Proxy Server

Start the Administrator server and enter the console Console (http: // 10.16.92.33: 7080/console/). Here we place the proxy server and administrator server on the same host.

After entering the console, right-click the "server" node, select "configure a new server" in the pop-up menu, and configure the relevant information of the proxy server. (You only need to specify the name, listening address, and listening port)

The deployment of httpclusterservlet mainly involves servlet declaration and ing, and setting initialization parameters. You can create a web app and then directly on the web. add or set httpclusterservlet deployment information in XML. Finally, publish it to the server used as the proxy, and set the web app as the default web application of the server.

Web. xml file example

Weblogic. xml file example

Package Web Applications

You can use the jar command to package the proxy application into a war file. Create a temporary directory temp and create the following directory structure:

You can use the following command to package Web applications:

Jar-directory to which the parameter Web Application name is to be packaged

Of course, we can also directly deploy the directory without packaging, which is very helpful in the development phase of the project and easy to modify.

Deploy a proxy application

Start the Administrator server and enter the console Console (http: // 10.16.92.33: 7080/console/). Here we place the proxy server and administrator server on the same host.

After entering the console, right-click the "Web application modules" node, select "deploy a new Web application module" in the pop-up menu, and select the file or directory to be deployed, click "target module", select "proxyserver", and click "continue". Next, click "deploy" to complete the deployment.

After the deployment is complete, check that the Web application status is "fails". The cause is that "proxyserver" has not been started yet. You can run the following command to start "proxyserver ":

Click "Redeploy" and redeploy the application. The status value changes to "success ".

To configure a web application as the default web application, Weblogic8.1 is very different from weblogic6.1. 8.1 does not support configuration from the console, but is in weblogic. the following nodes are used in XML to complete the configuration.

<Context-root>/</context-root>

Test proxy application

Modify the Web. xml file, add the following nodes, and restart the service.

<Init-param>

<Param-Name> debugconfiginfo </param-Name>

<Param-value> On </param-value>

</Init-param>

Open your browser and access the following address. The result is displayed, indicating that your configuration is successful.

Http: // myserver: Port/placeholder. jsp? _ Weblogicbridgeconfig

Myserver is the service address (here is 10.16.92.7)

Port is the proxy service port (8080 here)

Placeholder. jsp (this is a non-existent JSP file, you can also specify the file name at Will)

_ Weblogicbridgeconfig (this can never be written incorrectly !)

Test the cluster distribution function.

Write and test web applications and deploy them

Compile a simple web application that prints "OK" on both the console and browser, and then deploys the web application to all the managed servers in the cluster. (For the code, see the attachment)

Here we will use the AB package in Apache to simulate concurrent access and use the following command to complete the stress test.

Ab-n 100-C 10 http: // 10.16.92.7: 8080/index. jsp

AB is the name of the test program.

Parameter n indicates the total number of requests.

Parameter C indicates the number of concurrent requests.

The URL is the page for stress testing.

Note: When using this command, you must find the program in the system path; otherwise, the program cannot be executed.

After the stress test is completed, we can see from the management server console that nodea, NodeB, and nodec all print "OK", which indicates that in the case of concurrent requests, the cluster can distribute requests to achieve load balancing.

The directory structure of the test application is as follows. The deployment is the same as that of the proxy application. You must deploy the application on the managed server.

Deploy clusters on different machines in the same network segment

The cluster deployment on different machines is somewhat different from the above operations, that is, when deploying the "managed server", you should note that, refer to the illustration below.

When configuring "managed server" on another machine, you must specify the name, listening address, and listening port of "Admin Server.

Notes for cluster configuration

  • Admin Server is only used for cluster management and cannot participate in cluster transactions.
  • Web applications should be deployed to clusters, and file synchronization is completed by weblogic.

Appendix

Weblogic8.1 document http://e-docs.bea.com/wls/docs81/

Dev2dev http://dev2dev.bea.com.cn online

-

Related Article

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.