- 浏览: 953995 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (423)
- mysql (37)
- hibernate (3)
- struts (9)
- spring (33)
- dom4j (2)
- junit (0)
- exception (1)
- 随笔杂谈 (12)
- google app engine (1)
- XMPP (1)
- OAuth安全授权 (1)
- 版本控制 (8)
- 心情感悟 (0)
- core java (19)
- log4j (7)
- jquery (12)
- javascript (10)
- 网站性能优化及工具 (11)
- 服务器架设配置等 (38)
- EXT (4)
- 正则表达式 (5)
- 日志统计分析 (2)
- htmlparse (4)
- httpclient (5)
- java随笔 (5)
- dhtmlxtree (1)
- freemarke (5)
- memcached (6)
- javamail (5)
- Linux命令 (10)
- 应用监控cpu web jdbc等 (4)
- jmagick (9)
- 第三方缓存策略 (9)
- ORM (2)
- hadoop (2)
- 大数据量处理 (8)
- 经典 (1)
- 权限设计 (1)
- andriod (1)
- mybatis (12)
- redis (24)
- 数据结构_算法 (5)
- 分布式系统 (1)
- php (1)
- 网络编程 (3)
- 服务器部署 (3)
- ios (2)
- IM (23)
- mina (1)
- 视讯和语音 (1)
- 代码生成 (1)
- 架构 (4)
- 建模工具 (1)
- oracle (4)
- solr (10)
- 构建工具 (7)
- html5 (1)
- nginx (5)
- css (1)
- 大数据-分布式 (2)
- 设计模式 (2)
- mq (2)
- jvm调优 (8)
- 并发编程 (2)
- 搜索引擎 (1)
- UML (2)
最新评论
-
天使建站:
jquery获取网页里多选框checkbox选中项的值的方法及 ...
JS jQuery分别获取选中的复选框值 -
abao1:
发现一个小问题 sortAndSave方法中的for循环 第二 ...
完整java实现外部排序 -
西巴拉古呀那:
Kafka分布式消息系统实战(与JavaScalaHadoop ...
消息系统kafka介绍 -
kafodaote:
Kafka分布式消息系统实战(与JavaScalaHadoop ...
消息系统kafka介绍 -
成大大的:
Kafka分布式消息系统实 ...
消息系统kafka介绍
原文地址:http://azeditech.com/tomcat/multiple-tomcat-instances.html
Running multiple Tomcat instances on one server
Here's a brief step by step guide to running more than one instance of Tomcat on a single machine.
Step 1: Install the Tomcat files
Download Tomcat 4.1 or 5.5, and unzip it into an appropriate directory. I usually put it in /usr/local, so it ends up in a directory called /usr/local/apache-tomcat-5.5.17 (5.5.17 being the current version as of this writing), and make a symlink named /usr/local/tomcat to that directory. When later versions come out, I can unzip them and relink, leaving the older version in case things don't work out (which rarely if ever happens, but I'm paranoid).
Step 2: Make directories for each instance
For each instance of Tomcat you're going to run, you'll need a directory that will be CATALINA_HOME. For example, you might make them /var/tomcat/serverA and /var/tomcat/serverB.
In each of these directories you need the following subdirectories: conf, logs, temp, webapps, and work.
Put a server.xml and web.xml file in the conf directory. You can get these from the conf directory of the directory where you put the tomcat installation files, although of course you should tighten up your server.xml a bit.
The webapps directory is where you'll put the web applications you want to run on the particular instance of Tomcat.
I like to have the Tomcat manager webapp installed on each instance, so I can play with the webapps, and see how many active sessions there are. See my instructions for configuring the Tomcat manager webapp.
Step 3: Configure the ports and/or addresses for each instance
Tomcat listens to at least two network ports, one for the shutdown command, and one or more for accepting requests. Two instances of Tomcat can't listen to the same port number on the same IP address, so you will need to edit your server.xml files to change the ports they listen to.
The first port to look at is the shutdown port. This is used by the command line shutdown script (actually, but the Java code it runs) to tell the Tomcat instance to shut itself down. This port is defined at the top of the server.xml file for the instance.
<Server port="8001" shutdown="_SHUTDOWN_COMMAND_" debug="0">
Make sure each instance uses a different port value. The port value will normally need to be higher than 1024, and shouldn't conflict with any other network service running on the same system. The shutdown string is the value that is sent to shut the server down. Note that Tomcat won't accept shutdown commands that come from other machines.
Unlike the other ports Tomcat listens to, the shutdown port can't be configured to listen to its port on a different IP address. It always listens on 127.0.0.1.
The other ports Tomcat listens to are configured with the <Connector> elements, for instance the HTTP or JK listeners. The port attribute configures which port to listen to. Setting this to a different value on the different Tomcat instances on a machine will avoid conflict.
Of course, you'll need to configure whatever connects to that Connector to use the different port. If a web server is used as the front end using mod_jk, mod_proxy, or the like, then this is simple enough - change your web server's configuration.
In some cases you may not want to do this, for instance you may not want to use a port other than 8080 for HTTP connectors. If you want all of your Tomcat intances to use the same port number, you'll need to use different IP addresses. The server system must be configured with multiple IP addresses, and the address attribute of the <Connector> element for each Tomcat instance will be set to the appropriate IP address.
Step 4: Startup
Startup scripts are a whole other topic, but here's the brief rundown. The main different from running a single Tomcat instance is you need to set CATALINA_BASE to the directory you set up for the particular instance you want to start (or stop). Here's a typical startup routine:
JAVA_HOME=/usr/java JAVA_OPTS="-Xmx800m -Xms800m" CATALINA_HOME=/usr/local/tomcat CATALINA_BASE=/var/tomcat/serverA export JAVA_HOME JAVA_OPTS CATALINA_HOME CATALINA_BASE $CATALINA_HOME/bin/catalina.sh start
补充:每个tomcat实例的启动脚本和关闭脚本必须设置的环境变量是:
CATALINA_HOME (每个实例的值都一样,指向tomcat程序的安装目录)
CATALINA_BASE (各个实例有不同的值,指向各个实例的安装目录)
JAVA_HOME或JRE_HOME (各个实例的值都一样)
例子:start.bat (Windows环境下)
- rem 每个tomcat实例的启动脚本
- rem 设置Java虚拟机的安装路径(也可以设置JDK的安装路径JAVA_HOME,二者选其一即可)
- rem ------------------------------------------------------------------
- set JRE_HOME=C:/Program Files/Java/jre6
- rem 设置CATALINA_HOME
- rem -----------------
- set CATALINA_HOME=D:/server/tomcat6_HOME
- rem 每个tomcat实例的CATALINA_BASE的值是不一样的
- rem -------------------------------------------
- set CATALINA_BASE=D:/server/tomcat6_BASE_1
- call %CATALINA_HOME%/bin/startup.bat
发表评论
-
tomcat jvm 参数说明
2013-12-17 09:50 1552maxThreads=”1000″ enableLookup ... -
SecureCRT常用快捷键设置
2013-11-27 08:36 2763http://www.tatujia.com 1:如果不 ... -
自动拒绝恶意IP远程登录Linux服务器脚本
2013-09-19 13:00 1289http://wgkgood.blog.51cto.com/ ... -
帮助中心分类 新闻公告 (10) Windows VPS教程 (13) Linux VPS教程 (28) 其他 (1) linux中Cron定时任务系统命令详解
2013-05-21 17:46 1043有很多同学在购买VPS之后,需要用到计划任务.但是又对计划任 ... -
Nginx配置文件nginx.conf中文详解
2013-04-03 10:29 942#定义Nginx运行的用户和用户组user www www ... -
nginx配置相关文章
2013-04-03 10:29 949nginx配置相关文章 http://developer ... -
Nginx日志自动切割脚本
2013-04-03 10:29 1026说明:每隔7天执行一次,使用crontab自动运行脚本,请 ... -
centos 6.2 64位安装nginx php mysql
2013-04-03 10:30 1809平台环境http://jiyunjie.blog.51ct ... -
centos nginx安装教程
2013-04-02 13:50 10871.安装 默认安装到/usr/local/ng ... -
Linux中iptables设置详细
2012-09-28 14:13 1580无论如何,iptables是一个需要特别谨慎设置的东西,万 ... -
CentOS 5.6Final下FTP安装及配置 .
2012-09-27 10:07 1249My Scripts: [root@localhost ~] ... -
CentOS5.6 安装JDK
2012-09-27 10:05 1023首先通过界面卸载OpenJDK.然后卸载默认的jdk1.42 ... -
Java获取客户端真实IP地址的两种方法
2012-09-13 13:08 1033在JSP里,获取客户端的IP地址的方法是:request.ge ... -
令 Nginx 后端的 Apache 获取到互联网 IP
2012-09-13 10:58 1931http://blog.csdn.net/songerzhou ... -
让tomcat支持2级域名共享session
2012-09-13 10:46 1042tomcat默认情况下是不支持2级域名共享session的,所 ... -
nginx防盗链配置
2012-08-21 13:22 1264以下配置一般可称为图片防盗链配置,如果是mp3这种文件,我现在 ... -
将nginx同时作为负载均衡和Web缓存服务器
2012-02-13 11:11 1213http://server.51cto.com/sColleg ... -
nginx 代理模式下,获取客户端真实IP
2011-11-30 09:42 4870最近做博友推荐,发现个小问题,用$_SERVER['REMOT ... -
nginx相关文章地址收集
2011-11-04 14:07 1055http://bbs.chinaunix.net/thread ... -
LVS+keeplived+nginx+tomcat高可用、高性能jsp集群
2011-11-04 10:31 2100摘自:http://kerry.blog.51cto.com/ ...
相关推荐
Linux下tomcat多实例配置成功。步骤如下: 1. 下载一个免安装版本的tomcat,例如:apache-tomcat-7.0.59.tar.gz。解压:tar xvf pache-tomcat-7.0.59.tar.gz. 解压后的文件夹中大致有7个文件夹: bin (运行...
多实例配置允许开发者或系统管理员在同一个物理或虚拟机上隔离不同的应用,提高资源利用率并方便管理。 描述 "tomcat 多实例脚本文件" 提示我们这里可能有一个自动化脚本,用于创建、启动、停止或管理这些独立的 ...
首先,理解“Zabbix监控Tomcat多实例自动化脚本配置”意味着我们需要在Zabbix中设置一个自动发现规则,以便它能识别并监控运行在同一服务器或不同服务器上的所有Tomcat实例。这通常涉及到以下几个关键步骤: 1. **...
### JDK与Tomcat配置实例详解 #### 一、JDK安装与配置 在进行Java开发时,首先需要安装Java Development Kit(简称JDK),它是Java应用程序的基础环境。 **步骤1:下载并安装JDK** 1. **下载JDK**:访问Oracle...
### 二、Tomcat多实例配置步骤详解 #### 步骤1:下载并安装Tomcat 以Tomcat 5.5为例,首先从官方网站或其他可信源下载Tomcat的安装包,如提供的链接所示:`http://download.csdn.net/detail/myj_hunter/185913`。...
配置Nginx+Tomcat集群负载均衡的第一步是安装Nginx和多个Tomcat实例。在多台服务器上部署Tomcat,形成一个集群,确保服务的高可用性。每台服务器上的Tomcat实例都需要配置相同的应用,以处理相同类型的请求。 接...
【Zabbix自动安装单机多Tomcat实例脚本详解】 在IT运维中,监控系统扮演着至关重要的角色,Zabbix作为一款开源的企业级监控解决方案,能够有效地监控服务器、网络设备以及应用程序的运行状态。本资源提供的"zabbix...
### 运行多个Tomcat实例 #### 背景与需求 在软件开发与测试过程中,经常需要将不同阶段的应用程序部署在同一台服务器上。例如,一个处于alpha测试阶段的应用程序可能需要与已经稳定运行的生产环境应用程序共存于...
6. **虚拟主机配置**:如何配置多个域名指向同一Tomcat实例,实现多站点部署。 7. **日志和错误处理**:设置和查看Tomcat的日志文件,理解错误代码和解决常见问题。 8. **安全性设置**:涵盖用户认证、角色权限、 ...
- **Redis共享Session**:在Tomcat和Nginx之间部署一个Redis服务器,将Session数据存储在Redis中,所有Tomcat实例都可以访问。 5. **实践步骤**: 1. 安装Nginx和Tomcat。 2. 配置Nginx,添加多域名的虚拟主机...
【标题】:“Tomcat及其配置文件” 在Java Web开发领域,Tomcat是一个广泛使用的开源应用服务器,它专注于Servlet和JSP的应用。Tomcat是Apache软件基金会的Jakarta项目的一部分,作为一个轻量级的Web服务器和...
当我们谈论“Tomcat集群实例下载”时,这通常指的是通过设置多个Tomcat实例来构建一个集群,以实现负载均衡、高可用性和容错性。 集群是一种策略,将多个独立的服务器组织成一个逻辑单元,共同提供服务,从而提高...
- 修改Tomcat实例配置文件server.xml,主要是更改端口号以确保不同实例的端口不冲突(如8005改为8011、8005改为8012,以及HTTP连接器端口8080改为8081、8082)。 - 通过sed命令对server.xml文件中的端口设置进行批量...
【描述】:本文详细阐述了如何在单台服务器上配置和管理多个独立的Tomcat实例,以实现应用程序的隔离和资源的有效利用。通过实例和代码,我们将深入理解单机多实例的优缺点以及具体实施步骤。 【知识点】: 1. **...
本文档将详细介绍如何在一个Tomcat实例中部署多个Web应用程序,包括必要的步骤、配置以及一些注意事项。 #### 二、基础知识回顾 在深入了解具体的部署方法之前,我们首先需要了解一些关于Tomcat的基本概念: - **...
6. **虚拟主机配置**:如何在同一台机器上配置多个独立的Tomcat实例,或者在单个Tomcat中设置多个虚拟主机,以托管不同的Web应用。 7. **部署Web应用**:演示如何将WAR文件或已解压的目录放入webapps目录,以及如何...
如果遇到这样的问题,可以尝试删除Tomcat实例,然后重新添加,确保所有配置项正确无误。 Apache Tomcat的版本更新通常会带来性能优化和新特性的支持,因此建议用户关注Apache Tomcat的官方网站,了解最新的版本更新...
Tomcat集群是指多个独立的Tomcat实例通过网络连接协同工作,共同处理请求,实现负载均衡和数据共享。在集群环境中,每个Tomcat实例被称为一个节点。 **二、负载均衡** 负载均衡是Tomcat集群的核心功能之一,它的...
"Nginx负载均衡代理多个Tomcat搭建实例过程" 一、Nginx安装与配置 Nginx是一款轻量级的Web...Nginx负载均衡代理多个Tomcat搭建实例过程需要完成Nginx和Tomcat的安装和配置,配置Nginx负载均衡,并进行压力测试。