This quick start example shows how to configure three locally attached workstations using the Dispatcher component's mac forwarding method to load-balance Web traffic between two Web servers. The configuration would be essentially the same for balancing any other TCP or stateless UDP application traffic.
The mac forwarding method is the default forwarding method whereby Dispatcher load balances incoming requests to the server, and the server returns the response directly to the client. For more information on Dispatcher's MAC forwarding method, see Dispatcher's MAC-level routing (mac forwarding method).
For the quick start example, you need three workstations and four IP addresses. One workstation is the Dispatcher machine; the other two workstations are the Web servers. Each Web server requires one IP address. The Dispatcher workstation requires two addresses: the nonforwarding address (NFA), and the cluster address (the address which is load balanced) that you provide to clients to access your Web site.
Workstation | Name | IP Address |
---|---|---|
1 | server1.Intersplashx.com | 9.47.47.101 |
2 | server2.Intersplashx.com | 9.47.47.102 |
3 | server3.Intersplashx.com | 9.47.47.103 |
Netmask = 255.255.255.0 |
Name= www.Intersplashx.com IP=9.47.47.104
Add an alias for www.Intersplashx.com to the loopback interface on server2.Intersplashx.com and server3.Intersplashx.com.
ifconfig lo0 alias www.Intersplashx.com netmask 255.255.255.255
ifconfig lo0:1 plumb www.Intersplashx.com netmask 255.255.255.0 up
You have now completed all configuration steps that are required on the two Web server workstations.
With Dispatcher, you can create a configuration by using the command line, the configuration wizard, or the graphical user interface (GUI).
If you are using the command line, follow these steps:
dscontrol executor start
dscontrol cluster add www.Intersplashx.com
dscontrol port add www.Intersplashx.com:80
dscontrol server add www.Intersplashx.com:80:server2.Intersplashx.com
dscontrol server add www.Intersplashx.com:80:server3.Intersplashx.com
dscontrol executor configure www.Intersplashx.com
dscontrol manager start
Dispatcher will now do load balancing based on server performance.
dscontrol advisor start http 80
Dispatcher 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:
For information about using the Dispatcher GUI, see GUI and Appendix A. GUI: General instructions.
For information about using the configuration wizard, see Configuring with the configuration wizard.
There are many ways that you can configure Load Balancer 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, configure a port through which Load Balancer communicates. See Figure 9.
In this example for the Dispatcher 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) goes to a different server than a client requesting https://www.productworks.com (port 443).
Another way of configuring Load Balancer might 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 Dispatcher 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 Load Balancer might 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 Dispatcher component, two clusters are defined with port 80 for HTTP and port 23 for Telnet for each of the sites at www.productworks.com and www.testworks.com.