Application Server: Parameterized Web Server Cluster

From Resin 4.0 Wiki

(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
{{Config}} {{WebServer}} {{Cookbook}}
 
{{Config}} {{WebServer}} {{Cookbook}}
  
 +
Resin application server configuration can use a properties file with EL expressions to parameterize values, like http
 +
ports or cluster addresses. You might use the same resin.xml configuration for QA, staging and deployment
 +
and just change the ports or IP addresses to match the configuration.
  
=== resin.properties ===
+
The example is a complete web server configuration, with applications deployed in webapps/, the health
 +
system activated (requires Resin Pro), and clustering enabled (also requires Resin Pro.) The configuration
 +
will also work with Resin Open Source if you use a single server.
 +
 
 +
* complete web-server cluster example
 +
* resin.properties to parameterized values
 +
* http port parameterized with EL ${http}
 +
* cluster local IP parameterized with EL ${web_servers}
 +
* server-multi expands into multiple servers by its parameters
 +
* applications deploys with webapps/foo.war
 +
* root application in webapps/ROOT
 +
* sample shows a 3-server configuration but can use 1 to n servers.
 +
* includes health system
 +
 
 +
== startup ==
 +
 
 +
  unix> resinctl start
 +
 
 +
Resin will find the server configuration belonging to it by looking at the IP interfaces.
 +
 
 +
=== /etc/resin/resin.properties ===
  
 
   http : 8080
 
   http : 8080
 
   web_servers : 192.168.1.10 192.168.1.11 192.168.1.12
 
   web_servers : 192.168.1.10 192.168.1.11 192.168.1.12
  
=== resin.xml ===
+
If you are using Resin Open Source, you can use a single web_server (like 192.168.1.10). More than
 +
one web_server in the cluster requires Resin Professional.
 +
 
 +
=== /etc/resin/resin.xml ===
  
 
  <resin xmlns="<nowiki>http://caucho.com/ns/resin</nowiki>"
 
  <resin xmlns="<nowiki>http://caucho.com/ns/resin</nowiki>"
Line 13: Line 39:
 
   
 
   
 
     <resin:properties path="${__DIR__}/resin.properties" optional="true"/>
 
     <resin:properties path="${__DIR__}/resin.properties" optional="true"/>
+
 
 
     <log-handler name="" level="all" path="stdout:"/>
 
     <log-handler name="" level="all" path="stdout:"/>
+
 
 
     <home-cluster>web</home-cluster>
 
     <home-cluster>web</home-cluster>
 
   
 
   
 +
    <resin:import path="${__DIR__}/health.xml"/>
 +
 
 
     <cluster id="web">
 
     <cluster id="web">
 
       <resin:import path="classpath:META-INF/caucho/app-default.xml"/>
 
       <resin:import path="classpath:META-INF/caucho/app-default.xml"/>
 
   
 
   
       <server-multi id-prefix="web-" address_list="${web_servers}" port="6800">
+
       <server-multi id-prefix="web-" address-list="${web_servers}" port="6800">
 
         <http port="${http}"/>
 
         <http port="${http}"/>
 
       </server-multi>
 
       </server-multi>

Latest revision as of 00:00, 28 January 2012

Gears-48.pngWeb-48.pngCookbook-48.png

Resin application server configuration can use a properties file with EL expressions to parameterize values, like http ports or cluster addresses. You might use the same resin.xml configuration for QA, staging and deployment and just change the ports or IP addresses to match the configuration.

The example is a complete web server configuration, with applications deployed in webapps/, the health system activated (requires Resin Pro), and clustering enabled (also requires Resin Pro.) The configuration will also work with Resin Open Source if you use a single server.

  • complete web-server cluster example
  • resin.properties to parameterized values
  • http port parameterized with EL ${http}
  • cluster local IP parameterized with EL ${web_servers}
  • server-multi expands into multiple servers by its parameters
  • applications deploys with webapps/foo.war
  • root application in webapps/ROOT
  • sample shows a 3-server configuration but can use 1 to n servers.
  • includes health system

startup

 unix> resinctl start

Resin will find the server configuration belonging to it by looking at the IP interfaces.

/etc/resin/resin.properties

 http : 8080
 web_servers : 192.168.1.10 192.168.1.11 192.168.1.12

If you are using Resin Open Source, you can use a single web_server (like 192.168.1.10). More than one web_server in the cluster requires Resin Professional.

/etc/resin/resin.xml

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

   <resin:properties path="${__DIR__}/resin.properties" optional="true"/>
 
   <log-handler name="" level="all" path="stdout:"/>
 
   <home-cluster>web</home-cluster>

   <resin:import path="${__DIR__}/health.xml"/>
 
   <cluster id="web">
     <resin:import path="classpath:META-INF/caucho/app-default.xml"/>

     <server-multi id-prefix="web-" address-list="${web_servers}" port="6800">
       <http port="${http}"/>
     </server-multi>

     <host id="">
       <web-app-deploy path="webapps"/>
     </host>
       
   </cluster>

</resin>
Personal tools
TOOLBOX
LANGUAGES