Setting up the Content Based Routing component

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]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.

Procedure

  1. 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.
    1. [AIX][HP-UX][Linux][Solaris]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.
    2. [Windows]Stop Caching Proxy from the Services panel.
    3. Modify the Caching Proxy configuration file (ibmproxy.conf), as follows:
      • Verify that the incoming CacheByIncomingUrl URL directive is off (default).
      • In the mapping rules section of the configuration file, add a mapping rule for every cluster that is similar to the following example:
        Proxy    /*  http://cluster.domain.com/*    cluster.domain.com
      Tip: CBR sets the protocol, server, and target port later.
    4. 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
  2. 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.
  3. 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.
  4. 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
  5. 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.
    [AIX][HP-UX][Linux][Solaris]Add the cluster address to the network interface by using the ifconfig command. Use the command for your operating system, as follows:
    Table 2. . Commands to alias the network interface card
    Operating system Command
    AIX
    ifconfig interface_name alias cluster_address netmask netmask
    HP-UX
    ifconfig interface_name cluster_address netmask netmask up
    Linux
    ifconfig interface_name cluster_address netmask netmask up
    Solaris 10
    ifconfig interface_name addif cluster_address netmask netmask up
    [Linux][HP-UX]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]For Windows 2008, add the cluster address to the network interface with the following steps.
    1. Click Start > Control Panel > Network and Internet > Network and Sharing Center > Change adapter settings.
    2. Right click the appropriate Local Area Connection icon and select Properties.
    3. Select Internet Protocol (TCP/IP) and click Properties.
    4. Select Use the following IP address and click Properties.
    5. Click Add, then type the IP address and subnet mask for the cluster.
  6. 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.
  7. 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.
  8. 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.

  9. 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
  10. Optional: Start the manager function. The manager function improves load balancing. Start the manager by issuing the following command:
    cbrcontrol manager start
  11. 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
  12. 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.
  13. Start Caching Proxy.
    1. Add to the environment variable.
      • [AIX]Add to the LIBPATH environment variable:
        /opt/IBM/WebSphere/Edge/ULB/cbr/servers/lib
      • [Linux][HP-UX][Solaris]Add to the LD_LIBRARY_PATH environment variable:
         /opt/IBM/WebSphere/Edge/ULB/cbr/servers/lib
      • [Windows]Add to the PATH environment variable:
        <install_root>ibm\edge\ulb\servers\lib
  14. In the new environment, start Caching Proxy:
    1. [AIX][Linux][HP-UX][Solaris]From the command prompt, issue ibmproxy
    2. [Windows]Start Caching Proxy from the Services panel: Click Start > Settings (Windows 2000) > Control Panel > Administrative Tools > Services.

Example

CBR configuration example
Configure CBR as follows:
  1. Start CBR by issuing the cbrserver command.
  2. Start the command line interface: issue the cbrcontrol command.
  3. The cbrcontrol prompt displays. Issue the following commands ((cluster(c),port(p),rule(r),server(s)):
    • executor start
    • cluster add c
    • port add c@p
    • server add c@p@s
    • rule add c@p@r type content pattern uri=*
    • rule useserver c@p@r s
  4. Start Caching Proxy by issuing the ibmproxy command. (For Windows platforms, start Caching Proxy from the Services panel.)
  5. Remove all proxy configurations from the browser.
  6. Load http://c/ into your browser, where c is the cluster that you configured previously.
    • Server s is started
    • The web page displays, as follows:
      http://s/

Icon that indicates the type of topic Task topic



Timestamp icon Last updated: March 23, 2018 0:18
File name: tcfg_cbrmachine.html