Overview of Request and Search Strings
The load balancer monitors the nodes in its pool by connecting to each node and sending a "request string." The request string is in the form of the "
GET" HTTP method/command. The request string then looks for a "search string." The default search string is "
Let's look at a specific example where we are load balancing an HTTP server with the default request string: "
GET / HTTP/1.0\r\n\r\n". This string is made up of the "
GET" command, the HTTP version you are using (HTTP/1.0) and a double CR/LF (\r\n\r\n) sequence at the end. If everything is going well with your node, this request string will return a response that includes the phrase "
We can see this happen when we 1) telnet to the node:
And 2) type in the request string and hit return twice:
(Note that we didn't need "
\r\n\r\n" because we are manually hitting return.) If everything is OK, we get something like:
Note that this output is a standard HTTP header, since there is no content on the web server yet. "
200 OK" is a standard part of an HTTP header when everything is running smoothly. So if you leave the monitor in default mode, it will look for "
200 OK"; when a node goes down "
200 OK" will not be returned and the node will be pulled out of rotation.
Using Request and Search Strings to Intentionally Fail a Node
You may want to change the request and search strings so that you can intentionally fail a node without removing it from the pool. In that case, it is easiest to create a file on your web servers and point the monitor there to look for the search string. For example, you could make a file "
status.html" and somewhere inside that file include the phrase "active." Then set your request string as:
And set your search string as "active."
The load balancer will connect to your nodes and use the GET command to get the contents of "
status.html". If it finds "active" it will report the node as up; if it doesn't, it will report the node as down. To remove a node from rotation just change "active" to something else in
Adding or Changing a Request and Search String
You can include a request or search string when you create a pool using the "
manage-lb-pool create" command. You can add or change the strings of an existing pool using the "
manage-lb-pool modify" command. For example:
Case of HTTP/1.1 Version
As the standard requires the hostname to be specified for the 1.1 version of HTTP protocol, the following command should be run in that case: