- 浏览: 1026658 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (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 5759http://topic.csdn.net/u/2009111 ... -
tomcat+apache+terracotta做集群
2010-01-05 19:37 1456http://huaiyude06.iteye.com/blo ... -
Apache+tomcat集群 中文乱码问题解决方法
2009-10-09 17:00 2477http://blog.csdn.net/shaohui/ar ... -
Tomcat 在IE中下载rar文件直接以乱码方式打开解决方案
2009-08-20 14:26 1175http://taosst.iteye.com/blog/28 ... -
关于tomcat虚拟路径配置
2009-08-20 14:17 3420http://blog.sina.com.cn/s/blog_ ... -
Java 中文问题的解决 mysql, oracle, servlet, jsp
2009-05-11 17:11 1150[url]http://blog.csdn.net/ariel ... -
tomcat控制浏览器不缓存
2009-01-09 17:32 9616http://xinsync.xju.edu.cn/index ... -
tomcat根目录
2008-10-16 08:41 1710正常情况下,我们访问tomcat都是通过http://XXXX ...
相关推荐
Apache 2.2 + Tomcat 6.0 + MySQL 5.0 + mod_jk 整合
apache2.2+tomcat6.0.doc负载均衡教程
Apache2.2+tomcat6.0配置[归类].pdf
直接下载, 即可用 apache2.4+tomcat 7 集群配置
apache2.2.4+tomcat6.0+jdk7.0进行web服务器的整合配置,文档包含了连接mod-jk-2.2.4.so以及详细的配置步骤和配置文档参考!
apache2.4+tomcat7集群,是在win7环境下的单机垂直集群。
下载后直接解压,里面有说明,安装步骤来,如果还不行,就到apache官网上下载最新的isapi_redirect.dll
Apache2.4+Tomcat8.0集群安装--测试项目。集群配置地址为:
这是本人原创整理的文档。包括apache的安装配置,tomcat的配置,热备份,配置均衡算法,webservice集群配置
NULL 博文链接:https://mlaaalm.iteye.com/blog/681463
apache充当代理服务器,配置多个tomcat,提高访问量
Apache2.4+tomcat7集群: Apache HTTP server2.4_X64 +Tomcat7_X64 +mod_jk_2.0.46.so所有文件和说明书都有了
Apache2.4 + Tomcat 6.0 集群部署 64位-附件资源