windows系统下nginx+tomcat+redis做负载均衡和session粘滞附整套解决方案
来源:互联网 发布:电脑解除限制软件 编辑:程序博客网 时间:2024/05/18 13:45
Nginx:
在nginx-1.8.0\conf目录下找到nginx.conf文件,打开文件修改文件中http{}中的内容,在http{}中加入
upstream localhost {
server localhost:8080;
server localhost:8090;
}
include mime.types;
default_type application/octet-stream;
其中8080和8090是下面说到的两个tomcat的端口号。
另外需要注意的是upstream tomcat的tomcat是主机服务器域名,在本地测试的话是localhost,与此同时server中的代理配置
location / {
proxy_pass http://tomcat;
}
中的tomcat也需要改为localhost
如下图
配置后双击nginx-1.8.0目录下的nginx.exe启动nginx,这个可以在进程中看到。
Redis:
打开redis-latest文件夹,可以看到redis-server.exe和redis-cli.exe两个安装文件,一个是redis的服务,一个是连接redis的客户端窗口。
首先打开cmd ,进入到redis-latest文件夹下,执行redis-server.exe redis.windows.conf 启动redis服务。
两个tomcat模拟两个服务器:
将原始文件中的tomcat7集群文件夹下的jar包复制到每个tomcat的lib目录下,然后修改每个tomcat的conf/content.xml文件,添加
<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
host="localhost"
port="6379"
database="0"
maxInactiveInterval="60" />
两个tomcat的webapp下放入同一个项目。
windows下配置负载均衡至此完毕。启动两个tomcat,测试一下ok。
- windows系统下nginx+tomcat+redis做负载均衡和session粘滞附整套解决方案
- Windows环境下Nginx+Tomcat+Redis实现应用服务器集群负载均衡和Session共享
- nginx+tomcat+redis 做负载均衡时session 共享实现
- nginx+tomcat+redis 负载均衡和session共享
- Windows下Nginx+tomcat7+redis负载均衡与session共享
- nginx+tomcat+redis负载均衡session共享
- nginx+redis+tomcat 负载均衡 session共享
- Windows下Nginx+Tomcat负载均衡、Session复制
- Nginx+Tomcat负载均衡Session复制解决方案
- nginx+tomcat+redis做集群负载均衡
- Nginx+Tomcat在Windows下做负载均衡
- nginx+tomcat在windows下做负载均衡
- linux、windows下利用Nginx对Tomcat做负载均衡
- Nginx+Tomcat在Windows下做负载均衡
- Nginx+Tomcat在Windows下做负载均衡
- Nginx+Tomcat在Windows下做负载均衡
- windows+nginx+memcached+tomcat做负载均衡
- Nginx安装,Nginx静态缓存,Nginx Gzip压缩,Nginx负载均衡,Nginx方向代理,Nginx+Tomcat+Redis做session共享
- python3学习之set
- 解决springboot将jar包打成war包之后首页能访问,但是接口全为404
- OC中常用的数学函数以及浮点处理函数
- OpenSSL和Python实现RSA Key数字签名和验证
- MARK!! 博客记录第一篇
- windows系统下nginx+tomcat+redis做负载均衡和session粘滞附整套解决方案
- 网站页面底部的著作权(版权)声明应该怎么写?
- windows 显示程序被加载地址的三种方法
- 习题8.3--证明吝啬SAT是NP-完全问题
- iOS之获取UITableViewCell中UITextField的值
- POJ 2393 Yogurt factory 贪心
- Oracle逻辑备份脚本(收集学习)
- Android Snackbar使用详解
- eclipse用安卓模拟器遇到的一个问题