<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Tomcat多實例及集群架構 [TOC] ## 一、 多實例部署 ### 1. 方法說明 tomcat的多實例很簡單,就是把主文件加多復制積分,然后修改配置文件中的端口號即可,并且可以將做好的多實例程序打包,然后在其他電腦上解壓后直接用即可 ### 2. 多實例創建 1)復制Tomcat目錄 ```sh cd /app/ cp -a apache-tomcat-8.0.27 tomcat8_1 cp -a apache-tomcat-8.0.27 tomcat8_2 ``` 2)修改配置文件 ```sh sed -i 's#8005#8011#;s#8080#8081#' tomcat8_1/conf/server.xml sed -i 's#8005#8012#;s#8080#8082#' tomcat8_2/conf/server.xml ``` 然后將以上實例打包,以后就可以用在其他地方了,命令如下 ```sh tar zcf tomcat_muti.tar.gz ./tomcat8_1/ ./tomcat8_2/ ``` 3)創建實例的測試網頁 ```sh echo 8081 >>/app/tomcat8_1/webapps/ROOT/index.jsp echo 8082 >>/app/tomcat8_2/webapps/ROOT/index.jsp ``` 4)啟動多實例 ```sh /app/tomcat8_1/bin/startup.sh /app/tomcat8_2/bin/startup.sh netstat -tunlp|grep java ``` 瀏覽器可以分別訪問如下地址驗證配置結果 http://10.0.0.3:8081/index.jsp http://10.0.0.3:8082/index.jsp ## 二、Tomcat與nginx集群 使用nginx做反向代理,Tomcat多實例做web應用,可以實現Tomcat反向代理集群,編輯nginx配置文件 注意看`upstream`和`location`處的修改 ```sh cat >/etc/nginx/nginx.conf <<'EOF' worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream web_pools { server 10.0.0.3:8081; server 10.0.0.3:8082; } server { listen 80; server_name localhost; location / { root html; index index.jsp index.html index.htm; proxy_pass http://web_pools; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } EOF ``` 重啟nginx后瀏覽器可以訪問http://10.0.0.3/index.jsp
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看