Nginx to solve the session sharing problem Jvm-route way (actually did not really solve the sharing problem) Defroute Icroute airlinerout

Source: Internet
Author: User


Nginx solves the session sharing problem (Jvm-route) way (actually does not realize the share, but distributes fixed, view comments 2)

1. Download and install Jvm_route:http://nginx-upstream-jvm-route.googlecode.com/svn/trunk/nginx-upstream-jvm-route-read-only

cd/usr/src/nginx-1.2.1

Patch-p0 </usr/local/nginx/nginx_upstream-jvm-route-read-only/jvm_route.patch

./configure--add-module=/usr/local/nginx/nginx-upstream-jvm-route-read-only

Make & make Install

2.nginx settings:

Repair
Upstream www.linuxidc.com {
Server 192.168.1.116:8080 srun_id=a;
Here srun_id=a corresponds to the server id= "a" in the Server1 resin configuration
Server 192.168.1.117:8081 srun_id=b;
Here srun_id=b corresponds to the server id= "B" in the Server2 resin configuration
Jvm_route $cookie _jsessionid|sessionid;
}

3.tomcat settings:

192.168.0.116 settings:

Modify Tomcat/conf/server.xml

192.168.0.117 settings:

Modify Tomcat/conf/server.xml

3. Configuration Complete

This module uses the session cookie to get the session sticky. If there is no session in the cookie and URL, then this is just a simple round-robin load balancer.

Jvm_route principle (from author Weibin Yao):

1. At the beginning of the request, without the session information, Jvm_route based on round robin method, sent to a tomcat above.

2. Tomcat adds the session information and returns it to the customer.

3. When the user requests this, Jvm_route sees the name of the backend server in the session, and it transfers the request to the corresponding server.

Temporarily the Jvm_route module does not yet support the default fair mode. Jvm_route's working mode and fair are conflicting. For a particular user, when the tomcat that has been serving him is down, by default it retries the number of max_fails, and if it fails, re-enables round robin, which in this case causes the user's session to be lost.

In general, Jvm_route is a way to implement session stickiness by Session_cookie, attaching a specific session to a specific tomcat, which resolves the session out-of-sync problem, but does not solve the problem of conversation transfer after an outage.

The above describes the nginx to solve the session sharing problem Jvm-route way (in fact, not really solve the sharing problem), including the session,route aspects of the content, I hope that the PHP tutorial interested friends have helped.

  • 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.