linux企业运维--LAMP架构--tomcat+nginx+memcache

tomcat+nginx

负载均衡
linux企业运维--LAMP架构--tomcat+nginx+memcache_第1张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第2张图片

linux企业运维--LAMP架构--tomcat+nginx+memcache_第3张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第4张图片
不能直接暴露8080,不能高并发
linux企业运维--LAMP架构--tomcat+nginx+memcache_第5张图片
关闭openresty中的nginx
使用最初的nginx
linux企业运维--LAMP架构--tomcat+nginx+memcache_第6张图片
编写负载均衡器
linux企业运维--LAMP架构--tomcat+nginx+memcache_第7张图片
当访问jsp页面时,调度到tomcat负载均衡器

linux企业运维--LAMP架构--tomcat+nginx+memcache_第8张图片
将test.jsp文件放置到tomcat的默认发布目录
linux企业运维--LAMP架构--tomcat+nginx+memcache_第9张图片
server3同样
linux企业运维--LAMP架构--tomcat+nginx+memcache_第10张图片
server1上没有test.jsp。但是1上的nginx配置了负载均衡,调度到server2和server3
默认使用round-robin调度算法
linux企业运维--LAMP架构--tomcat+nginx+memcache_第11张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第12张图片

客户端与服务器端保持完整连接

tomcat+nginx (sticky模块)

linux企业运维--LAMP架构--tomcat+nginx+memcache_第13张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第14张图片
编译
请添加图片描述
只需要Make
linux企业运维--LAMP架构--tomcat+nginx+memcache_第15张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第16张图片
添加sticky
linux企业运维--LAMP架构--tomcat+nginx+memcache_第17张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第18张图片
此时session保持
多次刷新也不变
linux企业运维--LAMP架构--tomcat+nginx+memcache_第19张图片
手动关闭server2
linux企业运维--LAMP架构--tomcat+nginx+memcache_第20张图片
nginx自带健康检测,server2关闭,server3自动接管
linux企业运维--LAMP架构--tomcat+nginx+memcache_第21张图片
用户之前提交的session不见了,因为之前的session由server22处理。所以要进行交叉存储

tomcat+nginx+memcache交叉存储

2和3的缓存数据
linux企业运维--LAMP架构--tomcat+nginx+memcache_第22张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第23张图片
拷贝到server3
linux企业运维--LAMP架构--tomcat+nginx+memcache_第24张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第25张图片
出现故障找自己,正常找对方
server2为n1
server3为n2
linux企业运维--LAMP架构--tomcat+nginx+memcache_第26张图片
linux企业运维--LAMP架构--tomcat+nginx+memcache_第27张图片
开始初始化
linux企业运维--LAMP架构--tomcat+nginx+memcache_第28张图片
初始化完成
linux企业运维--LAMP架构--tomcat+nginx+memcache_第29张图片
server3正常将缓存存储在server2上
linux企业运维--LAMP架构--tomcat+nginx+memcache_第30张图片
在server2上安装telnet
请添加图片描述
使用Telnet查看memcache
3正常将缓存存储在2上。在2上可以看到刚刚提交的数据
linux企业运维--LAMP架构--tomcat+nginx+memcache_第31张图片
3正常运行,缓存在server2的memcache上
linux企业运维--LAMP架构--tomcat+nginx+memcache_第32张图片
关掉server3
linux企业运维--LAMP架构--tomcat+nginx+memcache_第33张图片
server2自动接管,但是之前数据还在
linux企业运维--LAMP架构--tomcat+nginx+memcache_第34张图片

你可能感兴趣的:(linux,运维)