Nginx+tomcat7+redis cluster configuration

Source: Internet
Author: User
Tags redis cluster
1. Prepare the required installation package and JAR package

Nginx-1.6.3.tar.gz

Apache-tomcat-7.0.62.tar.gz

Redis-3.0.2.tar.gz

Jdk-7u79-linux-x64.tar.gz

Jedis-2.1.0.jar

Commons-pool-1.6.jar

Tomcat-redis-session-manager-tomcat-7.jar

Description: The Jedis version used here is 2.1.0,commons-pool to 1.6,

There are many places on the net jedis2.6 above, commons-pool2.0 version, will appear class not found error, is due to commons-pool2.0 version of the missing Commons/pool/impl folder.

2.tomcat Configuration

Join Tomcat's session management in Context.xml

 
      
 
  Redis key value time-out

3.nginx Configuration

Upstream tomcat{
Server 127.0.0.1:18099;
Server 127.0.0.1:18098;
}
Server
{
Listen 80;
server_name www.myserver.com;
Index maomingindex.do index.do index.jsp index.html;
Location/{
Proxy_redirect off;

Proxy_set_header Host $host;

Proxy_set_header X-real-ip $remote _addr;

Proxy_set_header x-forwarded-for $remote _addr;

Client_max_body_size 10m;

Client_body_buffer_size 128k;

Proxy_connect_timeout 5;//here time according to the actual situation of application configuration

Proxy_send_timeout 5;//Too short will lead to bad Gateway error

Proxy_read_timeout 5;//too long can cause tomcat downtime to switch slowly

Proxy_buffer_size 4k;

Proxy_buffers 4 32k;

Proxy_busy_buffers_size 64k;

Proxy_temp_file_write_size 64k;
Proxy_pass Http://tomcat;
}
Rewrite_log off;
}

4. The corresponding jar package and relevant download address are attached here.

Tomcat-redis-session Source Address: https://github.com/jcoleman/tomcat-redis-session-manager/downloads

Jedis Source Address: Https://github.com/xetorthio/jedis


The above describes the Nginx+tomcat7+redis cluster configuration, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

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