Menu

File and Directory Locations

Introduction

Every RabbitMQ node uses a number of files and directories to load configuration; store data, metadata, log files, and so on. Their location can be changed.

This guide covers:

  • How to customise location of various directories and files used RabbitMQ nodes
  • Default locations for various operating systems
  • Other topics related to file and directory locations

File System Permissions

When changing file or directory locations, it is important to make sure that they have sufficient permissions for RabbitMQ node OS process to read and write from. It's best to assume that most directories and files used by RabbitMQ require read, write, and file creation permissions. Debian, RPM and Windows installer scripts will set up file system permissions suitable for most environments, however, when strict default permissions are used system-wide, it may be necessary to run additional configuration steps after installation to make sure RabbitMQ node file and directories have sufficient permissions

Specifying Locations

You can set the following environment variables to specify where RabbitMQ should locate certain things. In most environments default values should work just fine.

NameDescription
RABBITMQ_BASE This base directory contains sub-directories for the RabbitMQ server's database and log files. Alternatively, set RABBITMQ_MNESIA_BASE and RABBITMQ_LOG_BASE individually.
RABBITMQ_CONFIG_FILE The path to the configuration file, without the .config extension. If the configuration file is present it is used by the server to configure RabbitMQ components. See Configuration guide for more information.
RABBITMQ_MNESIA_BASE This base directory contains sub-directories for the RabbitMQ server's node database, message store and cluster state files, one for each node, unless RABBITMQ_MNESIA_DIR is set explicitly. It is important that effective RabbitMQ user has sufficient permissions to read, write and create files and subdirectories in this directory at any time.
RABBITMQ_MNESIA_DIR The directory where this RabbitMQ node's Mnesia database files are placed. (In addition to Mnesia files this location also contains message storage and index files as well as schema and cluster details.)
RABBITMQ_LOG_BASE This base directory contains the RabbitMQ server's log files, unless RABBITMQ_LOGS or RABBITMQ_SASL_LOGS are set explicitly.
RABBITMQ_LOGS The path of the RabbitMQ server's Erlang log file. This variable cannot be overridden on Windows.
RABBITMQ_SASL_LOGS The path of the RabbitMQ server's Erlang SASL (System Application Support Libraries) log file. This variable cannot be overridden on Windows.
RABBITMQ_PLUGINS_DIR The list of directories where plugins are found and loaded from. This is PATH-like variable, where different paths are separated by an OS-specific separator (: for Unix, ; for Windows). Plugins can be installed to any of the directories listed here.
RABBITMQ_PLUGINS_EXPAND_DIR Working directory used to expand enabled plugins when starting the server. It is important that effective RabbitMQ user has sufficient permissions to read and create files and subdirectories in this directory.
RABBITMQ_ENABLED_PLUGINS_FILE This file records explicitly enabled plugins. When a plugin is enabled or disabled, this file will be recreated. It is important that effective RabbitMQ user has sufficient permissions to read, write and create this file at any time.
RABBITMQ_PID_FILE File in which the process id is placed for use by rabbitmqctl wait.

Unix Default Locations

In the following table the ${install_prefix} to some paths is indicated. Homebrew installations use the installation-prefix (Homebrew Cellar) when installed. By default this is /usr/local.

Deb / RPM package installations use an empty ${install_prefix}.

NameLocation
RABBITMQ_BASE (Not used)
RABBITMQ_CONFIG_FILE ${install_prefix}/etc/rabbitmq/rabbitmq
RABBITMQ_MNESIA_BASE ${install_prefix}/var/lib/rabbitmq/mnesia
RABBITMQ_MNESIA_DIR $RABBITMQ_MNESIA_BASE/$RABBITMQ_NODENAME
RABBITMQ_LOG_BASE ${install_prefix}/var/log/rabbitmq
RABBITMQ_LOGS $RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME.log
RABBITMQ_SASL_LOGS $RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME-sasl.log
RABBITMQ_PLUGINS_DIR /usr/lib/rabbitmq/plugins:$RABBITMQ_HOME/plugins

Note that /usr/lib/rabbitmq/plugins is used only when RabbitMQ is installed into the standard (default) location.

RABBITMQ_PLUGINS_EXPAND_DIR $RABBITMQ_MNESIA_BASE/$RABBITMQ_NODENAME-plugins-expand
RABBITMQ_ENABLED_PLUGINS_FILE ${install_prefix}/etc/rabbitmq/enabled_plugins
RABBITMQ_PID_FILE $RABBITMQ_MNESIA_DIR.pid

Windows Default Locations

NameLocation
RABBITMQ_BASE %APPDATA%\RabbitMQ
RABBITMQ_CONFIG_FILE %RABBITMQ_BASE%\rabbitmq
RABBITMQ_MNESIA_BASE %RABBITMQ_BASE%\db
RABBITMQ_MNESIA_DIR %RABBITMQ_MNESIA_BASE%\%RABBITMQ_NODENAME%
RABBITMQ_LOG_BASE %RABBITMQ_BASE%\log
RABBITMQ_LOGS %RABBITMQ_LOG_BASE%\%RABBITMQ_NODENAME%.log
RABBITMQ_SASL_LOGS %RABBITMQ_LOG_BASE%\%RABBITMQ_NODENAME%-sasl.log
RABBITMQ_PLUGINS_DIR Installation-directory/plugins
RABBITMQ_PLUGINS_EXPAND_DIR %RABBITMQ_MNESIA_BASE%\%RABBITMQ_NODENAME%-plugins-expand
RABBITMQ_ENABLED_PLUGINS_FILE %RABBITMQ_BASE%\enabled_plugins
RABBITMQ_PID_FILE (Not currently supported)

Generic Unix Default Locations

These are the defaults obtained when unpacking the Generic Unix tar-file and running the server without modification. In this table $RABBITMQ_HOME refers to the directory rabbitmq_server-3.6.12 produced when unpacking the download.

NameLocation
RABBITMQ_BASE (Not used)
RABBITMQ_CONFIG_FILE $RABBITMQ_HOME/etc/rabbitmq/rabbitmq
RABBITMQ_MNESIA_BASE $RABBITMQ_HOME/var/lib/rabbitmq/mnesia
RABBITMQ_MNESIA_DIR $RABBITMQ_MNESIA_BASE/$RABBITMQ_NODENAME
RABBITMQ_LOG_BASE $RABBITMQ_HOME/var/log/rabbitmq
RABBITMQ_LOGS $RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME.log
RABBITMQ_SASL_LOGS $RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME-sasl.log
RABBITMQ_PLUGINS_DIR $RABBITMQ_HOME/plugins
RABBITMQ_PLUGINS_EXPAND_DIR $RABBITMQ_MNESIA_BASE/$RABBITMQ_NODENAME-plugins-expand
RABBITMQ_ENABLED_PLUGINS_FILE $RABBITMQ_HOME/etc/rabbitmq/enabled_plugins
RABBITMQ_PID_FILE $RABBITMQ_MNESIA_DIR.pid