PDA

View Full Version : Help in setting up a cluster of servers in Resin 4


rein
12-11-2010, 07:21 AM
Hey,
Im using Resin 4.0 Pro with a license.Have a small doubt when trying to set up a cluster.

Do the configuration file for all the resin instances have to be the same, inorder for them to work in the same cluster?
Or can the conf files for each instance have different settings like different web-apps,host settings etc ,and only the the common information inorder to setup the cluster would be that the server for that instance would be under the same cluster id and we would just need to provide it the knowledge of the other servers in the same cluster?

eg: (Just a sample explanation)
// Conf 1
<cluster ="common_across_confs">
<host id="">
<web-app id="/" document-directory='/xyz'>
</web-app>
</host>
<server id="instance1" address="192.168.1.10" port="6800">
info for this instance
</server>
<server id="instance2" address="192.168.1.20" port="6801">
</cluster>


// Conf 2

<cluster ="common_across_confs">
<host id="">
<web-app id="/" document-directory='/not_xyz_but_a_diff_path'>
</web-app>
</host>
<server id="instance2" address="192.168.1.20" port="6801">
info for this instance
</server>
<server id="instance1" address="192.168.1.10" port="6800">
</cluster>

ferg
12-11-2010, 10:08 PM
With Resin 4.0, you should use the exact same resin.xml for all servers in the cluster.

Resin's concept of "cluster" is a group of servers doing the same thing. The only difference between servers should be jvm-args (or load balance weights) in case you have a lightly-loaded performance-testing server.

In particular, the server order must be the same or Resin will get very confused.

If you have different configurations, you'll create multiple clusters, each doing a slightly different thing.

In your case, it sounds like you want two clusters, each serving a slightly different web-app.

The only case I can think of where you might want two configurations is if you had a test version of your web-app (possibly for marketing reasons), where you wanted 10% of your customers to try the new web-app. But even in that case, it would probably be better to have two clusters and a more complicated load-balance configuration.

rein
12-12-2010, 07:32 AM
thanks ferg for the clarification.

My setup is such that I have two physical servers each having an instance of resin running with the exact same configuration file but they dont share sessions...

Ive added the follwing tags in the config file

<cluster-default>
<persistent-store type="cluster"> </persistent-store>
</cluster-default>

and under the required webapps ive added the follwing
<session-config>
<use-persistent-store/>
<always-load-session/>
<always-save-session/>
</session-config>

ive also added the servers in the same cluster

<cluster id="main">
<server id="a" address="172.16.140.63" port="6802"/>
<server id="b" address="172.16.141.63" port="6801"/>
</cluster>


is there something im missing indorder for them to share sessions?

rein
12-13-2010, 10:29 AM
Any idea whats missing? ...the machines use the same config but the sessions are not getting shared...

rein
12-13-2010, 05:48 PM
Even from resin-admin for both the servers when I view the Session Manager from the webapps tab ,i get Persistent Store=null ...

alex
12-13-2010, 11:00 PM
Hi Rein,

Can you give me some more detail:

– What version Resin 4 do you use.
– Post your conf.file
– Post some log files from your Resin's log directory (jvm-a.log , jvm-b.log)

thanks,
alex

rein
12-14-2010, 04:20 AM
* Im using Resin 4.0.13 Pro

* Conf file which is being used on both the machines

------------------Start of conf file---------------------------------

<resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core">

<resin:AdminAuthenticator xmlns="http://caucho.com/ns/resin" xmlns:resin="urn:java:com.caucho.resin">
<user name="xyz" password="xyz"/>
</resin:AdminAuthenticator>

<log-handler name='com.caucho.server' level='finest' path='log/server.debug.log' timestamp='[%H:%M:%S.%s] ' />
<log-handler name='com.caucho' level='finest' path='log/caucho-com.debug.trunk.log' timestamp='[%H:%M:%S.%s] ' rollover-period='1M' rollover-count='1'/>

<!-- Disable Dependency Check -->
<dependency-check-interval>1s</dependency-check-interval>

<!-- You can change the compiler to "javac" or jikes.The default is "internal" only because it's the most likely to be available. -->
<javac compiler="internal" args="-source 6"/>



<!-- Configures threads shared among all HTTP and SRUN ports -->
<system-property mail.smtp.host="127.0.0.1"/>
<system-property mail.smtp.port="25"/>
<!-- adds all .jar files under the resin/lib directory -->
<class-loader>
<tree-loader path="$(resin-home)/lib"/>
</class-loader>

<!--
- *******************
- Start Cluster Config
- *******************
-->
<!-- <cluster id=""> -->
<cluster-default>
<persistent-store type="cluster"></persistent-store>

<server-default>


<memory-free-min>1M</memory-free-min>
<thread-max>256</thread-max>
<jvm-arg>-Xmx256m</jvm-arg>
<jvm-arg>-Xss1m</jvm-arg>
<jvm-arg>-Xdebug</jvm-arg>
<jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
<jvm-arg>-Dcom.logicboxes.jdbc.pooleddriver=primrose</jvm-arg>
<thread-idle-min>10</thread-idle-min>
<thread-idle-max>20</thread-idle-max>

<!-- Configures the keepalive -->
<keepalive-max>200</keepalive-max>
<keepalive-timeout>900s</keepalive-timeout>
</server-default>

<!-- Enables/disables exceptions when the browser closes a connection -->
<ignore-client-disconnect>true</ignore-client-disconnect>

<!-- Disable Cache -->
<cache>
<path>cache</path>
<enable>false</enable>
</cache>

<!-- Defaults applied to each web-app -->
<web-app-default>

<shutdown-wait-max>900s</shutdown-wait-max>
<session-config>
<use-persistent-store/>
<ignore-serialization-errors>true</ignore-serialization-errors>
<always-load-session/>
<always-save-session/>
<session-max>100000</session-max>
<session-timeout>50000</session-timeout>
</session-config>

<cache-mapping url-pattern='*.gif' expires='1D'/>
<cache-mapping url-pattern='*.js' expires='1D'/>
<cache-mapping url-pattern='*.css' expires='1D'/>
<cache-mapping url-pattern='*.jpg' expires='1D'/>
<cache-mapping url-pattern='*.png' expires='1D'/>

</web-app-default>

<!-- includes the web-app-default for default web-app behavior -->
<resin:import path="${resinHome}/conf/app-default.xml"/>


<host id=''>
<class-loader>
<compiling-loader path='trunk/orderbox/webapps/WEB-INF/classes'/>
<library-loader path='trunk/orderbox/webapps/WEB-INF/lib'/>
</class-loader>

<!-- Enable Logging (With another web server, like Apache, this can be commented out because the web server will log this information -->
<access-log path='logs/access.trunk.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='trunk/orderbox/webapps'/>

<!-- creates a second deploy directory for .war expansion -->
<web-app-deploy path='trunk/orderbox/deploy'/>
<log-handler name='' level='finest' path='log/debug.trunk.log' timestamp="[%H:%M:%S.%s]" rollover-period='1D'
rollover-count='1'/>



<!-- configures the root web-app -->
<web-app id='/' document-directory='/opt/trunk_staging/webapps/ROOT'>

<class-loader>
<simple-loader path="$(host-root)/xsl"/>
<compiling-loader path="WEB-INF/classes"/>
</class-loader>
</web-app>
<web-app id='resin-admin' root-directory='${resin.home}/doc/admin'>
<prologue>
<resin:set var="resin_admin_external" value="true"/>
<resin:set var="resin_admin_insecure" value="true"/>
</prologue>
</web-app>


</host>

</cluster-default>

<cluster id="localtestingcluster">
<server id="trunk" address="172.16.140.63" port="6801">
<http port="8888"/>
</server>
<server id="trunkvps1" address="172.16.142.163" port="6802">
<http port="9998"/>
</server>
</cluster>



<!--
- *******************
- End Cluster Config
- *******************
-->
</resin>


------------------Endof conf file---------------------------------

* The log files are huge ,is there any specific part you need me to look for in the logs and post ?

Thank Alex

alex
12-14-2010, 04:12 PM
Can you check your logs for any of the following:

– Session Serialization / Deserealization problems
– Connection Denied messages when servers attempt establish links between themselves.

Please also check if 172.16.140.63 can access 172.16.142.163 and vice versa.

Thanks,
Alex

rein
12-14-2010, 04:14 PM
yup will check the logs. In the mean while does the config file seem ok?

rein
12-14-2010, 05:57 PM
* The logs contains nothing of those type of exceptions.
* Also did a telnet to and from the servers and no issue in connection

Why is the persistent store for a web-app null (when viewing the information from resin-admin). Ive used the appropriate <persistent-store type="cluster"> in the config.

alex
12-14-2010, 06:28 PM
Persistent store isn't really used. It looks like you may need to send the logs after all. If they are big you can simply start fresh, deleting the logs, and issuing a couple of requests to both of your servers. Please attach logs from both of the servers, or send to alex at caucho.com

Thanks,
alex

rein
12-14-2010, 08:10 PM
ive mailed you the required details....