rabbitmqadmin 2.22.0

rabbitmqadmin v2 is a modern CLI tool for the RabbitMQ HTTP API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
# rabbitmqadmin v2: a Modern Command Line Client for the [RabbitMQ HTTP API]https://www.rabbitmq.com/docs/http-api-reference

`rabbitmqadmin` v2 is a major revision of `rabbitmqadmin`, one of the [RabbitMQ CLI tools](https://www.rabbitmq.com/docs/cli)
that target the [HTTP API](https://www.rabbitmq.com/docs/http-api-reference).

If you are migrating from the original `rabbitqadmin`, please see [Breaking or Potentially Breaking Changes](#breaking-or-potentially-breaking-changes)
to learn about the breaking changes in the command line interface.

The general "shape and feel" of the interface is still very similar to `rabbitmqadmin` v1. However, this generation
is significantly more powerful, in particular, when it comes to [Blue-Green Deployment upgrades and migrations](https://www.rabbitmq.com/blog/2025/07/29/latest-benefits-of-rmq-and-migrating-to-qq-along-the-way)
from RabbitMQ 3.13.x to 4.x.


## Supported RabbitMQ Series

`rabbitmqadmin` v2 targets

 * Open source RabbitMQ `4.x`
 * Open source RabbitMQ `3.13.x` (specifically for the command groups and commands related to upgrades)
 * Tanzu RabbitMQ `4.x`
 * Tanzu RabbitMQ `3.13.x`


## Getting Started

### Installation

#### Binary Releases

To download a binary build, see [Releases](https://github.com/rabbitmq/rabbitmqadmin-ng/releases).

#### Building from Source with `cargo install`

On platforms not covered by the binary builds, `rabbitmqadmin` v2 can be installed with [Cargo](https://doc.rust-lang.org/cargo/commands/cargo-install.html):

```shell
cargo install rabbitmqadmin
```

### Documentation

For usage documentation, see the [dedicated RabbitMQ doc guide](https://www.rabbitmq.com/docs/management-cli) and/or [Usage](#usage) below.


## Getting Help

Please use GitHub Discussions in this repository and [RabbitMQ community Discord server](https://rabbitmq.com/discord/).


## Project Maturity

This version of `rabbitmqadmin` should be considered reasonably mature to be used.

Before migrating, please see [Breaking or Potentially Breaking Changes](#breaking-or-potentially-breaking-changes) to learn about a few breaking change in the interface.


## Usage

### Explore Available Command Groups and Sub-commands

To explore what command groups are available, use

```shell
rabbitmqadmin help
```

which will output a list of command groups:

```
Usage: rabbitmqadmin [OPTIONS] <COMMAND>

Commands:
  bindings             Operations on bindings
  channels             Operations on channels
  close                Closes connections
  connections          Operations on connections
  declare              Creates or declares objects
  definitions          Operations on definitions (everything except for messages: virtual hosts, queues, streams, exchanges, bindings, users, etc)
  delete               Deletes objects
  deprecated_features  Operations on deprecated features
  exchanges            Operations on exchanges
  export               See 'definitions export'
  feature_flags        Operations on feature flags
  federation           Operations on federation upstreams and links
  get                  Fetches message(s) from a queue or stream via polling. Only suitable for development and test environments.
  global_parameters    Operations on global runtime parameters
  health_check         Runs health checks
  import               See 'definitions import'
  list                 Lists objects
  nodes                Node operations
  operator_policies    Operations on operator policies
  parameters           Operations on runtime parameters
  passwords            Operations on passwords
  permissions          Operations on user permissions
  plugins              List enabled plugins
  policies             Operations on policies
  publish              Publishes (inefficiently) message(s) to a queue or a stream. Only suitable for development and test environments.
  purge                Purges queues
  queues               Operations on queues
  rebalance            Rebalancing of leader replicas
  show                 Overview, memory footprint breakdown, and more
  shovels              Operations on shovels
  streams              Operations on streams
  tanzu                Tanzu RabbitMQ-specific commands
  users                Operations on users
  user_limits          Operations on per-user (resource) limits
  vhosts               Virtual host operations
  vhost_limits         Operations on virtual host (resource) limits
  help                 Print this message or the help of the given subcommand(s)
```

To explore commands in a specific group, use

```shell
rabbitmqadmin {group name} help
```

### Explore the CLI with `help`, `--help`

To learn about what command groups and specific commands are available, run

``` shell
rabbitmqadmin help
```

This flag can be appended to a command or subcommand to get command-specific documentation:

```shell
rabbitmqadmin queues declare --help
# => Declares a queue or a stream
# =>
# => Usage: rabbitmqadmin queues declare [OPTIONS] --name <name>
# => ...
```

Alternatively, the `help` subcommand can be given a command name. It's the equivalent
of tagging on `--help` at the end of command name:

```shell
rabbitmqadmin queues help declare
# => Declares a queue or a stream
# =>
# => Usage: rabbitmqadmin queues declare [OPTIONS] --name <name>
```

More specific examples are covered in the Examples section below.


### Interactive vs. Use in Scripts

Like the original version, `rabbitmqadmin` v2 is first and foremost built for interactive use
by humans. Many commands will output formatted tables, for example:

```shell
rabbitmqadmin show overview
```

will output a table that looks like this:

```
┌───────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Overview                                                                                                                                                            │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ key                                                               │ value                                                                                           │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Product name                                                      │ RabbitMQ                                                                                        │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Product version                                                   │ 4.1.2                                                                                           │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ RabbitMQ version                                                  │ 4.1.2                                                                                           │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Erlang version                                                    │ 27.3.4                                                                                          │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Erlang details                                                    │ Erlang/OTP 27 [erts-15.2.5] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Connections (total)                                               │ 4                                                                                               │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ AMQP 0-9-1 channels (total)                                       │ 4                                                                                               │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Queues and streams (total)                                        │ 4                                                                                               │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Consumers (total)                                                 │ 4                                                                                               │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Messages (total)                                                  │ 222                                                                                             │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Messages ready for delivery (total)                               │ 2                                                                                               │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Messages delivered but unacknowledged by consumers (total)        │ 220                                                                                             │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Publishing (ingress) rate (global)                                │                                                                                                 │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Publishing confirm rate (global)                                  │                                                                                                 │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Consumer delivery (egress) rate (global)                          │                                                                                                 │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Consumer delivery in automatic acknowledgement mode rate (global) │                                                                                                 │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Consumer acknowledgement rate (global)                            │                                                                                                 │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Unroutable messages: returned-to-publisher rate (global)          │                                                                                                 │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Unroutable messages: dropped rate (global)                        │                                                                                                 │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Cluster tags                                                      │ "az": "us-east-3"                                                                               │
│                                                                   │ "environment": "production"                                                                     │
│                                                                   │ "region": "us-east"                                                                             │
│                                                                   │                                                                                                 │
├───────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Node tags                                                         │ "environment": "production"                                                                     │
│                                                                   │ "instance": "xlarge.m3"                                                                         │
│                                                                   │                                                                                                 │
└───────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────┘
```

As it is easy to observe, parsing such output in a script will be challenging.

For this reason, `rabbitmqadmin` v2 can render results in a way that would be much more friendly
for scripting if the `--non-interactive` flag is passed. It is a global flag so it must be
passed before the command and subcommand name:

```shell
rabbitmqadmin --non-interactive show overview
```

The output of the above command will not include any table borders and will is much easier to parse
as a result:

```
key
Product name                                                      RabbitMQ
Product version                                                   4.1.2
RabbitMQ version                                                  4.1.2
Erlang version                                                    27.3.4
Erlang details                                                    Erlang/OTP 27 [erts-15.2.7] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Connections (total)                                               0
AMQP 0-9-1 channels (total)                                       0
Queues and streams (total)                                        3
Consumers (total)                                                 0
Messages (total)                                                  0
Messages ready for delivery (total)                               0
Messages delivered but unacknowledged by consumers (total)        0
Publishing (ingress) rate (global)
Publishing confirm rate (global)
Consumer delivery (egress) rate (global)
Consumer delivery in automatic acknowledgement mode rate (global)
Consumer acknowledgement rate (global)
Unroutable messages: returned-to-publisher rate (global)
Unroutable messages: dropped rate (global)
Cluster tags                                                      "az": "us-east-3","environment": "production","region": "us-east",
Node tags                                                         "environment": "production","instance": "xlarge.m3",
```

### Retrieve Basic Node Information

``` shell
rabbitmqadmin show overview
```

will display essential node information in tabular form.

### Retrieve Connection, Queue/Stream, Channel Churn Information

Helps assess connection, queue/stream, channel [churn metrics](https://rabbitmq.com/docs/connections#high-connection-churn) in the cluster.

``` shell
rabbitmqadmin show churn
```

### Display the HTTP API Endpoint

To verify the computed HTTP API endpoint URI (useful for troubleshooting):

``` shell
rabbitmqadmin show endpoint
```

### List Cluster Nodes

``` shell
rabbitmqadmin nodes list
```

### List Virtual Hosts

``` shell
rabbitmqadmin vhosts list
```

### List Users

``` shell
rabbitmqadmin users list
```

### List Queues

``` shell
rabbitmqadmin queues list
```

``` shell
rabbitmqadmin --vhost "monitoring" queues list
```

``` shell
# List queues with specific columns only
rabbitmqadmin queues list --columns name,queue_type,message_count
```

### Show Queue Details

``` shell
rabbitmqadmin queues show --name "events.incoming"
```

``` shell
rabbitmqadmin queues show --name "orders.pending" --columns name,queue_type,message_count
```

### List Exchanges

``` shell
rabbitmqadmin exchanges list
```

``` shell
rabbitmqadmin --vhost "events" exchanges list
```

### List Bindings

``` shell
rabbitmqadmin bindings list
```

``` shell
rabbitmqadmin --vhost "events" bindings list
```

### List Consumers

``` shell
rabbitmqadmin consumers list
```

``` shell
rabbitmqadmin --vhost "events" consumers list
```

### Create a Virtual Host

```shell
rabbitmqadmin vhosts declare --name "vh-789" --default-queue-type "quorum" --description "Used to reproduce issue #789"
```

### Delete a Virtual Host

```shell
rabbitmqadmin vhosts delete --name "vh-789"
```

```shell
# --idempotently means that 404 Not Found responses will not be  considered errors
rabbitmqadmin vhosts delete --name "vh-789" --idempotently
```

### Enable Virtual Host Deletion Protection

```shell
rabbitmqadmin vhosts enable_deletion_protection --name "production"
```

### Disable Virtual Host Deletion Protection

```shell
rabbitmqadmin vhosts disable_deletion_protection --name "production"
```

### Declare a Queue

```shell
rabbitmqadmin --vhost "events" queues declare --name "target.quorum.queue.name" --type "quorum" --durable true
```

```shell
rabbitmqadmin --vhost "events" queues declare --name "target.stream.name" --type "stream" --durable true
```

```shell
rabbitmqadmin --vhost "events" queues declare --name "target.classic.queue.name" --type "classic" --durable true --auto-delete false
```

### Purge a queue

```shell
rabbitmqadmin --vhost "events" queues purge --name "target.queue.name"
```

### Delete a queue

``` shell
rabbitmqadmin --vhost "events" queues delete --name "target.queue.name"
```

``` shell
# --idempotently means that 404 Not Found responses will not be  considered errors
rabbitmqadmin --vhost "events" queues delete --name "target.queue.name" --idempotently
```

### Declare an Exchange

```shell
rabbitmqadmin --vhost "events" exchanges declare --name "events.all_types.topic" --type "topic" --durable true
```

```shell
rabbitmqadmin --vhost "events" exchanges declare --name "events.all_type.uncategorized" --type "fanout" --durable true --auto-delete false
```

```shell
rabbitmqadmin --vhost "events" exchanges declare --name "local.random.c60bda92" --type "x-local-random" --durable true
```

### Delete an exchange

``` shell
rabbitmqadmin --vhost "events" exchanges delete --name "target.exchange.name"
```

``` shell
# --idempotently means that 404 Not Found responses will not be  considered errors
rabbitmqadmin --vhost "events" exchanges delete --name "target.exchange.name" --idempotently
```

### Bind an Exchange to a Queue or Another Exchange

```shell
rabbitmqadmin --vhost "events" exchanges bind --source "events.topic" --destination-type "queue" --destination "events.processing" --routing-key "user.created"
```

```shell
rabbitmqadmin --vhost "events" exchanges bind --source "events.fanout" --destination-type "exchange" --destination "events.archived" --routing-key ""
```

### Unbind an Exchange from a Queue or Another Exchange

```shell
rabbitmqadmin --vhost "events" exchanges unbind --source "events.topic" --destination-type "queue" --destination "events.processing" --routing-key "user.created"
```

```shell
rabbitmqadmin --vhost "events" exchanges unbind --source "events.fanout" --destination-type "exchange" --destination "events.archived" --routing-key ""
```

### Inspect Node Memory Breakdown

There are two commands for reasoning about target [node's memory footprint](https://rabbitmq.com/docs/memory-use):

```shell
# displays a breakdown in bytes
rabbitmqadmin show memory_breakdown_in_bytes --node 'rabbit@hostname'
```

```shell
# displays a breakdown in percent
rabbitmqadmin show memory_breakdown_in_percent --node 'rabbit@hostname'
```

Example output of `show memory_breakdown_in_percent`:

```
┌────────────────────────────────────────┬────────────┐
│ key                                    │ percentage │
├────────────────────────────────────────┼────────────┤
│ total                                  │ 100%       │
├────────────────────────────────────────┼────────────┤
│ Binary heap                            │ 45.10%     │
├────────────────────────────────────────┼────────────┤
│ Allocated but unused                   │ 23.45%     │
├────────────────────────────────────────┼────────────┤
│ Quorum queue ETS tables                │ 23.05%     │
├────────────────────────────────────────┼────────────┤
│ Other processes                        │ 5.32%      │
├────────────────────────────────────────┼────────────┤
│ Other (used by the runtime)            │ 4.98%      │
├────────────────────────────────────────┼────────────┤
│ Code                                   │ 4.54%      │
├────────────────────────────────────────┼────────────┤
│ Client connections: others processes   │ 3.64%      │
├────────────────────────────────────────┼────────────┤
│ Management stats database              │ 3.48%      │
├────────────────────────────────────────┼────────────┤
│ Client connections: reader processes   │ 3.22%      │
├────────────────────────────────────────┼────────────┤
│ Plugins and their data                 │ 3.12%      │
├────────────────────────────────────────┼────────────┤
│ Other (ETS tables)                     │ 1.55%      │
├────────────────────────────────────────┼────────────┤
│ Metrics data                           │ 0.66%      │
├────────────────────────────────────────┼────────────┤
│ AMQP 0-9-1 channels                    │ 0.40%      │
├────────────────────────────────────────┼────────────┤
│ Message store indices                  │ 0.27%      │
├────────────────────────────────────────┼────────────┤
│ Atom table                             │ 0.24%      │
├────────────────────────────────────────┼────────────┤
│ Client connections: writer processes   │ 0.19%      │
├────────────────────────────────────────┼────────────┤
│ Quorum queue replica processes         │ 0.10%      │
├────────────────────────────────────────┼────────────┤
│ Stream replica processes               │ 0.07%      │
├────────────────────────────────────────┼────────────┤
│ Mnesia                                 │ 0.02%      │
├────────────────────────────────────────┼────────────┤
│ Metadata store                         │ 0.02%      │
├────────────────────────────────────────┼────────────┤
│ Stream coordinator processes           │ 0.02%      │
├────────────────────────────────────────┼────────────┤
│ Classic queue processes                │ 0.00%      │
├────────────────────────────────────────┼────────────┤
│ Metadata store ETS tables              │ 0.00%      │
├────────────────────────────────────────┼────────────┤
│ Stream replica reader processes        │ 0.00%      │
├────────────────────────────────────────┼────────────┤
│ Reserved by the kernel but unallocated │ 0.00%      │
└────────────────────────────────────────┴────────────┘
```

Note that there are [two different supported strategies](https://rabbitmq.com/docs/memory-use#strategies)
for computing memory footprint of a node. `rabbitmqadmin` will use the greater value
for 100% when computing the relative share in percent for each category.

Other factors that can affect the precision of percentage values reported
are [runtime allocator](https://rabbitmq.com/docs/memory-use#preallocated-memory)
behavior nuances and the [kernel page cache](https://rabbitmq.com/docs/memory-use#page-cache).

### List feature flags and their state

```shell
rabbitmqadmin feature_flags list
```

### Enable a feature flag

```shell
rabbitmqadmin feature_flags enable --name rabbitmq_4.0.0
```

### Enable all stable feature flags

```shell
rabbitmqadmin feature_flags enable_all
```

### List deprecated features in use in the cluster

```shell
rabbitmqadmin deprecated_features list_used
```

### List all deprecated features

```shell
rabbitmqadmin deprecated_features list
```

### Export Definitions

To export [definitions](https://www.rabbitmq.com/docs/definitions) to standard output, use `definitions export --stdout`:

```shell
rabbitmqadmin definitions export --stdout
```

To export definitions to a file, use `definitions export --file /path/to/definitions.file.json`:

```shell
rabbitmqadmin definitions export --file /path/to/definitions.file.json
```

### Export and Transform Definitions

`definitions export` can transform the exported JSON definitions file it gets from the
target node. This is done by applying one or more transformations to the exported
JSON file.

This can be useful to remove classic queue mirroring-related keys (such as `ha-mode`) from a definitions
set originating from a 3.13.x node, or to obfuscate usernames and passwords, or exclude certain definitions file
sections entirely.

To specify what transformations should be applied, use the `--transformations` options,
which takes a comma-separated list of  supported operation names.

The following table explains what transformations are available and what they do:

| Transformation name            | Description                                                  |
|--------------------------------|--------------------------------------------------------------|
| `strip_cmq_keys_from_policies` | Deletes all classic queue mirroring-related keys (such as `ha-mode`) from all exported policies.<br><br>Must be followed by `drop_empty_policies` to strip off the policies whose definition has become empty (and thus invalid at import time) after the removal of all classic queue mirroring-related keys |
| `drop_empty_policies`          | Should be used after `strip_cmq_keys_from_policies` to strip off the policies whose definition has become empty (and thus invalid at import time) after the removal of all classic queue mirroring-related keys |
| `obfuscate_usernames`          | Replaces usernames and passwords with dummy values.<br><br>For usernames the values used are: `obfuscated-username-1`, `obfuscated-username-2`, and so on.<br><br>For passwords the values generated are: `password-1`, `password-2`, and so forth.<br><br>This transformations updates both the users and the permissions sections, consistently |
| `exclude_users`                | Removes all users from the result. Commonly used together with `exclude_permissions` |
| `exclude_permissions`          | Removes all permissions from the result. Commonly used together with `exclude_users` |
| `exclude_runtime_parameters`   | Removes all runtime parameters (including federation upstreams, shovels, WSR and SDS settings in Tanzu RabbitMQ) from the result |
| `exclude_policies`             | Removes all policies from the result                         |
| `no_op`                        | Does nothing. Can be used as the default in dynamically computed transformation lists, e.g. in scripts |

#### Examples

The following command applies two transformations named `strip_cmq_keys_from_policies` and `drop_empty_policies`
that will strip all classic queue mirroring-related policy keys that RabbitMQ 3.13 nodes supported,
then removes the policies that did not have any keys left (ended up having an empty definition):

```shell
# strips classic mirrored queue-related policy keys from the exported definitions, then prints them
# to the standard output stream
rabbitmqadmin definitions export --stdout --transformations strip_cmq_keys_from_policies,drop_empty_policies
```

The following example exports definitions without users and permissions:

```shell
# removes users and user permissions from the exported definitions, then prints them
# to the standard output stream
rabbitmqadmin definitions export --stdout --transformations exclude_users,exclude_permissions
```

To export definitions with usernames replaced by dummy values (usernames: `obfuscated-username-1`, `obfuscated-username-2`, and so on;
passwords: `password-1`, `password-2`, and so forth), use the `obfuscate_usernames` transformation:

```shell
rabbitmqadmin definitions export --file /path/to/definitions.file.json --transformations obfuscate_usernames
```

### Declare a Policy

```shell
rabbitmqadmin --vhost "vh-1" policies declare \
  --name "policy-name-1" \
  --pattern '^cq.1\..+' \
  --apply-to "queues" \
  --priority 10 \
  --definition '{"max-length": 1000000}'
```

### Delete a Policy

```shell
rabbitmqadmin --vhost "vh-1" policies delete --name "policy-name-1"
```

### List All Policies

```shell
rabbitmqadmin policies list
```

### List Policies in A Virtual Host

```shell
rabbitmqadmin --vhost "vh-1" policies list_in
```

### List Policies Matching an Object

```shell
rabbitmqadmin --vhost "vh-1" policies list_matching_object --name "cq.1" --type "queues"

rabbitmqadmin --vhost "vh-1" policies list_matching_object --name "qq.1" --type "queues"

rabbitmqadmin --vhost "vh-1" policies list_matching_object --name "topics.events" --type "exchanges"
```

### Patch (Perform a Partial Update on) a Policy

```shell
rabbitmqadmin --vhost "vh-1" policies patch \
  --name "policy-name-1" \
  --definition '{"max-length": 7777777, "max-length-bytes": 3333333333}'
```

### Remove One Or More Policy Definition Keys

```shell
rabbitmqadmin policies delete_definition_keys \
  --name "policy-name-2" \
  --definition-keys max-length-bytes,max-length
```

### Declare an [Override Policy]https://www.rabbitmq.com/docs/policies#override

[Override policies](https://www.rabbitmq.com/docs/policies#override) are temporarily declared
policies that match the same objects as an existing policy but have a higher priority
and a slightly different definition.

This is a potentially safer alternative to patching policies, say, during [Blue-Green deployment migrations](https://www.rabbitmq.com/docs/blue-green-upgrade).

Override policies are meant to be relatively short lived.

```shell
rabbitmqadmin --vhost "vh-1" policies declare_override \
  --name "policy-name-1" \
  --override-name "tmp.overrides.policy-name-1" \
  --definition '{"federation-upstream-set": "all"}'
```

### Declare a [Blanket Policy]https://www.rabbitmq.com/docs/policies#blanket

A [blanket policy](https://www.rabbitmq.com/docs/policies#blanket) is a policy with a negative priority that
matches all names. That is, it is a policy that matches everything not matched by other policies (that usually
will have positive priorities).

Blanket policies are most useful in combination with override policies
covered above during [Blue-Green deployment migrations](https://www.rabbitmq.com/docs/blue-green-upgrade).

Blanket policies are meant to be relatively short lived.

```shell
rabbitmqadmin --vhost "vh-1" policies declare_blanket \
  --name "blanket-queuues" \
  --apply-to "queues" \
  --definition '{"federation-upstream-set": "all"}'
```

### Update a Policy Definition Key

```shell
rabbitmqadmin --vhost "vh-1" policies update_definition \
  --name "policy-name-1" \
  --definition-key "max-length" \
  --new-value "5000000"
```

### Update a Definition Key in All Policies in a Virtual Host

```shell
rabbitmqadmin --vhost "vh-1" policies update_definitions_of_all_in \
  --definition-key "max-length" \
  --new-value "5000000"
```

### Update a Definition Key in All Policies in the Cluster

```shell
rabbitmqadmin policies update_definitions_of_all \
  --definition-key "max-length" \
  --new-value "5000000"
```

### Delete Definition Keys from All Policies in a Virtual Host

```shell
rabbitmqadmin --vhost "vh-1" policies delete_definition_keys_from_all_in \
  --definition-keys max-length,max-length-bytes
```

### Delete Definition Keys from All Policies in the Cluster

```shell
rabbitmqadmin policies delete_definition_keys_from_all \
  --definition-keys max-length,max-length-bytes
```


### Import Definitions

To import definitions from the standard input, use `definitions import --stdin`:

```shell
cat /path/to/definitions.file.json | rabbitmqadmin definitions import --stdin
```

To import definitions from a file, use `definitions import --file /path/to/definitions.file.json`:

```shell
rabbitmqadmin definitions import --file /path/to/definitions.file.json
```

### Export Definitions from a Specific Virtual Host

```shell
rabbitmqadmin --vhost "events" definitions export_from_vhost --stdout
```

```shell
rabbitmqadmin --vhost "events" definitions export_from_vhost --file /path/to/vhost-definitions.json
```

### Import Virtual Host-specific Definitions

```shell
rabbitmqadmin --vhost "events" definitions import_into_vhost --file /path/to/vhost-definitions.json
```

### Declare an AMQP 0-9-1 Shovel

To declare a [dynamic shovel](https://www.rabbitmq.com/docs/shovel-dynamic) that uses AMQP 0-9-1 for both source and desitnation, use
`shovels declare_amqp091`:

```shell
rabbitmqadmin shovels declare_amqp091 --name my-amqp091-shovel \
    --source-uri amqp://username:s3KrE7@source.hostname:5672 \
    --destination-uri amqp://username:s3KrE7@source.hostname:5672 \
    --ack-mode "on-confirm" \
    --source-queue "src.queue" \
    --destination-queue "dest.queue"
```

### Declare an AMQP 1.0 Shovel

To declare a [dynamic shovel](https://www.rabbitmq.com/docs/shovel-dynamic) that uses AMQP 1.0 for both source and desitnation, use
`shovels declare_amqp10`.

Note that

1. With AMQP 1.0 shovels, credentials in the URI are mandatory (there are no defaults)
2. With AMQP 1.0 shovels, the topology must be pre-declared (an equivalent of `--predeclared-source` and `--predeclared-destination` flags for AMQP 0-9-1 shovels)
3. AMQP 1.0 shovels should use [AMQP 1.0 addresses v2]https://www.rabbitmq.com/docs/amqp#addresses

```shell
rabbitmqadmin shovels declare_amqp10 --name my-amqp1.0-shovel \
    --source-uri "amqp://username:s3KrE7@source.hostname:5672?hostname=vhost:src-vhost" \
    --destination-uri "amqp://username:s3KrE7@source.hostname:5672?hostname=vhost:dest-vhost" \
    --ack-mode "on-confirm" \
    --source-address "/queues/src.queue" \
    --destination-address "/queues/dest.queue"
```

### List Shovels

To list shovels across all virtual hosts, use `shovels list_all`:

```shell
rabbitmqadmin shovels list_all
```

### Delete a Shovel

To delete a shovel, use `shovels delete --name`:

```shell
rabbitmqadmin shovels delete --name my-amqp091-shovel
```

### List Federation Upstreams

To list [federation upstreams](https://www.rabbitmq.com/docs/federation) across all virtual hosts, use `federation list_all_upstreams`:

```shell
rabbitmqadmin federation list_all_upstreams
```

### Create a Federation Upstream for Exchange Federation

To create a [federation upstream](https://www.rabbitmq.com/docs/federated-exchanges), use `federation declare_upstream_for_exchanges`.
This command provides a reduced set of options, only those that are relevant
specifically to exchange federation.

```shell
rabbitmqadmin --vhost "local-vhost" federation declare_upstream_for_exchanges --name "pollux" \
                --uri "amqp://pollux.eng.megacorp.local:5672/remote-vhost" \
                --ack-mode 'on-publish' \
                --prefetch-count 2000 \
                --exchange-name "overridden.name" \
                --queue-type quorum \
                --bind-using-nowait true
```

### Create a Federation Upstream for Queue Federation

To create a [federation upstream](https://www.rabbitmq.com/docs/federated-queues), use `declare_upstream_for_queues`.
This command provides a reduced set of options, only those that are relevant
specifically to queue federation.

```shell
rabbitmqadmin --vhost "local-vhost" federation declare_upstream_for_queues --name "clusters.sirius" \
                --uri "amqp://sirius.eng.megacorp.local:5672/remote-vhost" \
                --ack-mode 'on-publish' \
                --prefetch-count 2000 \
                --queue-name "overridden.name" \
                --consumer-tag "overriden.ctag"
```

### Create a Universal Federation Upstream

To create a [federation upstream](https://www.rabbitmq.com/docs/federation) that will be (or can be)
used for federating both queues and exchanges, use `declare_upstream`. It combines
[all the federation options](https://www.rabbitmq.com/docs/federation-reference), that is,
the options of both `declare_upstream_for_queues` and `declare_upstream_for_exchanges`.

```shell
rabbitmqadmin --vhost "local-vhost" federation declare_upstream --name "pollux" \
                --uri "amqp://pollux.eng.megacorp.local:5672/remove-vhost" \
                --ack-mode 'on-publish' \
                --prefetch-count 2000 \
                --queue-name "overridden.name" \
                --consumer-tag "overriden.ctag" \
                --exchange-name "overridden.name" \
                --queue-type quorum \
                --bind-using-nowait true
```

### Delete a Federation Upstream

To delete a [federation upstream](https://www.rabbitmq.com/docs/federation), use 'federation delete_upstream',
which takes a virtual host and an upstream name:

```shell
rabbitmqadmin --vhost "local-vhost" federation delete_upstream --name "upstream.to.delete"
```

### List Federation Links

To list all [federation links](https://www.rabbitmq.com/docs/federation) across all virtual hosts, use `federation list_all_links`:

```shell
rabbitmqadmin federation list_all_links
```

### Create a User

```shell
# Salt and hash a cleartext password value, and output the resultign hash.
# See https://www.rabbitmq.com/docs/passwords to learn more.
rabbitmqadmin passwords salt_and_hash "cleartext value"
```

```shell
rabbitmqadmin users declare --name "new-user" --password "secure-password" --tags "monitoring,management"
```

```shell
# Create user with administrator tag using pre-hashed password
# (use 'rabbitmqadmin passwords salt_and_hash' to generate the hash)
rabbitmqadmin users declare --name "admin-user" --password-hash "{value produced by 'rabbitmqadmin passwords salt_and_hash'}" --tags "administrator"
```

```shell
# If RabbitMQ nodes are configured to use SHA512 for passwords, add `--hashing-algorithm`.
# See https://www.rabbitmq.com/docs/passwords to learn more.
rabbitmqadmin users declare --name "secure-user" --password-hash "{SHA512-hashed-password}" --hashing-algorithm "SHA512" --tags "monitoring"
```

### Delete a User

```shell
rabbitmqadmin users delete --name "user-to-delete"
```

```shell
# Idempotent deletion (won't fail if user doesn't exist)
rabbitmqadmin users delete --name "user-to-delete" --idempotently
```

### List User Permissions

```shell
# List all user permissions across all virtual hosts
rabbitmqadmin permissions list
```

### Grant Permissions to a User

```shell
rabbitmqadmin permissions declare --user "app-user" --configure ".*" --write ".*" --read ".*"
```

```shell
rabbitmqadmin --vhost "production" permissions declare --user "app-user" --configure "^amq\.gen.*|^aliveness-test$" --write ".*" --read ".*"
```

### Revoke User Permissions

```shell
rabbitmqadmin --vhost "production" permissions delete --user "app-user"
```

```shell
# Idempotent deletion (won't fail if permissions don't exist)
rabbitmqadmin --vhost "production" permissions delete --user "app-user" --idempotently
```

### Create a Binding

```shell
rabbitmqadmin --vhost "events" bindings declare --source "events.topic" --destination-type "queue" --destination "events.processing" --routing-key "user.created"
```

```shell
rabbitmqadmin --vhost "events" bindings declare --source "events.fanout" --destination-type "exchange" --destination "events.archived" --routing-key "" --arguments '{"x-match": "all"}'
```

### Delete a Binding

```shell
rabbitmqadmin --vhost "events" bindings delete --source "events.topic" --destination-type "queue" --destination "events.processing" --routing-key "user.created"
```

### List Connections

```shell
rabbitmqadmin connections list
```

```shell
# List connections for a specific user
rabbitmqadmin connections list_of_user --username "app-user"
```

### Close Connections

```shell
# Close a specific connection by name
rabbitmqadmin connections close --name "connection-name"
```

```shell
# Close all connections from a specific user
rabbitmqadmin connections close_of_user --username "a-user"
```

### List Channels

```shell
rabbitmqadmin channels list
```

```shell
# List channels in a specific virtual host
rabbitmqadmin --vhost "production" channels list
```

### Run Health Checks

```shell
# Check for local alarms
rabbitmqadmin health_check local_alarms
```

```shell
# Check for cluster-wide alarms
rabbitmqadmin health_check cluster_wide_alarms
```

```shell
# Check if node is quorum critical
rabbitmqadmin health_check node_is_quorum_critical
```

```shell
# Check for deprecated features in use
rabbitmqadmin health_check deprecated_features_in_use
```

```shell
# Check if a port listener is running
rabbitmqadmin health_check port_listener --port 5672
```

```shell
# Check if a protocol listener is running
rabbitmqadmin health_check protocol_listener --protocol "amqp"
```

### Authentication Attempt Statistics

```shell
rabbitmqadmin auth_attempts stats --node "rabbit@hostname"
```

### Runtime Parameters

```shell
# List all runtime parameters
rabbitmqadmin parameters list_all
```

```shell
# Set a runtime parameter
rabbitmqadmin --vhost "events" parameters set --component "federation-upstream" --name "upstream-1" --value '{"uri": "amqp://remote-server", "ack-mode": "on-publish"}'
```

```shell
# Clear (delete) a runtime parameter
rabbitmqadmin --vhost "events" parameters clear --component "federation-upstream" --name "upstream-1"
```

### Global Parameters

```shell
# List global parameters
rabbitmqadmin global_parameters list
```

```shell
# Set a global parameter
rabbitmqadmin global_parameters set --name "cluster_name" --value '"production-cluster"'
```

```shell
# Clear (delete) a global parameter
rabbitmqadmin global_parameters clear --name "cluster_name"
```

### Declare Operator Policies

```shell
rabbitmqadmin --vhost "production" operator_policies declare --name "queue-limits" --pattern ".*" --definition '{"max-length": 10000}' --priority 1 --apply-to "queues"
```

### List Operator Policies

```shell
rabbitmqadmin operator_policies list
```

### Delete Operator Policies

```shell
rabbitmqadmin --vhost "production" operator_policies delete --name "queue-limits"
```

### Patch (Perform a Partial Update on) an Operator Policy

```shell
rabbitmqadmin --vhost "production" operator_policies patch \
  --name "queue-limits" \
  --definition '{"max-length": 7777777}'
```

### Update an Operator Policy Definition Key

```shell
rabbitmqadmin --vhost "production" operator_policies update_definition \
  --name "queue-limits" \
  --definition-key "max-length" \
  --new-value "5000000"
```

### Update a Definition Key in All Operator Policies in a Virtual Host

```shell
rabbitmqadmin --vhost "production" operator_policies update_definitions_of_all_in \
  --definition-key "max-length" \
  --new-value "5000000"
```

### Delete Definition Keys from an Operator Policy

```shell
rabbitmqadmin --vhost "production" operator_policies delete_definition_keys \
  --name "queue-limits" \
  --definition-keys max-length,max-length-bytes
```

### Delete Definition Keys from All Operator Policies in a Virtual Host

```shell
rabbitmqadmin --vhost "production" operator_policies delete_definition_keys_from_all_in \
  --definition-keys max-length,max-length-bytes
```

### List Operator Policies Matching an Object

```shell
rabbitmqadmin --vhost "production" operator_policies list_matching_object --name "qq.1" --type "queues"
```

### User Limits

Per-user [resource limits](https://www.rabbitmq.com/docs/user-limits) can be used to restrict how many connections or channels a specific user can open.

```shell
# List all per-user limits
rabbitmqadmin user_limits list
```

```shell
# Set maximum connections for a user
rabbitmqadmin user_limits declare --user "app-user" --name "max-connections" --value 100
```

```shell
# Set maximum channels for a user
rabbitmqadmin user_limits declare --user "app-user" --name "max-channels" --value 1000
```

```shell
# Clear a user limit
rabbitmqadmin user_limits delete --user "app-user" --name "max-connections"
```

### Virtual Host Limits

Virtual host [resource limits](https://www.rabbitmq.com/docs/vhosts#limits) can be used to restrict the maximum number of queues, connections, or other resources in a virtual host.

```shell
# List all virtual host limits
rabbitmqadmin vhost_limits list
```

```shell
# Set maximum queues for a virtual host
rabbitmqadmin --vhost "production" vhost_limits declare --name "max-queues" --value 1000
```

```shell
# Set maximum connections for a virtual host
rabbitmqadmin --vhost "production" vhost_limits declare --name "max-connections" --value 500
```

```shell
# Clear a virtual host limit
rabbitmqadmin --vhost "production" vhost_limits delete --name "max-queues"
```

### List Enabled Plugins

```shell
# List plugins across all cluster nodes
rabbitmqadmin plugins list_all
```

```shell
# List plugins enabled on a specific node
rabbitmqadmin plugins list_on_node --node "rabbit@hostname"
```

### Rebalance Quorum Queue Leaders

```shell
# Rebalances leader members (replicas) for all quorum queues
rabbitmqadmin rebalance queues
```

### Stream Operations

```shell
# List streams
rabbitmqadmin streams list
```

```shell
# List streams with specific columns only
rabbitmqadmin streams list --columns name,queue_type
```

```shell
# Show details for a single stream
rabbitmqadmin streams show --name "events.stream"
```

```shell
# Declare a stream
rabbitmqadmin --vhost "logs" streams declare --name "application.logs" --expiration "7D" --max-length-bytes "10737418240"
```

```shell
# Delete a stream
rabbitmqadmin --vhost "logs" streams delete --name "old.stream"
```

### Node Operations

```shell
# List cluster nodes
rabbitmqadmin nodes list
```

```shell
# Memory breakdown in bytes
rabbitmqadmin nodes memory_breakdown_in_bytes --node "rabbit@hostname"
```

```shell
# Memory breakdown in percent
rabbitmqadmin nodes memory_breakdown_in_percent --node "rabbit@hostname"
```


## Tanzu RabbitMQ Commands

The `tanzu` command group provides Tanzu RabbitMQ-specific operations for Schema Definition Sync (SDS) and
Warm Standby Replication (WSR).

### Schema Definition Sync (SDS) Status

```shell
rabbitmqadmin tanzu sds status_on_node --node "rabbit@hostname"
```

### Enable/Disable Schema Definition Sync on a Node

```shell
rabbitmqadmin tanzu sds disable_on_node --node "rabbit@hostname"
```

```shell
rabbitmqadmin tanzu sds enable_on_node --node "rabbit@hostname"
```

### Enable/Disable Schema Definition Sync Cluster-Wide

```shell
rabbitmqadmin tanzu sds disable_cluster_wide
```

```shell
rabbitmqadmin tanzu sds enable_cluster_wide
```

### Warm Standby Replication (WSR) Status

```shell
rabbitmqadmin tanzu wsr status
```


## Subcommand and Long Option Inference

This feature is available only in the `main` branch
at the moment.

If the `RABBITMQADMIN_NON_INTERACTIVE_MODE` is not set to `true`, this tool
now can infer subcommand and --long-option names.

This means that a subcommand can be referenced with its unique prefix,
that is,

* 'del queue' will be inferred as 'delete queue'
* 'del q --nam "a.queue"' will be inferred as 'delete queue --name "a.queue"'

To enable each feature, set the following environment variables to
'true':

* `RABBITMQADMIN_INFER_SUBCOMMANDS`
* `RABBITMQADMIN_INFER_LONG_OPTIONS`

This feature is only meant to be used interactively. For non-interactive
use, it can be potentially too dangerous to allow.


## Configuration Files

`rabbitmqadmin` v2 supports [TOML](https://toml.io/en/)-based configuration files
stores groups of HTTP API connection settings under aliases ("node names" in original `rabbitmqadmin` speak).

Here is an example `rabbitmqadmin` v2 configuration file:

```toml
[local]
hostname = "localhost"
port = 15672
username = "lolz"
password = "lolz"
vhost = '/'

[staging]
hostname = "192.168.20.31"
port = 15672
username = "staging-2387a72329"
password = "staging-1d20cfbd9d"

[production]
hostname = "(redacted)"
port = 15671
username = "user-2ca6bae15ff6b79e92"
password = "user-92ee4c479ae604cc72"
```

Instead of specifying `--hostname` or `--username` on the command line to connect to
a cluster (or specific node) called `staging`, a `--node` alias can be specified instead:

```shell
# will use the settings from the section called [staging]
rabbitmqadmin --node staging show churn
```

Default configuration file path is at `$HOME/.rabbitmqadmin.conf`, as it was in
the original version of `rabbitmqadmin`. It can be overridden on the command line:

```shell
# will use the settings from the section called [staging]
rabbitmqadmin --config $HOME/.configuration/rabbitmqadmin.conf --node staging show churn
```

### Managing Configuration Files

The `config_file` command group provides operations for managing `rabbitmqadmin` configuration files:

```shell
# Show the path to the configuration file
rabbitmqadmin config_file show_path

# Show all configured nodes (passwords masked by default)
rabbitmqadmin config_file show
rabbitmqadmin config_file show --reveal-passwords

# Add a new node (fails if an entry with this name already exists)
rabbitmqadmin config_file add_node --node experiment-001 --host rabbit.eng.example.com --port 15672 --username admin --password secret --vhost /

# Update an existing node (or create one if it does not exist)
# Only the specified fields are updated; unspecified fields are preserved
rabbitmqadmin config_file update_node --node experiment-001 --host new-rabbit.eng.example.com --port 15673

# Enable TLS for a node (other settings like username, password are preserved)
rabbitmqadmin config_file update_node --node experiment-001 --use-tls --port 15671

# Delete a node (a configuration file entry)
rabbitmqadmin config_file delete_node --node experiment-001
```

## Intentionally Restricted Environment Variable Support

Environment variables have a number of serious downsides compared to a `rabbitmqadmin.conf`
and the regular `--long-options` on the command line:

1. Non-existent support for value types and validation ("everything is a string")
2. Subprocess inheritance restrictions that can be very time-consuming to debug
3. Different syntax for setting them between the classic POSIX-era shells (such as `bash`, `zsh`) and modern ones (such as [`nushell`]https://www.nushell.sh/)

For these reasons and others, `rabbitmqadmin` v2 intentionally uses the configuration file and the
CLI options over the environment variables.

`rabbitmqadmin` v2 does, however, supports a number of environment variables for a few
global settings that cannot be configured any other way (besides a CLI option),
or truly represent an environment characteristic, e.g. either the non-interactive mode
should be enabled.

These environment variables are as follows:

| Environment variable                 | Type                                              | When used                             | Description                                                  |
|--------------------------------------|---------------------------------------------------|---------------------------------------|--------------------------------------------------------------|
| `RABBITMQADMIN_CONFIG_FILE_PATH`     | Local filesystem path                             | Pre-flight (before command execution) | Same meaning as the global `--confg-file` argument           |
| `RABBITMQADMIN_NON_INTERACTIVE_MODE` | Boolean                                           | Command execution                     | Enables the non-interactive mode.<br><br>Same meaning as the global `--non-interactive` argument |
| `RABBITMQADMIN_QUIET_MODE`<br>       | Boolean                                           | Command execution                     | Instructs the tool to produce less output.<br><br>Same meaning as the global `--quiet` argument |
| `RABBITMQADMIN_NODE_ALIAS`           | String                                            | Command execution                     | Same meaning as the global `--node` argument                 |
| `RABBITMQADMIN_TARGET_HOST`          | String                                            | Command execution                     | Same meaning as the global `--host` argument                 |
| `RABBITMQADMIN_TARGET_PORT`          | Positive integer                                  | Command execution                     | Same meaning as the global `--port` argument                 |
| `RABBITMQADMIN_API_PATH_PREFIX`      | String                                            | Command execution                     | Same meaning as the global `--path-prefix` argument          |
| `RABBITMQADMIN_TARGET_VHOST`         | String                                            | Command execution                     | Same meaning as the global `--vhost` argument                |
| `RABBITMQADMIN_BASE_URI`             | String                                            | Command execution                     | Same meaning as the global `--base-uri` argument             |
| `RABBITMQADMIN_USE_TLS`              | Boolean                                           | Command execution                     | Same meaning as the global `--tls` argument                  |
| `RABBITMQADMIN_USERNAME`             | String                                            | Command execution                     | Same meaning as the global `--username` argument             |
| `RABBITMQADMIN_PASSWORD`             | String                                            | Command execution                     | Same meaning as the global `--password` argument             |
| `RABBITMQADMIN_TABLE_STYLE`          | Enum, see `--table-style` in `rabbitmqadmin help` | Command execution                     | Same meaning as the global `--table-style` argument          |



## Project Goals Compared to `rabbitmqadmin` v1

This version of `rabbitmqadmin` has a few ideas in mind:

* This is a major version bump. Therefore, reasonable breaking changes are OK. `rabbitmqadmin` hasn't seen a revision in fifteen years
* Some features in `rabbitmqadmin` v1 arguably should never have been built-ins,
  external tools for data processing and [modern shells]https://www.nushell.sh/ can manipulate tabular data
  better than `rabbitmqadmin` ever would
* `rabbitmqadmin` should be standalone binary. There are very few reasons not to build and distribute it that way
* Standalone project, not an obscure feature: `rabbitmqadmin` should be a standalone tool, not a relatively unknown "feature" of
  the RabbitMQ management plugin, and should be developed as such, not tied completely to the development
  environment, practices and release schedule of RabbitMQ itself
* v2 should be a distributed via GitHub releases and not a special `rabbitmq_management` endpoint
* There is a lot of room to improve validation of flags and arguments, since breaking changes are OK for v2
* This tool should strive to be as free as practically possible from CVEs in other projects that show up on security scans.
  CVEs from older Python versions should not plague OCI images that choose to include `rabbitmqadmin` v2


## Breaking or Potentially Breaking Changes

### Some Non-Essential Features Were Dropped

`rabbitmqadmin` v2 does not support

 * Sorting of results. Instead, use `--non-interactive` and parse the spaces-separated
   output. Many modern tools for working with data parse it into a table, sort the data set,
   filter the results, and son. In fact, these features for data processing are ready available [in some shells]https://www.nushell.sh/
 * Column selection for most commands. `queues list`, `queues show`, `streams list`, and `streams show` do support `--columns`
 * JSON output for arbitrary commands (with the exception of `definitions` commands).
   Use the HTTP API directly if you need to work with JSON
 * CSV output for arbitrary commands. This format may be reintroduced

### --snake-case for Command Options

`rabbitmqadmin` v1 used `lower_case` for named command arguments, for example:

```shell
# Note: auto_delete
rabbitmqadmin-v1 --vhost "vh-2" declare queue name="qq.1" type="quorum" durable=true auto_delete=false
```

`rabbitmqadmin` v2 uses a more typical `--snake-case` format for the same arguments:

```shell
# Note: --auto-delete
rabbitmqadmin --vhost "vh-2" declare queue --name "qq.1" --type "quorum" --durable true --auto-delete false
```

### Global Arguments Come First

Global flags in `rabbitmqadmin` v2 must precede the command category (e.g. `list`) and the command itself,
namely various HTTP API endpoint options and `--vhost`:

```shell
rabbitmqadmin --vhost "events" declare queue --name "target.quorum.queue.name" --type "quorum" --durable true
```

### --prefix Overrides API Path Prefix

In `rabbitmqadmin` v1, `--path-prefix` appended to the default [API path prefix](https://rabbitmq.com/docs/management#path-prefix).
In this version, the value passed to `--path-prefix` will be used as given, in other words,
it replaces the default prefix, `/api`.

### Configuration File Format Moved to TOML

`rabbitmqadmin` v1 supported ini configuration files that allowed
the user to group a number of command line values under a name, e.g. a cluster or node nickname.

Due to the "no dependencies other than Python" design goal of `rabbitmqadmin` v1, this feature was not really tested,
and the specific syntax (that of ini files, supported by Python's [`ConfigParser`](https://docs.python.org/3/library/configparser.html)) linting, parsing or generation tools were not really available.

`rabbitmqadmin` v2 replaces this format with [TOML](https://toml.io/en/), a popular configuration standard
with [verification and linting tools](https://www.toml-lint.com/), as well as very mature parser
that is not at all specific to `rabbitmqadmin` v2.

Here is an example `rabbitmqadmin` v2 configuration file:

```toml
[local]
hostname = "localhost"
port = 15672
username = "lolz"
password = "lolz"
vhost = '/'

[staging]
hostname = "192.168.20.31"
port = 15672
username = "staging-2387a72329"
password = "staging-1d20cfbd9d"

[production]
hostname = "(redacted)"
port = 15671

username = "user-efe1f4d763f6"
password = "(redacted)"

tls = true
ca_certificate_bundle_path = "/path/to/ca_certificate.pem"
client_certificate_file_path = "/path/to/client_certificate.pem"
client_private_key_file_path = "/path/to/client_key.pem"
```


## License

This tool, `rabbitmqadmin` (v2 and later versions), is dual-licensed under
the Apache Software License 2.0 and the MIT license.

SPDX-License-Identifier: Apache-2.0 OR MIT