配置环境:
主机一:172.16.251.73 安装tomcat(tomcat, tomcat-lib, tomcat-admin-webapps, tomcat-webapps, tomcat-docs-webapp)
主机二:172.16.251.75 安装tomcat(tomcat, tomcat-lib, tomcat-admin-webapps, tomcat-webapps, tomcat-docs-webapp)
主机三:172.16.251.91 安装ngnix,httpd,haproxy
在实验环境下所有主机清空防火墙策略以及禁用selinux:
iptables -F
setenforce 0
为了使实验便于观察与分析,使2台tomcat主机的默认页面为自定义页面 。
QQ截图20170902114109.png
①nginx + tomcat
vim /etc/nginx/nginx.conf
QQ截图20170902113857.png ![QQ截图20170902114138.png](https://img.haomeiwen.com/i6107809/1b42467fa541f224.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) QQ截图20170902114303.png
② haproxy + tomcat
vim /etc/haproxy/haproxy.cfg
haproxy的状态页
③httpd + tomcat
vim /etc/httpd/conf/httpd.conf
④会话粘滞
QQ截图20170902135846.png ![QQ截图20170902135931.png](https://img.haomeiwen.com/i6107809/68d3e42dea4e7943.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) QQ截图20170902135931.png⑤会话集群
Vim /usr/share/tomcat/webapps/ROOT/WEB-INF/web.xml
QQ截图20170903150423.png QQ截图20170903150310.png QQ截图20170903150650.png QQ截图20170903150751.png
⑥nginx + (apache + tomcat)
先将原先的tomcat主机安装httpd包,以第一台主机为例,将808端口的tomcat作为后端。80端口的http作为前端代理。
网友评论