我正在尝试使用rabbitmq.config配置RabbitMQ。我收到错误{could_not_start,rabbit,{error,<>}” >>}}]
我已经创建了Rabbitmq.conf和definitions.json
[
{rabbit, [
{loopback_users, []}
]},
{rabbitmq_management, [
{load_definitions, "/etc/rabbitmq/definitions.json"}
]}
].
{
"rabbit_version": "3.6.6",
"users": [
{
"name": "guest",
"password_hash": "abcd",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": ""
},
{
"name": "admin",
"password_hash": "abcd",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": "administrator"
}
],
"vhosts": [
{
"name": "\/abc"
}
],
"permissions": [
{
"user": "guest",
"vhost": "\/abc",
"configure": ".*",
"write": ".*",
"read": ".*"
}
],
"parameters": [],
"policies": [],
"queues": [],
"exchanges": [],
"bindings": []
}
Docker组成文件
rabbitmq:
image: rabbitmq
container_name: rabbitmq
hostname: rabbitmq
ports:
- "5672:5672"
- "15672:15672"
volumes:
- ./path/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro
- ./path/definitions.json:/etc/rabbitmq/definitions.json:ro
错误日志:
=CRASH REPORT==== 30-Sep-2019::18:50:35 ===
rabbitmq | crasher:
rabbitmq | initial call: application_master:init/4
rabbitmq | pid: <1.123.1>
rabbitmq | registered_name: []
rabbitmq | exception exit: {bad_return,
rabbitmq | {{rabbit,start,[normal,[]]},
rabbitmq | {'EXIT',{error,<<"{not_base64,<<\"guest\">>}">>}}}}
rabbitmq | in function application_master:init/4 (application_master.erl, line 134)
rabbitmq | ancestors: [<0.136.0>]
rabbitmq | messages: []
rabbitmq | links: [<1.124.1>,<1.128.1>,<1.31.1>]
rabbitmq | dictionary: []
rabbitmq | trap_exit: true
rabbitmq | status: running
rabbitmq | heap_size: 587
rabbitmq | stack_size: 21
rabbitmq | reductions: 97
rabbitmq | neighbours:
我犯了什么错误?看来我在配置时犯了一些错误。但我无法识别它。
guest帐户和admin帐户的password_hash值都不正确。
"password_hash": "abcd"
如果您要生成自己的哈希,则此答案中对此有很好的解释
How to generate password_hash for RabbitMQ Management HTTP API