See also "experimental-mode" in Section 9.3 and "mcli-debug-mode" in 9.4.1.
+hard-reload
+ This command does the same as the "reload" command over the master CLI with
+ the expection that it does a hard-stop (-st) instead of a stop-stop (-sf) of
+ the previous process. This means the previous process does not wait to
+ achieve anything before exiting, so all connections will be closed.
+
+ See also the "reload" command.
+
mcli-debug-mode [on|off]
This keyword allows a special mode in the master CLI which enables every
keywords that were meant for a worker CLI on the master CLI, allowing to debug
will close the connection to the CLI.
Note that a reload will close all connections to the master CLI.
+ See also the "hard-reload" command.
show proc
The master CLI introduces a 'show proc' command to surpervise the
void display_version();
void mworker_accept_wrapper(int fd);
-void mworker_reload(void);
+void mworker_reload(int hardreload);
/* to be used with warned and WARN_* */
static inline int already_warned(unsigned int warning)
* When called, this function reexec haproxy with -sf followed by current
* children PIDs and possibly old children PIDs if they didn't leave yet.
*/
-static void mworker_reexec()
+static void mworker_reexec(int hardreload)
{
char **next_argv = NULL;
int old_argc = 0; /* previous number of argument */
if (mworker_child_nb() > 0) {
struct mworker_proc *child;
- next_argv[next_argc++] = "-sf";
+ if (hardreload)
+ next_argv[next_argc++] = "-st";
+ else
+ next_argv[next_argc++] = "-sf";
list_for_each_entry(child, &proc_list, list) {
if (!(child->options & PROC_O_LEAVING) && (child->options & PROC_O_TYPE_WORKER))
static void mworker_reexec_waitmode()
{
setenv("HAPROXY_MWORKER_WAIT_ONLY", "1", 1);
- mworker_reexec();
+ mworker_reexec(0);
}
/* reload haproxy and emit a warning */
-void mworker_reload()
+void mworker_reload(int hardreload)
{
struct mworker_proc *child;
struct per_thread_deinit_fct *ptdf;
- ha_notice("Reloading HAProxy\n");
+ ha_notice("Reloading HAProxy%s\n", hardreload?" (hard-reload)":"");
/* close the poller FD and the thread waker pipe FD */
list_for_each_entry(ptdf, &per_thread_deinit_list, list)
if (global.tune.options & GTUNE_USE_SYSTEMD)
sd_notify(0, "RELOADING=1\nSTATUS=Reloading Configuration.\n");
#endif
- mworker_reexec();
+ mworker_reexec(hardreload);
}
static void mworker_loop()
*/
void mworker_catch_sighup(struct sig_handler *sh)
{
- mworker_reload();
+ mworker_reload(0);
}
void mworker_catch_sigterm(struct sig_handler *sh)
struct stream *strm = NULL;
struct connection *conn = NULL;
int fd = -1;
+ int hardreload = 0;
if (!cli_has_level(appctx, ACCESS_LVL_OPER))
return 1;
+ /* hard reload requested */
+ if (*args[0] == 'h')
+ hardreload = 1;
+
/* This ask for a synchronous reload, which means we will keep this FD
instead of closing it. */
if (fd != -1 && send_fd_uxst(proc_self->ipc_fd[0], fd) == 0) {
fd_delete(fd); /* avoid the leak of the FD after sending it via the socketpair */
}
- mworker_reload();
+ mworker_reload(hardreload);
return 1;
}
{ { "@!<pid>", NULL }, "@!<pid> : send a command to the <pid> process", cli_parse_default, NULL, NULL, NULL, ACCESS_MASTER_ONLY},
{ { "@master", NULL }, "@master : send a command to the master process", cli_parse_default, NULL, NULL, NULL, ACCESS_MASTER_ONLY},
{ { "show", "proc", NULL }, "show proc : show processes status", cli_parse_default, cli_io_handler_show_proc, NULL, NULL, ACCESS_MASTER_ONLY},
- { { "reload", NULL }, "reload : reload haproxy", cli_parse_reload, NULL, NULL, NULL, ACCESS_MASTER_ONLY},
+ { { "reload", NULL }, "reload : achieve a soft-reload (-sf) of haproxy", cli_parse_reload, NULL, NULL, NULL, ACCESS_MASTER_ONLY},
+ { { "hard-reload", NULL }, "hard-reload : achieve a hard-reload (-st) of haproxy", cli_parse_reload, NULL, NULL, NULL, ACCESS_MASTER_ONLY},
{ { "_loadstatus", NULL }, NULL, cli_parse_default, cli_io_handler_show_loadstatus, NULL, NULL, ACCESS_MASTER_ONLY},
{{},}
}};