Architecture Design for installing Apache + Tomcat + memcached shared session on the server

Source: Internet
Author: User
Website cluster Deployment Solution plan

I. planning objectives

The high availability of the interactive message system and background publishing system is achieved, effectively solving the impact of high concurrency on a single application server, and ensuring that the single point of failure of the application server does not affect the normal operation of the system.

Ii. deployment architecture

The Tomcat cluster deployment method is adopted. Apache uses the proxy_module proxy method to load balance user requests and forwards them to an instance in the Tomcat cluster for processing, tomcat clusters use memcached high-performance cache clusters to share fast-resolution sessions. The detailed structure is as follows:

Iii. Complete Solution plan

1. List of software installation required for each server:

Serial number

Role

IP address

Required Software

1

Apache production server

10.10.19.1

Apache HTTP server2.2 * (proxy_module, proxy_http_module \ proxy_balancer_module \

Proxy_ajp_module)

2

Tomcat interactive Message Server No. 1

10.10.19.2

Tomcat 7.0. *, the jar package under tomcat_homt/lib:

Memcached-session-manager-x.y.z.jar,

Memcached-session-manager-tc7-x.y.z.jar,

(Or memcached-session-manager-tc6-x.y.z.jar)

Spymemcached-x.y.z.jar,

Kryo-1.04.jar, kryo-serializers-0.10.jar, asm-3.2.jar, minlog-1.2.jar, msm-kryo-serializer-1.6.3.jar, reflectasm-1.01.jar

(Kryo-serializer: MSM-kryo-serializer, kryo-serializers-0.10 (0.10 is needed, as 0.20 + is for kryo2), kryo, minlog, reflectasm, asm-3.2)

3

Tomcat interactive Message Server No. 1

10.10.19.3

Same as above

4

Production server No. 1

10.10.19.4

Apache HTTP Server 2.2 * (application during site Preview)

Others same as above

5

Production server No. 2

10.10.19.5

Except Apache HTTP Server 2.2 *,

6

Memcached Cache Server No. 1

10.10.19.6

Libevent-2.0.21-stable (required when installing memcached) and memcached1.4.15

7

Memcached Cache Server No. 2

10.10.19.7

Same as above

8

Database Server

10.10.18.3

SQL Server 2008 r2

2. installation steps:

1) Compile and install apache2.2 *. In addition to the modules required by the website, add proxy_module, proxy_http_module \ proxy_balancer_module \

Daily routine
Life is not a "Digest". It is not plain, just a collection of highlights. She is a complete process, a "serialization", no matter whether it is successful or failed, she will not leave blank behind you; life is not a rehearsal, you can start from scratch if you do not go well, she will never give you a second chance.

Proxy_ajp_module. Configure Apache to load balance JSP page requests as follows:

L Publishing Server:

Loadmodule proxy_module modules/mod_proxy.so

 

Loadmodule proxy_http_modulemodules/mod_proxy_http.so

 

Loadmodule proxy_balancer_modulemodules/mod_proxy_balancer.so

 

Loadmoduleproxy_ajp_module modules/mod_proxy_ajp.so

<Proxy balancer: // cluster>

Balancermember AJP: // 10.10.19.2: 8009 route = jvm1

Balancermember AJP: // 10.10.19.3: 8009 route = jvm2

</Proxy>

Proxypass/balancer: // cluster/stickysession = JSESSIONID | JSESSIONID

L production server No. 1:

Loadmodule proxy_module modules/mod_proxy.so

 

Loadmodule proxy_http_module modules/mod_proxy_http.so

 

Loadmodule proxy_balancer_module modules/mod_proxy_balancer.so

 

Loadmodule proxy_ajp_module modules/mod_proxy_ajp.so

<Proxy balancer: // cluster>

Balancermember AJP: // 10.10.19.4: 8009 route = jvm3

Balancermember AJP: // 10.10.19.5: 8009 route = jvm4

</Proxy>

Proxypass/balancer: // cluster/stickysession = JSESSIONID | JSESSIONID

2) Compile and install memcached

Note that to install memcached, you must first install the libevent-2.0.21-stable

Start memcached:

Memcached-D-M 4096-l localhost-P route 11-u Root

Detailed description of memcached startup command parameters is provided.

-D option is to start a daemon,

-M indicates the amount of memory allocated to the memcache application. The unit is mb. Here I am 10 MB,

-U is the user who runs memcache. Here I am root,

-L is the IP address of the listening server. If there are multiple IP addresses, I have specified the IP address 192.168.0.200,

-P is the port for memcache listening. I have set port 12000 here, preferably port 1024 or above,

-The "C" option is the maximum number of concurrent connections. The default value is 1024. I have set 256 here, which is based on the load of your server,

-P is the PID file for saving memcache. Here I save it in/tmp/memcached. PID,

-P application's TCP port. The default value is 11211.

-MB maximum memory size. The default value is 64 MB.

-VV is started in very vrebose mode. debugging information and errors are output to the console.

-D is started as a daemon in the background

3) install the Java environment and atat7 .*.

Put the nine downloaded jar packages in the tomcat_home/lib folder, and modify the tomcat configuration file tomcat_home/CONF/context. XML as follows:

L Tomcat interactive Message Server No. 1:

<Context>

<Managerclassname = "De. javakaffee. Web. MSM. memcachedbackupsessionmanager"

Memcachednodes = "N1: 10.10.19.6: 11211, N2: 10.10.19.7: 11211"

/* The IP addresses of the two previously installed memcached servers. The default memcached port number is 11211 */

Failovernodes = "N1"

Requesturiignorepattern = ". * \. (ICO | PNG | GIF | JPG | CSS | JS) $"

Transcoderfactoryclass = "De. javakaffee. Web. MSM. serializer. kryo. kryotranscoderfactory"

/>

</Context>

L Tomcat interactive Message Server No. 2:

<Context>

<Managerclassname = "De. javakaffee. Web. MSM. memcachedbackupsessionmanager"

Memcachednodes = "N1: 10.10.19.6: 11211, N2: 19.7: 11211"

/* The IP addresses of the two previously installed memcached servers. The default memcached port number is 11211 */

Failovernodes = "N2"

Requesturiignorepattern = ". * \. (ICO | PNG | GIF | JPG | CSS | JS) $"

Transcoderfactoryclass = "De. javakaffee. Web. MSM. serializer. kryo. kryotranscoderfactory"

/>

</Context>

L production server No. 1:

<Context>

<Managerclassname = "De. javakaffee. Web. MSM. memcachedbackupsessionmanager"

Memcachednodes = "N1: 10.10.19.6: 11211, N2: 19.7: 11211"

/* The IP addresses of the two previously installed memcached servers. The default memcached port number is 11211 */

Failovernodes = "N1"

Requesturiignorepattern = ". * \. (ICO | PNG | GIF | JPG | CSS | JS) $"

Transcoderfactoryclass = "De. javakaffee. Web. MSM. serializer. kryo. kryotranscoderfactory"

/>

</Context>

L production server No. 2:

<Context>

<Managerclassname = "De. javakaffee. Web. MSM. memcachedbackupsessionmanager"

Memcachednodes = "N1: 10.10.19.6: 11211, N2: 19.7: 11211"

/* The IP addresses of the two previously installed memcached servers. The default memcached port number is 11211 */

Failovernodes = "N2"

Requesturiignorepattern = ". * \. (ICO | PNG | GIF | JPG | CSS | JS) $"

Transcoderfactoryclass = "De. javakaffee. Web. MSM. serializer. kryo. kryotranscoderfactory"

/>

</Context>

 

References

1. https://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration

2. http://www.bradchen.com/blog/2012/12/tomcat-auto-failover-using-apache-memcached

3. http://blog.csdn.net/ichsonx/article/details/6911358

4. http://www.linuxidc.com/Linux/2012-08/69312.htm

 

Architecture Design for installing Apache + Tomcat + memcached shared session on the server

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.