In this recipe, we are going to introduce the RabbitMQ parameters. By default, the broker doesn't create the configuration files because in most of the cases you don't need to change them. However, it's important to know how to configure the environment variables and the broker parameters.
In RabbitMQ, you can configure the environment variables and the server file configuration. With the environment variables, you can change parameters such as the server port or the node name. There are two ways to change these variables:
rabbitmq-env.conf
located in /etc/rabbitmq
.If, for example, you want to change the RabbitMQ node name, you have to do the following:
exportRABBITMQ_NODENAME=mylittlerabbit
on the shell or insert the string NODENAME=mylittlerabbit
in the file, /etc/rabbitmq/rabbitmq-env.conf
.Originally, the web management shows the default node name, rabbit@hostname
, as follows:
After our configuration, it shows mylittlerabbit@hostname
as shown in the following screenshot:
In this way, you can change all the parameters that you can find in the URL https://www.rabbitmq.com/configure.html#define-environment-variables.
With the server file configuration, you can change the internal broker configuration. The configuration file is rabbitmq.config
and the location is the same as that of rabbitmq-env.conf
. Use the RABBITMQ_CONFIG_FILE
environment variable to change the location. You can find the complete list of parameters at https://www.rabbitmq.com/configure.html#configuration-file.