标签:ORC tor apach enforce exp rest etc int sticky
坏境:192.168.200.112 tomcat1
192.168.200.103 tomcat2
192.168.200.111 Apache
Apache:yum -y install httpd*
systemctl start httpd
vim /etc/httpd/conf/httpd.conf
添加:<VirtualHost *:80>
ServerName www.ht.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / balancer://htcluster/
ProxyPassReverse / balancer://htcluster/
<Proxy balancer://htcluster>
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
BalancerMember http://192.168.200.103:8080/ loadfactor=5
BalancerMember http://192.168.200.112:8080/ loadfactor=5
ProxySet lbmethod=byrequests
ProxySet stickysession=ROUTEID
</Proxy>
</VirtualHost>
systemctl restart network
tomcat1服务器:
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# iptables -F
[root@localhost ~]# rpm -qa |grep -i openjdk
java-11-openjdk-headless-11.0.ea.28-7.el7.x86_64
java-11-openjdk-11.0.ea.28-7.el7.x86_64
[root@localhost ~]# rpm -e java-11-openjdk-11.0.ea.28-7.el7.x86_64
rpm -e java-11-openjdk-headless-11.0.ea.28-7.el7.x86_64 --nodeps ##--nodeps解除依赖包的安装
[root@localhost ~]# tar xf jdk-8u191-linux-x64.tar.gz
[root@localhost ~]# mv jdk1.8.0_191/ /usr/local/java
[root@localhost ~]# /usr/local/java/bin/java -version
cat /etc/profile
export JAVA=/usr/local/java
export PATH=$PATH:$JAVA/bin
[root@localhost ~]# source /etc/profile
[root@localhost ~]# tar xf apache-tomcat-8.5.40.tar.gz
[root@localhost ~]# mv apache-tomcat-8.5.40 /usr/local/tomcat8
[root@localhost ~]# /usr/local/tomcat8/bin/startup.sh
[root@localhost ~]# mkdir -pv /web/webapp
[root@localhost ~]# vim /web/webapp/index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<title>JSP test page</title>
</head>
<body>
<% out.println("Welcome to test site,http://www.test1.com");%>
</body>
</html>
[root@localhost ~]# vim /usr/local/tomcat8/conf/server.xml
148行添加:
<Context docBase="/web/webapp" path="" reloadable="flase">
</Context>
[root@localhost ~]# /usr/local/tomcat8/bin/shutdown.sh
[root@localhost ~]# /usr/local/tomcat8/bin/startup.sh
tomcat2服务器:
唯一不同的地方就是:
[root@localhost ~]# vim /web/webapp/index.jsp
里面的test1改成test2
修改主机hosts文件
192.168.200.111 www.ht.com
测试:www.ht.com
标签:ORC tor apach enforce exp rest etc int sticky
原文地址:https://www.cnblogs.com/maoyanqing/p/11552374.html