标签:tom pac rpo dev pool print 系统 ssi efault
环境描述:(三台服务器 系统:7.6)
192.168.200.111 nginx
192.168.200.112 tomcat
192.168.200.113 tomcat
环境配置:192.168.200.111 192.168.200.112 192.168.200.113
[root@nginx ~]# cat /etc/hosts
192.168.200.111 nginx
192.168.200.112 node1
192.168.200.113 node2
nginx服务器配置:192.168.200.111
[root@nginx ~]# hostname nginx
[root@nginx ~]# bash
[root@nginx ~]# vim /usr/local/nginx/conf/nginx.conf
upstream tomcat_pool {
server 192.168.200.112:8080 weight=1 max_fails=1 fail_timeout=10s;
server 192.168.200.113:8080 weight=1 max_fails=1 fail_timeout=10s;
}
location / {
root html;
index index.html index.htm;
proxy_pass http://tomcat_pool;
proxy_set_header Host $http_host;
}
[root@nginx ~]# killall -1 nginx
第一台tomcat服务器配置:192.168.200.112
[root@node1 ~]# hostname node1
[root@node1 ~]# bash
[root@node1 ~]# vim /usr/local/tomcat8/webapps/ROOT/session.jsp
Session ID:<%= session.getId() %> <BR>
SessionPort:<%= request.getServerPort() %>
<% out.println("This tomcat server 192.168.200.112"); %>
[root@node1 ~]# vim /usr/local/tomcat8/conf/server.xml
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node1"> //修改
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> //去掉注释
[root@node1 ~]# vim /usr/local/tomcat8/webapps/ROOT/WEB-INF/web.xml
distributable/> //尾行添加
</web-app>
[root@node1 ~]# /usr/local/tomcat8/bin/shutdown.sh
[root@node1 ~]# /usr/local/tomcat8/bin/startup.sh
第二台tomcat服务器配置:192.168.200.113
[root@node2 ~]# hostname node2
[root@node2 ~]# bash
[root@node2 ~]# vim /usr/local/tomcat8/webapps/ROOT/session.jsp
Session ID:<%= session.getId() %> <BR>
SessionPort:<%= request.getServerPort() %>
<% out.println("This tomcat server 192.168.200.113"); %>
[root@node2 ~]#[root@node1 ~]# vim /usr/local/tomcat8/conf/server.xml
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node2"> //修改
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> //去掉注释
[root@node2 ~]# vim /usr/local/tomcat8/webapps/ROOT/WEB-INF/web.xml
distributable/> //尾行添加
</web-app>
[root@node2 ~]# /usr/local/tomcat8/bin/shutdown.sh
[root@node2 ~]# /usr/local/tomcat8/bin/startup.sh
注意:如果启动出错的话,可以添加组播地址
route add -net 224.0.0.0 netmask 240.0.0.0 dev ens32
标签:tom pac rpo dev pool print 系统 ssi efault
原文地址:https://www.cnblogs.com/lyqlyqlyq/p/11641859.html