Commit Graph

903 Commits

Author SHA1 Message Date
David Ansari 38a6ce9601 Fix link of stream docs 2021-07-26 12:03:06 +02:00
Michael Klishin ef14bf067e
ctl add_vhost: propagate tags if no description is given 2021-07-18 08:28:53 +03:00
Arnaud Cogoluègnes 49a70a0f9f
Handle last_stream_member more gently in CLI 2021-06-04 16:35:46 +02:00
Karl Nilsson 9bcd51c2a5 Correct help text for rabbitmq-queue grow command 2021-05-26 14:20:04 +01:00
Gerhard Lazu f8b4e1e298
Add consumer offset_lag to rabbitmq-stream CLI command & Management
This is an important metric to keep track of and be aware (maybe even
alert on) when consumers fall behind consuming stream messages. While
they should be able to catch up, if they fall behind too much and the
stream gets truncated, they may miss on messages.

This is something that we want to expose via Prometheus metrics as well,
but we've started closer to the core, CLI & Management.

This should be merged as soon as it passes CI, we shouldn't wait on the
Prometheus changes - they can come later.

Pair: @kjnilsson

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-05-21 13:02:48 +01:00
Michael Klishin 040f8cc912
Replace a few more leftover MPLv1.1 license headers
Most files have been using the MPLv2 headers for months now.
These were detected by the OSL process.
2021-05-19 21:20:47 +03:00
Michael Klishin 36020f1036
Merge pull request #3017 from rabbitmq/mk-vhost-update-tags
Make it possible to update virtual host metadata (specifically tags)
2021-05-01 22:04:38 +03:00
Michael Klishin a5373d71d6
Make it possible to update virtual host tags
Currently they can only be specified at creation time
2021-05-01 21:48:50 +03:00
dcorbacho 2998234f48 Move stream_status command to streams
Keeps the alias to diagnostics and queues
2021-04-30 11:33:05 +02:00
dcorbacho 310a483221 CLI command to for stream details
rabbitmq-queues stream_status [--tracking] <queue>
If the --tracking option is enabled, it returns a table with all offset tracking
for that queue.
2021-04-13 15:29:40 +01:00
Michael Klishin 7aa0fd6215
CLI: format infinity high VM memory watermark in status
High VM memory watermark cannot actually be set to 'infinity' (and beyond :P)
but it can be returned as a fallback value. See #2733 for some additional
context.

We format 'infinity' as "100% of available memory". This seems to be
a reasonable way to do it because the status command will try to
present a final interpreted limit value.
Generally a limit of infinity won't be returned except very early in node
boot when the monitor(s) haven't yet started.

Per discussion with @evaskova.
2021-04-10 17:33:29 +03:00
Michael Klishin 8566524d3c
CLI: handle {:relative, val} cases when formatting memory watermark
It can be exposed to CLI tools when relative watermark value is
configured via advanced.config.

Closes #2964.
2021-04-10 16:54:12 +03:00
Philip Kuryloski 388654c542
Add a partial Bazel build (#2938)
Adds WORKSPACE.bazel, BUILD.bazel & *.bzl files for partial build & test with Bazel. Introduces a build-time dependency on https://github.com/rabbitmq/bazel-erlang
2021-03-29 11:01:43 +02:00
Michael Klishin 4bceae0c21
Use the standard domain for quorum queue doc guides 2021-03-22 13:40:42 +03:00
Michael Klishin 2fcb282633
Make 'rabbitmq-queues await_online_quorum_plus_one' a no-op for single node clusters
since it does not make sense in that case
2021-03-13 00:47:23 +03:00
Jean-Sébastien Pédron cdcf602749
Switch from Lager to the new Erlang Logger API for logging
The configuration remains the same for the end-user. The only exception
is the log root directory: it is now set through the `log_root`
application env. variable in `rabbit`. People using the Cuttlefish-based
configuration file are not affected by this exception.

The main change is how the logging facility is configured. It now
happens in `rabbit_prelaunch_logging`. The `rabbit_lager` module is
removed.

The supported outputs remain the same: the console, text files, the
`amq.rabbitmq.log` exchange and syslog.

The message text format slightly changed: the timestamp is more precise
(now to the microsecond) and the level can be abbreviated to always be
4-character long to align all messages and improve readability. Here is
an example:

    2021-03-03 10:22:30.377392+01:00 [dbug] <0.229.0> == Prelaunch DONE ==
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Starting RabbitMQ 3.8.10+115.g071f3fb on Erlang 23.2.5
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Licensed under the MPL 2.0. Website: https://rabbitmq.com

The example above also shows that multiline messages are supported and
each line is prepended with the same prefix (the timestamp, the level
and the Erlang process PID).

JSON is also supported as a message format and now for any outputs.
Indeed, it is possible to use it with e.g. syslog or the exchange. Here
is an example of a JSON-formatted message sent to syslog:

    Mar  3 11:23:06 localhost rabbitmq-server[27908] <0.229.0> - {"time":"2021-03-03T11:23:06.998466+01:00","level":"notice","msg":"Logging: configured log handlers are now ACTIVE","meta":{"domain":"rabbitmq.prelaunch","file":"src/rabbit_prelaunch_logging.erl","gl":"<0.228.0>","line":311,"mfa":["rabbit_prelaunch_logging","configure_logger",1],"pid":"<0.229.0>"}}

For quick testing, the values accepted by the `$RABBITMQ_LOGS`
environment variables were extended:
  * `-` still means stdout
  * `-stderr` means stderr
  * `syslog:` means syslog on localhost
  * `exchange:` means logging to `amq.rabbitmq.log`

`$RABBITMQ_LOG` was also extended. It now accepts a `+json` modifier (in
addition to the existing `+color` one). With that modifier, messages are
formatted as JSON intead of plain text.

The `rabbitmqctl rotate_logs` command is deprecated. The reason is
Logger does not expose a function to force log rotation. However, it
will detect when a file was rotated by an external tool.

From a developer point of view, the old `rabbit_log*` API remains
supported, though it is now deprecated. It is implemented as regular
modules: there is no `parse_transform` involved anymore.

In the code, it is recommended to use the new Logger macros. For
instance, `?LOG_INFO(Format, Args)`. If possible, messages should be
augmented with some metadata. For instance (note the map after the
message):

    ?LOG_NOTICE("Logging: switching to configured handler(s); following "
                "messages may not be visible in this log output",
                #{domain => ?RMQLOG_DOMAIN_PRELAUNCH}),

Domains in Erlang Logger parlance are the way to categorize messages.
Some predefined domains, matching previous categories, are currently
defined in `rabbit_common/include/logging.hrl` or headers in the
relevant plugins for plugin-specific categories.

At this point, very few messages have been converted from the old
`rabbit_log*` API to the new macros. It can be done gradually when
working on a particular module or logging.

The Erlang builtin console/file handler, `logger_std_h`, has been forked
because it lacks date-based file rotation. The configuration of
date-based rotation is identical to Lager. Once the dust has settled for
this feature, the goal is to submit it upstream for inclusion in Erlang.
The forked module is calld `rabbit_logger_std_h` and is based
`logger_std_h` in Erlang 23.0.
2021-03-11 15:17:36 +01:00
Michael Klishin d7e1336741
rabbitmq-diagnostics remote_shell: squash a compiler warning 2021-03-11 04:12:23 +03:00
Michael Klishin 0d29cbb116
Cosmetics 2021-03-03 17:17:59 +03:00
Loïc Hoguin 5c829ff599
Add rabbitmq-diagnostics remote_shell 2021-03-03 11:28:54 +01:00
Michael Klishin 93721bfa2d
Whitelist consumer_capacity in 'rabbitmqctl list_queues' 2021-02-24 21:26:46 +03:00
Michael Klishin 17526987c6
Bump (c) year 2021-02-14 00:54:01 +03:00
Michael Klishin 68c04358a5
Drive-by change: improve wording used by 'rabbitmq-queues rebalance' 2021-02-09 21:02:52 +03:00
Michael Klishin 3f6a42e82b
Wording 2021-02-01 20:19:22 +03:00
Michal Kuratczyk ea1f4a355a New command: `rabbitmqctl close_all_user_connections` 2021-02-01 16:04:16 +01:00
Michal Kuratczyk 5a967affdd WIP: close_all_user_connections command 2021-01-28 12:57:18 +01:00
Michael Klishin 400f6f1188
Wording and additional usage docs
(cherry picked from commit 3e3ef927b2)
2020-11-17 14:17:43 +03:00
Michal Kuratczyk ce65586405
Allow "all" as a feature flag name
`rabbitmqctl enable_feature_flag all` enables all currently disabled feature flags.
While https://github.com/rabbitmq/rabbitmq-cli/issues/455 asked for
`--all`, I decided to just use "all" for consistency with
`rabbitmq-queues rebalance all`.

Closes rabbitmq/rabbitmq-cli#455

(cherry picked from commit af9e877848)
2020-11-17 14:17:35 +03:00
Michael Klishin 4f7db32452 Provide an extra hint in 'rabbitmqctl add_user' output
to give the user an idea that she would have to
grant permissions to the newly added user.
2020-10-25 16:43:37 +03:00
Arnaud Cogoluègnes 82e7cb95a1 Merge pull request #460 from rabbitmq/queue-type-info-keys
Add relevant info keys for stream and quorum queues
2020-10-22 13:52:47 +02:00
Michael Klishin 053104258c Simplify node ID generation to just a random number [0, 1024] 2020-10-20 09:18:49 +03:00
Luke Bakken 1a7df254c3 mix format 2020-10-19 17:31:03 -07:00
Luke Bakken 02e234c2de Use the current epoch seconds to generate CLI name
This will limit the number of CLI node names to 1024 by taking the
current epoch seconds modulo a random number between 1 and 1024.

Follow-up to the following:

rabbitmq/rabbitmq-server#552

https://groups.google.com/d/msg/rabbitmq-users/aSnlC5hSvMk/sIWtv5fxCgAJ
2020-10-19 17:27:43 -07:00
dcorbacho d7aaf7bccb Add relevant info keys for stream and quorum queues 2020-10-19 15:57:08 +01:00
Michael Klishin b5bdfe701b Don't consider nodes in maintenance mode to be quorum critical
they should have transferred their QQ replicas to its peers
and won't be considered for new replica placement
or Raft leader elections.

Closes #2469.
2020-10-19 17:29:12 +03:00
Michael Klishin 5a95b3b847 Merge pull request #450 from rabbitmq/auth-attempt-metrics
Add enable/disable and list auth attempt metrics
2020-10-14 23:56:47 +03:00
Michael Klishin c43db9d4d9 Auth attempt command naming, add JSON --formatter support 2020-10-14 23:32:16 +03:00
Luke Bakken 69a51a9c89 mix format 2020-10-12 07:29:00 -07:00
Luke Bakken a9a2164026 Handle offline remote node in rename_cluster_node
If the remote node is unavailable, we use the default values of
`mnesia_dir` and `feature_flags_file`
2020-10-12 07:27:53 -07:00
Michael Klishin 12ec3716e6 Squash a compiler warning 2020-10-05 17:48:55 +03:00
dcorbacho a40f08fbc4 Fix stream commands 2020-09-30 16:34:53 +01:00
dcorbacho eaacd594f5 Move set stream retention policy to rabbitm-streams
Add forgotten tests
2020-09-30 16:34:53 +01:00
dcorbacho fb8610ff44 Add/delete stream replica commands
New ctl utility for stream queues
[#171207068]
2020-09-30 16:34:50 +01:00
dcorbacho b2698901d3 Set stream retention policy command
[#171207092]
2020-09-30 16:34:13 +01:00
dcorbacho ece0aa7609 Shrink quorum queues on forget cluster node command
When the node is offline we can only offer a warning - operator
must use the shrink command once the node is restarted
2020-09-25 15:06:39 +01:00
dcorbacho 49616a709a Add --by-source option to list auth attempts command 2020-09-24 12:29:52 +01:00
dcorbacho 156df91ae2 Rename auth attempt commands 2020-09-23 11:49:13 +01:00
Michael Klishin 664db6c28f Handle cases when there's no message to peek at 2020-09-21 12:33:45 +03:00
Michael Klishin 446e164f27 'rabbitmq-queues peek': tighter position validation, basic JSON formatter support 2020-09-21 12:00:45 +03:00
Michael Klishin 09f60618db 'rabbitmq-queues peek': use MergesDefaultVirtualHost 2020-09-20 20:14:49 +03:00
Michael Klishin e9919a9651 peek command: limit to rabbitmq-queues 2020-09-20 20:13:31 +03:00