- 浏览: 1052847 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (538)
- 奇文共赏 (36)
- spring (13)
- hibernate (10)
- AOP/Aspectj (9)
- spring security (7)
- lucence (5)
- compass (3)
- jbmp (2)
- jboss rule(drools) (0)
- birt (1)
- jasper (1)
- cxf (3)
- flex (98)
- webgis (6)
- 设计模式 (1)
- 代码重构 (2)
- log4j (1)
- tomcat (9)
- 神品音乐 (1)
- 工作计划 (2)
- appfuse (1)
- svn (4)
- 寻章摘句 (3)
- eclipse (10)
- arcgis api for flex (1)
- 算法 (5)
- opengis-cs (1)
- bug心得 (13)
- 图标 (1)
- software&key (14)
- java (17)
- 搞笑视频 (13)
- sqlserver (9)
- postgresql (1)
- postgis (0)
- geoserver (5)
- 日子 (50)
- 水晶报表 (1)
- 绝对电影 (3)
- Alternativa3D (1)
- 酷站大全 (10)
- c++ (5)
- oracle (17)
- oracle spatial (25)
- flashbuilder4 (3)
- TweenLite (1)
- DailyBuild (6)
- 华山论贱 (5)
- 系统性能 (5)
- 经典古文 (6)
- SOA/SCA/OSGI (6)
- jira (2)
- Hadoop生态圈(hadoop/hbase/pig/hive/zookeeper) (37)
- 风水 (1)
- linux操作基础 (17)
- 经济 (4)
- 茶 (3)
- JUnit (1)
- C# dotNet (1)
- netbeans (1)
- Java2D (1)
- QT4 (1)
- google Test/Mock/AutoTest (3)
- maven (1)
- 3d/OSG (1)
- Eclipse RCP (3)
- CUDA (1)
- Access control (0)
- http://linux.chinaunix.net/techdoc/beginner/2008/01/29/977725.shtml (1)
- redis (1)
最新评论
-
dove19900520:
朋友,你确定你的标题跟文章内容对应???
tomcat控制浏览器不缓存 -
wussrc:
我只想说牛逼,就我接触过的那点云计算的东西,仔细想想还真是这么 ...
别样解释云计算,太TM天才跨界了 -
hw_imxy:
endpoint="/Hello/messagebr ...
flex+java代码分两个工程 -
gaohejie:
rsrsdgrfdh坎坎坷坷
Flex 与 Spring 集成 -
李涤尘:
谢谢。不过说得有点太罗嗦了。
Oracle数据库数据的导入及导出(转)
http://c-j.iteye.com/blog/364503
1、下载和安装。
下载安装apache2.2.3,tomcat6.0.(注意设置环境变量)
2、配置Apache
修改Apache安装目录下conf/httpd.conf文件.
由
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
修改为:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
填加以下内容(注意此配置是在1台PC开多TOMCAT进程,并注意注释的格式):
# ProxyRequests Off
#
ProxyPass / balancer://tomcatcluster/ lbmethod=byrequests stickysession=JSESSIONID nofailover=Off timeout=3 maxattempts=3
###################################################################
#
# IBmethod:
# Balancer load-balance method. Select the load-balancing scheduler method to use. Either byrequests, to perform weighted request counting or bytraffic, to perform weighted traffic byte #count balancing. Default is byrequests.
#
# stickysession:
# Balancer sticky session name. The value is usually set to something like JSESSIONID or #PHPSESSIONID, and it depends on the backend application server that # support sessions.
#
# nofailover:
# If set to On the session will break if the worker is in error state or disabled. Set this value #to On if backend servers do not support session
# replication.
#
# timeout:
# Balancer timeout in seconds. If set this will be the maximum time to wait for a free worker. #Default is not to wait.
#
# maxattempts:
# Maximum number of failover attempts before giving up.
####################################################################################
ProxyPassReverse / balancer://tomcatcluster/
<Proxy balancer://tomcatcluster>
BalancerMember ajp://localhost:8109 smax=10 route=jvm1
BalancerMember ajp://localhost:8209 smax=10 route=jvm2
BalancerMember ajp://localhost:8309 smax=10 route=jvm3
BalancerMember ajp://localhost:8409 smax=10 route=jvm4
BalancerMember ajp://localhost:8509 smax=10 route=jvm5
</Proxy>
# smax:
# Upto the Soft Maximum number of connections will be created on demand. Any connections above smax are subject to a time to live or ttl.
# route:
# Route of the worker when used inside load balancer. The route is a value appended to seesion id.
注意端口号和TOMCAT配置保持一致,并避免冲突,否则启动TOMCAT将失败.
3、配置Tomcat
安装多个TOMCAT(ZIP版本,不要安装"安装版本")
修改TOMCAT安装目录下conf/server.xml
如修改tomcat_1配置
修改:
<Server port="8105" shutdown="SHUTDOWN">
修改:
<Connectorport="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8143" />
修改:
<Connectorport="8109" protocol="AJP/1.3" redirectPort="8143" />
修改:
<Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
修改另外几个tomcat文件,并避免端口冲突.如果多个TOMCAT安装在多个服务器则只要注意IP地址的正确.
4、保持Session同步
在TOMCAT安装目录conf/server.xml下的
<Engine>... </Engine>标签下填加如下内容:
- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="4">
<ManagerclassName="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" />
- <!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
- <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
- <Channel className="org.apache.catalina.tribes.group.GroupChannel">
<MembershipclassName="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000" />
<ReceiverclassName="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="4001" autoBind="100" selectorTimeout="5000" maxThreads="6" />
- <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<TransportclassName="org.apache.catalina.tribes.transport.nio.PooledParallelSender" />
</Sender>
<InterceptorclassName="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector" />
<InterceptorclassName="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor" />
</Channel>
<ValveclassName="org.apache.catalina.ha.tcp.ReplicationValve" filter="" />
<ValveclassName="org.apache.catalina.ha.session.JvmRouteBinderValve" />
<DeployerclassName="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false" />
<ClusterListenerclassName="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener" />
<ClusterListenerclassName="org.apache.catalina.ha.session.ClusterSessionListener" />
</Cluster>
#注意port="4001" 是否与其他TOMCAT进程冲突.
配置详细解释见文档"Clustering-Session Replication HOW-TO.htm"
5、修改WEB项目Web.xml
在工程项目中修改web.xml;
填加如下标签:
<distributable/>
6、Testing
打开浏览器,写一个简单的JSP,测试
http://localhost/mytest/index.jsp
http://localhost/mytest:8109/index.jsp
http://localhost/mytest:8209/index.jsp
http://localhost/mytest:8309/index.jsp
http://localhost/mytest:8409/index.jsp
http://localhost/mytest:8509/index.jsp
7、QA
问:如何配置多个服务器?
答:修改Apache 下httpd.conf文件;
把
<Proxy balancer://tomcatcluster>
BalancerMember ajp://localhost:8109 smax=10 route=jvm1
BalancerMember ajp://localhost:8209 smax=10 route=jvm2
BalancerMember ajp://localhost:8309 smax=10 route=jvm3
BalancerMember ajp://localhost:8409 smax=10 route=jvm4
BalancerMember ajp://localhost:8509 smax=10 route=jvm5
</Proxy>
中的localhost改成内部服务器IP地址就OK了.
问:为什么启动多个TOMCAT进程失败?
答:注意配置的TOMCAT服务各个端口是否有冲突.
问:为什么session不能保持一致?
答:需要注意以下几点:
All your session attributes must implement java.io.Serializable
If you have defined custom cluster valves, make sure you have the ReplicationValve defined as well under the Cluster element in server.xml
If your Tomcat instances are running on the same machine, make sure the tcpListenPort attribute is unique for each instance, in most cases Tomcat is smart enough to resolve this on it's own by autodetecting available ports in the range 4000-4100
Make sure your web.xml has the <distributable/> element or set at your <Context distributable="true" />
Make sure that all nodes have the same time and sync with NTP service!
Make sure that your loadbalancer is configured for sticky session mode.
1、下载和安装。
下载安装apache2.2.3,tomcat6.0.(注意设置环境变量)
2、配置Apache
修改Apache安装目录下conf/httpd.conf文件.
由
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
修改为:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
填加以下内容(注意此配置是在1台PC开多TOMCAT进程,并注意注释的格式):
# ProxyRequests Off
#
ProxyPass / balancer://tomcatcluster/ lbmethod=byrequests stickysession=JSESSIONID nofailover=Off timeout=3 maxattempts=3
###################################################################
#
# IBmethod:
# Balancer load-balance method. Select the load-balancing scheduler method to use. Either byrequests, to perform weighted request counting or bytraffic, to perform weighted traffic byte #count balancing. Default is byrequests.
#
# stickysession:
# Balancer sticky session name. The value is usually set to something like JSESSIONID or #PHPSESSIONID, and it depends on the backend application server that # support sessions.
#
# nofailover:
# If set to On the session will break if the worker is in error state or disabled. Set this value #to On if backend servers do not support session
# replication.
#
# timeout:
# Balancer timeout in seconds. If set this will be the maximum time to wait for a free worker. #Default is not to wait.
#
# maxattempts:
# Maximum number of failover attempts before giving up.
####################################################################################
ProxyPassReverse / balancer://tomcatcluster/
<Proxy balancer://tomcatcluster>
BalancerMember ajp://localhost:8109 smax=10 route=jvm1
BalancerMember ajp://localhost:8209 smax=10 route=jvm2
BalancerMember ajp://localhost:8309 smax=10 route=jvm3
BalancerMember ajp://localhost:8409 smax=10 route=jvm4
BalancerMember ajp://localhost:8509 smax=10 route=jvm5
</Proxy>
# smax:
# Upto the Soft Maximum number of connections will be created on demand. Any connections above smax are subject to a time to live or ttl.
# route:
# Route of the worker when used inside load balancer. The route is a value appended to seesion id.
注意端口号和TOMCAT配置保持一致,并避免冲突,否则启动TOMCAT将失败.
3、配置Tomcat
安装多个TOMCAT(ZIP版本,不要安装"安装版本")
修改TOMCAT安装目录下conf/server.xml
如修改tomcat_1配置
修改:
<Server port="8105" shutdown="SHUTDOWN">
修改:
<Connectorport="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8143" />
修改:
<Connectorport="8109" protocol="AJP/1.3" redirectPort="8143" />
修改:
<Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
修改另外几个tomcat文件,并避免端口冲突.如果多个TOMCAT安装在多个服务器则只要注意IP地址的正确.
4、保持Session同步
在TOMCAT安装目录conf/server.xml下的
<Engine>... </Engine>标签下填加如下内容:
- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="4">
<ManagerclassName="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" />
- <!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
- <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
- <Channel className="org.apache.catalina.tribes.group.GroupChannel">
<MembershipclassName="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000" />
<ReceiverclassName="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="4001" autoBind="100" selectorTimeout="5000" maxThreads="6" />
- <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<TransportclassName="org.apache.catalina.tribes.transport.nio.PooledParallelSender" />
</Sender>
<InterceptorclassName="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector" />
<InterceptorclassName="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor" />
</Channel>
<ValveclassName="org.apache.catalina.ha.tcp.ReplicationValve" filter="" />
<ValveclassName="org.apache.catalina.ha.session.JvmRouteBinderValve" />
<DeployerclassName="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false" />
<ClusterListenerclassName="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener" />
<ClusterListenerclassName="org.apache.catalina.ha.session.ClusterSessionListener" />
</Cluster>
#注意port="4001" 是否与其他TOMCAT进程冲突.
配置详细解释见文档"Clustering-Session Replication HOW-TO.htm"
5、修改WEB项目Web.xml
在工程项目中修改web.xml;
填加如下标签:
<distributable/>
6、Testing
打开浏览器,写一个简单的JSP,测试
http://localhost/mytest/index.jsp
http://localhost/mytest:8109/index.jsp
http://localhost/mytest:8209/index.jsp
http://localhost/mytest:8309/index.jsp
http://localhost/mytest:8409/index.jsp
http://localhost/mytest:8509/index.jsp
7、QA
问:如何配置多个服务器?
答:修改Apache 下httpd.conf文件;
把
<Proxy balancer://tomcatcluster>
BalancerMember ajp://localhost:8109 smax=10 route=jvm1
BalancerMember ajp://localhost:8209 smax=10 route=jvm2
BalancerMember ajp://localhost:8309 smax=10 route=jvm3
BalancerMember ajp://localhost:8409 smax=10 route=jvm4
BalancerMember ajp://localhost:8509 smax=10 route=jvm5
</Proxy>
中的localhost改成内部服务器IP地址就OK了.
问:为什么启动多个TOMCAT进程失败?
答:注意配置的TOMCAT服务各个端口是否有冲突.
问:为什么session不能保持一致?
答:需要注意以下几点:
All your session attributes must implement java.io.Serializable
If you have defined custom cluster valves, make sure you have the ReplicationValve defined as well under the Cluster element in server.xml
If your Tomcat instances are running on the same machine, make sure the tcpListenPort attribute is unique for each instance, in most cases Tomcat is smart enough to resolve this on it's own by autodetecting available ports in the range 4000-4100
Make sure your web.xml has the <distributable/> element or set at your <Context distributable="true" />
Make sure that all nodes have the same time and sync with NTP service!
Make sure that your loadbalancer is configured for sticky session mode.
发表评论
-
如何将tomcat控制台输出的内容直播用日志文件保存起来
2010-01-12 19:40 5826http://topic.csdn.net/u/2009111 ... -
tomcat+apache+terracotta做集群
2010-01-05 19:37 1501http://huaiyude06.iteye.com/blo ... -
Apache+tomcat集群 中文乱码问题解决方法
2009-10-09 17:00 2523http://blog.csdn.net/shaohui/ar ... -
Tomcat 在IE中下载rar文件直接以乱码方式打开解决方案
2009-08-20 14:26 1225http://taosst.iteye.com/blog/28 ... -
关于tomcat虚拟路径配置
2009-08-20 14:17 3471http://blog.sina.com.cn/s/blog_ ... -
Java 中文问题的解决 mysql, oracle, servlet, jsp
2009-05-11 17:11 1185[url]http://blog.csdn.net/ariel ... -
tomcat控制浏览器不缓存
2009-01-09 17:32 9712http://xinsync.xju.edu.cn/index ... -
tomcat根目录
2008-10-16 08:41 1764正常情况下,我们访问tomcat都是通过http://XXXX ...
相关推荐
- **Tomcat**: 选择Tomcat5.5或Tomcat6.0版本。 #### 二、Apache配置 在进行Apache配置时,主要涉及对`httpd.conf`文件的修改和`workers.properties`文件的创建。 ##### 1. httpd.conf配置 - 将`mod_jk.so`文件...
8、安装apache tomcat 6.0.. 79 9、安装flash... 81 10、Linux下安装Oracle11g服务器.... 81 11、Linux下安装tomcat和apache(tar版).... 116 12、CentOS安装apache + tomcat集群(一).... 124 12、CentOS...
1. **Tomcat版本**:Tomcat 5.5.x系列是较早的版本,尽管这里提供的不是6.0版本,但它依然体现了Tomcat的历史和发展。每个版本都包含了新的特性和改进,例如6.0版本引入了更好的管理和监控工具,以及对Java EE 5的...
在部署和使用Apache Tomcat时,开发者通常会遇到以下关键概念和操作: 1. **配置文件**:如`server.xml`和`web.xml`,它们定义了服务器的全局配置和应用程序的部署信息。 2. **部署应用**:可以通过将WAR文件或解压...
这个压缩包包含了Tomcat 6.0的不同版本,包括64位和32位,以及安装版和解压版,这对于那些需要在不同操作系统环境下运行旧项目的人来说非常有用。以下是对Tomcat 6.0的详细知识点介绍: 1. **Tomcat概述**:Tomcat...
Apache Tomcat 是一个广泛使用的开源Java Servlet容器,用于部署和运行Java Web应用程序。各个版本的Tomcat都有其特定的特性和改进,下面将详细介绍不同版本之间的主要区别。 **Apache Tomcat 9.x** Tomcat 9.x 是...