New Configuration Format in RabbitMQ 3.7

In this post we'll cover a new configuration format available in RabbitMQ 3.7.0.

Why Do We Need a New Format

Many developers and operators have strong opinions about software configuration formats. Debates about the pros and cons of a particular format center on readability, whether a format supports comments, and so on.

Those are valid concerns indeed but configuration files are not always hand crafted by a human. In the age of rising automation expectations, the ease of generation of a particular format is rarely discussed.

Historically, RabbitMQ uses Erlang term files for configuration. Besides being the standard way of configuring Erlang-based systems, it strikes a good balance of power and safety: any Erlang data structure can be used, including arbitrary nesting, yet arbitrary code cannot be evaluated.

That format, however, also has a few downsides that became obvious once the project had accumulated a certain critical mass of users:

  • It's not familiar to those getting started with RabbitMQ
  • It has subtle aspects such as required trailing dots and commas that confuse beginners
  • Arbitrary nesting can be powerful and sometimes necessary but it also can greatly complicate config file generation
  • In some cases familiarity with different Erlang data types was necessary (e.g. lists vs. binaries) for no good reason

Team RabbitMQ wanted to address all of those concerns but particularly the last one. Provisioning tools such as Chef and BOSH manage to generate functional config files but that code is difficult to read and maintain, which in turn means that it is error-prone.

The New Format

After evaluating all the usual suspects, we settled on an ini-like format used by sysctl and Riak. It uses a different config extension, .conf, and looks like this:

This overrides default heartbeat value offered by the server to 30 seconds.

Most settings use a single line, with configuration key and value separated by an equality sign and zero or more spaces. Such formats have been around for decades and are known to be fairly readable for humans.

Here's a slightly longer example:

In addition to the hearbeat setting, it also configures a TCP listener to use port 5672 and bind to all interfaces available.

Settings can be structured (logically grouped) using dots. For example, all plain TCP (as opposed to TCP plus TLS) listener settings are grouped under listener.tcp.*.

Here's how TLS certificates and key are configured in the new format:

Compare this to the same settings in the classic (Erlang terms) format:

Besides being easier to read, the new version is much easier to generate.

It also has one less obvious improvement: the values are now validated with a schema. For path values such as the private key path this means that should a file not be found or not be readable, the node will immediately report it and refuse to start. Previously the node would start but the files would fail to load at runtime, which is a great way to confuse deployment and monitoring tools.

Fields that expect numerical values will refuse to accept strings, and so on. The new format offers some of the benefits of static typing, which is not the case with many commonly used formats.


Single value keys are trivial to configure in this format. But what about collections? For example, it's possible to configure more than one TCP listener. It is also possible to list cluster nodes for peer discovery purposes. How does this format account for that?

The new format supports collections that are maps (dictionaries). For values that are arrays or sets, the keys are ignored. Here's how to specify a list of nodes for peer discovery:

The keys in this example are 1, 2 and so on. Any key values can be used. Sequentially growing numbers are easy to generate, so that's what our documentation examples use.


Comments are supported in the new format, allowing us to continue providing an annotated example file:

Advanced Configuration

As nice as this format is, there are certain limitations to it. Consider the following config file that demonstrates a number of features in the LDAP plugin:

This example uses deeply nested data structures to express LDAP queries. Such scenarios do not fit the new format very well but they have to be supported.

To account for this, it is now possible to specify another config file, advanced.config, in the classic (Erlang terms) config format.

The two config formats are then merged. How is this possible? The trick is in translating the new format to the old one, which we will cover next.

Alternatively it is possible to only use the legacy config format. It makes sense during a transition period, for example.

How it Works

As mentioned above, the new format is translated into the classic one under the hood since that's what a lot of libraries, including in Erlang/OTP, expect. The translation is done by a tool called Cuttlefish, originally developed by Basho Technologies. On start, RabbitMQ nodes use Cuttlefish to do the following:

  • Collect config schema files from all plugins
  • Run Cuttlefish to do the translation
  • Combines the result with the advanced.config file
  • Loads the final config

For both RabbitMQ core and plugins the process is entirely transparent. All the heavy lifting is done by a number of functions that form a translation schema. Cuttlefish does the parsing and invokes schema functions to perform validation and translation.

Plugin Configuration

Plugins that have configurable settings now ship their own schemas that are extracted and incorporated into the main one on node boot.

Here's what management plugin configuration might look like:

The schema file for management.* keys is provided by the management plugin.


This new format makes RabbitMQ config files be more familiar and readable to humans, easier to generate for tools, and introduces value validation against an extensible schema. Plugins can ship their own config schema files and benefit from the new format.

It still possible to use the previous format or combine the two. We believe that the new format can cover the proverbial 80% of use cases, though.

Take a look at the updated configuration guide, give this feature a try and let us know what you think on the RabbitMQ mailing list!

Tags: , , ,

Comments are closed.