[MINOR] checks: add the ability to disable a server in the config

Adding the "disabled" keyword on a server line disables it. It can
then be enabled again on the unix socket.
This commit is contained in:
Willy Tarreau 2010-03-29 10:02:24 +02:00
parent 42d2c6c1be
commit 9683909dce
2 changed files with 18 additions and 2 deletions

View File

@ -5392,6 +5392,15 @@ cookie <value>
Supported in default-server: No
disabled
The "disabled" keyword starts the server in the "disabled" state. That means
that it is marked down in maintenance mode, and no connection other than the
ones allowed by persist mode will reach it. It is very well suited to setup
new servers, because normal traffic will never reach them, while it is still
possible to test the service by making use of the force-persist mechanism.
Supported in default-server: No
error-limit <count>
If health observing is enabled, the "error-limit" parameter specifies the
number of consecutive errors that triggers event selected by the "on-error"

View File

@ -3181,7 +3181,8 @@ stats_error_parsing:
goto out;
}
newsrv->health = newsrv->rise;
if (newsrv->health)
newsrv->health = newsrv->rise;
cur_arg += 2;
}
else if (!strcmp(args[cur_arg], "fall")) {
@ -3332,6 +3333,12 @@ stats_error_parsing:
do_check = 1;
cur_arg += 1;
}
else if (!defsrv && !strcmp(args[cur_arg], "disabled")) {
newsrv->state |= SRV_MAINTAIN;
newsrv->state &= ~SRV_RUNNING;
newsrv->health = 0;
cur_arg += 1;
}
else if (!defsrv && !strcmp(args[cur_arg], "observe")) {
if (!strcmp(args[cur_arg + 1], "none"))
newsrv->observe = HANA_OBS_NONE;
@ -3512,7 +3519,7 @@ stats_error_parsing:
}
else {
if (!defsrv)
Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'redir', 'observer', 'on-error', 'error-limit', 'check', 'track', 'id', 'inter', 'fastinter', 'downinter', 'rise', 'fall', 'addr', 'port', 'source', 'minconn', 'maxconn', 'maxqueue', 'slowstart' and 'weight'.\n",
Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'redir', 'observer', 'on-error', 'error-limit', 'check', 'disabled', 'track', 'id', 'inter', 'fastinter', 'downinter', 'rise', 'fall', 'addr', 'port', 'source', 'minconn', 'maxconn', 'maxqueue', 'slowstart' and 'weight'.\n",
file, linenum, newsrv->id);
else
Alert("parsing [%s:%d]: default-server only supports options 'on-error', 'error-limit', 'inter', 'fastinter', 'downinter', 'rise', 'fall', 'port', 'minconn', 'maxconn', 'maxqueue', 'slowstart' and 'weight'.\n",