MQ Commands Cheatsheet - Kafka/RabbitMQ/RocketMQ Reference
All essential MQ commands organized by use case, with 32+ entries you can copy and run directly. Find the right command fast when you need it.
Back to SysOpsKafka 6
kafka-consumer-groups.sh --bootstrap-server :9092 --listList all consumer groups
kafka-consumer-groups.sh --describe --group <group>View a group's lag and partition progress
kafka-topics.sh --describe --topic <topic>View topic partitions, replicas and leader distribution
kafka-topics.sh --create --topic <t> --partitions 3 --replication-factor 2Create a topic with given partitions and replication factor
kafka-console-producer.sh --topic <t> --bootstrap-server :9092Produce messages from the CLI (for debugging)
kafka-console-consumer.sh --topic <t> --from-beginning --group <g>Consume from the start and join a consumer group
RabbitMQ 6
rabbitmqctl list_queues name messages consumersView queue backlog and consumer count
rabbitmqctl list_connections name state channelsView connections and channel count (leak check)
rabbitmqctl list_channels pid numberFind which connection holds many channels
rabbitmqctl cluster_statusView cluster nodes and partition state
rabbitmqadmin get queue=<q> count=1 ack=falsePeek at the head message without ack (debugging)
rabbitmqctl list_exchanges name type / list_bindingsView exchanges and bindings
RocketMQ 5
mqadmin consumerProgress -g <group>View per-queue backlog progress of a consumer group
mqadmin topicList -mView topic routing and queue distribution
mqadmin clusterListView broker cluster status and roles
mqadmin brokerConsumeStats -b <addr> -g <group>View consumption stats per broker
mqadmin queryMsgById -i <msgId>Query a message by ID to trace losses
Redis Pub/Sub 5
PUBLISH channel "message"Publish a message to a channel
SUBSCRIBE channel1 channel2Subscribe to one or more channels
PSUBSCRIBE news.*Subscribe to channels matching a pattern
PUBSUB CHANNELS *List currently active channels
PUBSUB NUMSUB channelView the subscriber count of a channel
General Backlog & Connection Checks 5
kafka-consumer-groups.sh --describe --group <g> --stateCheck whether a group is rebalancing
rabbitmqctl node_health_checkQuick node health check (legacy command)
ss -tnp | grep :9092 | wc -lCount connections to the broker (leak check)
du -sh /var/lib/kafka /var/lib/rabbitmqCheck MQ disk usage (watch water-mark alerts)
journalctl -u kafka --since "10 min ago"View recent broker logs for OOM or throttling
Performance Testing & Benchmarking 5
kafka-consumer-perf-test.sh --bootstrap-server :9092 --topic <t> --messages 1000Benchmark consumer throughput
kafka-producer-perf-test.sh --topic <t> --num-records 100000 --throughput -1Benchmark producer throughput and latency
rabbitmq-perf-test --queue <q> --rate 1000 --producers 5Official RabbitMQ benchmarking tool
redis-benchmark -h host -t publish,subscribe -n 100000Redis Pub/Sub performance benchmark
kafka-consumer-groups.sh --describe --group <g> --members --verboseView consumer-group members and assignments
Tips
- For message backlog, first check lag and consumer count to tell slow consumers from too few — don't just purge the queue.
- When hunting connection leaks, check both list_connections and the app's connection-pool config; looking at one side alone misleads.
- Before restarting a broker, confirm messages are persisted; unflushed messages are lost.
- In Kafka perf tests, --throughput -1 means uncapped; combine with --num-records for peak throughput.
- Redis Pub/Sub is not persistent; messages during a disconnect are lost. Use Stream for reliable delivery.
- When a RabbitMQ queue backs up, check the consumers column first; 0 means consumers aren't registered or have dropped.
Official References
Commands are compiled from the official docs below. Click to verify the latest usage.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us