nginx+tomcat7+redis cluster configuration

WBOY
Release: 2016-08-08 09:22:33
Original
1436 people have browsed it

1. Prepare the required installation packages and jar packages

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: used here The jedis version is 2.1.0, and commons-pool is 1.6.

There are many places on the Internet that use versions of jedis 2.6 or above and commons-pool 2.0. The class not found error will occur. This is due to the commons-pool 2.0 version. The commons/pool/impl folder is missing.

2.tomcat configuration

Add tomcat session management in context.xml

<Valve className="com.radiadesign.catalina.session.RedisSessionHandlerValve" />
    <Manager className="com.radiadesign.catalina.session.RedisSessionManager"
         host="192.168.2.20"//redis的host地址
         port="6379"//端口
         database="0"
         maxInactiveInterval="60" />//redis的key值超时时间
Copy after login

3.nginx configuration

upstream tomcat{
                                                                                                                                                                                                                                  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 out 5;//The time here is configured according to the actual situation of the application

  proxy_send_timeout 5;//Too short Will cause bad gateway errors

      proxy_read_timeout 5; // Too long will cause tomcat to shut down and switch slowly

      proxy_buffer_size 4k;

        proxy_buffers 4 32k;

           64k;

proxy_temp_file_write_size 64k;

proxy_pass http://tomcat ;

                                                                                                                                               rewrite_log; -session-manager/downloads

jedis source code address: https://github.com/xetorthio/jedis



The above introduces the nginx+tomcat7+redis cluster configuration, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!