PDA

View Full Version : Resin Configuration for load balancing


talktotapas
06-15-2010, 11:59 AM
Dear All,
I am having our web application using resin. Where in the first page there is a link for login. If it is clicked one page with SSL encryption opens. There we need to put username password and group name for authentication. It communicates through cobra (Iona/Progress) based communication. In a single server it is working fine.
Now we have two web servers and I want to balance load through web-tier.
At present I am running web-tier in one machine and app-tier in other machine.
From web-tier I am able to connect to first page only. If I click for login, system gives error as ??System cannot display this webpage??.
What should I do to achieve the requirement. I am attaching my resin.conf file below:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

<!--
- Resin 3.1 configuration file.
-->
<resin xmlns="http://caucho.com/ns/resin"
xmlns:resin="http://caucho.com/ns/resin/core">

<!-- adds all .jar files under the resin/lib directory -->
<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"/>

<resin:if test="${resin.professional}">
<deploy-service/>
<jmx-service/>
<log-service/>
<xa-log-service/>
</resin:if>
</management>

<log name="" level="info" path="stdout:"
timestamp="[%H:%M:%S.%s] {%{thread}} "/>


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

<logger name="com.caucho.java" level="config"/>
<logger name="com.caucho.loader" level="config"/>

<dependency-check-interval>120s</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>
<!-- The http port -->
<http address="*" port="7070"/>

<http address="*" port="6443">
<jsse-ssl>
<key-store-type>jks</key-store-type>
<key-store-file>keys/server.keystore</key-store-file>
<password>test123</password>
</jsse-ssl>
</http>

<jvm-arg>-Xmx512m</jvm-arg>
<jvm-arg>-Xss1m</jvm-arg>
<jvm-arg>-Xdebug</jvm-arg>
<jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
<jvm-arg>-d64</jvm-arg>

<watchdog-jvm-arg>-Dcom.sun.management.jmxremote</watchdog-jvm-arg>
<watchdog-port>6600</watchdog-port>

<memory-free-min>1M</memory-free-min>

<!-- Maximum number of threads. -->
<thread-max>512</thread-max>

<!-- Configures the socket timeout -->
<socket-timeout>65s</socket-timeout>

<!-- Configures the keepalive -->
<keepalive-max>128</keepalive-max>
<keepalive-timeout>15s</keepalive-timeout>

</server-default>

<!-- define the servers in the cluster -->
<server id="app-a" address="172.16.200.185" port="6800"/>
<server id="app-b" address="172.16.200.183" port="6800"/>

<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>


<web-app-default>
<prologue>

<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>

<!--
- Sets timeout values for cacheable pages, e.g. static pages.
-->
<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"/>

<!--
- for security, disable session URLs by default.
-->
<session-config>
<enable-url-rewriting>false</enable-url-rewriting>
</session-config>

<!--
- For security, set the HttpOnly flag in cookies.
- <cookie-http-only/>
-->

<!--
- Some JSP packages have incorrect .tld files. It's possible to
- set validate-taglib-schema to false to work around these packages.
-->
<jsp>
<validate-taglib-schema>true</validate-taglib-schema>
<fast-jstl>true</fast-jstl>
</jsp>
</web-app-default>

<!-- includes the app-default for default web-app behavior -->
<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"/>

<!-- creates the webapps directory for .war expansion -->
<web-app-deploy path="webapps"/>

<!-- creates the deploy directory for .ear expansion -->
<ear-deploy path="deploy">
<ear-default>
<ejb-server>
<config-directory>WEB-INF</config-directory>
</ejb-server>
</ear-default>
</ear-deploy>

<!-- creates the deploy directory for .rar expansion -->
<resource-deploy path="deploy"/>
</host-default>

<!-- configures a deployment directory for virtual hosts -->
<host-deploy path="hosts">
<host-default>
<resin:import path="host.xml" optional="true"/>
</host-default>
</host-deploy>

<!-- configures the default host, matching any host name -->
<host id="" root-directory=".">
<!--
- configures an explicit root web-app matching the
- webapp's ROOT
-->
<web-app id="/" root-directory="webapps/ROOT"/>

<web-app id="/resin-admin" root-directory="${resin.home}/php/admin">
<!--
- Administration application /resin-admin
-->
<prologue>
<resin:set var="resin_admin_external" value="false"/>
<resin:set var="resin_admin_insecure" value="true"/>
</prologue>
</web-app>
</host>
</cluster>

<cluster id="web-tier">
<server-default>
<!-- The http port -->
<http address="*" port="7080"/>
</server-default>

<server id="web-a" address="172.16.200.185" port="6700" />
<server id="web-b" address="172.16.200.183" port="6700" />

<cache path="cache" memory-size="64M"/>

<host id="" root-directory="web-tier">
<web-app id="/">

<rewrite-dispatch>
<load-balance regexp="" cluster="app-tier"/>
</rewrite-dispatch>

</web-app>
</host>
</cluster>

</resin>