rabbitmq / rabbitmq-cli

Command line tools for RabbitMQ
Other
105 stars 34 forks source link

Don't consider nodes in maintenance mode to be queue quorum critical #459

Closed michaelklishin closed 4 years ago

michaelklishin commented 4 years ago

they should have transferred their QQ replicas to its peers and won't be considered for new replica placement or Raft leader elections.

Closes rabbitmq/rabbitmq-server#2469.

gerhard commented 4 years ago
cd deps/rabbitmq_management
make start-cluster NODES=3

export RABBITMQ_NODENAME=rabbit-1@$HOSTNAME
export PATH=$PWD/bin:$PWD/sbin:$PATH
rabbitmqadmin declare queue name=qq queue_type=quorum

rabbitmq-upgrade drain
Will put node rabbit-1@w20 into maintenance mode. The node will no longer serve any client traffic!

rabbitmq-queues quorum_status qq
Status of quorum queue qq on node rabbit-1@w20 ...
┌──────────────┬────────────┬───────────┬──────────────┬────────────────┬──────┬─────────────────┐
│ Node Name    │ Raft State │ Log Index │ Commit Index │ Snapshot Index │ Term │ Machine Version │
├──────────────┼────────────┼───────────┼──────────────┼────────────────┼──────┼─────────────────┤
│ rabbit-3@w20 │ follower   │ 3         │ 3            │ undefined      │ 2    │ 1               │
├──────────────┼────────────┼───────────┼──────────────┼────────────────┼──────┼─────────────────┤
│ rabbit-2@w20 │ leader     │ 3         │ 3            │ undefined      │ 2    │ 1               │
├──────────────┼────────────┼───────────┼──────────────┼────────────────┼──────┼─────────────────┤
│ rabbit-1@w20 │ noproc     │           │              │                │      │                 │
└──────────────┴────────────┴───────────┴──────────────┴────────────────┴──────┴─────────────────┘

rabbitmq-queues check_if_node_is_quorum_critical ; echo $?
Checking if node rabbit-1@w20 is critical for quorum of any quorum queues ...
Node rabbit-1@w20 seems to be in maintenance mode, the check does not apply
0
gerhard commented 4 years ago

Works as expected :shipit: