LavinMQ Command Line Interface

What is a command line interface?

A command line interface lets you configure a program from your terminal. This has several benefits but one big advantage is that you can control your program from script files or from other programs.

What benefits does lavinmqctl offer?

Being able to control LavinMQ from the command line can be very powerful, it allows you to do repetitive tasks like setting up exchanges and queues very simple. You can also use it to check the status of the broker.

How should I use lavinmqctl?

Lavinmqctl can be used on your own computer or a server and you can use it against a local instance of lavinmq or a hosted one running on cloudamqp.com as it supports remote instances as well.

Usage

lavinmqctl is a command line tool for managing an LavinMQ instance, it connects to the running instance over either unix socket or over HTTP. Default is using a unix socket, which therefore requires the instance to be running on the same machine. You can tell the tool to connect to a remote instance using HTTPS and using basic auth for authentication. When using this method the credentials to use are the same as you use when connecting an AMQP client so the same permissions is also used for lavinmqctl.

Example of listing queues in vhost cloudamqp

lavinmqctl -p cloudamqp list_queues

Global options

Global options are available for all commands.

Option Description
-p vhost, --vhost=vhost Specify vhost
-H host, --host=host Specify host, if skipped it will connect using the default unix socket,
which require LavinMQ to be running on the same machine.
When connecting to a remote broker you should specify host a complete
http uri like this: https://username:password@hostname.com/
-q, --quiet Suppress informational messages
-s, --silent Suppress informational messages and table formatting
-v, --version Show version
-h, --help Print all options and commands available, this can also be used for a command
like “lavinmqctl list_queue -h” to show options for this command.
-f format, --format=format Format output (text, json) default is text
-n node, --node=node Does nothing, only used in CI for compatibility reasons.

Commands

Command Description
status Display server status
add_user Creates a new user
change_password Change the user password
delete_user Delete a user
list_users List user names and tags
set_user_tags Sets user tags
list_vhosts Lists virtual hosts
add_vhost Creates a virtual host
delete_vhost Deletes a virtual host
reset_vhost Purges all messages in all queues in the vhost and close all consumers, optionally back up the data
list_connections Lists AMQP 0.9.1 connections for the node
close_connection Instructs the broker to close a connection by pid
close_all_connections Instructs the broker to close all connections for the specified vhost or entire node
list_queues Lists queues and their properties
create_queue Create queue
purge_queue Purges a queue (removes all messages in it)
pause_queue Pause all consumers on a queue
resume_queue Resume all consumers on a queue
delete_queue Delete queue
list_exchanges Lists exchanges
create_exchange Create exchange
delete_exchange Delete exchange
set_policy Sets or updates a policy
clear_policy Clears (removes) a policy
list_policies Lists all policies in a virtual host
definitions Generate definitions json from the data directory
export_definitions Exports definitions in JSON
import_definitions Import definitions in JSON

Ready to take the next steps? Here are some things you should keep in mind:

Managed LavinMQ instance on CloudAMQP

LavinMQ has been built with performance and ease of use in mind - we've benchmarked a throughput of about 1,000,000 messages/sec. You can try LavinMQ without any installation hassle by creating a free instance on CloudAMQP. Signing up is a breeze.

Help and feedback

We welcome your feedback and are eager to address any questions you may have about this piece or using LavinMQ. Join our Slack channel to connect with us directly. You can also find LavinMQ on GitHub.