Resin+Resin配置负载均衡
web-a.bat:httpd.exe -conf conf/WebA.conf -server web-a -Xmn100M -Xms312M -Xmx512M
app-a.bat:
httpd.exe -conf conf/APP-tier_log.conf -server app-a -Xmn100M -Xms312M -Xmx512M
WebA.conf:
<!--
- Resin 3.0 configuration file.
-->
<resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core">
<log name="" path="stdout:" timestamp="[%H:%M:%S.%s] "/>
<logger name="com.caucho.java" level="config"/>
<logger name="com.caucho.loader" level="config"/>
<dependency-check-interval>2s</dependency-check-interval>
<javac compiler="internal" args=""/>
<thread-pool>
<thread-max>2024</thread-max>
<spare-thread-min>10</spare-thread-min>
</thread-pool>
<min-free-memory>1M</min-free-memory>
<server>
<class-loader>
<tree-loader path="${resin.home}/lib"/>
<tree-loader path="${server.root}/lib"/>
</class-loader>
<!-- Configures the keepalive -->
<keepalive-max>1500</keepalive-max>
<keepalive-timeout>120s</keepalive-timeout>
<select-manager enable="true"/>
<!-- listen to the http ports only after the server has started. -->
<bind-ports-after-start/>
<!-- The http port -->
<http id="web-a" port="80"/> //app需注释
<cluster id="app-tier">
<srun id="app-a" host='127.0.0.1' port='6808'/>
<srun id="app-b" host='127.0.0.1' port='6809'/>
<srun id="app-c" host='127.0.0.1' port='6810'/>
<srun id="app-d" host='127.0.0.1' port='6811'/>
<srun id="app-e" host='127.0.0.1' port='6812'/>
</cluster>
<ignore-client-disconnect>true</ignore-client-disconnect>
<!--cache path="cache" memory-size="118M"/-->
<web-app-default>
<class-loader>
<tree-loader path="${server.root}/ext-webapp"/>
</class-loader>
<cache-mapping url-pattern="/" expires="5s"/>
<cache-mapping url-pattern="*.gif" expires="60s"/>
<cache-mapping url-pattern="*.jpg" expires="60s"/>
<allow-servlet-el/>
</web-app-default>
<host-default>
<access-log path="/data/resinlog_bl/access.log"
format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
rollover-period="1h"/>
<!--web-app-deploy path="webapps"/-->
<ear-deploy path="deploy">
<ear-default>
</ear-default>
</ear-deploy>
<resource-deploy path="deploy"/>
<web-app-deploy path="deploy"/>
</host-default>
<resin:import path="${resin.home}/conf/app-default.xml"/>
<host-deploy path="hosts">
<host-default>
<resin:import path="host.xml" optional="true"/>
</host-default>
</host-deploy>
<host id="">
<class-loader>
<compiling-loader path="/WEB-INF/classes"/>
<library-loader path="/WEB-INF/lib"/>
</class-loader>
<web-app id="">
<servlet>
<servlet-name>balance-a</servlet-name>
<servlet-class>com.caucho.servlets.LoadBalanceServlet</servlet-class>
<init cluster="app-tier"/>
</servlet>
<servlet-mapping url-pattern="/*" servlet-name="balance-a"/>
</web-app>
</host>
</server>
</resin>
APP-tier_log.conf:
<!--
- Resin 3.0 configuration file.
-->
<resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core">
<log name="" path="stdout:" timestamp="[%H:%M:%S.%s] "/>
<logger name="com.caucho.java" level="config"/>
<logger name="com.caucho.loader" level="config"/>
<dependency-check-interval>2s</dependency-check-interval>
<javac compiler="internal" args=""/>
<thread-pool>
<thread-max>2024</thread-max>
<spare-thread-min>10</spare-thread-min>
</thread-pool>
<min-free-memory>1M</min-free-memory>
<server>
<class-loader>
<tree-loader path="${resin.home}/lib"/>
<tree-loader path="${server.root}/lib"/>
</class-loader>
<!-- Configures the keepalive -->
<keepalive-max>1500</keepalive-max>
<keepalive-timeout>120s</keepalive-timeout>
<select-manager enable="true"/>
<!-- listen to the http ports only after the server has started. -->
<bind-ports-after-start/>
<!-- The http port -->
<cluster id="app-tier">
<srun id="app-a" host='127.0.0.1' port='6808'/>
<srun id="app-b" host='127.0.0.1' port='6809'/>
<srun id="app-c" host='127.0.0.1' port='6810'/>
<srun id="app-d" host='127.0.0.1' port='6811'/>
<srun id="app-e" host='127.0.0.1' port='6812'/>
</cluster>
<persistent-store type="cluster">
<init path="cluster"/>
</persistent-store>
<ignore-client-disconnect>true</ignore-client-disconnect>
<!--cache path="cache" memory-size="118M"/-->
<web-app-default>
<class-loader>
<tree-loader path="${server.root}/ext-webapp"/>
</class-loader>
<cache-mapping url-pattern="/" expires="5s"/>
<cache-mapping url-pattern="*.gif" expires="60s"/>
<cache-mapping url-pattern="*.jpg" expires="60s"/>
<allow-servlet-el/>
<session-config>
<!--enable-url-rewriting>false</enable-url-rewriting-->
<!--use-persistent-store/-->
<!--always-save-session/-->
<session-max>4096</session-max>
<session-timeout>300</session-timeout>
<enable-cookies>true</enable-cookies>
<enable-url-rewriting>true</enable-url-rewriting>
<use-persistent-store>WEB-INF/sessions</use-persistent-store>
</session-config>
</web-app-default>
<host-default>
<access-log path="/data/resinlog_bl/access.log"
format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
rollover-period="1h"/>
<!--web-app-deploy path="webapps"/-->
<ear-deploy path="deploy">
<ear-default>
</ear-default>
</ear-deploy>
<resource-deploy path="deploy"/>
<web-app-deploy path="deploy"/>
</host-default>
<resin:import path="${resin.home}/conf/app-default.xml"/>
<host-deploy path="hosts">
<host-default>
<resin:import path="host.xml" optional="true"/>
</host-default>
</host-deploy>
<host id="" root-directory="E:/BOSS/SVN_Work/boss/web">
<stderr-log path='/data/log/BOSS/stderr.log'
rollover-period='1h'/>
<class-loader>
<compiling-loader path="/WEB-INF/classes"/>
<library-loader path="/WEB-INF/lib"/>
</class-loader>
<web-app id="/">
<security-constraint>
<web-resource-collection>
<url-pattern>/bulletin/leftpicture/*</url-pattern>
</web-resource-collection>
<ip-constraint>
<deny>192.168.63.133</deny>
</ip-constraint>
</security-constraint>
</web-app>
<web-app id="/Upload" document-directory="/data1/webFiles/bossSite_Common" />
<resin:if test="${java.isJava5()}">
<resin:set var="resin_admin_password" value=""/>
<resin:set var="resin_admin_localhost" default="false"/>
<web-app id="/resin-admin" document-directory="${resin.home}/php/admin"/>
</resin:if>
</host>
</server>
</resin>
被使用web的resin,负责处理http请求,然后转发给相对应的app.
页:
[1]