Windows Nginx Tomcat Redis cluster

Source: Internet
Author: User
Tags download redis redis redis cluster redis server

For the previous Nginx+tomcat load-balancing mechanism, because there will be session loss, special research on the next Redis session sharing; (if you want to build this environment can start from the previous, involving the nginx of the environment to build http:// blog.csdn.net/qq584852076/article/details/46469141)

Download JDK7, TOMCAT7 for follow-up test;

First, download the source of tomcat-redis-session Packaging: Https://github.com/jcoleman/tomcat-redis-session-manager

Here's a special record for tomcat-redis-session packaging:

Because our environment is based on the 7 series to run, we must maintain consistency;

Second, download Redis install and run Http://redis.io/download

Download and enter the redis-windows-master\src\msopentech\redis-64.2.8.17 directory

Execute Redis-server.exe redis.windows.conf in cmd as shown

Third, pack and generate Tomcat-redis-session.jar package, download Jedis-2.7.2.jar Commons-pool2-2.4.1.jar from the Internet, put the 3 packets into the Tomcat\lib directory;

Iv. Configure the Context.xml files under tomcat\conf[HTML]  View plain  copy <?xml version= ' 1.0 '  encoding= ' utf-8 '?>   ' <Context>        <WatchedResource>WEB-INF/web.xml</WatchedResource>              <!-- tomcat-redis-session shared configuration  -->        <valve classname= " Com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve " />            <manager classname= " Com.orangefunction.tomcat.redissessions.RedisSessionManager "             host= "localhost"              port = "6379"              database= "0"              maxinactiveinterval= " />   <!-"---------------------------- -->      </Context>  

Five, multiple tomcat configuration is consistent, so the configuration is copy to the corresponding other tomcat; If you test on one machine, remember to modify the ports of each tomcat; The personal deployment environment is as follows:

Testing the entire environment: (need to place a simple Web project in Tomcat in advance)

Start Redis

Start Nginx

Start 3 Tomcat
Access: http://localhost/non-stop F5 Refresh the page to find the SessionID of the page is unchanged; turn off a tomcat and continue to f5,sessionid unchanged, indicating the success of the environment; Place the configuration files that need to be used in the personal repository and the associated jar packs. Redis server and other resources;

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.