Cluster with Two Servers

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Cleanup}}
 
[[Category: Cookbook]]
 
[[Category: Cookbook]]
  
Line 5: Line 6:
 
(Resin, Apache or hardware) to work properly.
 
(Resin, Apache or hardware) to work properly.
  
The two servers act as backups for each other for clustering purposes, because they form
+
* The two servers act as backups for each other for clustering purposes, because they form
 
the first two clusters of a triad. The two servers check each others heartbeats, record statistics and
 
the first two clusters of a triad. The two servers check each others heartbeats, record statistics and
 
save each others statistics and error logs.
 
save each others statistics and error logs.
  
Each server listens to HTTP port 8080 and serves web-apps from the webapps directory.
+
* Each server listens to HTTP port 8080 and serves web-apps from the webapps directory.
 
The root web-app would be in webapps/ROOT, for example. Standard servlet behavior and jsp and php
 
The root web-app would be in webapps/ROOT, for example. Standard servlet behavior and jsp and php
 
support is enabled with the <resin:import> of app-default.xml.
 
support is enabled with the <resin:import> of app-default.xml.
  
JDK logging goes to stdout, which goes to jvm-a.log and jvm-b.log as managed by
+
* JDK logging goes to stdout, which goes to jvm-a.log and jvm-b.log as managed by
 
the [[watchdog]].
 
the [[watchdog]].
  
 +
* Proxy caching is enabled to improve performance.
 +
 +
* The /resin-admin is enabled. Passwords belong in ${resin.home}/conf/admin-users.xml
  
 
== resin.xml configuration ==
 
== resin.xml configuration ==
Line 26: Line 30:
 
   
 
   
 
     <logger name="com.caucho" level="info"/>
 
     <logger name="com.caucho" level="info"/>
 
+
 +
    <resin:AdminAuthenticator>
 +
      <resin:import path="${__DIR__}/admin-users.xml" optional="true"/>
 +
    </resin:AdminAuthenticator>
 +
 
 
     <cluster id="my-cluster">
 
     <cluster id="my-cluster">
 
       <server-default>
 
       <server-default>
Line 52: Line 60:
 
   
 
   
 
         <web-app-deploy path="webapps"/>
 
         <web-app-deploy path="webapps"/>
 +
 
 +
        <web-app id="/resin-admin" root-directory="${resin.root}/doc/admin">
 +
          <prologue>
 +
            <resin:set var="resin_admin_external" value="false"/>
 +
            <resin:set var="resin_admin_insecure" value="true"/>
 +
          </prologue>
 +
        </web-app>
 +
 
       </host>
 
       </host>
 
     </cluster>
 
     </cluster>
 
   </resin>
 
   </resin>

Latest revision as of 15:50, 2 December 2011

40px-Edit-clear.png This article requires cleanup and may refer to a legacy version of Resin.

Please visit http://www.caucho.com/documentation/ for the most up-to-date documentation.

This is a basic Resin configuration with two servers in a single cluster. Since this configuration does not have a load balance tier, it needs a load balancer (Resin, Apache or hardware) to work properly.

  • The two servers act as backups for each other for clustering purposes, because they form

the first two clusters of a triad. The two servers check each others heartbeats, record statistics and save each others statistics and error logs.

  • Each server listens to HTTP port 8080 and serves web-apps from the webapps directory.

The root web-app would be in webapps/ROOT, for example. Standard servlet behavior and jsp and php support is enabled with the <resin:import> of app-default.xml.

  • JDK logging goes to stdout, which goes to jvm-a.log and jvm-b.log as managed by

the watchdog.

  • Proxy caching is enabled to improve performance.
  • The /resin-admin is enabled. Passwords belong in ${resin.home}/conf/admin-users.xml

[edit] resin.xml configuration

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

   <log-handler name="" level="all" path="stdout:"
                timestamp="[%y-%m-%d %H:%M:%S.%s] "/>

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

   <resin:AdminAuthenticator>
     <resin:import path="${__DIR__}/admin-users.xml" optional="true"/>
   </resin:AdminAuthenticator>
  
   <cluster id="my-cluster">
     <server-default>
       <http port="8080"/>
     </server-default>

     <server id="a" address="192.168.1.10" port="6800"/>
     <server id="b" address="192.168.1.11" port="6801"/>

     <resin:import path="${__DIR__}/app-default.xml"/>

     <development-mode-error-page/>
 
     <proxy-cache memory-size="64M"/>

     <resin:DeployService/>
     <resin:JmxService/>
     <resin:LogService/>
     <resin:StatService/>
 
     <host id="">
       <access-log path="log/access.log"
                   format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
                   rollover-period="1W"/>

       <web-app-deploy path="webapps"/>
 
       <web-app id="/resin-admin" root-directory="${resin.root}/doc/admin">
         <prologue>
           <resin:set var="resin_admin_external" value="false"/>
           <resin:set var="resin_admin_insecure" value="true"/>
         </prologue>
       </web-app>

     </host>
   </cluster>
 </resin>
Personal tools