Unknown variable "management.load_definitions" in rabbitmq rabbit.conf file
Answer a question
Background
We have a RabbitMQ management docker image in a docker-compose
setup and we are trying to launch rabbit with some users, vhosts and exchanges already added. However, the bootup is crashing and we don't know why.
What we tried
We have a folder called "rabbitmq" with the following files (this is our configuration folder):
definitions.json
{
"rabbit_version": "3.8.2",
"users": [
{
"name": "user1",
"password_hash": "user1",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": ""
}
],
"vhosts": [
{
"name": "\/vhost1"
}
],
"permissions": [
{
"user": "user1",
"vhost": "\/vhost1",
"configure": ".*",
"write": ".*",
"read": ".*"
}
],
"parameters": [],
"policies": [],
"queues": [],
"exchanges": [
{
"name": "Pizza",
"vhost": "\/vhost1",
"type": "fanout"
}
],
"bindings": []
}
rabbitmq.conf
loopback_users.guest = false
listeners.tcp.default = 5672
management.load_definitions = "/etc/rabbitmq/definitions.json"
To make use of this setup, we have the following docker-compose
file:
version: '3'
services:
rabbit:
image: rabbitmq:3.8.2-management
ports:
- "8080:15672"
- "5672:5672"
volumes:
- ${PWD}/rabbitmq:/etc/rabbitmq
We know that RabbitMQ finds this folder and tries to load the rabbitmq.conf
file. In fact, this is where our issues start.
Problem
When we try to launch our setup, RabbitMQ fails to launch with the following message:
BOOT FAILED
rabbit_1 | ===========
rabbit_1 |
rabbit_1 | Config file generation failed:
rabbit_1 | 10:46:43.479 [error] You've tried to set management.load_definitions, but there is no setting with that name.
rabbit_1 | 10:46:43.479 [error] Did you mean one of these?
rabbit_1 | 10:46:43.537 [error] load_definitions
rabbit_1 | 10:46:43.537 [error] raft.segment_max_entries
rabbit_1 | 10:46:43.537 [error] log.syslog.identity
rabbit_1 | 10:46:43.537 [error] Error generating configuration in phase transform_datatypes
rabbit_1 | 10:46:43.537 [error] Conf file attempted to set unknown variable: management.load_definitions
rabbit_1 | In case the setting comes from a plugin, make sure that the plugin is enabled.
rabbit_1 | Alternatively remove the setting from the config.
rabbit_1 |
rabbit_1 | init terminating in do_boot (generate_config_file)
rabbit_1 | {"init terminating in do_boot",generate_config_file}
rabbit_1 |
rabbit_1 | Crash dump is being written to: /var/log/rabbitmq/erl_crash.dump...done
This is confusing. We are using the rabbitmq:3.8.2-management
image, so the management plugin should be enabled by default.
What are we doing wrong?
Answers
The problem
The reason why we were getting this error was in the docker-compose
file:
version: '3'
services:
rabbit:
image: rabbitmq:3.8.2-management
ports:
- "8080:15672"
- "5672:5672"
volumes:
- ${PWD}/rabbitmq:/etc/rabbitmq
Specifically the volumes part: ${PWD}/rabbitmq:/etc/rabbitmq
The issue here is that this command completely smashes the original rabbitmq folder with ours. This means that all the extra files in the original /etc/rabbitmq fodler are lost.
This was not our purpose, our purpose was to add our files to the original folder, replacing said files if they already existed.
The solution
The following docker-compose
fixes this issue:
version: '3'
services:
rabbit:
image: rabbitmq:3.8.2-management
ports:
- "8080:15672"
- "5672:5672"
volumes:
- ${PWD}/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
- ${PWD}/rabbitmq/definitions.json:/etc/rabbitmq/definitions.json
Here we only push and replace the files we need, letting the rest of the content from the original folder untouched.
This means that the plugins folder inside /etc/rabbitmq
won't be deleted and that the plugins (such as the management one) will be loaded and we will be able to configure them via the rabbitmq.conf
file.
更多推荐
所有评论(0)