- 浏览: 740369 次
- 性别:
- 来自: 重庆
文章分类
- 全部博客 (194)
- Webservice (6)
- ExtJs (2)
- Work Summary (4)
- CoreJava (51)
- Spring (10)
- EJB (5)
- struts1.x (3)
- C/C++ (5)
- DatabaseManager (19)
- Hibernate (5)
- Crytology (1)
- Web Server (5)
- Software Manager (5)
- WebUi (39)
- Web page (2)
- android (5)
- struts2 (12)
- Java 导出 Excel (1)
- Spring 与struts2 和Hibernate 4.0注解解决方安 (1)
- Dwr (1)
- maven3 (4)
- Windows (3)
- 表格头部信息不动使用Jquery 外部框架 (1)
- 软件行业动态 (1)
- mybatis (1)
- C# (3)
- MySQL (4)
最新评论
-
July01:
最近了解到一款StratoIO打印控件,功能如下:1、Html ...
LODOP插件开发 -
an52036:
u010980147 写道您的代码确实能生成条形码,但是打印出 ...
Java 条形码生成(一维条形码) -
di1984HIT:
学习了,很好~~
Ant 打包war 生成文件内容build.xml -
lhb319lhb:
如果 ajax(jquery)更新了 iframe 的 src ...
jquery 修改iframe src -
calosteward:
感谢楼主,除了一维条码,有没有相关二维码的资源呢?______ ...
Java 条形码生成(一维条形码)
1.背景介绍
集群服务在企业组织部署关键业务、电子商务与商务流程应用起到了日益重要的作用。
集群指的是在一组运行相同的应用系统并向客户端和应用系统呈现统一系统的计算机。 计算机通过缆线完成连接,并通过集群软件实现程序上的连接。这些连接使计算机能够使用单机无法实现的容错和负载均衡。
2. 原理价绍
(apache http)balancer ----tomcat1
----tomcat2
....................................x
tomcat n + 1
在这里我们选择了 apache 2.2 + tomcat 7.0
3.1来配置tomcat 的集群
在conf 目录下打开httpd.conf 文件
找到去掉注释
####liuqing update 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 ####liuqing update end
1 LoadModule proxy_module modules/mod_proxy.so
这是因为我们这里要用到负载均衡 要反向代理调用
2 LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
apache 与tomcat 要使ajp 协议通讯
3 LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
添加负载均衡功能
4 LoadModule proxy_connect_module modules/mod_proxy_connect.so
添加连接代理
5 LoadModule proxy_ftp_module module/mod_proxy_ftp.so
添国ftp 功能
6 LoadModule proxy_http_module modules/mod_proxy_http.so
添加http 功能
3.2在向下拉
找到#Include conf/extra/httpd-vhosts.conf
打开Virtual hosts 功能
因为在这里要实现这个功能 apache === > tomcat x ... tomcat n
在到文件最后面加入
在前面以经配置好了host 我们在这里需要
配置VirtualHost 对应的端口号
ServerAdmin 管理员电邮
ServerName 服务器名字
ServerAlias 别名
ProxyPass 定义负载均衡对应集群
ErrorLog和CustomLog 对的两个日志
<VirtualHost *:7070> ServerAdmin mianhuaman@yahoo.com.cn ServerName 127.0.0.1 ServerAlias localhost ProxyPass / balancer://cluster/ stickysession=jsessionid nofailover=On ProxyPassReverse / balancer://cluster/ ErrorLog "logs/lbtest-error.log" CustomLog "logs/lbtest-access.log" common </VirtualHost>
最后我们要添加tomcat 对应的集群结点
3.3同样在文档的最后面加入ajp 结点地址
ProxyRequests Off <proxy balancer://cluster> BalancerMember ajp://127.0.0.1:2009 loadfactor=1 route=jvm1 BalancerMember ajp://127.0.0.1:8009 loadfactor=1 route=jvm2 BalancerMember ajp://192.168.0.108:9009 loadfactor=1 route=jvm3 </proxy>
4.1 配置tomcat 的内容用最简单的方法 如要知详细内容以参考Tomcat 文档(说明是)
修改tomcat 的server.xml 文件
启动后测试OK
<?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> <Server port="8005" shutdown="SHUTDOWN"> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> <Listener className="org.apache.catalina.core.JasperListener" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="2020" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="2443" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation --> <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost"> --> <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm2"> <!--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"> <Manager className="org.apache.catalina.ha.session.BackupManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" mapSendOptions="6"/> <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000"/> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="4000" selectorTimeout="100" maxThreads="6"/> <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/> </Sender> <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/> </Channel> <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=".*\.gif|.*\.js|.*\.jpeg|.*\.jpg|.*\.png|.*\.htm|.*\.html|.*\.css|.*\.txt"/> <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false"/> <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/> </Cluster> <!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --> <Realm className="org.apache.catalina.realm.LockOutRealm"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/> </Host> </Engine> </Service> </Server>
tomcat2 configuration
<?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> <Server port="2005" shutdown="SHUTDOWN"> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> <Listener className="org.apache.catalina.core.JasperListener" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation --> <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="2009" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost"> --> <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> <!--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"> <Manager className="org.apache.catalina.ha.session.BackupManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" mapSendOptions="6"/> <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000"/> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="4001" selectorTimeout="100" maxThreads="6"/> <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/> </Sender> <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/> </Channel> <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=".*\.gif|.*\.js|.*\.jpeg|.*\.jpg|.*\.png|.*\.htm|.*\.html|.*\.css|.*\.txt"/> <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false"/> <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/> </Cluster> <!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --> <Realm className="org.apache.catalina.realm.LockOutRealm"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/> </Host> </Engine> </Service> </Server>
发表评论
-
设内存参数
2011-05-20 16:32 1009set JAVA_OPTS=-Xms1024 -Xmx1024 ... -
Tomcat 配置https SSL 认证
2010-12-28 09:09 17641.在介绍过SSL 协议之后我们来实践一下,在Tomcat 中 ... -
EJB3 + GlassFish version 3
2010-11-19 15:14 3897开发环境NetBeans 6.9.1 step 1: ... -
Tomcat configuration DataSource
2010-10-12 13:18 23051. configuration MySql Connecti ...
相关推荐
apache-tomcat-7.0.109安装包(含windows和linux版本).zip包含如下内容: apache-tomcat-7.0.109-windows-x64.zip; apache-tomcat-7.0.109-windows-x86.zip; apache-tomcat-7.0.109.exe; apache-tomcat-7.0.109....
Apache Tomcat 7.0.100 是一个流行的开源软件,用以部署和运行Java Servlet和JavaServer Pages(JSP)应用程序。它是Apache Software Foundation维护的Tomcat服务器的一个版本,专为64位Windows操作系统设计。这个...
Apache Tomcat 7.0.109是Tomcat服务器的一个特定版本,它是一个开源软件应用服务器,专门用于运行Java Servlets和JavaServer Pages(JSP)。Tomcat是由Apache Software Foundation开发并维护的,它是Java EE(现在...
古董版,Tomcat 7.0,官网已经下不到了,需要自取
Apache Tomcat 7.0.106 是一个开源的Java Servlet容器,它实现了Java Servlet和JavaServer Pages(JSP)规范,使开发者能够构建和部署动态Web应用程序。这个版本适用于Windows 64位操作系统,这意味着它已经被优化以...
Apache Tomcat 7.0.100 是一个开源的Java Servlet容器,它实现了Java EE Web应用程序的规范,包括Servlet、JSP(JavaServer Pages)和EL(Expression Language)。这个版本是Tomcat 7系列的一个特定发行版,可能包含...
在解压"apache-tomcat-7.0.108"后,你会得到包括bin、conf、lib、logs、webapps、work等目录,每个目录都有特定的作用,比如bin目录用于存放可执行脚本,conf目录存储服务器配置文件,lib包含运行所需JAR库,webapps...
在Linux系统中,`apache-tomcat-7.0.100.tar.gz` 是一个归档文件,通常用于在类Unix系统中分发软件。你需要使用`tar`命令来解压,然后将Tomcat添加到系统路径,以便能够执行其二进制文件。与Windows版本类似,Linux...
总的来说,“apache-tomcat-7.0.105.zip”是一个用于部署和运行Java Web应用程序的服务器软件包,它的使用和配置涉及到Java Servlet、JSP、网络编程等多个IT领域的知识。理解并掌握Tomcat的配置和管理对于Java Web...
Apache Tomcat是一个开源的Java Servlet容器,主要用于实现Java Web应用程序的部署。在这个"apache-tomcat-7.0.100.tar.gz"压缩包中,我们拥有的是Tomcat的7.0.100版本,这是一个适用于Linux操作系统的发布版。这个...
Apache Tomcat是一个开源的软件应用服务器,主要用于部署和运行Java Servlet和JavaServer Pages(JSP)应用程序。在本文中,我们将深入探讨与"Apache-tomcat-7.0.109-Windows-x64"相关的知识,包括Tomcat的概述、...
部署和使用Apache Tomcat 7.0.104,你需要根据你的Linux系统配置环境变量,如CATALINA_HOME指向Tomcat的安装目录,然后通过bin目录下的脚本启动服务。同时,根据你的应用需求,可能还需要修改conf目录下的配置文件,...
Apache Tomcat 7.0.109 是一个流行的开源Java Servlet容器,它实现了Java EE Web应用程序的规范,包括Servlet、JSP(JavaServer Pages)和EL(Expression Language)。这个版本是面向Windows 64位操作系统的。在本文...
apache-tomcat-7.0.99安装包(含windows和linux版本).zip包含如下内容: apache-tomcat-7.0.99-windows-x64.zip; apache-tomcat-7.0.99-windows-x86.zip; apache-tomcat-7.0.99.exe; apache-tomcat-7.0.99.tar....
标题中的"tomcat-7.0.108.zip"是一个Tomcat服务器的特定版本,...总的来说,Apache Tomcat 7.0.108是一个用于开发和测试Java web应用的重要工具,通过理解它的部署和运行机制,开发者可以有效地管理他们的web应用程序。
Apache Tomcat是一款开源的Java Servlet容器,主要用于部署和运行Java Web应用程序。它是基于Sun Microsystems的Java Servlet和JavaServer Pages(JSP)技术的。在本压缩包“apache-tomcat-7.0.105.zip”中,你将...
Apache Tomcat 7是Apache软件基金会的一个开源项目,专门用于实现Java Servlet和JavaServer Pages(JSP)技术的标准,以及Java EE的Web应用程序部署。这个最新版本,即7.0.109,包含了对先前版本的改进和修复,旨在...
6. **目录结构变更**:与早期版本相比,Tomcat 7.0的默认目录结构有所改变,例如`conf/Catalina/localhost`下用于存放每个虚拟主机的配置文件,这提高了多应用部署的灵活性。 7. **增强的部署功能**:通过`WEB-INF/...
在压缩包中,"Apache Tomcat7.0 v7.0.52 官方64位版_386w.com" 包含了Tomcat的完整安装文件,用户可以通过解压后按照指定步骤进行安装。主要目录包括: - **bin**: 包含启动和停止Tomcat的脚本。 - **conf**: 存放...