码迷,mamicode.com
首页 > 其他好文 > 详细

配置resin4多实例

时间:2018-05-07 11:06:28      阅读:511      评论:0      收藏:0      [点我收藏+]

标签:resin

Resin 运行起来后,一般有这么几个端口

  1. WatchDog 的端口,默认6600
  2. Server 监控端口,默认6800
  3. 应用的HTTP端口,默认8080
    不管有多少个应用,Resin只会启动一个WatchDog 实例。

首先Resin中每个应用会占用一个HTTP端口以及一个Server监控端口,假设有两个应用,我们分配的端口分别是:
app1:8010,6801
app2:8020,6802

下面是详细的配置:

  <cluster id="app1">

    <server-default>
        <jvm-arg>-Xms512m</jvm-arg>
        <jvm-arg>-Xmx512m</jvm-arg>
        <jvm-arg>-Xmn128m</jvm-arg>
        <jvm-arg>-XX:PermSize=64m</jvm-arg>
        <jvm-arg>-XX:MaxPermSize=128m</jvm-arg>
        <thread-max>512</thread-max>
        <socket-timeout>30s</socket-timeout>
        <keepalive-max>512</keepalive-max>
        <keepalive-timeout>60s</keepalive-timeout>
    </server-default>
    <!-- define the servers in the cluster -->
    <server-multi id-prefix="app1-" address-list="127.0.0.1" port="6801">
       <http address="192.168.30.10" port="8010"/>
    </server-multi>

    <!-- the default host, matching any host name -->
    <host id="" root-directory=".">
      <!--
         - webapps can be overridden/extended in the resin.xml
        -->
    <web-app id="/" character-encoding=‘UTF-8‘ document-directory="/data/project/app1/ROOT" archive-path="/data/project/app1/ROOT.war">
                <form-parameter-max>100</form-parameter-max>
                <stderr-log path=‘/data/logs/app1/stderr.log‘ timestamp=‘[%Y-%m-%d %H:%M:%S] ‘ rollover-period=‘1D‘/>
                <stdout-log path=‘/data/logs/app1/stdout.log‘ timestamp=‘[%Y-%m-%d %H:%M:%S] ‘ rollover-period=‘1D‘/>
        </web-app>
    </host>
  </cluster>

  <cluster id="app2">

    <server-default>
        <jvm-arg>-Xms512m</jvm-arg>
        <jvm-arg>-Xmx512m</jvm-arg>
        <jvm-arg>-Xmn128m</jvm-arg>
        <jvm-arg>-XX:PermSize=64m</jvm-arg>
        <jvm-arg>-XX:MaxPermSize=128m</jvm-arg>
        <thread-max>512</thread-max>
        <socket-timeout>30s</socket-timeout>
        <keepalive-max>512</keepalive-max>
        <keepalive-timeout>60s</keepalive-timeout>
    </server-default>

    <server-multi id-prefix="app2-" address-list="127.0.0.1" port="6802">
       <http address="192.168.30.10" port="8020"/>
    </server-multi>

    <host id="" root-directory=".">
      <!--
                    - webapps can be overridden/extended in the resin.xml
        -->
    <web-app id="/" character-encoding=‘UTF-8‘ document-directory="/data/project/app2/ROOT" archive-path="/data/project/app2/ROOT.war">
                <form-parameter-max>100</form-parameter-max>
                <stderr-log path=‘/data/logs/app2/stderr.log‘ timestamp=‘[%Y-%m-%d %H:%M:%S] ‘ rollover-period=‘1D‘/>
                <stdout-log path=‘/data/logs/app2/stdout.log‘ timestamp=‘[%Y-%m-%d %H:%M:%S] ‘ rollover-period=‘1D‘/>
        </web-app>
     </host>
  </cluster>

上面的配置中,我们为每个应用分配一个唯一的 server id,分别是 app1 和 app2
要启动这两个应用,命令文件在resin的bin目录中

resin.sh start -server app1-0  
resin.sh start -server app2-0  

停止命令:

resin.sh stop -server app1-0  
resin.sh stop -server app2-0  

配置resin4多实例

标签:resin

原文地址:http://blog.51cto.com/qiangsh/2113423

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!