| name | rabbitmq-admin |
| description | RabbitMQ 4.1.4 administration including streams, AMQP, topology management, and troubleshooting |
| license | MIT |
| compatibility | opencode |
| metadata | {"messaging":"rabbitmq","version":"4.1.4","protocols":"streams,amqp,management"} |
What I Do
Provide comprehensive guidance for administering RabbitMQ 4.1.4 in the crypto-scout ecosystem, including Streams, AMQP, topology configuration, and operational tasks.
Core Concepts
RabbitMQ Streams
High-throughput, append-only log messaging with:
- Non-destructive reads: Multiple consumers at different offsets
- Offset tracking: Per-consumer position management
- Retention policies: Time and size-based retention
- Protocol: Binary protocol on port 5552
AMQP 0.9.1
Traditional message queuing with:
- Queue-based: FIFO message delivery
- Acknowledgments: Explicit delivery confirmation
- Routing: Exchange-based message routing
- Protocol: Binary protocol on port 5672
Management UI
Web-based administration interface:
- Port: 15672 (localhost only in production)
- Features: Monitoring, configuration, user management
- API: RESTful API for automation
Topology Reference
Exchanges
| Exchange | Type | Purpose |
|---|
crypto-scout-exchange | direct | Main message routing |
dlx-exchange | direct | Dead letter handling |
Streams
| Stream | Retention | Max Size | Segment Size | Purpose |
|---|
bybit-stream | 1 day | 2GB | 100MB | Bybit market data |
crypto-scout-stream | 1 day | 2GB | 100MB | CMC/parser data |
Stream retention policy (stream-retention):
- Pattern:
.*-stream$
- max-length-bytes: 2000000000 (2GB)
- max-age: 1D
- stream-max-segment-size-bytes: 100000000 (100MB)
Queues
| Queue | Type | Arguments | Purpose |
|---|
collector-queue | Classic | lazy, TTL 6h, max 2500, reject-publish, DLX | Control messages |
chatbot-queue | Classic | lazy, TTL 6h, max 2500, reject-publish, DLX | Notifications |
dlx-queue | Classic | lazy, max 10k, TTL 7d | Dead letters |
Queue arguments:
Bindings
| Source | Routing Key | Destination |
|---|
| crypto-scout-exchange | bybit | bybit-stream |
| crypto-scout-exchange | crypto-scout | crypto-scout-stream |
| crypto-scout-exchange | collector | collector-queue |
| crypto-scout-exchange | chatbot | chatbot-queue |
| dlx-exchange | dlx | dlx-queue |
Configuration Management
definitions.json
Declarative topology configuration loaded at startup via:
load_definitions = /etc/rabbitmq/definitions.json
Structure:
{
"vhosts": [{"name": "/"}],
"exchanges": [...],
"queues": [...],
"bindings": [...],
"policies": [...]
}
rabbitmq.conf
Key settings:
stream.listeners.tcp.1 = 0.0.0.0:5552
stream.advertised_host = crypto_scout_mq
stream.advertised_port = 5552
load_definitions = /etc/rabbitmq/definitions.json
disk_free_limit.absolute = 2GB
vm_memory_high_watermark.relative = 0.6
management.tcp.ip = 0.0.0.0
management.rates_mode = basic
cluster_formation.peer_discovery_backend = classic_config
cluster_formation.classic_config.nodes.1 = rabbit@crypto_scout_mq
Environment Variables
RABBITMQ_ERLANG_COOKIE=secret_cookie
Stored in secret/rabbitmq.env with 600 permissions.
CLI Commands
Node Operations
rabbitmq-diagnostics -q ping
rabbitmq-diagnostics -q status
rabbitmqctl stop
rabbitmqctl start_app
User Management
rabbitmqctl list_users
./script/rmq_user.sh -u username -p 'password' -t administrator
rabbitmqctl add_user username 'password'
rabbitmqctl set_user_tags username administrator
rabbitmqctl set_permissions -p / username ".*" ".*" ".*"
rabbitmqctl change_password username 'new_password'
rabbitmqctl delete_user username
Queue Operations
rabbitmqctl list_queues name messages consumers
rabbitmqctl list_queues name memory messages
rabbitmqctl purge_queue queue_name
rabbitmqctl delete_queue queue_name
Stream Operations
rabbitmqctl list_streams name retention_policy
rabbitmqctl list_stream_consumers stream_name
rabbitmqctl list_stream_publishers stream_name
Monitoring Commands
Health Checks
./script/rmq_compose.sh status
rabbitmq-diagnostics -q ping
rabbitmq-diagnostics -q listeners
rabbitmq-diagnostics -q alarms
rabbitmq-diagnostics -q memory
rabbitmq-diagnostics -q overview
Connection Monitoring
rabbitmqctl list_connections peer_host peer_port state user
rabbitmqctl list_channels connection peer_pid user
rabbitmqctl list_consumers
Security Best Practices
Network Security
podman inspect crypto-scout-mq | grep -A 5 "PortBindings"
management.tcp.ip = 127.0.0.1
Access Control
rabbitmqctl set_permissions -p / user "^bybit-.*" "^bybit-.*" "^bybit-.*"
rabbitmqctl delete_user guest
Secret Management
cd crypto-scout-mq
COOKIE=$(openssl rand -base64 48 | tr -dc 'A-Za-z0-9' | head -c 48)
printf "RABBITMQ_ERLANG_COOKIE=%s\n" "$COOKIE" > secret/rabbitmq.env
chmod 600 secret/rabbitmq.env
Troubleshooting
Connection Refused
podman ps | grep crypto-scout-mq
podman logs crypto-scout-mq
podman exec crypto-scout-mq rabbitmq-diagnostics -q listeners
Authentication Failed
rabbitmqctl list_users | grep username
rabbitmqctl change_password username 'new_password'
rabbitmqctl list_permissions -p /
High Memory Usage
rabbitmq-diagnostics -q memory
rabbitmqctl list_queues name memory | sort -k2 -n | tail
rabbitmqctl list_connections name peer_host memory_reduction
Streams Not Working
rabbitmq-plugins list | grep stream
rabbitmq-diagnostics -q listeners | grep 5552
rabbitmqctl list_streams
Helper Scripts Reference
| Script | Purpose | Usage |
|---|
./script/network.sh | Create network | ./script/network.sh |
./script/rmq_compose.sh | Manage service | ./script/rmq_compose.sh up -d |
./script/rmq_user.sh | User management | ./script/rmq_user.sh -u admin -p 'pass' -t administrator |
When to Use Me
Use this skill when:
- Configuring RabbitMQ topology
- Managing users and permissions
- Monitoring service health
- Troubleshooting connectivity
- Understanding Streams vs AMQP
- Performing operational tasks
- Setting up security policies