This article is my 2nd article on building a Web server that integrates apache and tomcat in linux. Compared with the integration of apahe and tomcat in Linux (the first version), the GD library, Zend, and eaccelerator acceleration are added, and some well-known open-source PHP and JSP programs are tested, sablog, shopex, phpcms, discuz, ucenter_home, and lybbs can all run normally.Apache and Tomcat are two projects under the Apache Foundation.One is the http web server, and the other is the ser
processing port of the HTTPS request. This port is called HTTPS port.
port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>Receives the processing port of the AJP protocol. This port is called the AJP port.
"8443 "/>The processing port of the HTTPS request.There are actually 4 ports.Let me start with a system of 3 Tomcat as an examp
.
After the Apache2.2 version, there are two connectors available to choose from, that is, Http-proxy and PROXY-AJP module, Apache Proxy (proxy) module can achieve two-way agent, the function is very powerful, from the realization of the principle of the connector, with the Http-proxy module to achieve is also very natural Things, just open Tomcat's HTTP function, and then use the Apache proxy agent function to the dynamic request to Tomcat processin
DescriptionPeter Parker wants to play a game with Dr Octopus.The game is about cycles. Cycle is a sequence of vertices, such that first one are connected with the second, second are connected with third and So on and the last one are connected with the first one again. Cycle may consist of a isolated vertex. Initially there Are K cycles, I -th of them consisting of Exactly v i vertices. Players Play
= "Org.apache.catalina.core.ThreadLocalLeakPreventionListener"/> Global JNDI Resources Documentation at/docs/jndi-resources-howto.html - globalnamingresources> Editable User database that can also is used by Userdatabaserealm to authenticate users - ResourceAuth= "Container"Description= "User database that can be updated and saved"Factory= "Org.apache.catalina.users.MemoryUserDatabaseFactory"name= "Userdatabase"Pathname= "Conf/tomcat-users.xml"type= "Org.apache.catalina.UserDatabase"/>
Today, technical director of the implementation of Apache and Tomacat integration, on the Internet to find a lot of information, the results found that this is the most convenient!
Here is the implementation of 2 Tomcat load balancing, if only one can delete a
apache2.2 the above version, no need to use Jk_mod to integrate Tomcat, direct use of AJP, very convenient.
Modify Apache configuration file httpd.conf
Enable MOD_PROXY_AJP
Copy Cod
the author another blog/http/ zyycaesar.javaeye.com/admin/blogs/293839), used to configure all nodes working in the Tomcat cluster, where the "cluster" must be consistent with the cluster name above.
Apache communicates with Tomcat via the AJP protocol, and the IP address and port uniquely identify the Tomcat node and the configured AJP accept port. Loadfactor is a load factor, Apache forwards requests to
Today, the technical director called Apache and Tomacat integration. He found a lot of information on the Internet and found that it was the most convenient!
Below are two tomcat implementation load balancing, if there is only one, you can delete one
Apache2.2 and later versions, without using jk_mod to integrate tomcat, use ajp directly, very convenient.
Modify the apache configuration file httpd. conf
Enable mod_proxy_ajpCopy codeThe Code is a
updated and saved"Factory= "Org.apache.catalina.users.MemoryUserDatabaseFactory"Pathname= "Conf/tomcat-users.xml" /> globalnamingresources> a "service" is a collection of one or more "connectors", "that share A", "Container" note:a "service" is n OT itself a "Container", so if not define subcomponents such as "valves" at the This level. Documentation At/docs/config/service.html - Servicename= "Catalina"> The connectors can use a GKFX executor, you can define one or more named thread
;name define the name of the virtual hostThe following child elements can be included in the It is defined by the Context interface. Is the most frequently used element. Each A corresponding context represents the Web application itself. The servlet container creates one for the first web AppThe ServletContext object. 2GT;PATH Specifies the URL entry to access the Web app, note/myweb, not myweb3>reloadable If this property is set to True, the Tomcat server will monitor the change of class files
. enablelookups: Call request, Getremotehost () to perform a DNS query to return the host name of the remote host, or, if set to false, to return the IP address directly. Maxpostsize: Specifies the maximum number of post requests, without specifying a default of 2097152. Protocol: value must be HTTP1.1, if AJP processor is used, the value must be ajp/1.3 Proxyname: If this connector is being
Apache HTTP Server and Tomcat three ways to connect Jk,http_proxy,ajp_proxy. Let's introduce each of the following (the examples presented here are based on the previously established Tomcat cluster, all native, with ports 18080 and 28080, respectively):JK:JK is the most common way, JK itself has two versions are 1 and 2, the current 1 the latest version is 1.2.37, and version 2 has been obsolete, and no longer have a new version of the launch, so it is recommended that you adopt version 1.JK is
requests that are sent externally. A tomcat server typically opens only one tomcat engine. In server, multiple engines can be opened, and the server is associated with the engine called the connector, and the connector is divided into various, such as HTTPS,HTTP,PROXY,AJP and so on.Service: Primarily as a connection between the server and the Tomcat engine, one or more connectors are associated to a Tomcat engine. There can be only one Tomcat engine
Apache and Tomcat load cluster integration methods have 3 jk, jk_proxy, http_proxyApache:httpd-2.2.17-win32-x86-no_ssl.msiTomcat:apache-tomcat-6.0.20.zipInstall Apache HTTP Server omitted, access address is http://127.0.0.1:8081Install tomcat, unzip the apache-tomcat-6.0.20.zip, and test when I put two Tomcat separately on a different virtual machine, one of which is the same virtual machine as Apache.Two Tomcat named Worker2 and worker3, respectivelyFirst say the configuration of tomcat.worker2
follows:To configure the Equalizer first:Balancermember ajp://127.0.0.1:8009/loadfactor=1Balancermember http://192.168.10.6:8083/loadfactor=1Where http://192.168.10.6:8083 is actually another port-initiated Apache, for testing, it simply forwards all requests directly to Tomcat.For the last VirtualHost, make the following modifications:ServerName www.test.comDocumentroot/wwwDirectoryIndex index.html index.jspOptions Indexes FollowSymLinksAllowOverrid
measurement and calculation, and then set the number of threads.
To set the number of threads:
Maximum number of threads to be measured
For example, by measuring the optimal number of threads to obtain a system is 10, then the number of threads calculated by memory is 20, then the number of threads set JBoss is 15 is feasible, if you set 10 directly, because the system itself will be affected by a number of dependent system changes and some changes, For example, the system relies on some IO r
JDK and so on omitted (on-line search material)
2. Install zlib-1.2.3.tar.gz (download address: http://ishare.iask.sina.com.cn/f/14331439.html?from=like), Apache server installation without this library will be an error.
Copy zlib-1.2.3.tar.gz to/usr/directory
# TAR-ZXVF Zlib-1.2.3.tar.gz
# CD zlib-1.2.3
#./configure
# make
# make Install
3. Install Apache server (download address: http://httpd.apache.org/download.cgi)
Copy the httpd-2.2.19.tar.gz to the/usr/directory
# TAR-ZXVF Httpd-2.2.19.ta
configuration, and it feels like the balance of the load is more fully justified. My configuration is simple, as follows:
To configure the Equalizer first:
Copy Code code as follows:
Balancermember ajp://127.0.0.1:8009/loadfactor=1
Balancermember http://192.168.10.6:8083/loadfactor=1
Where http://192.168.10.6:8083 is actually another port-initiated Apache, for testing, it simply forwards all requests directly to Tomcat.
For
through the pressure measurement and calculation, and then set the number of threads.
To set the number of threads:
Maximum number of threads to be measured
For example, by measuring the optimal number of threads to obtain a system is 10, then the number of threads calculated by memory is 20, then the number of threads set JBoss is 15 is feasible, if you set 10 directly, because the system itself will be affected by a number of dependent system changes and some changes, For example, the syste
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.