Commit Graph

63 Commits

Author SHA1 Message Date
cui fliter 76989a7733
remove repetitive words (#8981)
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-07-31 12:50:52 +02:00
David Ansari ed31a818c3 Make mqtt.subscription_ttl unsupported
Starting with RabbitMQ 3.13 mqtt.max_session_expiry_interval_seconds
(set in seconds) will replace the previous setting
mqtt.subscription_ttl.

MQTT 5.0 introduces the Session Expiry Interval
feature which does not only apply to subscribers, but also to
publishers.

The new config name mqtt.max_session_expiry_interval_seconds makes it clear
that it also applies to publishers.

Prior to this commit, when mqtt.subscription_ttl was set, a warning got
logged and the value was ignored. This is dangerous if an operator does
not see the warning but relies for example on `mqtt.subscription =
infinity` to not expire non clean session.

It's safer to make the boot fail if that unsupported config name is
still set. A clear error message will be logged:
```
[error] <0.142.0> Error preparing configuration in phase apply_translations:
[error] <0.142.0>   - Translation for 'rabbitmq_mqtt.subscription_ttl' found invalid configuration:
        Since 3.13 mqtt.subscription_ttl (in milliseconds) is unsupported.
        Use mqtt.max_session_expiry_interval_seconds (in seconds) instead.
```

Alternatively, RabbitMQ could translate mqtt.subscription_ttl to
mqtt.max_session_expiry_interval_seconds.

However, forcing the new config option sounds the better way to go.

Once we write MQTT 5.0 docs, this change must go into the 3.13 release notes.

This commit also renames max_session_expiry_interval_secs to max_session_expiry_interval_seconds.
The latter is clearer to users.
2023-07-13 14:47:33 +00:00
Michael Klishin 769875db45 Trigger a new build
(cherry picked from commit 0900c292b8)
2023-06-22 02:43:20 +04:00
David Ansari 2efd9c06b8 Support Session Expiry Interval
Allow Session Expiry Interval to be changed when client DISCONNECTs.

Deprecate config subscription_ttl in favour of max_session_expiry_interval_secs
because the Session Expiry Interval will also apply to publishers that
connect with a will message and will delay interval.
"The additional session state of an MQTT v5 server includes:
* The Will Message and the Will Delay Interval
* If the Session is currently not connected, the time at which the Session
  will end and Session State will be discarded."

The Session Expiry Interval picked by the server and sent to the client
in the CONNACK is the minimum of max_session_expiry_interval_secs and
the requested Session Expiry Interval by the client in CONNECT.

This commit favours dynamically changing the queue argument x-expires
over creating millions of different policies since that many policies
will come with new scalability issues.

Dynamically changing queue arguments is not allowed by AMQP 0.9.1
clients. However, it should be perfectly okay for the MQTT plugin to do
so for the queues it manages. MQTT clients are not aware that these
queues exist.
2023-06-21 17:14:08 +01:00
Michael Klishin 55442aa914 Replace @rabbitmq.com addresses with rabbitmq-core@groups.vmware.com
Don't ask why we have to do it. Because reasons!
2023-06-20 15:40:13 +04:00
Jean-Sébastien Pédron ac0565287b
Deprecated features: New module to manage deprecated features (!)
This introduces a way to declare deprecated features in the code, not
only in our communication. The new module allows to disallow the use of
a deprecated feature and/or warn the user when he relies on such a
feature.

[Why]
Currently, we only tell people about deprecated features through blog
posts and the mailing-list. This might be insufficiant for our users
that a feature they use will be removed in a future version:
* They may not read our blog or mailing-list
* They may not understand that they use such a deprecated feature
* They might wait for the big removal before they plan testing
* They might not take it seriously enough

The idea behind this patch is to increase the chance that users notice
that they are using something which is about to be dropped from
RabbitMQ. Anopther benefit is that they should be able to test how
RabbitMQ will behave in the future before the actual removal. This
should allow them to test and plan changes.

[How]
When a feature is deprecated in other large projects (such as FreeBSD
where I took the idea from), it goes through a lifecycle:
1. The feature is still available, but users get a warning somehow when
   they use it. They can disable it to test.
2. The feature is still available, but disabled out-of-the-box. Users
   can re-enable it (and get a warning).
3. The feature is disconnected from the build. Therefore, the code
   behind it is still there, but users have to recompile the thing to be
   able to use it.
4. The feature is removed from the source code. Users have to adapt or
   they can't upgrade anymore.

The solution in this patch offers the same lifecycle. A deprecated
feature will be in one of these deprecation phases:
1. `permitted_by_default`: The feature is available. Users get a warning
   if they use it. They can disable it from the configuration.
2. `denied_by_default`: The feature is available but disabled by
   default. Users get an error if they use it and RabbitMQ behaves like
   the feature is removed. They can re-enable is from the configuration
   and get a warning.
3. `disconnected`: The feature is present in the source code, but is
   disabled and can't be re-enabled without recompiling RabbitMQ. Users
   get the same behavior as if the code was removed.
4. `removed`: The feature's code is gone.

The whole thing is based on the feature flags subsystem, but it has the
following differences with other feature flags:
* The semantic is reversed: the feature flag behind a deprecated feature
  is disabled when the deprecated feature is permitted, or enabled when
  the deprecated feature is denied.
* The feature flag behind a deprecated feature is enabled out-of-the-box
  (meaning the deprecated feature is denied):
    * if the deprecation phase is `permitted_by_default` and the
      configuration denies the deprecated feature
    * if the deprecation phase is `denied_by_default` and the
      configuration doesn't permit the deprecated feature
    * if the deprecation phase is `disconnected` or `removed`
* Feature flags behind deprecated feature don't appear in feature flags
  listings.

Otherwise, deprecated features' feature flags are managed like other
feature flags, in particular inside clusters.

To declare a deprecated feature:

    -rabbit_deprecated_feature(
       {my_deprecated_feature,
        #{deprecation_phase => permitted_by_default,
          msgs => #{when_permitted => "This feature will be removed in RabbitMQ X.0"},
         }}).

Then, to check the state of a deprecated feature in the code:

    case rabbit_deprecated_features:is_permitted(my_deprecated_feature) of
        true ->
            %% The deprecated feature is still permitted.
            ok;
        false ->
            %% The deprecated feature is gone or should be considered
            %% unavailable.
            error
    end.

Warnings and errors are logged automatically. A message is generated
automatically, but it is possible to define a message in the deprecated
feature flag declaration like in the example above.

Here is an example of a logged warning that was generated automatically:

    Feature `my_deprecated_feature` is deprecated.
    By default, this feature can still be used for now.
    Its use will not be permitted by default in a future minor RabbitMQ version and the feature will be removed from a future major RabbitMQ version; actual versions to be determined.
    To continue using this feature when it is not permitted by default, set the following parameter in your configuration:
        "deprecated_features.permit.my_deprecated_feature = true"
    To test RabbitMQ as if the feature was removed, set this in your configuration:
        "deprecated_features.permit.my_deprecated_feature = false"

To override the default state of `permitted_by_default` and
`denied_by_default` deprecation phases, users can set the following
configuration:

    # In rabbitmq.conf:
    deprecated_features.permit.my_deprecated_feature = true # or false

The actual behavior protected by a deprecated feature check is out of
scope for this subsystem. It is the repsonsibility of each deprecated
feature code to determine what to do when the deprecated feature is
denied.

V1: Deprecated feature states are initially computed during the
    initialization of the registry, based on their deprecation phase and
    possibly the configuration. They don't go through the `enable/1`
    code at all.

V2: Manage deprecated feature states as any other non-required
    feature flags. This allows to execute an `is_feature_used()`
    callback to determine if a deprecated feature can be denied. This
    also allows to prevent the RabbitMQ node from starting if it
    continues to use a deprecated feature.

V3: Manage deprecated feature states from the registry initialization
    again. This is required because we need to know very early if some
    of them are denied, so that an upgrade to a version of RabbitMQ
    where a deprecated feature is disconnected or removed can be
    performed.

    To still prevent the start of a RabbitMQ node when a denied
    deprecated feature is actively used, we run the `is_feature_used()`
    callback of all denied deprecated features as part of the
    `sync_cluster()` task. This task is executed as part of a feature
    flag refresh executed when RabbitMQ starts or when plugins are
    enabled. So even though a deprecated feature is marked as denied in
    the registry early in the boot process, we will still abort the
    start of a RabbitMQ node if the feature is used.

V4: Support context-dependent warnings. It is now possible to set a
    specific message when deprecated feature is permitted, when it is
    denied and when it is removed. Generic per-context messages are
    still generated.

V5: Improve default warning messages, thanks to @pstack2021.

V6: Rename the configuration variable from `permit_deprecated_features.*`
    to `deprecated_features.permit.*`. As @michaelklishin said, we tend
    to use shorter top-level names.
2023-06-06 13:02:03 +02:00
Michal Kuratczyk 0a3136a916
Allow applying policies to specific queue types
Rather than relying on queue name conventions, allow applying policies
based on the queue type. For example, this allows multiple policies that
apply to all queue names (".*") that specify different parameters for
different queue types.
2023-03-13 12:36:48 +01:00
Aitor Perez Cedres 9c198d3df4
Document set_permissions_globally CLI command
Signed-off-by: Aitor Perez Cedres <acedres@vmware.com>
2023-03-09 16:06:23 +00:00
aubbiali 64957b0251 Added documentation for decommission_mqtt_node 2023-02-28 08:25:26 +01:00
Michael Klishin dd90d64a77
rabbitmqctl(8): move hash_password next to clear_password 2023-02-27 16:19:56 +04:00
Luke Bakken f420487e5e
Add documentation for hashing passwords
Fixes #7432

Adds HTTP API documentation as well as `rabbitmqctl hash_password` docs.

Add `rabbitmqctl` docs
2023-02-26 15:16:38 -08:00
David Ansari 575f4e78bc Remove compatibility for feature flag stream_queue
Remove compatibility code for feature flag `stream_queue`
because this feature flag is required in 3.12.

See #7219
2023-02-13 15:31:40 +00:00
David Ansari 97fefff0fe Add overflow drop-head to rabbit_mqtt_qos_queue type
Traditionally, queue types implement flow control by keeping state in
both sending and receiving Erlang processes (for example credit based flow
control keeps the number of credits within the process dictionary).

The rabbit_mqtt_qos0_queue cannot keep such state in sending or receiving
Erlang process because such state would consume a large amount of memory
in case of large fan-ins or large fan-outs.
The whole idea of the rabbit_mqtt_qos_queue type is to not keep any
state in the rabbit_queue_type client. This makes this new queue
type scale so well.

Therefore the new queue type cannot (easily) implement flow control
throttling individual senders.

In this commit, we take a different approach:
Instead of implementing flow control throttling individual senders,
the receiving MQTT connection process drops QoS 0 messages from the
rabbit_mqtt_qos_queue if it is overflowed with messages AND its MQTT
client is not capable of receiving messages fast enough.

This is a simple and sufficient solution because it's better to drop QoS
0 (at most once) messages instead of causing cluster-wide memory alarms.

The user can opt out of dropping messages by setting the new env setting
mailbox_soft_limit to 0.

Additionally, we reduce the send_timeout from 30 seconds default in
Ranch to 15 seconds default in MQTT. This will detect hanging MQTT
clients faster causing the MQTT connection to be closed.
2023-01-24 17:30:10 +00:00
Luke Bakken 4c5de7cf8b
Add load_definitions example
Pointed out by @tinakurian-pki

https://groups.google.com/g/rabbitmq-users/c/UAi_v3dyMtQ
2023-01-06 06:43:47 -08:00
Michael Klishin ec4f1dba7d
(c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
Michal Kuratczyk e203dd8615
Add `rabbitmq-queues rebalance stream` to the man page 2022-12-19 10:50:40 +01:00
Michael Klishin 93bac75169
rabbitmqctl(8): wording 2022-12-03 02:54:42 +04:00
Alexey Lebedeff 398f072a03 Expose effective policy definition via CLI
Now it's only visible in the management UI.

One can craft a series of calls to `rabbitmqctl list_queues` and
`rabbitmqctl list_policies` to achieve similiar result. But it's more
difficult, and also doesn't take operator policy (if any) into account.
2022-12-02 17:06:17 +01:00
Michael Klishin 8c305a0770
rabbitmqctl(8) wording 2022-11-13 12:25:26 +04:00
Alex Valiushko d70660dac7 Add inclusive aliases to ctl info keys
Includes generic ability to provide aliases in other commands.
2022-11-11 14:44:05 -08:00
Michael Klishin ba9b4c143c
Apply rabbitmq/rabbitmq-website#1508 at the source (man pages) 2022-10-26 15:39:06 +04:00
Alex Valiushko 2e7692da5b fix docs for rabbitmqctl restart_vhost 2022-10-05 20:22:22 -07:00
Arnaud Cogoluègnes f92b2a3d7d
Complement rabbitmq-stream.8 with SAC and super streams 2022-09-23 09:57:42 +02:00
Arnaud Cogoluègnes ed8c9f9298
Add links to rabbitmq-streams man page 2022-09-22 12:00:48 +02:00
Arnaud Cogoluègnes 91b93137a7
Add stream plugin commands to rabbitmq-streams man page 2022-09-22 11:49:57 +02:00
Arnaud Cogoluègnes 1e07a5f5cd
Add rabbitmq-streams manpage 2022-09-22 09:38:21 +02:00
Michael Klishin 770953f753 Apply rabbitmq/rabbitmq-website#1462 at the source (man pages) 2022-08-23 02:33:13 +04:00
Michael Klishin bc49d42bb5 rabbitmq-diagnostics(8): correct a flag
Suggested in rabbitmq/rabbitmq-website#1462
2022-08-22 21:57:56 +04:00
Michael Klishin 4faec42412
rabbitmqctl(8): correct add_vhost option dashes 2022-08-02 14:50:48 +04:00
Michael Klishin abc1dcc5e6
rabbitmqctl(8): document optional args supported by add_vhost 2022-08-02 14:46:53 +04:00
Iliia Khaprov - VMware 6aff83c834
Follow-up for #5399. Add new vhost information items to the list 2022-08-02 10:35:55 +02:00
Jean-Sébastien Pédron 4dd07e2905
rabbitmqctl.8: Use `stream_queue` in the `enable_feature_flag` example
The `quorum_queue` feature flag is now required and is always enabled.
2022-08-01 12:31:44 +02:00
Péter Gömöri 542ffeebb5 Clarify documented/allowed log_level arg of rabbitmqctl set_log_level
The `critical` log level is already documented on the website/logging section.
2022-05-11 19:22:28 +02:00
Michael Klishin 9fb1ca140d
Add clear_user_limits to rabbitmqctl(8) 2022-04-28 23:52:54 +04:00
Michael Klishin 363bf649ff
Correct a typo 2022-04-28 22:20:53 +04:00
Michael Klishin e58679153d
Add set_user_limits to rabbitmqctl(8) 2022-04-28 22:11:59 +04:00
Michael Klishin e9ba3f760a
Add a visible warning for mqtt.durable_queue_type 2022-04-05 14:34:32 +04:00
Gabriele Santomaggio 35d8978de5 add config example for mqtt quorum 2022-04-05 09:16:24 +02:00
Michael Klishin c38a3d697d
Bump (c) year 2022-03-21 01:21:56 +04:00
Michael Klishin f7d32d69f8 Introduce a new CLI tool (scope), rabbitmq-tanzu
For Tanzu (commercial) plugins to attach their commands to instead of
polluting rabbitmqctl.

Pair: @pjk25
(cherry picked from commit 6e0f2436fa)
2021-11-30 14:54:09 +00:00
Fushan Wen 23d5073dcb Add systemd hardening parameters in rabbitmq-server.service.example
systemd offers various options to harden services. To see details please
visit https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
2021-11-19 19:06:21 +08:00
Michael Klishin 133e0ab72d
Manually apply rabbitmq/rabbitmq-website#1241 by @lushndm 2021-08-11 13:34:27 +03:00
Michael Klishin c12544f545
Update rabbitmq.conf.example header
mostly to test Mergify integration with @pjk25.
2021-08-03 13:19:52 +03:00
Michael Klishin 5f8f57dac6
Drop a few exclusive terms still present in man pages
References #3159
2021-07-02 14:12:43 +03:00
Michael Klishin 8ec3b08462
More man page massaging 2021-06-19 19:27:53 +08:00
Michael Klishin 0b716aee3b
Minor man page updates post rabbitmq/rabbitmq-website#1209 2021-06-18 08:47:13 +08:00
Michael Klishin 0572156d74
Update a rabbitmqctl(8) example
As suggested in rabbitmq/rabbitmq-website#1209 by @jaisea
2021-06-15 14:52:18 +08:00
Michael Klishin 8c03f51972
Revert "Merge pull request #3090 from johanrhodin/patch-1"
This reverts commit 0f94046b37, reversing
changes made to 37f5744833.

The value would be rejected by rabbitmq.conf schema validation.
It can be set to `undefined` via `rabbit.consumer_timeout` in
`advanced.config`.
2021-06-11 03:58:52 +03:00
Johan Rhodin ec23d34b48
Update rabbitmq.conf.example 2021-06-09 14:55:42 -05:00
kjnilsson 2ab05b8ff5 Set a default for consumer_timeout
So that faulty consumers that will never ack a pending messages have
their channels closed after 15 minutes.
2021-04-21 09:58:41 +01:00