Apache + resin cluster configuration (Server Load balancer)

Source: Internet
Author: User

Original article: http://hi.baidu.com/mygia/blog/item/c3b53da8e336cfa6ca130cb2.html

Apache is an excellent HTTP server. Unlike resin and tomcat, Apache cannot interpret dynamic pages, but static files such as HTML and JS are much more effective than Web servers. Apache also provides multiple management methods. Apache can integrate resin or Tomcat as an efficient and stable web server.

1 configure Apache (one) + resin (one)
Apache 2.0.55 resin 3.0.19
Configuring Apache + resin is much better for Web servers than using resin alone. The resin help documentation also provides information integrated with Apache.
First, make sure that your resin and Apache can run independently. The installation and testing of resin are omitted here. Apache installation is very simple. You only need to install it by default. You only need to enter your email in the middle. (I installed Apache 2.0.55) after Apache is installed, the default port is 80. After the test http: // localhost/is installed, the successful test page is displayed. Make sure that your resin and Apache can be run independently, modify the Apache configuration file CONF/httpd. conf, and add the following section.

Loadmodule caucho_module & lt; % resin_home % & gt;/Win32/Apache-2.0/mod_caucho.dll

Resinconfigserver 192.169.100.15 6802

<Locationcaucho-status = "">
Sethandler Caucho-status
</Location>

Note: & lt; % resin_home % & gt; indicates the resin installation directory. Replace it with the specific directory.

This section adds a plug-in for Apache. Apache loads the plug-in using loadmodule ***** _ module syntax. * *** _ Module is the plug-in name followed by the plug-in file address. Caucho_module this plug-in is provided by resin, is Apache and resin communication middleware, generally placed in the resin installation directory Win32/apache-x.x/(resin 3.0.19), apache-x.x directory generally has multiple, you only need to select a version that matches your acpache.

Or you can copy the mod_caucho.dll file under the corresponding apache-x.x directory to the Apche plug-in folder (& lt; % apache_home % & gt;/modules /). Then use the relative path. For example
Loadmodule caucho_module modules/mod_caucho.dll
In the next sentence, "192.169.100.15" indicates the IP address of the machine where resin is located, and "6802" indicates the default port. Modify the configuration file CONF/resin. conf of resin. Find these lines:
<Cluster>
<Srunserver-id = "" host = "127.0.0.1" Port = "6802">
</Srun>
If they have been commented out, remove the annotator and make sure the port (for example: Port = "6802 ") it is consistent with the port configured in the resinconfigserver 192.169.100.15 6802 statement in the resin configuration file. If you do not use the default port 6802. 192.169.100.15 should also correspond to 127.0.0.1. They both refer to the IP address of the machine where resin is located. If resin is on the same machine as Apache, <srunserver-id = "" host = "127.0.0.1" Port = "6802"> If 127.0.0.1 is used
In 192.169.100.15 6802, replace 192.169.100.15 with localhost or 127.0.0.1. That is to say, if a specific IP address is used, for example, 192.169.100.15, the specific IP address is used in both regions.
After the configuration is successful, open http: // localhost/Caucho-status to view the detailed configuration results of the server.
The workflow of Apache (one) + resin (one) is as follows:

Access Apache to the project configured in resin. Apache is responsible for static files in the project, and resin is used as the JSP/servlet interpretation server. Http: // localhost/tianyacity/JS/pagefunc. JS (or HTML file) is explained by Apache by default. It will configure the project and default access path in Apache & lt; % apache_home % & gt; search for http: // localhost/tianyacity/JS/pagefunc in/htdocs. JS path, which is not found in the project configured in resin. Therefore, add the directory/tianyacity/JS/pagefunc. js to & lt; % apache_home % & gt;/htdocs /.
Or configure a project in the Apache configuration file httpd. conf:

Alias/tianyacity/"D:/workspace2006/tianyacity/web /"

<Directoryd: = "" workspace2006 = "" tianyacity = "" Web = "">
Options Indexes
AllowOverride none
Order allow, deny
Allow from all
</Directory>
Alias/tianyacity/here/tianyacity/is the access path name, which is best consistent with the access to tiayacity of the project configured in resin.

2. Configure the Apache (one) + resin (batch) Cluster
Apache 2.0.55 resin 3.0.19

To configure an Apache + resin cluster, you only need to modify the configuration files of Apache and resin on the basis of Apache (one) + resin (one.

Modify the resin configuration file as follows:

<Httpserver-id = "pan" host = "*" Port = "8010">
<! --
-SSL Port Configuration:
-
-& Lt; http port = "8443" & gt;
-<OpenSSL>
-<Certificate-File> keys/Gryffindor. CRT </certificate-File>
-<Certificate-key-File> keys/Gryffindor. Key </certificate-key-File>
-<Password> test123 </password>
-</OpenSSL>
-</HTTP>
-->

<! --
-The local cluster, used for load balancing and distributed
-Backup.
-->
<Cluster>
<Srunserver-id = "pan" host = "192.169.100.15" Port = "6802" Index = "" 1 "/">
<Srunserver-id = "he" host = "192.169.100.16" Port = "6802" Index = "" 2 "/">
</Srun>
...........

<Srunserver-id = "pan" host = "192.169.100.15" Port = "6802" Index = "" 1 "/">
<Srunserver-id = "he" host = "192.169.100.16" Port = "6802" Index = "" 1 "/"> This means that the two servers with the IP address of 15 and 16 are used A cluster. The server-ID in the cluster cannot be the same. The server-ID of the local machine must be the server-ID in the configuration file . Because the default server-id of resin is null (server-id = ""), you must add the-server parameter after modification to correctly start resin. In the command window (CMD), go to the resin installation directory and enter:
Httpd.exe-server "Pan"
The resin will be correctly started.

Modify the Apache configuration file as follows:

Loadmodule caucho_module modules/mod_caucho.dll

Resinconfigserver 192.169.100.15 6802
Resinconfigserver 192.169.100.16 6802

<Locationcaucho-status = "">
Sethandler Caucho-status
</Location>

You only need to add this line based on the original configuration.
Resinconfigserver 192.169.100.16 6802
Indicates that the resin on machine 16 is also registered to Apache. It involves two servers. It is best to copy the communication plug-ins of Apache and resin to the plug-in folder of Apche (& lt; % apache_home % & gt;/modules /).
In fact, Apche only needs to know one primary Resin server. Therefore, the Apache configuration file does not need to be modified based on the original configuration. The primary Resin server is responsible for finding other resin servers. However, if the primary Resin server breaks down, other problems will occur. Therefore, we recommend that you register all the resin servers on Apache.
After the configuration is complete, open http: // localhost/Caucho-status to view the detailed configuration results of the server. All the resin servers registered with Apache can be seen, and those registered with Apache will not be displayed.

 

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.