[root@localhost ~]# tar fx apache-tomcat-8.5.40.tar.gz
[root@localhost ~]# tar fx jdk-8u191-linux-x64.tar.gz
[root@localhost ~]# mv jdk1.8.0_191/ /usr/local/java
[root@localhost ~]# vim /etc/profile
JAVA_HOME=/usr/local/java
PATH=$PATH:$JAVA_HOME/bin
[root@localhost ~]# source /etc/profile
[root@localhost ~]# mv apache-tomcat-8.5.40 /usr/local/
[root@localhost ~]# mkdir -p /usr/local/tomcat_instance/tomcat1
[root@localhost ~]# mkdir -p /usr/local/tomcat_instance/tomcat2
[root@localhost ~]# cp -R /usr/local/apache-tomcat-8.5.40/conf/ /usr/local/tomcat_instance/tomcat1
[root@localhost ~]# cp -R /usr/local/apache-tomcat-8.5.40/conf/ /usr/local/tomcat_instance/tomcat2
[root@localhost ~]# mkdir /usr/local/tomcat_instance/{tomcat1,tomcat2}/bin
[root@localhost ~]# touch /usr/local/tomcat_instance/{tomcat1,tomcat2}/bin/startup.sh
[root@localhost ~]# touch /usr/local/tomcat_instance/{tomcat1,tomcat2}/bin/shutdown.sh
[root@localhost ~]# chmod +x /usr/local/tomcat_instance/{tomcat1,tomcat2}/bin/startup.sh
[root@localhost ~]# chmod +x /usr/local/tomcat_instance/{tomcat1,tomcat2}/bin/shutdown.sh
[root@localhost ~]# vi /usr/local/tomcat_instance/tomcat1/bin/startup.sh
#/bin/bash
export CATALINA_HOME="/usr/local/apache-tomcat-8.5.40"
export CATALINA_BASE="/usr/local/tomcat_instance/tomcat1"
export CATALINA_TMPDIR="$CATALINA_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
export JAVA_OPTS="-server -Xms1024m -Xmx1024m -Djava.awt.headless=true -Dtomcat.name=tomcat1"
if [ ! -d "$CATALINA_BASE/logs" ]; then
mkdir $CATALINA_BASE/logs
fi
if [ ! -d "$CATALINA_BASE/temp" ]; then
mkdir $CATALINA_BASE/temp
fi
bash $CATALINA_HOME/bin/startup.sh "$@"
[root@localhost ~]# vi /usr/local/tomcat_instance/tomcat2/bin/startup.sh
#/bin/bash
export CATALINA_HOME="/usr/local/apache-tomcat-8.5.40"
export CATALINA_BASE="/usr/local/tomcat_instance/tomcat2"
export CATALINA_TMPDIR="$CATALINA_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
export JAVA_OPTS="-server -Xms1024m -Xmx1024m -Djava.awt.headless=true -Dtomcat.name=tomcat2"
if [ ! -d "$CATALINA_BASE/logs" ]; then
mkdir $CATALINA_BASE/logs
fi
if [ ! -d "$CATALINA_BASE/temp" ]; then
mkdir $CATALINA_BASE/temp
fi
bash $CATALINA_HOME/bin/startup.sh "$@"
[root@localhost ~]# vi /usr/local/tomcat_instance/tomcat1/bin/shutdown.sh
#/bin/bash
export CATALINA_HOME="/usr/local/apache-tomcat-8.5.40"
export CATALINA_BASE="/usr/local/tomcat_instance/tomcat1"
export CATALINA_TMPDIR="$CATALINA_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
bash $CATALINA_HOME/bin/shutdown.sh "$@"
[root@localhost ~]# vi /usr/local/tomcat_instance/tomcat2/bin/shutdown.sh
#/bin/bash
export CATALINA_HOME="/usr/local/apache-tomcat-8.5.40"
export CATALINA_BASE="/usr/local/tomcat_instance/tomcat2"
export CATALINA_TMPDIR="$CATALINA_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
bash $CATALINA_HOME/bin/shutdown.sh "$@"
[root@localhost ~]# vim /usr/local/tomcat_instance/tomcat2/conf/server.xml
22 <Server port="8006" shutdown="SHUTDOWN">
69 <Connector port="8090" protocol="HTTP/1.1"
116 <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
[root@localhost ~]# mkdir -p /usr/local/tomcat_instance/{tomcat1,tomcat2}/webapps/ROOT
[root@localhost ~]# vim /usr/local/tomcat_instance/tomcat1/webapps/ROOT/index.jsp
<html>
<title>Tomcat-1</title>
<body>
Hello This is Tomcat-1
</body>
</html>
[root@localhost ~]# vim /usr/local/tomcat_instance/tomcat2/webapps/ROOT/index.jsp
<html>
<title>Tomcat-2</title>
<body>
Hello This is Tomcat-2
</body>
</html>
[root@localhost ~]# /usr/local/tomcat_instance/tomcat1/bin/startup.sh
[root@localhost ~]# /usr/local/tomcat_instance/tomcat2/bin/startup.sh

192.168.200.111 安装nginx
[root@nginx ~]# vim /usr/local/nginx/conf/nginx.conf
http {
upstream tomcat_pool {
server 192.168.200.112:8080 weight=1 max_fails=1 fail_timeout=10s;
server 192.168.200.112:8090 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
访问192.168.200.111进行测试

tomcat多实例及负载均衡的更多相关文章

  1. Nginx+Tomcat多实例及负载均衡配置

    Nginx+Tomcat多实例及负载均衡配置 采用nginx的反向代理负载均衡功能,配合后端的tomcat多实例来实现tomcat WEB服务的负载均衡 01 安装nginx服务 安装所需的pcre库 ...

  2. 图文解说:Nginx+tomcat配置集群负载均衡

    图文解说:Nginx+tomcat配置集群负载均衡 博客分类: appserver nginxTomcatUbuntuLinux网络应用  作者:niumd Blog:http://ari.iteye ...

  3. Apache+Tomcat +mod_proxy集群负载均衡及session

      序言: 在玩Apache+Tomcat +mod_jk集群负载均衡及session的时候发现,还有一种方式可以实现,就是网上各位大牛们说的mod_proxy反向代理. 实在弄的我的知识细胞洋洋.实 ...

  4. 搭建 Keepalived + Nginx + Tomcat 的高可用负载均衡架构

    1 概述 初期的互联网企业由于业务量较小,所以一般单机部署,实现单点访问即可满足业务的需求,这也是最简单的部署方式,但是随着业务的不断扩大,系统的访问量逐渐的上升,单机部署的模式已无法承载现有的业务量 ...

  5. Web服务器Tomcat集群与负载均衡技术

    我们曾经介绍过三种Tomcat集群方式的优缺点分析.本文将介绍Tomcat集群与负载均衡技术具体实施过程. 在进入集群系统架构探讨之前,先定义一些专门术语: 1. 集群(Cluster):是一组独立的 ...

  6. linux下配置tomcat集群的负载均衡

    linux下配置tomcat集群的负载均衡 一.首先了解下与集群相关的几个概念集群:集群是一组协同工作的服务实体,用以提供比单一服务实体更具扩展性与可用性的服务平台.在客户端看来,一个集群就象是一个服 ...

  7. 实战Apache+Tomcat集群和负载均衡

    实战Apache+Tomcat集群和负载均衡 目录 1.    什么是J2EE集群... 3 1.1.     序言... 3 1.2.     基本术语... 3 伸缩性(Scalability): ...

  8. Keepalived + Nginx + Tomcat 的高可用负载均衡架构搭建

    Keepalived + Nginx + Tomcat 的高可用负载均衡架构搭建 Nginx 是一个高性能的 HTTP反向代理服务器 Keepalived 是一个基于VRRP协议来实现的LVS服务高可 ...

  9. 搭建Keepalived + Nginx + Tomcat的高可用负载均衡架构

    1 概述 初期的互联网企业由于业务量较小,所以一般单机部署,实现单点访问即可满足业务的需求,这也是最简单的部署方式,但是随着业务的不断扩大,系统的访问量逐渐的上升,单机部署的模式已无法承载现有的业务量 ...

随机推荐

  1. 在vim中设置tab缩进为4个字符

    编辑一个文件,进入之后一次输入 [esc] --> [ : ] --> [ set ts=4 ]vim aaa.txt

  2. cas4.2.7 集群服务搭建

    cas服务端集群,网上资料很多,无非就是session共享,ticket共享. 但是session共享是必须的吗?或者能实现集群吗? 实践: 1. ticket共享,直接上代码 package org ...

  3. 翻译 What is the concept of Service Container in Laravel?

    原文链接: https://stackoverflow.com/questions/37038830/what-is-the-concept-of-service-container-in-larav ...

  4. timezone

    Calendar cal2 = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss&q ...

  5. redis数据操作篇

    服务器端 服务器端的命令为redis-server 可以使⽤help查看帮助⽂档 redis-server --help 个人习惯 ps aux | grep redis 查看redis服务器进程su ...

  6. kubeadm部署多master节点高可用k8s1.16.2

    一.架构信息 系统版本:CentOS 7.6 内核:3.10.0‐1062.4.1.el7.x86_64 Kubernetes: v1.16.2 Docker­ce: 19.03 推荐硬件配置:2核4 ...

  7. CentOS 7.2 安装MySQL 5.7

    CentOS 7之后的版本yum的默认源中使用MariaDB替代原先MySQL,因此安装方式较为以往有一些改变: 下载mysql的源 wget http://dev.mysql.com/get/mys ...

  8. java中EL表达式怎么获取网站的根目录

    ${pageContext.request.contextPath} <a href="${pageContext.request.contextPath}/login.jsp&quo ...

  9. 【Dart学习】-- Dart之extends && implements && with的用法与区别

    一,概述 继承(关键字 extends) 混入  mixins (关键字 with) 接口实现(关键字 implements) 这三种关系可以同时存在,但是有前后顺序: extends -> m ...

  10. 区间dp+预处理——cf1278F(难题)

    感觉很难的区间dp,主要是状态难想 /* 对于一个区间[i,j],设其最小的颜色编号是c=Min[i,j],那么该区间显然有一大段是以c为底的 设这个颜色在该区间出现位置的两端是L[c],R[c],那 ...