This quick start example shows how to configure three locally attached workstations using CBR along with Caching Proxy to load-balance Web traffic between two Web servers. (For simplicity, this example illustrates servers on the same LAN segment, however with CBR there is no restriction for using servers on the same LAN.)
For the quick start example, you will need three workstations and four IP addresses. One workstation is used as the CBR machine; the other two workstations are used as Web servers. Each Web server requires one IP address. The CBR workstation requires one actual address, and one address to be load balanced.
To use CBR, Caching Proxy must be installed on the same server. To configure Caching Proxy for CBR, see Step 1. Configure Caching Proxy to use CBR.
Workstation | Name | IP Address |
---|---|---|
1 | server1.mywebsite.com | 9.27.27.101 |
2 | server2.mywebsite.com | 9.27.27.102 |
3 | server3.mywebsite.com | 9.27.27.103 |
Netmask = 255.255.255.0 |
Name= www.mywebsite.com IP=9.27.27.104
With CBR, you can create a configuration by using the command line, the configuration wizard, or the graphical user interface (GUI). For this quick start example, configuration steps are demonstrated using the command line.
From a command prompt, follow these steps:
cbrcontrol executor start
ibmproxy
cbrcontrol cluster add www.mywebsite.com
cbrcontrol port add www.mywebsite.com:80
cbrcontrol server add www.mywebsite.com:80:server2.mywebsite.com
cbrcontrol server add www.mywebsite.com:80:server3.mywebsite.com
cbrcontrol rule add www.mywebsite.com:80:memberRule type content pattern uri=*/member/*
cbrcontrol rule add www.mywebsite.com:80:guestRule type content pattern uri=*/guest/*
In this example, using the content rule, client requests to Web site www.mywebsite.com are sent to a different server based on a directory in their URI request path. See Appendix B. Content rule (pattern) syntax for more information.
cbrcontrol rule useserver www.mywebsite:80:memberRule server2.mywebsite.com
cbrcontrol rule useserver www.mywebsite:80:guestRule server3.mywebsite.com
CBR will now do load balancing based on content-based rule. A client with a URL request containing /member/ will be directed to server2.mywebsite.com. A client with a URL request containing /guest/ will be directed to server3.mywebsite.com.
cbrcontrol manager start
cbrcontrol advisor start http 80
CBR will now make sure that client requests are not sent to a failed Web server.
Your basic configuration with locally attached servers is now complete.
Test to see if the configuration is working:
cbrcontrol server report www.mywebsite.com:80:The total connections column of the two servers should add up to "2."
For information on using the CBR GUI, see GUI and see Appendix A. GUI: General instructions.
For information on using the CBR wizard, see Configuration wizard.
There are many ways that you can configure CBR to support your site. If you have only one host name for your site to which all of your customers will connect, you can define a single cluster of servers. For each of these servers, you configure a port through which CBR communicates. See Figure 9.
In this example for the CBR component, one cluster is defined at www.productworks.com. This cluster has two ports: port 80 for HTTP and port 443 for SSL. A client making a request to http://www.productworks.com (port 80) would go to a different server than a client requesting https://www.productworks.com (port 443).
Another way of configuring CBR would be appropriate if you have a very large site with many servers dedicated to each protocol supported. In this case, you might want to define a cluster for each protocol with a single port but with many servers, as shown in Figure 10.
In this example for the CBR component, two clusters are defined: www.productworks.com for port 80 (HTTP) and www.testworks.com for port 443 (SSL).
A third way of configuring CBR would be necessary if your site does content hosting for several companies or departments, each one coming into your site with a different URL. In this case, you might want to define a cluster for each company or department and then define any ports to which you want to receive connections at that URL, as shown in Figure 11.
In this example for the CBR component, two clusters are defined with port 80 (HTTP) and port 443 (SSL) for each of the sites at www.productworks.com and www.testworks.com.