select * from section<?xml version='1.0' encoding='iso-8859-1' ?>
<article>
<id><![CDATA[39]]>></id>
<author><nick><![CDATA[Juan M. Casillas]]>></nick>
<email><![CDATA[juanm.casillas@jmcresearch.com]]>></email>
></author>
<title><![CDATA[Rule plugins]]>></title>
<subtitle><![CDATA[Internal overview]]>></subtitle>
<body><![CDATA[What is a ?Rule plugin? ?
&lt;p&gt;
Rule plugins have the task of switch between clusters based 
in the information provided by the chooser plugins: the 
client?s connection address and the request (optional). 
To archieve this task, this plugins use &lt;i&gt;rules&lt;/i&gt; this
rules allows the plugin to match this information and map
it into the right cluster.
&lt;/p&gt;

We have the following rule plugins available in Load Balancer:
&lt;table border=1 width=100% cellpadding=5 class=thinborder&gt;

&lt;tr bgcolor=&quot;#f0f0f0&quot;&gt;
&lt;td class=thinborder_title&gt;&lt;b&gt;plugin name&lt;/b&gt;&lt;/td&gt;
&lt;td class=thinborder_title width=70%&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt;&lt;td&gt;ruleplugin_generic.so&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
This is the generic rule plugin. This plugin only switches between
clusters using the client?s connection address. This is useful to
balance by geographical source, or by ISP source IP ranges. 
&lt;/p&gt;
&lt;b&gt;configuration options&lt;/b&gt;&lt;br&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;default_cluster:&lt;/b&gt; This is the default cluster name to use
                            if the client?s connection address doesn?t
                            match any of the rules
&lt;li&gt;Rules: this plugin allows a variable number of rules (at least one)
           to manage the switching between clusters. This rules have the
           fowolling configuration parameters:
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;address:&lt;/b&gt; This is the IP address (or name) of the client
                    connection address. You can use a fixed address
                    (e.g. &quot;192.168.0.1&quot;) or a regular expression to
                    specify a range of IP address
                    (e.g. &quot;192.168\.*&quot; note that we scape the ?dot?) 
                  
&lt;li&gt;&lt;b&gt;cluster:&lt;/b&gt; The cluster?s name form the chooser plugin will
                    take the server to server the request (see the
                    configuration section for detailed info about
                    Load Balancer?s configuration).
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;br&gt;
&lt;/td&gt;&lt;/tr&gt;


&lt;tr&gt;&lt;td&gt;ruleplugin_http.so&lt;/td&gt; 
&lt;td&gt;
&lt;p&gt;
This is the http rule plugin. This plugin only switches between
clusters using the client?s connection address and the uri request
that is passed by the chooser plugin. With this plugin, you can
balance &lt;i&gt;per traffic type&lt;/i&gt; that is, you can choose so server
all the cgi-bin request from a cluster, all the image files from
another one, and so on. Also, you can balance per client connection
address. 
&lt;/p&gt;
&lt;b&gt;configuration options&lt;/b&gt;&lt;br&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;default_cluster:&lt;/b&gt; This is the default cluster name to use
                            if the client?s connection address doesn?t
                            match any of the rules.
&lt;li&gt;Rules: this plugin allows a variable number of rules (at least one)
           to manage the switching between clusters. This rules have the
           fowolling configuration parameters:
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;address:&lt;/b&gt; This is the IP address (or name) of the client
                    connection address. You can use a fixed address
                    (e.g. &quot;192.168.0.1&quot;) or a regular expression to
                    specify a range of IP address
                    (e.g. &quot;192.168\.*&quot; note that we scape the ?dot?) 
                    This field is optional, if you don?t specify it
                    in the rule, Load Balancer setup it right so the
                    balance will be done using only the url part.
                  
&lt;li&gt;&lt;b&gt;url:&lt;/b&gt;     This is a filter for the uri request form the 
                    client, so you can do a traffic-based cluster
                    switching. This field allows regular expressions
                    inside (e.g to redirect all the cgi-bin traffic
                    to the cluster &quot;cluster-cgi&quot;: url=&quot;*/cgi-bin/*&quot;
                    cluster=&quot;cluster-cgi&quot;).

&lt;li&gt;&lt;b&gt;cluster:&lt;/b&gt; The cluster?s name form the chooser plugin will
                    take the server to server the request (see the
                    configuration section for detailed info about
                    Load Balancer?s configuration).
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;br&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/p&gt; 

&lt;h3&gt;ruleplugin_generic.so Sample&lt;/h3&gt;
&lt;p&gt;

&lt;pre&gt;

  &lt;rules_generic default_cluster=&quot;cluster1&quot;&gt;
	&amp;lt;rule 
             address=&quot;192\.168\.0\.1&quot; 
             cluster=&quot;cluster1&quot; 
        /&amp;gt;
	&amp;lt;rule 
             address=&quot;192\.205\.*&quot;  
             cluster=&quot;cluster2&quot; 
        /&amp;gt;
	&amp;lt;rule 
             address=&quot;192\.*&quot;  
             cluster=&quot;cluster3&quot; 
        /&amp;gt;
  &lt;/rules_generic&gt;
&lt;/pre&gt;


&lt;/p&gt;

&lt;h3&gt;ruleplugin_http.so Sample&lt;/h3&gt;
&lt;p&gt;

&lt;pre&gt;
    &amp;lt;rules_http default_cluster=&quot;cluster1&quot;&amp;gt;
    &amp;lt;rule 
	address=&quot;192\.168\.*&quot; 
	url=&quot;*/cgi.bin/*&quot; 
	cluster=&quot;clustercgi&quot;
    /&amp;gt;
     &amp;lt;rule 
	address=&quot;192\.168\.*&quot; 
	url=&quot;*\.gif&quot; 
	cluster=&quot;clusterimages&quot;
    /&amp;gt;
     &amp;lt;rule 
	url=&quot;^/index2\.html$&quot; 
	cluster=&quot;cluster2&quot;
    /&amp;gt;
  &amp;lt;/rules_http&amp;gt;
&lt;/pre&gt;

&lt;/p&gt;]]>></body>
<keywords><![CDATA[load balancer  rule plugins]]>></keywords>
<stamp><![CDATA[1063914662]]>></stamp>
<updated><![CDATA[1070911507]]>></updated>
<language><![CDATA[0]]>></language>
<sections><section><![CDATA[Load Balancer]]></section>
></sections>
<site><![CDATA[http://www.jmcresearch.com]]>></site>
<url><![CDATA[http://www.jmcresearch.com//src/articlehelper.php?action=preview&amp;id=39]]>></url>
</article>