Set up the Content Based Routing (CBR) component in production
environments and realistic test environments.
Before you begin
Before you set up the CBR component, you must be the root
user (for AIX®, HP-UX, Linux, or Solaris systems) or the
Administrator (for Windows systems).
About this task
You need one IP address for each cluster of servers that
is set up. A cluster address is an address that is associated with
a host name (such as
www.company.com). This IP address
is used by a client to connect to the servers in a cluster. Specifically,
this address is found in the URL request from the client. All requests
that are made to the same cluster address are load balanced by CBR.
![[Solaris]](../images/solaris.gif)
Before you use the CBR component, the system defaults
for IPC (Inter-process Communication) must be modified. The maximum
size of a shared memory segment and the number of semaphore identifiers
must be increased. To tune your system to support CBR, edit the
/etc/system file
on your system to add the following statements and then restart:
set shmsys:shminfo_shmmax=0x02000000
set semsys:seminfo_semmap=750
set semsys:seminfo_semmni=30
set semsys:seminfo_semmns=750
set semsys:seminfo_semmnu=30
set semsys:seminfo_semume=30
If you do not increase the
shared memory segment to the values shown previously,
cbrcontrol
executor start command fails.
- Configure Caching Proxy to use CBR.
Important: To use CBR, you must install Caching Proxy. Caching
Proxy is a service that starts automatically by default after installation.
You must stop Caching Proxy before you start the CBR server function
and modify the Caching Proxy service to start manually rather than
automatically.
![[AIX]](../images/aixlogo.gif)
![[HP-UX]](../images/hpux.gif)
![[Linux]](../images/linux.gif)
Stop Caching Proxy
by finding its process identifier by using the ps -ef | grep
ibmproxy command and then ending the process by using the kill process_id command.
Stop Caching Proxy from the Services panel.
- Modify the Caching Proxy configuration file (ibmproxy.conf),
as follows:
Tip: CBR sets the protocol, server, and target port
later.
- Edit the four entries for the CBR plug-in, as follows:
- ServerInit
- PostAuth
- PostExit
- ServerTerm
Each entry must be on a single line. There are several instances
of ServerInit in the ibmproxy.conf file,
one for each plug-in. The entries for the CBR plug-in must be edited
and uncommented.
Table 1. Additions to the configuration
file, by operating system. Operating system |
Additions to CBR configuration
file |
AIX, Linux, and Solaris systems |
ServerInit /opt/ibm/edge/cbr/servers/lib/liblbcbr.so:ndServerInit
PostAuth /opt/ibm/edge/cbr/servers/lib/liblbcbr.so:ndPostAuth
PostExit /opt/ibm/edge/cbr/servers/lib/liblbcbr.so:ndPostExit
ServerTerm /opt/ibm/edge/cbr/servers/lib/liblbcbr.so:ndServerTerm
|
HP-UX |
ServerInit /opt/ibm/edge/cbr/servers/lib/liblbcbr.sl:ndServerInit
PostAuth /opt/ibm/edge/cbr/servers/lib/liblbcbr.sl:ndPostAuth
PostExit /opt/ibm/edge/cbr/servers/lib/liblbcbr.sl:ndPostExit
ServerTerm /opt/ibm/edge/cbr/servers/lib/liblbcbr.sl:ndServerTerm
|
Windows systems |
ServerInit <install_root>\cbr\servers\lib\liblbcbr.dll:ndServerInit
PostAuth <install_root>\cbr\servers\lib\liblbcbr.dll:ndPostAuth
PostExit <install_root>\cbr\servers\lib\liblbcbr.dll:ndPostExit
ServerTerm <install_root>\cbr\servers\lib\liblbcbr.dll:ndServerTerm
|
- Start the server function by entering cbrserver on
the command line. A default configuration file (default.cfg)
automatically loads when you start cbrserver. If
you decide to save the CBR configuration in the default.cfg file,
then everything that is saved in this file automatically loads the
next time cbrserver starts.
- Start the executor function by entering cbrcontrol
executor start. You might also change various
executor settings now. Read the dscontrol executor
topic to learn about the executor function.
- Define a cluster and set cluster options. CBR
balances requests that are sent for the cluster to the corresponding
servers that are configured on the ports for that cluster.
The cluster
is the symbolic name that is in the host portion of the URL and must
match the name that is used in the Proxy statement of the ibmproxy.conf file.
Clusters
that are defined in CBR must be defined to match the incoming request.
A cluster must be defined by using the same host name or IP address
that the incoming request contains. For example, if the request enters
as the IP address, the cluster must be defined as the IP address.
If there is more than one host name that resolves to a single IP address
(and requests can arrive with any one of those host names) then all
the host names must be defined as clusters.
Define a cluster
by issuing the following command:
cbrcontrol cluster add cluster
Set
cluster options by issuing the following command:
cbrcontrol cluster set cluster option value
- Optional: Alias the network interface card
(optional). If you are running Caching Proxy configured as a reverse proxy, when load balancing
for multiple websites, you must add the cluster address for each website to at least one of the
network interface cards of the Load Balancer server. Otherwise, you can omit this step.
![[Linux]](../images/linux.gif)
Attention: For Linux and HP-UX systems,
interface_name must have a unique
number for each cluster address that is added, for example:
eth0:1,
eth0:2, and so on.
![[Windows]](../images/windows.gif)
For Windows 2008, add the cluster address to the network interface with the
following steps.
- Click Start > Control Panel > Network and Internet > Network and Sharing Center >
Change adapter settings.
- Right click the appropriate Local Area Connection icon and select
Properties.
- Select Internet Protocol (TCP/IP) and click
Properties.
- Select Use the following IP address and click
Properties.
- Click Add, then type the IP address and subnet mask for the cluster.
- Define ports and set port options. The port
number is the port on which the server applications are listening.
For CBR with Caching Proxy running HTTP traffic, this is typically
port 80.
Define a port to the cluster that you defined in the
previous step by issuing the following command:
cbrcontrol port add cluster@port
Set
port options by issuing the following command:
cbrcontrol port set cluster@port option value
Read
the Commands reference for a complete list of the available to Load
Balancer.
- Define load balanced servers. The servers are
the machines that run the applications that you want load balanced.
The server is the symbolic name or dotted decimal address of the server
machine. Define a server on the cluster and port by issuing the following
command:
cbrcontrol server add cluster@port@server
You
must define more than one server per port on a cluster to perform
load balancing.
- Add rules to your configuration. This step
is the key step in configuring CBR with Caching Proxy. A rule defines
how a URL request is distinguished and sent to one of the appropriate
set of servers. The special rule type that is used by CBR is called
a content rule. Define a content rule by issuing the following command:
cbrcontrol rule add cluster@port@rule type content pattern pattern
The
value, pattern, is the regular expression that
is compared to the URL in each client request.Other rule types
that are defined in Dispatcher can also be used in CBR.
- Add servers to your rules. When a rule is matched
by a client request, the rule's set of servers is queried for which
server is best. The rule's server set is a subset of the servers that
are defined in the port. Add servers to a rule's server set by issuing
the following command:
cbrcontrol rule useserver cluster@port@rule server
- Optional: Start the manager function. The manager function improves load balancing. Start the manager
by issuing the following command:
cbrcontrol manager start
- Optional: Start the advisor function. The advisors give the manager more information about the
ability of the load balanced servers to respond to requests. An advisor
is specific to a protocol. For example, start the HTTP advisor by
issuing the following command:
cbrcontrol advisor start http port
- Set cluster proportions, as required. If you
start advisors, you might modify the proportion of importance that
is given to advisor information that is included in the load balancing
decisions. Set the cluster proportions by issuing the cbrcontrol
cluster set cluster proportions command.
- Start Caching Proxy.
- Add to the environment variable.
Add to the LIBPATH environment variable:/opt/IBM/WebSphere/Edge/ULB/cbr/servers/lib
![[Linux]](../images/linux.gif)
![[HP-UX]](../images/hpux.gif)
Add to the LD_LIBRARY_PATH environment
variable: /opt/IBM/WebSphere/Edge/ULB/cbr/servers/lib
Add to the PATH environment variable:<install_root>ibm\edge\ulb\servers\lib
- In the new environment, start Caching Proxy:
![[AIX]](../images/aixlogo.gif)
![[Linux]](../images/linux.gif)
![[HP-UX]](../images/hpux.gif)
From the command
prompt, issue ibmproxy
Start Caching Proxy from the Services panel:
Click Start > Settings (Windows 2000) > Control Panel >
Administrative Tools > Services.