`

apache+mod_jk+tomcat安装配置指南(二)

阅读更多

第一步:

编辑/opt/app/apache-boss/conf/workers.properties

 

worker.list=boss,mystatus


  worker.boss-a.port=8009
  worker.boss-a.host=192.168.0.161
  worker.boss-a.domain=boss-a
  worker.boss-a.type=ajp13
  worker.boss-a.lbfactor=20
  worker.boss-a.max_packet_size=65536
  worker.boss-a.connection_pool_timeout=600
  worker.boss-a.connection_pool_size=50
  worker.boss-a.connection_pool_minsize=40
  worker.boss-a.connect_timeout=5000
  worker.boss-a.prepost_timeout=5000
  worker.boss-a.socket_timeout=5
  worker.boss-a.retries=10

  worker.boss-a-1.reference=worker.boss-a
  worker.boss-a-1.port=9009
  worker.boss-a-1.host=192.168.0.161
  worker.boss-a-1.domain=boss-a

  worker.boss-b.reference=worker.boss-a
  worker.boss-b.port=10009
  worker.boss-b.host=192.168.0.161
  worker.boss-b.domain=boss-b

  worker.boss-b-1.reference=worker.boss-a
  worker.boss-b-1.port=11009
  worker.boss-b-1.host=192.168.0.161
  worker.boss-b-1.domain=boss-b

  worker.boss-c.reference=worker.boss-a
  worker.boss-c.port=8009
  worker.boss-c.host=192.168.0.163
  worker.boss-c.domain=boss-c

  worker.boss-c-1.reference=worker.boss-a
  worker.boss-c-1.port=9009
worker.boss-c-1.host=192.168.0.163
  worker.boss-c-1.domain=boss-c

  worker.boss-d.reference=worker.boss-a
  worker.boss-d.port=10009
  worker.boss-d.host=192.168.0.163
  worker.boss-d.domain=boss-d

  worker.boss-d-1.reference=worker.boss-a
  worker.boss-d-1.port=11009
  worker.boss-d-1.host=192.168.0.163
  worker.boss-d-1.domain=boss-d
  


  worker.boss.type=lb
  worker.boss.method=B
  worker.boss.balance_workers=boss-a,boss-b
  worker.boss.sticky_session=1
  worker.boss.sticky_session_force=0
  worker.mystatus.type=status
  worker.mystatus.read_only=True
  worker.mystatus.mount=/mystatus

 第二步:编辑boss-uriworkermap.properties

!/*.gif=boss
!/*.css=boss
!/scripts/*=boss
!/dwr/engine.js=boss
!/dwr/util.js=boss
!/*.jpg=boss
!/*.jpeg=boss
!/*.htm=boss
!/textEdit/*.js=boss
!/js/*=boss
!/*.ico=boss
!/*.dll=boss
!/*.bmp=boss
!/*.pgn=boss
!/*.tgz=boss
!/*.mp3=boss
/mystatus=mystatus
/*=boss

 第三步:

修改tomcat配置

/opt/app/tomcat-boss-a/bin/catalina.sh

加上以下:

JAVA_HOME=/opt/app/java
#-Xms1024m -Xmx1024m -Xmn500m -XX:+UseConcMarkSweepGC   -XX:MaxTenuringThreshold=5  -XX:+ExplicitGCInvokesConcurrent
JAVA_OPTS='-server -Xms2560m -Xmx2560m -Xmn768m -XX:PermSize=128m -XX:MaxPermSize=256m -Xss256k -XX:ParallelGCThreads=6 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:MaxTenuringThreshold=5 -XX:SurvivorRatio=6 -verbose:gc -XX:+HeapDumpOnOutOfMemoryError -Xloggc:/var/log/boss/gc-a.log -Djava.awt.headless=true -XX:+DisableExplicitGC -Dlog.home=/var/log/boss/boss-a -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false'

 /opt/app/tomcat-boss-a/conf/server.xml

<?xml version='1.0' encoding='utf-8'?>
<!-- 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">

  <!--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" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

  <!-- 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>

  <Service name="Catalina">
  
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 
        maxThreads="150" minSpareThreads="4"/>
    -->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 
        maxThreads="500" minSpareThreads="100"/>
-->
 <!-- Define an AJP 1.3 Connector on port 8009 -->
<!--
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
-->
<Connector address="192.168.0.161" port="8009"
               maxThreads="500"  backlog="50" connectionTimeout="600000" packetSize="65536" keepAliveTimeout="600000"
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" URIEncoding="UTF-8" />
<!--
<Connector address="192.168.0.161" port="9009"
               executor="tomcatThreadPool"
               maxThreads="800"  backlog="200" connectionTimeout="20000" packetSize="65536" keepAliveTimeout="600000"
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" URIEncoding="UTF-8" />
-->



    <Engine name="Catalina"  defaultHost="boss.xxx.com" jvmRoute="boss-a">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->

<Host name="boss.xx.com"  appBase="/dev/null"
            unpackWARs="false" autoDeploy="false"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- 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 -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/opt/log/tomcat-a-log"  
               prefix="tomcat-a-access." suffix=".log" pattern="combined" resolveHosts="false"/>


<Context path="" docBase="/opt/webapps/boss" 
         privileged="true" reloadable="false" antiResourceLocking="false" antiJARLocking="false">

<!--
<Manager className="org.apache.catalina.session.PersistentManager" >
saveOnRestart="true"
maxActiveSessions="-1"
minIdleSwap="-1"
maxIdleBackup="-1"
<Store className="org.apache.catalina.session.JDBCStore"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.0.xx/xx?user=session&amp;password=xx77&amp;useUnicode=true&amp;characterEncodeing=utf-8"
sessionTable="tomcat_sessions"
sessionIdCol="session_id"
sessionDataCol="session_data"
sessionValidCol="valid_session"
sessionMaxInactiveCol="max_inactive"
sessionLastAccessedCol="last_access"
sessionAppCol="app_name"
/>

</Manager>

-->

</Context>


      </Host>
    </Engine>
  </Service>
</Server>
 

请根据自己情况做出相应修改

同样设置tomcat-b

0
0
分享到:
评论

相关推荐

    apache+tomcat+mod_jk

    apache+tomcat+mod_jk整合文档,内有安装包。apache+tomcat+mod_jk整合文档,内有安装包。

    Apache+mod_jk+Tomcat负载均衡配置

    ### Apache+mod_jk+Tomcat负载均衡配置详解 #### 一、背景介绍 随着互联网技术的迅猛发展,单一服务器已经难以满足日益增长的服务需求。负载均衡技术应运而生,成为提高服务可用性和扩展性的关键手段之一。本文将...

    Apache+Tomcat+mod_jk+mod_ssl配置笔记

    在配置Apache与Tomcat的连接时,我们需要在httpd.conf中添加mod_jk的配置,例如启用mod_jk模块,设置worker定义(这将在workers.properties文件中详细描述)以及虚拟主机或路径的重定向规则。 接下来,workers....

    Apache + mod_jk + tomcat(64)

    4. 配置mod_jk:解压tomcat-connectors-1.2.39-windows-x86_64-httpd-2.4.x.zip,将mod_jk.dll复制到Apache的modules目录,并创建worker.properties和jk.conf文件,定义Tomcat实例(workers)和负载均衡策略。...

    apache + tomcat + mod_jk集群

    3. **安装mod_jk**:对于Apache,你需要下载mod_jk模块的源码或预编译二进制文件。在Windows上,可以通过安装APR库和编译mod_jk,而在Linux上,可以使用包管理器如apt或yum来安装。 4. **配置mod_jk**:在Apache的...

    tomcat集群-Apache2.2.4+And+mod_jk.so+tomcat配置文件

    总结来说,"tomcat集群-Apache2.2.4+And+mod_jk.so+tomcat配置文件"的配置涉及到多个步骤,包括Apache和Tomcat的安装、mod_jk模块的集成、配置文件的修改以及负载均衡策略的设定。这个过程对于构建高可用、高性能的...

    apache2.4 +tomcat7+mod_jk.so 完美整合实例

    Apache 2.4、Tomcat 7 和 mod_jk.so 的整合是将 Apache 作为前端服务器,用于处理静态内容和反向代理,而 Tomcat 作为后端应用服务器,主要负责处理 Java Servlet 和 JSP。这种架构组合可以充分利用 Apache 的高性能...

    RedHat_linux+apache+tomcat+mod_jk_负载均衡安装说明

    通过以上步骤,我们完成了在 Red Hat Linux 9.0 上安装 Apache、Tomcat 和 Mod_jk 的过程,并进行了简单的负载均衡配置。这些配置能够帮助我们更好地管理应用服务器集群,提高系统的稳定性和性能。当然,实际部署时...

    mod_jk各个版本 apache与tomcat 整合

    ### mod_jk 各个版本及 Apache 与 Tomcat 的整合方法 在 IT 行业中,Apache 和 Tomcat 的整合是非常常见的需求之一。通过使用 mod_jk 这一模块,我们可以实现 Apache 和 Tomcat 之间的高效通信。mod_jk 是一个负载...

    apache2.2+mod_jk

    本压缩包包含 httpd-2.2.25-win32-x86-openssl-0.9.8y.msi 和mod_jk-apache-2.2.2 经测试 apache+tomcat整合成功(tomcat为7.042)操作系统为Windows 2008 SP2

    Tomcat+apache+mod_jk实现负载均衡和集群配置

    总之,利用Apache+Tomcat+mod_jk实现的负载均衡和集群配置是一种常见的Web服务器解决方案,它提供了一种灵活、可扩展的方式,以应对高并发访问和服务器故障的情况。在实际部署中,还需要考虑监控、性能调优以及安全...

    apache2.4+tomcat7+mod_jk.so_整合配置

    Apache 2.4 和 Tomcat 7 的整合配置主要依赖于 mod_jk 模块,这是一个 Apache HTTP 服务器的模块,用于与 Tomcat 进行负载均衡和通信。`mod_jk.so` 是该模块的动态链接库文件,用于在 Apache 和 Tomcat 之间建立连接...

    Apache2.4服务器+mod_jk.so

    4. **配置mod_jk**:创建一个新的配置文件,例如`workers.properties`,定义Apache与Tomcat之间的连接。在该文件中,我们会指定Tomcat实例的IP地址、端口以及工作线程数等信息。 5. **配置虚拟主机**:在`httpd-...

    Apache2.2.25 + Tomcat6.0.45 + mod_jk + 测试页面 + 集群

    本资源包含了文章Apache2.2.x + Tomcat6.x + JK 集群配置,http://blog.csdn.net/qq396229783/article/details/74295797里面所用到的软件配置

    Tomcat+Apache+JK集群

    【标题】"Tomcat+Apache+JK集群"指的是在Web服务器架构中,通过Apache HTTP Server与Tomcat应用服务器结合,并利用JK模块实现负载均衡和高可用性的集群部署方式。这种方式可以提升系统的性能和稳定性,应对高并发...

    apache2 通过mod_jk与tomcat配置

    本篇文章将详细介绍如何在Ubuntu 10.04系统环境下,配置Apache2通过mod_jk连接到Tomcat 6.0.24。 首先,确保你已经安装了Apache2和Tomcat。在Ubuntu上,可以通过以下命令安装: ```bash sudo apt-get update sudo ...

    两台服务器上做Apache2.2+Tomcat6.0+mod_jk的负载均衡

    5. **安装与配置**:首先,需要在两台服务器上分别安装Apache和Tomcat。然后,下载并编译mod_jk模块,将其加载到Apache配置中。接着,配置mod_jk的工作进程(workers.properties)文件,指定Tomcat实例的地址和端口...

    Apache 2.2.15+mod_jk

    3. **配置mod_jk**:在Apache的配置文件httpd.conf中,需要加载mod_jk模块,通过`LoadModule jk_module modules/mod_jk.so`指令。然后,定义JK工作模式,例如使用`JkWorkersFile /path/to/workers.properties`来指定...

Global site tag (gtag.js) - Google Analytics