配置resin4多实例
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置resin4多实例相关的知识,希望对你有一定的参考价值。
Resin 运行起来后,一般有这么几个端口- WatchDog 的端口,默认6600
- Server 监控端口,默认6800
- 应用的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多实例的主要内容,如果未能解决你的问题,请参考以下文章