Caucho Technology
documentation
examples
changes

overview
quick start
installation
command-line
configuration
admin
amber
clustering
caching
database
deployment
ejb 3.0
embedding
filters
hessian
hmtp
ioc
jsp
logging
messaging
performance
quercus/php
remoting
scheduled tasks
security
server push
servlets
third-party
troubleshooting
virtual hosting
watchdog
webapp
xml and xslt

resin watchdog


The Resin watchdog process monitors the Resin JVM instance restarting as necessary.

Overview

Single Resin instance

Example: conf/resin.conf
<resin xmlns="http://caucho.com/ns/resin">
<cluster id="">

  <server id="app-a" address="192.168.1.10" port="6800">
    <watchdog-port>6700</watchdog-port>

    <user-name>resin</user-name>
    <group-name>resin</group-name>

    <http port="80"/>
  </server>

  <host id="">
    <web-app id="" path="/var/www/htdocs"/>
  </host>

</cluster>
</resin>

Single machine load balance with shared watchdog

When running multiple instances of Resin on the same machine, one watchdog-manager typically handles all the instances. The server id will select which instance to start or stop.

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

<cluster id="app-tier">

  <server-default>
    <watchdog-port>6700</watchdog-port>

    <user-name>resin</user-name>
    <group-name>resin</group-name>
  </server-default>

  <server id="app-a" address="192.168.1.10" port="6810"/>
  <server id="app-b" address="192.168.1.10" port="6811"/>

  <host id="">
    <web-app id="" path="/var/www/htdocs"/>
  </host>

</cluster>

<cluster id="web-tier">

  <server-default>
    <watchdog-port>6700</watchdog-port>

    <user-name>resin</user-name>
    <group-name>resin</group-name>
  </server-default>

  <server id="web-a" address="192.168.1.10" port="6800">
    <http port="80"/>
  </server>

  <host id="">
    <web-app id="">
      <rewrite-redirect>
        <load-balance regexp="" cluster="app-tier"/>
      </rewrite-redirect>
    </web-app>
  </host>

</cluster>

</resin>

Single machine load balance with distinct watchdog

In some cases, it's best to let each Resin instance have its own watchdog, for example when multiple users are sharing the same machine. Each <server> block configures a separate <watchdog-port>. Because the watchdog will read the resin.conf and use the <server> block matching the -server id command-line argument, each watchdog will start with it's own port.

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

<cluster id="app-tier">

  <server-default>
    <user-name>resin</user-name>
    <group-name>resin</group-name>
  </server-default>

  <server id="app-a" address="192.168.1.10" port="6810">
    <watchdog-port>6700</watchdog-port>

    <http port="8080"/>
  </server>

  <server id="app-b" address="192.168.1.10" port="6811">
    <watchdog-port>6701</watchdog-port>

    <http port="8081"/>
  </server>

  <host id="">
    <web-app id="" path="/var/www/htdocs"/>
  </host>

</cluster>

</resin>

In the previous example, starting Resin with -server app-a will start a watchdog at port 6700. Starting Resin with -server app-b will start the watchdog at port 6701.

Example: starting app-b with watchdog-port=6701
resin-3.1.x> java -jar lib/resin.jar -server app-b start

ISP watchdog management

In a situation like an ISP, you may wish to have a separate configuration file for the watchdog, which launches Resin instances for different users. In this case, you will want to make sure the watchdog.conf is not readable by the users, and make sure to set a management user (see resin-security).

The watchdog will launch the Resin instance with the given user as a setuid. It will also open any necessary protected ports, e.g. port 80.

Example: /etc/resin/watchdog.conf
<resin xmlns="http://caucho.com/ns/resin">

<management>
  <user name="harry" password="MD5HASH=="/>
</management>

<watchdog-manager>

  <watchdog-default>
    <jvm-arg>-Xmx256m</jvm-arg>
  </watchdog-default>

  <watchdog id="user_1">
    <user-name>user_1</user-name>
    <group-name>group_1</group-name>

    <resin-conf>/home/user_1/conf/resin.conf</resin-conf>
    <resin-root>/home/user_1/www</resin-root>

    <open-port address="192.168.1.10" port="80"/>
  </watchdog>

  ...

  <watchdog id="user_n">
    <user-name>user_n</user-name>
    <group-name>group_n</group-name>

    <resin-conf>/home/user_n/conf/resin.conf</resin-conf>
    <resin-root>/home/user_n/www</resin-root>

    <open-port address="192.168.1.240" port="80"/>
  </watchdog>

</watchdog-manager>

</resin>

command-line

Example: watchdog status
resin-3.1.x> java -jar lib/resin.jar status

Resin/3.1.x status for watchdog at 127.0.0.1:6600

server '' : active
  password: missing
  user: ferg
  root: /home/test/resin/
  conf: /tmp/caucho/qa/cfg/resin.conf
Example: watchdog start
resin-3.1.x> java -jar lib/resin.jar -conf conf/test.conf -server a start

Resin/3.1.x started -server 'a' for watchdog at 127.0.0.1:6700
Example: watchdog stop
resin-3.1.x> java -jar lib/resin.jar stop

Resin/3.1.x started -server '' for watchdog at 127.0.0.1:6600

Management/JMX

The watchdog publishes the watchdog instances to JMX with the JMX name "resin:type=Watchdog,name=a". With a JMX monitoring tool like jconsole, you can view and manage the watchdog instances.


Copyright © 1998-2008 Caucho Technology, Inc. All rights reserved.
Resin ® is a registered trademark, and Quercustm, Ambertm, and Hessiantm are trademarks of Caucho Technology.