【高可用HA】Apache (2) —— Mac下安裝多個Apache Tomcat例項

Richaaaard發表於2015-12-08

Mac 下安裝多個Apache Tomcat例項

tomcat版本:tomcat-8.0.29


參考來源:

Installing Tomcat 7.0.x on OS X

在mac系統安裝Apache Tomcat的詳細步驟

安裝

官網下載Tomcat

這裡選擇的是"apache-tomcat-8.0.29"讀者可以自行選擇。

將“apache-tomcat-8.0.29.zip”解壓到自定義目錄"./servers/cluster/tomcat/"下,並複製出兩個備份"./tomcat/node-a"和"./tomcat/node-b"

配置

  • node-a

    修改"./tomcat/node-a"的server.xml配置檔案,注意有三個地方都需要修改

  • 預設Server Port

      <Server port="8005" shutdown="SHUTDOWN">

    修改成

      <Server port="8015" shutdown="SHUTDOWN">
  • 預設Connector

      <Connector port="8080" protocol="HTTP/1.1"
             connectionTimeout="20000"
             redirectPort="8443" />

    修改成

      <Connector port="8081" protocol="HTTP/1.1"
             connectionTimeout="20000"
             redirectPort="8443" />
  • 預設AJP

      <!-- Define an AJP 1.3 Connector on port 8009 -->
      <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> 

    修改成

      <!-- Define an AJP 1.3 Connector on port 8009 -->
      <Connector port="8019" protocol="AJP/1.3" redirectPort="8443" />
  • 預設Tomcat首頁

      "./servers/cluster/tomcat/node-a/webapps/ROOT/index.jsp" 

    將主題資訊修改成:

      <div id="congrats" class="curved container">
          <h2>If you're seeing this, you've successfully installed Tomcat. Congratulations! Node - A!!</h2>
      </div>

同理對於

  • node-b

分別修改Server/Connector/AJP對應的埠依次為 8025|8082|8029

  • 預設Tomcat首頁,將主題資訊修改成:

      <div id="congrats" class="curved container">
          <h2>If you're seeing this, you've successfully installed Tomcat. Congratulations! Node - B!!</h2>
      </div>

測試

通過瀏覽器分別訪問

http://localhost:8081/

【高可用HA】Apache (2) —— Mac下安裝多個Apache Tomcat例項

http://localhost:8082/              
           

【高可用HA】Apache (2) —— Mac下安裝多個Apache Tomcat例項

這樣多個Tomcat的例項就配置完成

相關文章