没有这样的vhost错误,当我运行我的docker-compose容器与rabbitmq里面



我需要创建一个docker-compose文件,以便在启动容器后立即有一个"myqueue"我可以立即开始处理的队列

我使用docker-compose:

version: '3.8'
services:
rabbitmq:
image: "rabbitmq:latest"
ports:
- "5672:5672"
- "15672:15672"
environment:
RABBITMQ_DEFAULT_USER: user
RABBITMQ_DEFAULT_PASS: pass
RABBITMQ_DEFAULT_VHOST: /
volumes:
- type: bind
source: rabbitmq-enabled-plugins
target: /etc/rabbitmq/enabled_plugins
- type: bind
source: rabbitmq.config
target: /etc/rabbitmq/rabbitmq.config
- type: bind
source: rabbitmq-defs.json
target: /etc/rabbitmq/rabbitmq-defs.json

rabbitmq-enabled-plugins

[rabbitmq_management].

rabbitmq.config

[
{
rabbit,
[
{default_user, <<"user">>},
{default_pass, <<"pass">>},
{default_vhost, <<"/">>},
{ loopback_users, [] }
]
},
{
rabbitmq_management,
[
{ load_definitions, "/etc/rabbitmq/rabbitmq-defs.json" }
]
}
].

rabbitmq-defs.json

{
"exchanges": [
{
"name": "myqueue",
"vhost": "/",
"type": "fanout",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
}
],
"queues": [
{
"name": "myqueue",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {}
}
],
"bindings": [
{
"source": "myqueue",
"vhost": "/",
"destination": "myqueue",
"destination_type": "queue",
"routing_key": "*",
"arguments": {}
}
]
}

当我尝试启动它时,我得到以下消息:

BOOT FAILED
===========
Exception during startup:
exit:{error,{no_such_vhost,<<"/">>}}
rabbit_boot_steps:-run_step/2-lc$^0/1-0-/2, line 45
rabbit_boot_steps:run_step/2, line 48
rabbit_boot_steps:-run_boot_steps/1-lc$^0/1-0-/1, line 19
rabbit_boot_steps:run_boot_steps/1, line 20
rabbit:start/2, line 958
application_master:start_it_old/4, line 293
Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{{error,{no_such_vhost,<<"/">>}},{rabbit,start,[normal,[]]}}})

我需要如何更改我的配置?

  1. 我尝试从rabbitmq-defs中删除vhost。
  2. 我试图用dockerfile解决这样的问题,但是curl有问题,这个解决方案看起来不太好

尝试使用带有management的标签。例如rabbitmq:management-alpine.

相关内容

  • 没有找到相关文章

最新更新