一、环境相关操作系统:CentOS7 软件版本:nginx/1.9.15 Apache Tomcat/7.0.69 redis 3.20 网络环境:Nginx 192.168.5.250 Tomat1:192.168.5.251 Tomcat2:192.168.5.252 Redis:192.168.5.253 相关软件网盘地址: 二、相关软件配置1、Nignx编译与添加自启脚本: Nginx 192.168.5.250 [root@nginx ~]# vim /etc/nginx/nginx.conf http上下文 upstream tomcat { server 192.168.5.251:8080; server 192.168.5.252:8080; } server上下文 location / { proxy_pass tomcat; } 2、Reids编译与添加自启脚本: 3、Tomcat编译与添加自启脚本:CentOS7 编译Tomcat并添加自启动脚本(注意:本文Tomcat要求版本为tomcat-7.x)
四、编译tomcat-redis-session-manager1.官方下载地址 https://github.com/jcoleman/tomcat-redis-session-manager 2.配置编译环境Gradle: [root@localhost ~]# unzip tomcat-redis-session-manager-master.zip [root@localhost ~]# cd tomcat-redis-session-manager-master/ [root@localhost tomcat-redis-session-manager-master]# vim build.gradle 注释以下内容: //signing { // sign configurations.archives //} //repository(url: " https://oss.sonatype.org/service/local/staging/deploy/maven2/ ") { // authentication(userName: sonatypeUsername, password: sonatypePassword) //} 增加依赖包的输出脚本 task copyJars(type: Copy) { from configurations.runtime into 'dist' } 3.执行gradle命令构建源码,编译输出tomcat-redis-session-manager-master 及依赖jar包(其他Tomcat只需要复制jar文件到tomcat目录) [root@localhost tomcat-redis-session-manager-master]# gradle build -x test copyJars [root@localhost tomcat-redis-session-manager-master]# mkdir /tmp/jar [root@localhost tomcat-redis-session-manager-master]# cp -a build/libs/*.jar /tmp/jar/ && cp -a dist/*.jar /tmp/jar/ [root@localhost jar]# ls /tmp/jar commons-pool2-2.2.jar jedis-2.5.2.jar tomcat-annotations-api-7.0.27.jar tomcat-api-7.0.27.jar tomcat-catalina-7.0.27.jar tomcat-juli-7.0.27.jar tomcat-redis-session-manager-master-2.0.0.jar tomcat-redis-session-manager-master-2.0.0-javadoc.jar tomcat-redis-session-manager-master-2.0.0-sources.jar tomcat-servlet-api-7.0.27.jar tomcat-util-7.0.27.jar [root@localhost jar]# cp -a /tmp/jar/* /usr/local/tomcat/lib/ (责任编辑:好模板) |