In the previous article we looked the Rabbit MQ management portal in more detail. In this article we will look at configuring RabbitMQ from the command line.
As well as using the web based management portal to administer RabbitMQ you can also use the command line (rabbitmqctrl.bat) interface. In this chapter we will demonstrate some of the basic features that you may need to use most frequently, but for a more exhaustive list of commands you can read the RabbitMQ manual page for the rabbitmqctrl.bat tool.
At a high level rabbitmqctrl lets you manage the run state of the message broker, manage your RabbitMQ clusters, administer users and permissions, manage policies and list exchanges, bindings, and queues.
Let’s work through a simple example of stopping and starting the RabbitMQ broker and checking the broker status.
Open up a command prompt and navigate to “C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.4.4\sbin
From the command prompt type:
Rabbitmqctl status
You will see the following output in the command line window.

To stop the RabbitMQ broker from running you type the following into the command line:
Rabbitmqctl stop
This will give you console output that looks as following:

If you run the status command line again by typing:
Rabbitmqctl status
You will see that the RabbitMQ service has stopped. This will mean RabbitMQ will stop receiving and processing messages. If you have not setup durable queues and messages you will lose any messages already in the system.

To restart the service you can either go to the windows services management window in Microsoft windows as shown in the following screenshot, or you can use the rabbitmqctl-service command line tool.

To start the service from the command line you need to type:
rabbitmq-service start
This will restart the service as shown in the following screenshot:

If you get a permission denied error, then you will need to make sure you open the command line window as an administrator. You can now query the status of the service again by using:
Rabbitmqctl status
You will now see that the service is up and running again.

This should have given you a flavour of administering RabbitMQ from the command line. For more information on the commands available then you can read the manual pages for rabbitmq-service and rabbitmqctl.
In the next article we will look at sending and receiving a basic message with Rabbit MQ via the management portal.
2 comments