resin3.16集群 resin3单机集群

2009-06-11 23:32

以下内容仅仅是集群改了一个java启动参数,但是没有测试也没有调优,所以请大家不要用此来配制生产机.
各参数需要自己去衡量配置.
前端配置文件:resin-web.xml

<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="http://caucho.com/ns/resin/core">
<class-loader>
    <tree-loader path="${resin.home}/ext-lib"/>
    <tree-loader path="${resin.root}/ext-lib"/>

    <tree-loader path="${resin.home}/lib"/>
    <tree-loader path="${resin.root}/lib"/>
</class-loader>

<management path="${resin.root}/admin">
    <user name="admin" password="password" disable="true"/>
<!--这里在win里集群时,如果改变上面的admin,user就出报 watchdog start authentication failure 错,但是重启前端的服务就没有问题了.-->
    <user name="resin" password="q+lkj238932+yY5Pqg=="/>

    <resin:if test="${resin.professional}">
      <deploy-service/>
      <jmx-service/>
      <log-service/>
      <xa-log-service/>
    </resin:if>
</management>
<log name="" level="all" path="og/stdout.log"
    archive-format="%Y-%m-%d.stdout.log.zip"
       timestamp="[%H:%M:%S.%s] {%{thread}} "
    rollover-period="1W"/>

<logger name="com.caucho" level="info"/>

<logger name="com.caucho.java" level="config"/>
<logger name="com.caucho.loader" level="config"/>
<dependency-check-interval>2s</dependency-check-interval>

<system-property mail.smtp.host="127.0.0.1"/>
<system-property mail.smtp.port="25"/>

<character-encoding>utf-8</character-encoding>
<javac compiler="internal" args="-source 1.5"/>

<cluster id="app-tier">
    <!-- sets the content root for the cluster, relative to server.root -->
    <root-directory>.</root-directory>

    <server-default>
      <http address="*" port="80"/>

      <jvm-arg>-Xmx256m</jvm-arg>
      <jvm-arg>-Xss1m</jvm-arg>
      <jvm-arg>-Xdebug</jvm-arg>
      <jvm-arg>-XX:PermSize=64m</jvm-arg>
    <jvm-arg>-XX:MaxNewSize=128m</jvm-arg>
    <jvm-arg>-XX:MaxPermSize=128m</jvm-arg>
    <jvm-arg>-Djava.awt.headless=true</jvm-arg>
      <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
      <watchdog-jvm-arg>-Dcom.sun.management.jmxremote</watchdog-jvm-arg>
      <watchdog-port>6600</watchdog-port>
      <memory-free-min>1M</memory-free-min>
      <thread-max>256</thread-max>
      <socket-timeout>65s</socket-timeout>
      <keepalive-max>128</keepalive-max>
      <keepalive-timeout>15s</keepalive-timeout>
    </server-default>
   <server id="a" address="127.0.0.1" port="6800"/>
    <server id='b' address='127.0.0.1' port='6801'/>
    <server id='c' address='127.0.0.1' port='6802' />
    <server id='d' address='127.0.0.1' port='6803' />
   
    <resin:if test="${resin.professional}">
      <persistent-store type="cluster">
        <init path="session"/>
      </persistent-store>
    </resin:if>
    <resin:if test="${resin.professional}">
      <cache path="cache" memory-size="64M">
        <!-- Vary header rewriting for IE -->
        <rewrite-vary-as-private/>
      </cache>
    </resin:if>
    <resin:if test="${resin.professional}">
      <ping>
        <!-- <url>http://localhost:8080/test-ping.jsp</url> -->
      </ping>
    </resin:if>

    <web-app-default>
      <prologue>
           - itself will be distinct.
          -->
        <class-loader>
          <tree-loader path="${resin.root}/ext-webapp-lib"/>
        </class-loader>

        <!--
           - Enable EL expressions in Servlet and Filter init-param
          -->
        <allow-servlet-el/>
      </prologue>
      <cache-mapping url-pattern="/" expires="5s"/>
      <cache-mapping url-pattern="*.gif" expires="60s"/>
      <cache-mapping url-pattern="*.jpg" expires="60s"/>
      <cache-mapping url-pattern="*.png" expires="60s"/>
      <session-config>
        <enable-url-rewriting>false</enable-url-rewriting>
      </session-config>
        <jsp>
          <validate-taglib-schema>true</validate-taglib-schema>
          <fast-jstl>true</fast-jstl>
          <fast-jsf>false</fast-jsf>
        </jsp>
    </web-app-default>
    <resin:import path="${resin.home}/conf/app-default.xml"/>

    <host-default>
      <access-log path="logs/access.log"
            format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
            rollover-period="1W"/>
      <web-app-deploy path="webapps"/>
      <ear-deploy path="deploy">
        <ear-default>
          <ejb-server>
            <config-directory>WEB-INF</config-directory>
          </ejb-server>
        </ear-default>
      </ear-deploy>
      <resource-deploy path="deploy"/>
    </host-default>
    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>
    <host id="" root-directory=".">

      <web-app id="/resin-admin" root-directory="${resin.home}/php/admin">
        <prologue>
          <resin:set var="resin_admin_external" value="true"/><!--true才可以显示后台-->
          <resin:set var="resin_admin_insecure" value="true"/>
        </prologue>
      </web-app>
    </host>
</cluster>

   <cluster id="web-tier"><!--定义id-->
      <server-default>
        <http address="*" port="80"/>
      </server-default>
      <server id="web-a" address="127.0.0.1" port="6700"/><!--定义前端服务-->
      <cache path="cache" memory-size="64M"/>
      <host id="">
        <web-app id="/">
           <rewrite-dispatch>
             <load-balance regexp="" cluster="app-tier"/>
<!--定义前端服务将服务分配给cluster="app-tier"集群处理-->
           </rewrite-dispatch>
        </web-app>
      </host>
    </cluster>
</resin>

 应用服务端:resin-abcd.xml

<resin xmlns="http://caucho.com/ns/resin"
xmlns:resin="http://caucho.com/ns/resin/core">
<class-loader>
<tree-loader path="${resin.home}/ext-lib"/>
<tree-loader path="${resin.root}/ext-lib"/>
<tree-loader path="${resin.home}/lib"/>
<tree-loader path="${resin.root}/lib"/>
</class-loader>
<!--这里在没有admin管理用户,不然会出错 -->
<log name="" level="all" path="og/stdout.log"
archive-format="%Y-%m-%d.stdout.log.zip"
timestamp="[%H:%M:%S.%s] {%{thread}} "
rollover-period="1W"/>
<logger name="com.caucho" level="info"/>

<logger name="com.caucho.java" level="config"/>
<logger name="com.caucho.loader" level="config"/>
<dependency-check-interval>2s</dependency-check-interval>
<system-property mail.smtp.host="127.0.0.1"/>
<system-property mail.smtp.port="25"/>
<character-encoding>utf-8</character-encoding>
<javac compiler="internal" args="-source 1.5"/>
<cluster id="app-tier">
<root-directory>.</root-directory>

<server-default>
<!-- <http address="*" port="80"/>需要注释起来 -->
<jvm-arg>-Xmx256m</jvm-arg>
<jvm-arg>-Xss1m</jvm-arg>
<jvm-arg>-Xdebug</jvm-arg>
<jvm-arg>-XX:PermSize=64m</jvm-arg>
<jvm-arg>-XX:MaxNewSize=128m</jvm-arg>
<jvm-arg>-XX:MaxPermSize=128m</jvm-arg>
<jvm-arg>-Djava.awt.headless=true</jvm-arg>
<jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
<watchdog-jvm-arg>-Dcom.sun.management.jmxremote</watchdog-jvm-arg>
<watchdog-port>6600</watchdog-port>
<memory-free-min>1M</memory-free-min>
<thread-max>256</thread-max>
<socket-timeout>65s</socket-timeout>
<keepalive-max>128</keepalive-max>
<keepalive-timeout>15s</keepalive-timeout>
</server-default>
<server id="a" address="127.0.0.1" port="6800"/>
<server id='b' address='127.0.0.1' port='6801'/>
<server id='c' address='127.0.0.1' port='6802' />
<server id='d' address='127.0.0.1' port='6803' />
<resin:if test="${resin.professional}">
<persistent-store type="cluster">
<init path="session"/>
</persistent-store>
</resin:if>
<resin:if test="${resin.professional}">
<cache path="cache" memory-size="64M">
<!-- Vary header rewriting for IE -->
<rewrite-vary-as-private/>
</cache>
</resin:if>
<resin:if test="${resin.professional}">
<ping>
<!-- <url>http://localhost:8080/test-ping.jsp</url> -->
</ping>
</resin:if>
<web-app-default>
<prologue>
<class-loader>
<tree-loader path="${resin.root}/ext-webapp-lib"/>
</class-loader>
<allow-servlet-el/>
</prologue>
<cache-mapping url-pattern="/" expires="5s"/>
<cache-mapping url-pattern="*.gif" expires="60s"/>
<cache-mapping url-pattern="*.jpg" expires="60s"/>
<cache-mapping url-pattern="*.png" expires="60s"/>
<session-config>
<enable-url-rewriting>false</enable-url-rewriting>
</session-config>
<jsp>
<validate-taglib-schema>true</validate-taglib-schema>
<fast-jstl>true</fast-jstl>
<fast-jsf>false</fast-jsf>
</jsp>
</web-app-default>
<resin:import path="${resin.home}/conf/app-default.xml"/>
<host-default>
<access-log path="logs/access.log"
format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
rollover-period="1W"/>
<web-app-deploy path="webapps"/>
<ear-deploy path="deploy">
<ear-default>
<ejb-server>
<config-directory>WEB-INF</config-directory>
</ejb-server>
</ear-default>
</ear-deploy>
<resource-deploy path="deploy"/>
</host-default>
<host-deploy path="hosts">
<host-default>
<resin:import path="host.xml" optional="true"/>
</host-default>
</host-deploy>
<host id="" root-directory=".">
<web-app id="/resin-admin" root-directory="${resin.home}/php/admin">
<prologue>
<resin:set var="resin_admin_external" value="true"/>
<resin:set var="resin_admin_insecure" value="true"/>
</prologue>
</web-app>
</host>
</cluster>
<resin:if test="${resin.professional}">
<cluster id="web-tier">
<server-default>
<!-- The http port -->
<http address="*" port="9080"/>
</server-default>
<server id="web-a" address="127.0.0.1" port="6700"/>
<cache path="cache" memory-size="64M"/>
<host id="">
<web-app id="/">
<rewrite-dispatch>
<load-balance regexp="" cluster="app-tier"/>
</rewrite-dispatch>
</web-app>
</host>
</cluster>
</resin:if>
</resin>

 我的是在win下.所以就安装到服务里了.
进入resin目录
用命令
http.exe install-as resin -conf conf/resin-web.xml -server resin
http.exe install-as resin -conf conf/resinabcd.xml -server a
http.exe install-as resin -conf conf/resinabcd.xml -server b
http.exe install-as resin -conf conf/resinabcd.xml -server c
http.exe install-as resin -conf conf/resinabcd.xml -server d
安装好了以后,到服务里找相关项启动吧.
如果报 watchdog start authentication failure 错..
那就再到服务里重启一下resin 这个服务或者
<user name="admin" password="password" disable="true"/>
在用户验证里只保留这一句.当然,这样就访问不了resin后台了.
因为改password="password " 字符也会报错,好像不影响运行.
如果大家有什么好的解决方法,请给我留言.谢谢大家了.
以下是我的配制后台.

 

你可能感兴趣的:(jvm,Web,cache,ext,JSF)