mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-24 07:11:20 +02:00
[MEDIUM] stats: offer the possibility to kill sessions by server
It's now possible to issue "shutdown sessions server <back/srv>" and have all this server's sessions immediately killed.
This commit is contained in:
parent
d52c41ea2d
commit
52b2d228ed
@ -9838,6 +9838,12 @@ shutdown session <id>
|
|||||||
endless transfer is ongoing. Such terminated sessions are reported with a 'K'
|
endless transfer is ongoing. Such terminated sessions are reported with a 'K'
|
||||||
flag in the logs.
|
flag in the logs.
|
||||||
|
|
||||||
|
shutdown sessions <backend>/<server>
|
||||||
|
Immediately terminate all the sessions attached to the specified server. This
|
||||||
|
can be used to terminate long-running sessions after a server is put into
|
||||||
|
maintenance mode, for instance. Such terminated sessions are reported with a
|
||||||
|
'K' flag in the logs.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
* fill-column: 79
|
* fill-column: 79
|
||||||
|
@ -1313,8 +1313,30 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
|||||||
session_shutdown(sess, SN_ERR_KILLED);
|
session_shutdown(sess, SN_ERR_KILLED);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(args[1], "sessions") == 0) {
|
||||||
|
if (strcmp(args[2], "server") == 0) {
|
||||||
|
struct server *sv;
|
||||||
|
struct session *sess, *sess_bck;
|
||||||
|
|
||||||
|
sv = expect_server_admin(s, si, args[3]);
|
||||||
|
if (!sv)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* kill all the session that are on this server */
|
||||||
|
list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
|
||||||
|
if (sess->srv_conn == sv)
|
||||||
|
session_shutdown(sess, SN_ERR_KILLED);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
si->applet.ctx.cli.msg = "'shutdown sessions' only supports 'server'.\n";
|
||||||
|
si->applet.st0 = STAT_CLI_PRINT;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
else { /* unknown "disable" parameter */
|
else { /* unknown "disable" parameter */
|
||||||
si->applet.ctx.cli.msg = "'shutdown' only supports 'frontend' and 'session'.\n";
|
si->applet.ctx.cli.msg = "'shutdown' only supports 'frontend', 'session' and 'sessions'.\n";
|
||||||
si->applet.st0 = STAT_CLI_PRINT;
|
si->applet.st0 = STAT_CLI_PRINT;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user