NSX Advanced Load Balancer can actively deactivate back-end servers for maintenance. It can be configured to use information in the health check responses from servers to detect if a server is in maintenance mode.
Administrators and application developers can use information in the health-check responses from servers to detect if a server is in maintenance mode. The information can be a specific response code, for instance, HTTP code 503, or a specific response message string, for instance, "Server is under maintenance".
Such an event is operationally different from a case where the server process is down due to a software issue. When a server is under maintenance, you must not send new connections to the server and must drain the existing connections.
Detecting Maintenance Mode
You can configure some types of health monitors to detect when a server has entered maintenance mode, based on specific response codes or response data contained in the server's responses to health checks. This monitor must be associated with the pool the server is in.
- Response code
-
You can configure HTTP and HTTPS health monitors to filter for a specific HTTP response code (101-599). If the code is detected in a server's response to a health check based on the HTTP or HTTPS monitor, NSX Advanced Load Balancer changes the server's status to Down for maintenance.
- Response data
-
You can configure TCP, UDP, HTTP, and HTTPS health monitors to filter for specific data (a response string). If the string is detected in a server's response to a health check based on the HTTP or HTTPS monitor, NSX Advanced Load Balancer changes the server's status to Down for maintenance. The response data must be within the first 2000 bytes of the response data.
An HTTP or HTTPS health monitor can filter for up to 4 maintenance response codes.
The HTTP and HTTPS health monitors can contain any of the following combinations of filters for detecting a maintenance mode:
Response string
Multiple response codes
Maintenance response string
Up to four maintenance response codes
TCP and UDP health monitors can contain a filter for maintenance mode based on either or both of the following:
Response string
Maintenance response string
Indicating Maintenance Mode
When NSX Advanced Load Balancer detects that a server has entered maintenance mode, the server's health status is changed to Down for maintenance.
When a server is marked DOWN
for maintenance, the existing connections to the server are left untouched and are allowed to close on their own. NSX Advanced Load Balancer continues to send health checks to the server. When the server stops responding with the maintenance string or code, this indicates to NSX Advanced Load Balancer that the maintenance mode has concluded, and changes the server's health status to UP
.
Similarly, the server's change into and back out of maintenance mode is indicated in the event log.
Configuring a Health Monitor To Detect Server Maintenance Mode
The following are the steps to configure web interface to detect server maintenance mode:
Navigate to the configuration popup of the health monitor:
Navigate to
.Click the edit icon next to the name of the health monitor.
Click Create button to create a new health monitor.
Specify a name, and select the monitor type, such as TCP or UDP for layer 4, HTTP or HTTPS for layer 7.
In the Server Maintenance Mode section, specify the response code(s) or data to use as the indicator that a server is in maintenance mode.
Click Save.
Example HTTPS Health Monitor with Maintenance Mode Detection:
Example TCP Health Monitor with Maintenance Mode Detection:
Attaching a Health Monitor to a Pool
The health monitor is used only for the pools the monitor is attached to.
To attach a health monitor to a pool,
Navigate to
.Click Create button.
Select the monitor by clicking Add Active Monitor button. The drop-down menu displays the list of health monitors.
Select the required health monitor option.
CLI
The following commands configure an HTTP health monitor to filter for the string under construction in health-check responses from servers:
: > configure healthmonitor System-HTTP : healthmonitor> http_monitor : healthmonitor:http_monitor> maintenance_response "under construction" : healthmonitor:http_monitor> save : healthmonitor> save
The following commands configure the same HTTP health monitor to filter for response codes 500 and 501 in health-check responses from servers. The following commands configure an HTTP health monitor to filter for the string under construction in health-check responses from servers:
: > configure healthmonitor System-HTTP : healthmonitor> http_monitor : healthmonitor:http_monitor> maintenance_code 500 : healthmonitor:http_monitor> maintenance_code 501 : healthmonitor:http_monitor> save : healthmonitor> save
The following commands edit the health monitor's configuration to remove the filter a response string:
: > configure healthmonitor System-HTTP : healthmonitor> http_monitor : healthmonitor:http_monitor> no maintenance_response : healthmonitor:th> save : healthmonitor> save