The RabbitMQ environment variables

RabbitMQ environment variables is one of the configuration ways of RabbitMQ. Every operating system has its own set of environment variables for each user. Although operating systems has the ability to have environment variables, the way in which environment variables are changed is slightly different across operating systems.

In Unix-based operating systems, we can change the environment variables rather easily using the rabbitmq-env.conf file. In the environment configuration file, we can add the environment parameters as follows:

CONFIG_FILE=/etc/rabbitmq/testfile

After changing the rabbitmq-env.conf file, we have to restart the RabbitMQ server to reload the environment variables.

In Windows, we should use the environment variables of the System Properties for modifying the environment variables of RabbitMQ. We can access to the Environment Variables by navigating to Settings | Control Panel | System Properties | Advanced | Environment Variables, where we use pipes to show transitions. You can see this in the following screenshot:

The RabbitMQ environment variables

Windows Environment Parameters

We are now accessing the environment variables of different operating systems. Although, RabbitMQ gives us lots of different environment variables, we will cover the most important ones.

Common environment variables

RabbitMQ gives us lots of great environment variables to control all of the parts of its engine. We don't have enough time to discuss all of the environment variables; however, we will talk about the most important ones. Furthermore, some variables have different default values for Unix and Windows operating systems; we'll consider these variables in the following parts of the topic. Anyway, let's dive into the important variables:

  • RABBITMQ_BASE: This variable basically locates the directory of RabbitMQ. This directory has the database and log files.
  • RABBITMQ_CONFIG_FILE: Although the configuration file of RabbitMQ has a default location, you can change its location using this environment variable.
  • RABBITMQ_LOGS: RabbitMQ supports different levels of logs. Whenever RabbitMQ is creating a log file, it has a default location; however, you can change its location using this environment variable.
  • RABBITMQ_NODE_IP_ADDRESS: RabbitMQ binds to all network interfaces as a default property. As RabbitMQ gives us a full control over network interfaces, we can easily change its binding network using this variable, such as 127.0.0.1.
  • RABBITMQ_NODE_PORT: RabbitMQ has a default port, 5672; however, we have sometimes collision on ports, so we should change the ports that RabbitMQ binds. We can change RabbitMQ's binding port using this variable.
  • RABBITMQ_PLUGINS_DIR: RabbitMQ has many very useful plugins that will be enabled through RabbitMQ. RabbitMQ has a default location for these Erlang coded plugins; however, you can change its location.

The RabbitMQ Environment Variables:

Name

Default Value

Description

RABBITMQ_BASE

*(default)

This is the directory in which RabbitMQ server's database and log files are located.

RABBITMQ_CONFIG_FILE

*

This is the name of configuration file. The name doesn't consist of the extension ".config".

RABBITMQ_CONSOLE_LOG

 

This variable can have one of the two values: "new" or "reuse". These variables are used to decide the console log file whether create a new log file or reuse the old log file. If these variables are not set, the console output will not be saved.

RABBITMQ_LOGS

*

This is the directory of the RabbitMQ log file.

RABBITMQ_LOG_BASE

*

This is the base directory that holds the log files. If RABBITMQ_LOGS or RABBITMQ_SASL_LOGS is set, then this variable has no effect on configuration.

RABBITMQ_MNESIA_BASE

*

This expresses the base location of the Mnesia databases files. If RABBITMQ_MNESIA_DIR is set, then this variable has no effect on configuration.

RABBITMQ_MNESIA_DIR

*

This variable specifies the location of Mnesia database files.

RABBITMQ_NODE_IP_ADDRESS

The empty string means that this binds to all network interfaces.

This is the binding address. You should change this attribute when you'd like to bind to a single network interface.

RABBITMQ_NODENAME

On Unix: rabbit@hostname

On Windows:

rabbit@%COMPUTERNAME%

This is the node name of RabbitMQ server. This should be unique per Erlang node and machine combination.

RABBITMQ_NODE_PORT

5672

This is the binding port of RabbitMQ server.

RABBITMQ_PLUGINS_DIR

*

The location where plugins of RabbitMQ server are located.

RABBITMQ_SASL_LOGS

*

This is the location of RabbitMQ server's System Application Support Libraries' log files.

RABBITMQ_SERVICENAME

On Windows Service:

RabbitMQ

On Unix:

rabbitmq-server

This variable specifies the service name that is installed on the service system of operating system.

RABBITMQ_SERVER_START_ARGS

None

Erlang parameters are used for the erl command when invoking the RabbitMQ server. This variable will not override RABBITMQ_SERVER_ERL_ARGS.

Cells marked with* will be explained in the Unix and Windows section

Unix-specific default location

The following table describes the Unix-specific default locations of the given environment variables. Most of the locations are related to the installed location.

Default locations of environment variables for Unix:

Name

Location

RABBITMQ_BASE

This variable is not used for Unix

RABBITMQ_CONFIG_FILE

${install_prefix}/etc/rabbitmq/rabbitmq

RABBITMQ_LOGS

$RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME.log

RABBITMQ_LOG_BASE

${install_prefix}/var/log/rabbitmq

RABBITMQ_MNESIA_BASE

${install_prefix}/var/lib/rabbitmq/mnesia

RABBITMQ_MNESIA_DIR

$RABBITMQ_MNESIA_BASE/$RABBITMQ_NODENAME

RABBITMQ_PLUGINS_DIR

$RABBITMQ_HOME/plugins

RABBITMQ_SASL_LOGS

$RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME-sasl.log

Windows-specific default location

In contrast to Unix, Windows default values of the RabbitMQ environment variables are related to the other environment variables of RabbitMQ. The following table shows the Windows default locations.

Default locations of environment variables for Windows:

Name

Location

RABBITMQ_BASE

%APPDATA%RabbitMQ

RABBITMQ_CONFIG_FILE

%RABBITMQ_BASE% abbitmq

RABBITMQ_LOGS

%RABBITMQ_LOG_BASE%\%RABBITMQ_NODENAME%.log

RABBITMQ_LOG_BASE

%RABBITMQ_LOG_BASE%log

RABBITMQ_MNESIA_BASE

%RABBITMQ_BASE%db

RABBITMQ_MNESIA_DIR

%RABBITMQ_MNESIA_BASE%\%RABBITMQ_NODENAME%

RABBITMQ_PLUGINS_DIR

%RABBITMQ_BASE%plugins

RABBITMQ_SASL_LOGS

%RABBITMQ_LOG_BASE%\%RABBITMQ_NODENAME%-sasl.log

RabbitMQ environment variables are highly dependent on operating system environment variables. As an example, Computer Name in Unix and Hostname in Windows set the environment variable RABBITMQ_SERVICENAME and RABBITMQ_NODENAME. Anyway, the following table describes the dependent environment variables:

Name

Default Value

Description

COMPUTERNAME

Unix:

env hostname

This is the name of current machine for Windows machines.

ERLANG_SERVICE_MANAGER_PATH

Windows Service:

%ERLANG_HOME%erts-x.x.xin

This is the location where the Erlang service wrapper script is located.

HOSTNAME

Windows:

localhost

This is the name of the current location for Unix machines.

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

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