Knowledge Base Administration Guide

rabbitmqctl (RabbitMQ administration)

For administrators, RabbitMQ can be configured/controlled via the rabbitmqctl command, which is often installed at either:

  • /sbin/rabbitmqctl
  • /usr/local/sbin/rabbitmqctl

Link: Official rabbitmqctl documentation

Create shared user account inside Rabbit

Note: RabbitMQ comes with a guest user account by default, but often this account is not accessible outside of localhost, so we recommend you create a new account.

List users

To see existing accounts:

> /sbin/rabbitmqctl list_users
Listing users ...
user    tags
compute []
guest   [administrator]

Add Rabbit user

To add an account, use the add_user subcommand:

# Template
> /sbin/rabbitmqctl add_user USERNAME PASSWORD

# Add user read/write privileges
> /sbin/rabbitmqctl set_permissions USERNAME ".*" ".*" ".*"

For example, this creates a shared account called compute (replace <password>):

> /sbin/rabbitmqctl add_user compute <password>

# Add user read/write privileges
> /sbin/rabbitmqctl set_permissions compute ".*" ".*" ".*"
  • After adding the account, please update simscope_tunnel_api.py, simscope.config, and tunnel.config with the account information.

Change user password

To change a user's password, use the change_password subcommand:

> /sbin/rabbitmqctl change_password USERNAME
<new_password>

Rabbit Diagnostics

> rabbitmq-diagnostics status

RabbitMQ comes with a diagnostic tool which can help with administration, to see:

  • Version
  • PID
  • Uptime
  • Threads
  • Memory/Disk usage
  • Plugins
  • Data/Log directories

Here is a sample run:

> rabbitmq-diagnostics status
Status of node rabbit@localhost ...
Runtime

OS PID: 67174
OS: macOS
Uptime (seconds): 1152
RabbitMQ version: 3.8.3
Node name: rabbit@localhost
Erlang configuration: Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:64] [hipe] [dtrace]
Erlang processes: 491 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60

Plugins

Enabled plugin file: /usr/local/etc/rabbitmq/enabled_plugins
Enabled plugins:

 * rabbitmq_mqtt
 * rabbitmq_amqp1_0
 * rabbitmq_management
 * rabbitmq_management_agent
 * rabbitmq_web_dispatch
 * rabbitmq_stomp
 * amqp_client
 * cowboy
 * cowlib
 * amqp10_common

Data directory

Node data directory: /usr/local/var/lib/rabbitmq/mnesia/rabbit@localhost

Config files

 * /usr/local/etc/rabbitmq/rabbitmq.conf

Log file(s)

 * /usr/local/var/log/rabbitmq/rabbit@localhost.log
 * /usr/local/var/log/rabbitmq/rabbit@localhost_upgrade.log

Alarms

(none)

Memory

Calculation strategy: rss
Memory high watermark setting: 0.4 of available memory, computed to: 3.436 gb
other_proc: 0.03 gb (29.2 %)
code: 0.0268 gb (26.11 %)
other_system: 0.0164 gb (15.97 %)
allocated_unused: 0.0156 gb (15.19 %)
plugins: 0.0049 gb (4.74 %)
other_ets: 0.0033 gb (3.26 %)
atom: 0.0015 gb (1.48 %)
reserved_unallocated: 0.0014 gb (1.34 %)
mgmt_db: 0.001 gb (0.98 %)
binary: 0.001 gb (0.97 %)
metrics: 0.0002 gb (0.22 %)
quorum_queue_procs: 0.0002 gb (0.16 %)
queue_procs: 0.0001 gb (0.1 %)
mnesia: 0.0001 gb (0.09 %)
connection_other: 0.0001 gb (0.08 %)
quorum_ets: 0.0001 gb (0.05 %)
msg_index: 0.0 gb (0.03 %)
connection_readers: 0.0 gb (0.02 %)
connection_channels: 0.0 gb (0.0 %)
connection_writers: 0.0 gb (0.0 %)
queue_slave_procs: 0.0 gb (0.0 %)

File Descriptors

Total: 3, limit: 159
Sockets: 1, limit: 141

Free Disk Space

Low free disk space watermark: 0.05 gb
Free disk space: 46.2442 gb

Totals

Connection count: 1
Queue count: 5
Virtual host count: 1

Listeners

Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Interface: 127.0.0.1, port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Interface: [::], port: 61613, protocol: stomp, purpose: STOMP
Interface: [::], port: 15672, protocol: http, purpose: HTTP API
Interface: [::], port: 1883, protocol: mqtt, purpose: MQTT

List Queues

You can use the list_queues sub-command to list Rabbit Queues, and the number of pending messages.

> rabbitmq-diagnostics list_queues
Timeout: 60.0 seconds ...
Listing queues for vhost / ...
name    messages
debug.release/13966     0
dead_letter_queue       0
tunnel-in       12
simscope-in     0