Configure the Weblogic server cluster in Linux

Source: Internet
Author: User
Tags xml file example node server
This article describes how to configure a cluster on WebLogic Server 8.1 and access the cluster through the proxy server. You can refer to this document to configure the Weblogic cluster in Linux, start the cluster, start the node, and publish the application, synchronize applications, copy and share sessions, test the application's automatic distribution function, and take over the function automatically.
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: Linux as 4
? Software: BEA WebLogic Server 8.1 SP5
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 (cluster)
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, configure the necessary conditions for 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 the cluster license (the trial version downloaded from the BEA website can be used for cluster 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 the cluster on different machines in the same network segment. The following is a cluster of two machines,
Remarks on the hardware configuration role of a machine-type Operating System
Common PC Linux as 4 IP: 10.3.15.85 port: 7001 administrator server pC1
Common PC Linux as 4 IP: 10.3.15.85 port: 80 Proxy Server pC1
Common PC Linux as 4 IP: 10.3.15.85 port: 7080 managed server pC1
Common PC Linux as 4 IP: 10.3.15.84 port: 7080 managed server PC2 use Domain Configuration Wizard for configuration
Create a new domain
Step 1:
Go to the/usr/local/wblogic/webloic81/common/bin directory of the Weblogic installation project and run the command. /config. sh start the domain configuration program <----------------------------------------------- BEA WebLogic Configuration Wizard ---------------------------------------------> Create or extend a configuration:
--------------------------------- Choose between creating and extending a configuration. Based on your selection, the Configuration Wizard guides you through
Steps to generate a new or extend an existing configuration.-> 1 | create a new WebLogic Configuration
| Start here to create a WebLogic configuration in your projects directory. 2 | extend an existing WebLogic Configuration
| Start here to extend an existing WebLogic configuration. Use this option to add applications and services, including
| Database access (JDBC) and messaging (JMS). This option also enables you to extend functionality by enabling WebLogic
| Workshop. Enter index number to select or [exit] [next]> [root @ localhost bin] #1 Step 2: select a template
The system prompts you to select a domain creation template. In the document, the configuration process of the Configuration Wizard can be saved as a template so that you can use the template for the next configuration. You have never tried to go back and try again.
<----------------------------------------------- BEA WebLogic Configuration Wizard ---------------------------------------------> select a domain template:
------------------------- Please select a template from the list or select another directory of templates. * [/usr/local/WebLogic/weblogic81/common/templates/domains] 1 | WebLogic Server Examples domain 8.1.5.0
| BEA Systems, Inc.
| Create the WebLogic Server Examples domain in a directory outside of the installed kit. The examples domain contains
| Collection of examples to show best practices for coding individual J2EE APIs. 2 | basic WebLogic Workshop domain 8.1.5.0
| BEA Systems, Inc.
| Create a basic WebLogic Workshop domain, without installing sample applications. domains created from this template will
| Support the WebLogic Server and WebLogic Workshop runtime functionality, including support for J2EE applications, web
| Applications, Web Services and custom controls. Use domains created from this template for development of WebLogic Workshop
| Applications.-> 3 | basic WebLogic Server domain 8.1.5.0
| BEA Systems, Inc.
| Create a basic WebLogic Server domain without installing sample applications. 4 | avitek medical records sample domain 8.1.5.0
| BEA Systems, Inc.
| Create the avitek medical records domain in a directory outside of the installed kit. The avitek medical records is
| WebLogic Server Sample application suite that concisely demonstrates all aspects of the J2EE platform. 5 | select another directory location enter index number to select or [exit] [previous] [next]> 3
Here we select 3. Use the basic template Step 3: whether to configure in Quick Mode Step 3: whether to configure in quick mode. Here we select 2. <----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
Choose configuration option:
----------------------------
* Do you want to run the wizard in express mode?
-> 1 | Yes
2 | No
Enter index number to select or [exit] [previous] [next]> 2 Step 4: The system prompts us to configure the Management Server and change the name of the management server, change to adminserver. <------- BEA WebLogic Configuration Wizard -------->
Configure the Administration Server:
------------------------------------
Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server.
Administration Server hosts the administration console which is used to perform administrative tasks.
| Name | value |
_ | __________________ | _____________________ |
1 | * Name: | myserver |
2 | listen address: | all local addresses |
3 | listen port: | 7001 |
4 | SSL listen port: | N/A |
5 | SSL Enabled: | false |
Select option:
1-modify "name"
2-modify "listen address"
3-modify "Listen port"
4-modify "SSL enabled"
Enter option number to select or [exit] [previous] [next]> 1
After entering 1, follow the system prompts to enter the new management server name adminserver Step 5: configure the managed server according to the following system prompts, configure the managed server <------------------------------------------- BEA WebLogic Configuration Wizard success>
Choose configuration option:
----------------------------
* Do you Want to configure managed servers, clusters and machines?
-> 1 | Yes
2 | No
Enter index number to select or [exit] [previous] [next]> 1 configure the following information as prompted:
<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
Configure managed servers:
--------------------------
Add or delete configuration information for managed servers. A typical production environment has one or more managed servers. each managed Server is an instance of Weblogic server used to host enterprise applications. | name * | listen address | listen port | SSL Enabled |
_ | __________ | ________________ | _____________ | _________________ | _____________ |
1 | mserver1 | 10.3.15.85 | 7080 | N/A | false |
-> 2 | mserver2 | 10.3.15.84 | 7080 | N/A | false | next, perform Step 6: configure the cluster <---- BEA WebLogic Configuration Wizard ------>
Configure clusters:
-------------------
A cluster contains multiple WebLogic Server instances (servers) that run simultaneously and work together to provide
Increased scalability and reliability. A cluster appears to be a single Weblogic server instance to clients.
| Name * | multicast address | multicast port | cluster address |
_ | _______ | _______________ | ________________ | _________________ |
Enter name for a new cluster or [exit] [previous] [next]> testcluster
Enter the cluster name testcluster. The default value is testcluster. The configuration is as follows:
| Name * | multicast address | multicast port | cluster address |
_ | _____________ | ___________________ | ________________ | _________________ |
-> 1 | testcluster | 237.0.0.1 | 7777 | Step 7: organize the server to the cluster and put mserver1 and mserver2 into the cluster testcluster according to the system prompts. After configuration, the configuration is as follows:
Cluster
| _____ Testcluster [1]
| _____ Mserver1
| _____ Mserver2 Step 8: Configure machines, JDBC, JMS, and security. In the next few steps, the system prompts you to configure machines, JDBC, JMS, and security. You do not need to configure them here. Just press Enter. Step 9: Enter the user name and password of the Management Server. The system prompts the following screen to configure the user name and password of the Management Server:
| Name | value |
_ | _________________________ | _________________________________ |
1 | * User name: | WebLogic |
2 | * User Password: | ******** |
3 | * confirm User Password: | ********* |
4 | Description: | the default administration user | Step 10: select the startup mode, JDK and storage directory startup mode, and set the JDK and domain file storage directory relatively simple, you can set it based on your interests.
Select production and development as the startup mode. JDK uses jrockit to store the default directory. Step 11: configure the domain name "Edit Domain Information:
------------------------
| Name | value |
_ | ________ | __________ |
1 | * Name: | mydomain |
Enter value for "name" or [exit] [previous] [next]> testclusterdomain
Set the domain name to testclusterdomain. Step 12: After the above steps are completed, the system will automatically create the domain and generate some files. The complete interface is as follows:
<----- BEA WebLogic Configuration Wizard --------->
Creating domain...
0% 25% 50% 75% 100%
[------------ | ------------]
[*************************************** * ***********]
* *** Domain created successfully! * *** Step 13: configure the node server managed server on another machine. The configuration process is the same as above. Make sure that the parameters are the same as those set above, including the domain name, IP address, port of mserver2, and name must be consistent with the configuration of the first machine. Otherwise, the node server cannot start Step 14: Start the Management Server to enter the/usr/local/WebLogic/weblogic81/user_projects/domains/testclusterdomain/directory.
Type./startweblogic. Sh
Run the following command to start the managed Server:
Start mserver1 on 10.3.15.85
./Startmanagedserver mserver1 10.3.15.85: 7001
Start mserver2 on 10.3.15.84
. /Startmanagedserver mserver2 10.3.15.85: 7001 Step 15: add the proxy server proxyserver to start the Administrator server, and then enter the console Console (http: // 10.3.15.85: 7001/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 proxy server name is the proxyserver listening address: 10.3.15.85 listening port 80 through httpclusterservlet for automatic request Distribution
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.3.15.85: 7001/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 here.) deployment of httpclusterservlet is mainly the servlet declaration and ing, and initialization parameters can be set to create a web app, then directly go to 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 complete the packaging of Web applications:
Jar-the directory of the parameter Web Application name to be packaged. Of course, you can directly deploy the directory without packaging. This is very helpful in the development phase of the project and is easy to modify.
Deploy a proxy application
Start the Administrator server and enter the console Console (http: // 10.3.15.85: 7001/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 ":
./Startmanagedserver proxyserver and click "Redeploy" to redeploy the application. The status value will change 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 the 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: // 10.3.15.85: 8080/placeholder. jsp? _ Weblogicbridgeconfig
Myserver is the service address (here is 10.3.15.85)
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.3.15.85: 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 both mserver1 and mserver2 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. You can close any node server and send the request again. You will find that although one node is closed, the response is very fast. You can repeatedly shut down any node server, and the same effect will be found. This means that after a node fails, other nodes automatically take over service requests. When "managed server" is configured on another machine on different machines deployed in the same network segment, you must specify the "Admin Server" name, listening address, and listening port. In addition, the configuration information on "managed server" must be consistent with the configuration information specified by the cluster in "Admin Server.
The command for starting "managed server" is the same as the preceding one, as shown below:
./Startmanagedserver mserver2 10.3.15.85: 7001 precautions 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.