diff --git a/Documentation/Reference/MaxCtrl.md b/Documentation/Reference/MaxCtrl.md index 1e0d71b8f..36dd41e6d 100644 --- a/Documentation/Reference/MaxCtrl.md +++ b/Documentation/Reference/MaxCtrl.md @@ -53,17 +53,17 @@ All command accept the following global options. --tsv Print tab separated output [boolean] [default: false] HTTPS/TLS Options: - -s, --secure Enable HTTPS requests [boolean] [default: false] - --tls-key Path to TLS private key [string] - --tls-cert Path to TLS public certificate [string] - --tls-ca-cert Path to TLS CA certificate [string] - --tls-verify-server-cert Whether to verify server TLS certificates + -s, --secure Enable HTTPS requests [boolean] [default: false] + --tls-key Path to TLS private key [string] + --tls-passphrase Password for the TLS private key [string] + --tls-cert Path to TLS public certificate [string] + --tls-ca-cert Path to TLS CA certificate [string] + -n, --tls-verify-server-cert Whether to verify server TLS certificates [boolean] [default: true] Options: - --version Show version number [boolean] - --tls-passphrase Password for the TLS private key [string] - --help Show help [boolean] + --version Show version number [boolean] + --help Show help [boolean] If no commands are given, maxctrl is started in interactive mode. Use `exit` to exit the interactive mode. @@ -83,7 +83,7 @@ Commands: filters List filters modules List loaded modules threads List threads - users List created network users + users List created users commands List module commands ``` @@ -140,7 +140,8 @@ List all worker threads. `Usage: list users` -List the users that can be used to connect to the MaxScale REST API. +List network the users that can be used to connect to the MaxScale REST API as +well as enabled local accounts. ### list commands @@ -298,6 +299,10 @@ Usage: set Commands: server Set server state +Set options: + --force Forcefully close all connections to the target server + [boolean] [default: false] + ``` ### set server @@ -471,6 +476,8 @@ The last argument to this command is a list of key=value parameters given as the service parameters. If the --servers or --filters options are used, they must be defined after the service parameters. +Note that the `user` and `password` parameters must be defined. + ### create filter `Usage: filter [params...]` @@ -610,7 +617,7 @@ Usage: start Commands: service Start a service monitor Start a monitor - maxscale Start MaxScale by starting all services + services Start all services [aliases: maxscale] ``` @@ -626,9 +633,9 @@ This starts a service stopped by `stop service ` This starts a monitor stopped by `stop monitor ` -### start maxscale +### start services -`Usage: start maxscale` +`Usage: start [services|maxscale]` This command will execute the `start service` command for all services in MaxScale. @@ -641,7 +648,7 @@ Usage: stop Commands: service Stop a service monitor Stop a monitor - maxscale Stop MaxScale by stopping all services + services Stop all services [aliases: maxscale] ``` @@ -660,9 +667,9 @@ until they are closed. Stopping a monitor will pause the monitoring of the servers. This can be used to manually control server states with the `set server` command. -### stop maxscale +### stop services -`Usage: stop maxscale` +`Usage: stop [services|maxscale]` This command will execute the `stop service` command for all services in MaxScale. @@ -679,6 +686,7 @@ Commands: service-filters [filters...] Alter filters of a service logging Alter logging parameters maxscale Alter MaxScale parameters + user Alter admin user passwords ``` @@ -698,8 +706,11 @@ To display the monitor parameters, execute `show monitor ` `Usage: alter service ` -To display the service parameters, execute `show service `. The -following list of parameters can be altered at runtime: +To display the service parameters, execute `show service `. Some +routers support runtime configuration changes to all parameters. Currently all +readconnroute, readwritesplit and schemarouter parameters can be changed at +runtime. In addition to module specific parameters, the following list of common +service parameters can be altered at runtime: [ "user", @@ -712,7 +723,8 @@ following list of parameters can be altered at runtime: "strip_db_esc", "localhost_match_wildcard_host", "max_slave_connections", - "max_slave_replication_lag" + "max_slave_replication_lag", + "retain_last_statements" ] ### alter service-filters @@ -747,9 +759,22 @@ of parameters can be altered at runtime: "auth_write_timeout", "admin_auth", "admin_log_auth_failures", - "passive" + "passive", + "ms_timestamp", + "skip_permission_checks", + "query_retries", + "query_retry_timeout", + "retain_last_statements", + "dump_last_statements" ] +### alter user + +`Usage: alter user ` + +Changes the password for a user. To change the user type, destroy the user and +then create it again. + ## rotate ``` diff --git a/maxctrl/lib/create.js b/maxctrl/lib/create.js index 2367b2ade..d0740a6f7 100644 --- a/maxctrl/lib/create.js +++ b/maxctrl/lib/create.js @@ -197,7 +197,8 @@ exports.builder = function(yargs) { .command('service ', 'Create a new service', function(yargs) { return yargs.epilog('The last argument to this command is a list of key=value parameters ' + 'given as the service parameters. If the --servers or --filters options ' + - 'are used, they must be defined after the service parameters.') + 'are used, they must be defined after the service parameters.' + + '\n\nNote that the `user` and `password` parameters must be defined.') .usage('Usage: service ') .group(['servers', 'filters'], 'Create service options:') .option('servers', { diff --git a/maxutils/maxbase/include/maxbase/worker.hh b/maxutils/maxbase/include/maxbase/worker.hh index 871f51581..7208ec403 100644 --- a/maxutils/maxbase/include/maxbase/worker.hh +++ b/maxutils/maxbase/include/maxbase/worker.hh @@ -42,17 +42,18 @@ struct WORKER_STATISTICS N_QUEUE_TIMES = 30 }; - int64_t n_read = 0; /*< Number of read events */ - int64_t n_write = 0; /*< Number of write events */ - int64_t n_error = 0; /*< Number of error events */ - int64_t n_hup = 0; /*< Number of hangup events */ - int64_t n_accept = 0; /*< Number of accept events */ - int64_t n_polls = 0; /*< Number of poll cycles */ - int64_t n_pollev = 0; /*< Number of polls returning events */ - int64_t evq_avg = 0; /*< Average event queue length */ - int64_t evq_max = 0; /*< Maximum event queue length */ - int64_t maxqtime = 0; - int64_t maxexectime = 0; + int64_t n_read = 0; /*< Number of read events */ + int64_t n_write = 0; /*< Number of write events */ + int64_t n_error = 0; /*< Number of error events */ + int64_t n_hup = 0; /*< Number of hangup events */ + int64_t n_accept = 0; /*< Number of accept events */ + int64_t n_polls = 0; /*< Number of poll cycles */ + int64_t n_pollev = 0; /*< Number of polls returning events */ + int64_t evq_avg = 0; /*< Average event queue length */ + int64_t evq_max = 0; /*< Maximum event queue length */ + int64_t maxqtime = 0; + int64_t maxexectime = 0; + std::array n_fds {}; /*< Number of wakeups with particular n_fds value */ std::array qtimes {}; std::array exectimes {}; diff --git a/maxutils/maxbase/src/worker.cc b/maxutils/maxbase/src/worker.cc index 71b0b4eb4..7b9638168 100644 --- a/maxutils/maxbase/src/worker.cc +++ b/maxutils/maxbase/src/worker.cc @@ -523,9 +523,19 @@ bool Worker::call(function func, execute_mode_t mode) bool Worker::post_message(uint32_t msg_id, intptr_t arg1, intptr_t arg2) { // NOTE: No logging here, this function must be signal safe. - MessageQueue::Message message(msg_id, arg1, arg2); + bool rval = false; - return m_pQueue->post(message); + // TODO: Enable and fix this in develop and/or 2.4: The deletion of rworker_local is done after the + // workers have stopped and it triggers this assertion. + // mxb_assert(state() != Worker::STOPPED); + + if (state() != Worker::STOPPED) + { + MessageQueue::Message message(msg_id, arg1, arg2); + rval = m_pQueue->post(message); + } + + return rval; } void Worker::run(mxb::Semaphore* pSem) diff --git a/server/core/admin.cc b/server/core/admin.cc index 23cfbf22a..902b3c2c6 100644 --- a/server/core/admin.cc +++ b/server/core/admin.cc @@ -420,6 +420,7 @@ bool mxs_admin_init() void mxs_admin_shutdown() { MHD_stop_daemon(http_daemon); + MXS_NOTICE("Stopped MaxScale REST API"); } bool mxs_admin_https_enabled() diff --git a/server/core/gateway.cc b/server/core/gateway.cc index ad7d35d71..e2e0d380b 100644 --- a/server/core/gateway.cc +++ b/server/core/gateway.cc @@ -2248,9 +2248,6 @@ int main(int argc, char** argv) main_worker->run(); - /** Stop administrative interface */ - mxs_admin_shutdown(); - /*< Stop all monitors */ MonitorManager::stop_all_monitors(); diff --git a/server/core/misc.cc b/server/core/misc.cc index bbdd8c919..18a2263d3 100644 --- a/server/core/misc.cc +++ b/server/core/misc.cc @@ -20,6 +20,7 @@ #include "internal/maxscale.hh" #include "internal/service.hh" +#include "internal/admin.hh" static time_t started; @@ -51,12 +52,18 @@ int maxscale_shutdown() if (n == 0) { - if (mxs::MainWorker::created()) - { - mxs::MainWorker::get().shutdown(); - } + auto func = []() { + if (mxs::MainWorker::created()) + { + mxs::MainWorker::get().shutdown(); + } - mxs::RoutingWorker::shutdown_all(); + mxs_admin_shutdown(); + mxs::RoutingWorker::shutdown_all(); + }; + + auto w = mxs::RoutingWorker::get(mxs::RoutingWorker::MAIN); + w->execute(func, nullptr, mxs::RoutingWorker::EXECUTE_QUEUED); } return n + 1;