zoukankan      html  css  js  c++  java
  • windows系统下同时启动三台Tomcat服务的配置&并设置开机启动服务

    1.tomcat 7.0.82下载地址:链接:https://pan.baidu.com/s/1i51pAgl 密码:mxol

    2.解压apache-tomcat-7.0.82-windows-x64.zip 到英文路径下

    3.重命名文件夹为tomcat7-9000,复制两份,分别重命名为tomcat7-9001,tomcat7-9002

    (端口号的选择:

      查看端口是否被占用:cmd----netstat -ano | findstr "80" (注80是你想要看查看的端口号)

    )

    4.添加环境变量:计算机--属性--高级设置--环境变量--添加系统环境变量

      CATALINA_HOME_9000,其值为:D: omcat7-9000;

           CATALINA_HOME_9001,其值为:D: omcat7-9001;

           CATALINA_HOME_9002,其值为:D: omcat7-9002;
    5.修改启动端口,运行端口和关闭端口:
      1)以9000端口为例,分别进入对应的conf目录下,打开server.xml进行修改,标红处
      
    <?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="8006" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
      <!-- 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="9000" 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 BIO implementation that requires the JSSE
             style configuration. When using the APR/native implementation, the
             OpenSSL style configuration is required as described in the APR/native
             documentation -->
        <!--
        <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
                   maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS" />
        -->
    
        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="8010" 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" jvmRoute="jvm1">
        -->
        <Engine name="Catalina" defaultHost="localhost">
    
          <!--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"/>
          -->
    
          <!-- 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 &quot;%r&quot; %s %b" />
    
          </Host>
        </Engine>
      </Service>
    </Server>

       2)修改startup.bat、shutdown.bat和catalina.bat文件内容:

        (1) 打开D: omcat7-9000instartup.bat文件,把其中所有CATALINA_HOME替换为CATALINA_HOME_9000。

        (2) 打开D: omcat7-9000inshutdown.bat文件,把其中所有CATALINA_HOME替换为CATALINA_HOME_9000。

        (3) 打开D: omcat7-9000incatalina.bat文件,把其中所有CATALINA_HOME替换为CATALINA_HOME_9000。

     6. tomcat7-9001,tomcat7-9002 同上

    配置为服务开机启动
    1.以管理员方式打开cmd
    2.进入到对应tomcat的bin目录下,如:D:serversxxtz omcat7-WZXT-9000in
    3.执行语句  
    service remove tomcat7-WZXT-9000 & service install tomcat7-WZXT-9000 & sc config tomcat7-WZXT-9000 start= auto
    4.查看管理--服务-

       


    参考:https://www.cnblogs.com/wryu/p/7327298.html 

  • 相关阅读:
    VS 2010 C#入门操作小技巧
    spring-data-jpa 多数据源
    Spring--3.Spring的单元测试
    Spring--5.IOC总结
    Spring--4.实验23.IOC容器的测试泛型依赖注入*
    Spring--2.Spring之IOC--IOC容器的22个实验(3)
    Spring--2.Spring之IOC--IOC容器的22个实验(2)
    Spring--2.Spring之IOC--IOC容器的22个实验(1)
    Spring--2.Spring之IOC--了解IOC容器
    Spring--1.了解Spring
  • 原文地址:https://www.cnblogs.com/ccEmma/p/8085242.html
Copyright © 2011-2022 走看看