resin 4配置多应用

时间:2022-07-23 17:53:09

Resin配置多个应用,每个应用需要有独立的http端口,独立的Server监控端口。共享同一个WatchDog。

相关端口如下:

  • app1:8010,6801
     
  • app2:8020,6802
     
  • WatchDog:默认6600
     

在resin.xml配置多个cluster

  <cluster >
    <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="127.0.0.1" port="8010"/>
    </server-multi>
    <!-- the default host, matching any host name -->
    <host id="" root-directory=".">
    <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 >
    <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="127.0.0.1" port="8020"/>
    </server-multi>
    <host id="" root-directory=".">
    <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.sh start -server app1-0

resin.sh start -server app2-0

停止:

resin.sh stop -server app1-0

resin.sh stop -server app2-0