What is a ’Rule plugin’ ?
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 rules this
rules allows the plugin to match this information and map
it into the right cluster.
We have the following rule plugins available in Load Balancer:
plugin name |
Description |
ruleplugin_generic.so |
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.
configuration options
- default_cluster: This is the default cluster name to use
if the client’s connection address doesn’t
match any of the rules
- 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:
- address: This is the IP address (or name) of the client
connection address. You can use a fixed address
(e.g. "192.168.0.1") or a regular expression to
specify a range of IP address
(e.g. "192.168.*" note that we scape the ’dot’)
- cluster: 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).
|
ruleplugin_http.so |
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 per traffic type 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.
configuration options
- default_cluster: This is the default cluster name to use
if the client’s connection address doesn’t
match any of the rules.
- 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:
- address: This is the IP address (or name) of the client
connection address. You can use a fixed address
(e.g. "192.168.0.1") or a regular expression to
specify a range of IP address
(e.g. "192.168.*" 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.
- url: 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 "cluster-cgi": url="*/cgi-bin/*"
cluster="cluster-cgi").
- cluster: 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).
|
ruleplugin_generic.so Sample
<rule
address="192.168.0.1"
cluster="cluster1"
/>
<rule
address="192.205.*"
cluster="cluster2"
/>
<rule
address="192.*"
cluster="cluster3"
/>
ruleplugin_http.so Sample
<rules_http default_cluster="cluster1">
<rule
address="192.168.*"
url="*/cgi.bin/*"
cluster="clustercgi"
/>
<rule
address="192.168.*"
url="*.gif"
cluster="clusterimages"
/>
<rule
url="^/index2.html$"
cluster="cluster2"
/>
</rules_http>