Configuring RabbitMQ parameters

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.

How to do it…

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:

  1. Define the variables in your shell environment.
  2. Create a file rabbitmq-env.conf located in /etc/rabbitmq.

If, for example, you want to change the RabbitMQ node name, you have to do the following:

  1. Stop the server.
  2. Either issue exportRABBITMQ_NODENAME=mylittlerabbit on the shell or insert the string NODENAME=mylittlerabbit in the file, /etc/rabbitmq/rabbitmq-env.conf.
  3. Restart the broker.

How it works…

Originally, the web management shows the default node name, rabbit@hostname, as follows:

How it works…

After our configuration, it shows mylittlerabbit@hostname as shown in the following screenshot:

How it works…

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.

Tip

The environment variable name is prefixed with RABBITMQ_. You do not have to use it if you write the variable in rabbitmq-env.conf.

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.

There's more…

In this recipe we have just introduced the RabbitMQ configuration. In the next chapters, we will change some of the default parameters to tune the performance or configure the cluster.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset