WebLogic Deploying clusters and proxy servers

Source: Internet
Author: User
Tags tomcat server domian

At the company's request, recently in the learning WebLogic cluster this piece of knowledge, I have learned these days, and the process encountered problems and how to solve, share to everyone. First of all, WebLogic is a product of Orcale company, as for its role, I think I don't have to say. But I think it is necessary to say a few words about the professional nouns in weblogic.

1.Server

Friends who used Tomcat should be aware that when we have multiple projects deployed under the same Tomcat server, we only need to launch this tomcat to access these applications depending on the directory, at which point the port number we use does not need to be changed. In the WebLogic server, one server equals one tomcat. First we need to specify an IP and port for the server when we create it (this IP can be the IP of a remote machine). Once the server is created, we can deploy the project in it. If we have multiple projects, and I want each project to correspond to a different port, then we can do it by creating multiple servers. Sometimes we call the server A ' node ', so don't be dazed when you hear someone say the node, that's it.

2.Cluster

This is the focus of our paper, cluster. According to my own understanding, the cluster is to have the same application of some servers, put together, unified management. A very simple example is that I have a project now, I put it in three different servers (let alone why I put three different servers). So the question comes, what should I do if my project is to be changed? To redeploy separately from the respective server? No kidding, what if three is 10? What if it's not on the same machine? (as mentioned earlier, can be a remote machine)?

Let's take a look at the cluster and put it together .... Unified management ....

Now understand, this is the convenience that the cluster brings to us, joins these servers to the same cluster, if the project has the change, we only need to deploy through the cluster when the project is deployed, then WebLogic will automatically help us to assign the application to each child node.

3.domain

Domian we sometimes call it a ' domain ', which is the equivalent of a large container that can hold many servers, with a default server that starts as the domain starts. One thing we have to understand is that when you want to start a server under a domain, you must start the domain first. The relationship between cluster and domain is similar, in short, there is domain to talk about the other. If you do not understand, no matter, read the following picture, I think you will probably understand.

Here I think it should be clear what is the cluster, and the role of the cluster. Next, let me tell you about the general need to use the cluster.

I wonder if you are still wondering, before, why do I say that I want to deploy the same project to multiple servers separately? In fact, the purpose of this is to reduce the pressure on the server, when a Web project concurrent access to excessive number of times, may cause the server pressure is too large and crash, if you can spread the user evenly across multiple servers, obviously can solve this question. If you want to spread the user's access to the various servers, but also do not allow the client to detect, in addition to using cluster to synchronize the application, here we also need to use another technology, that is, proxy, proxy server only one, if users want to access the application, only need to access the proxy server can be, However, the task of assigning users to applications on individual servers is done by the agent.

With the above foundation, I will formally teach you to deploy clusters and agents.

Take the picture above to give an example. Suppose I have a shop application now, I need to deploy it separately on a different machine, one IP is 100 and the other IP is 133. Here, I put the proxy server and the cluster separately on the other machine IP is 125. We call this 125:7,001 node the management node, and 100:7,100 and 133:7,200 are the managed service nodes.

First create a 125:7,001 Domian (hint that if you don't have multiple machines to create multiple domain tests on the same machine)

After configuring the Management Management Server, we will create a domain for the corresponding two child nodes.

The previous steps are the same.

Follow the next step directly, next.

So the first word node is well-equipped, the second child node is also so matching, here I will not repeat to say. At this point to start the server, login to the console, is the following look, the figure I was built 3 sub-nodes.

Again, configure the data source and deploy the app from the cluster. Here I'm just talking about the difference between configuring a data source and deploying an app in a traditional way. If you don't understand the traditional way of deploying, you can read another article I wrote about data source configuration and application deployment:

This is also true when configuring the application, and be aware of selecting clusters. After the configuration is complete, the cluster is basically over. Oh, yes, it has to be said. How to start a child service.

First we need to start the command line tool, run-cmd

Then switch the directory to the Admindaomain directory

Execute as above command: Startmanagedweblogic.cmd + Managed Service Name (child) + Manager IP: Port

Wait a few moments until the end of the command line appears running indicates that the child service started successfully

Next, let's take a look at setting up proxies.

Let's start by creating a proxy application, which is named Defalutproxy.

We just need to create two XML files under Web-inf. Web. XML and Weblogic.xml

Xml

 1 <?xml version= "1.0" encoding= "UTF-8"?> 2 <web-app> 3 <init-param> 4 <param-name>debu Gconfiginfo</param-name> 5 <param-value>ON</param-value> 6 </init-param> 7 <servle T> 8 <servlet-name>HttpClusterServlet</servlet-name> 9 <servlet-class>weblogic.servle T.proxy.httpclusterservlet</servlet-class> <init-param> <param-name>WebLogicCluster< /param-name> <param-value>13 192.168.0.100:7100|192.168.0.133:7200 <!--Depending on your personal situation, change this to your own set of child nodes IP and Port-->14 </param-value> </init-param> <init-param> <param-name>debugco nfiginfo</param-name> <param-value>ON</param-value> </init-param> <init-par Am> <param-name>verbose</param-name> <param-value>true</param-value> 2  3 </init-param></servlet>25 <servlet-mapping> <servlet-name>HttpClusterServlet</servlet-name> 2 8 <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <ser Vlet-name>httpclusterservlet</servlet-name> <url-pattern>*.jsp</url-pattern> </     Servlet-mapping> <servlet-mapping> <servlet-name>HttpClusterServlet</servlet-name> 36 <url-pattern>*.htm</url-pattern> Panax Notoginseng </servlet-mapping> <s Ervlet-name>httpclusterservlet</servlet-name> <url-pattern>*.html</url-pattern>41 </ Servlet-mapping> </web-app>

Weblogic.xml

1 <! 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 "> 2 <weblogic-web-app> 3     

Once the proxy app is created, we return to the WebLogic 125:7,100 console and deploy the app to AdminServer.

The next step is all you need to do, and it's simple. The deployment of an agent application is no different from a normal application deployment.

Now that we have all the clusters and agents deployed, we should test the effect.

How to test it? Very simple. It's just like accessing a web app as usual. If the projects that are deployed in separate servers are normally accessible, then the cluster is completely OK. As for the agent, you assume that your management node also deploys the project (in fact no no, you know), and then we just like to visit the other two sub-server projects under the same access to try it, if you can access, it means that the agent also works ...

There is a good test method, write a JSP page, the page content is to print the name of the current server, so when we in the front desk through the agent access to the project, we can clearly know each access to which server inside the JSP page.

index.jsp

<%@ page language= "java" import= "java.util.*" pageencoding= "Utf-8"%><% @page import= "Java.io.PrintWriter"% ><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >

Well, one more thing to note is that when deploying and accessing, the child nodes must be turned on, understand?

WebLogic Deploying clusters and proxy servers

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.