You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

RabbitMQ启动失败求助:配置文件端口设置错误问题

解决RabbitMQ启动失败(配置项错误)问题

问题原因

你在rabbitmq.conf中使用了不存在的配置项listeners.tcp.10.0.0.1,导致RabbitMQ无法解析配置,启动失败。错误日志明确指出该配置项无效,并提示了正确的可选配置项:

  • listeners.tcp.$name
  • listeners.tcp
  • listeners.ssl.$name

正确配置方式

要指定自定义的TCP监听端口和绑定地址,需使用以下正确的配置格式:

方式1:绑定到所有地址并指定端口

在rabbitmq.conf中添加:

listeners.tcp.default = 0.0.0.0:5673

(将5673替换为你要使用的未被占用的端口)

方式2:绑定到特定IP和端口

如果需要绑定到特定IP(比如10.0.0.1),格式应为:

listeners.tcp.my_listener = 10.0.0.1:5673

这里my_listener是自定义的监听器名称,可以替换为任意合法名称。

方式3:仅指定端口(绑定到所有地址)

如果只需修改端口,保持绑定所有地址,也可以简化为:

listeners.tcp = 5673

操作步骤

  1. 打开RabbitMQ的配置文件rabbitmq.conf(通常位于C:\Program Files\RabbitMQ Server\rabbitmq_server-3.11.15\etc\rabbitmq目录下)
  2. 删除错误的listeners.tcp.10.0.0.1配置项
  3. 添加上述任意一种正确的配置
  4. 保存配置文件后,重新启动RabbitMQ服务:
rabbitmq-server start

错误日志

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.11.15\sbin>rabbitmq-server start
2023-05-02 12:02:05.052000+02:00 [error] <0.131.0> 您尝试设置listeners.tcp.10.0.0.1,但不存在该配置项。
2023-05-02 12:02:05.083000+02:00 [error] <0.131.0> 您是否想设置以下选项之一?
2023-05-02 12:02:05.249000+02:00 [error] <0.131.0> listeners.tcp.$name
2023-05-02 12:02:05.249000+02:00 [error] <0.131.0> listeners.tcp
2023-05-02 12:02:05.249000+02:00 [error] <0.131.0> listeners.ssl.$name

2023-05-02 12:02:05.249000+02:00 [error] <0.131.0> 在transform_datatypes阶段准备配置时出错:
BOOT FAILED
2023-05-02 12:02:05.249000+02:00 [error] <0.131.0> - 配置文件尝试设置未知变量:listeners.tcp.10.0.0.1

2023-05-02 12:02:05.256000+02:00 [error] <0.131.0>
2023-05-02 12:02:05.256000+02:00 [error] <0.131.0> BOOT FAILED
2023-05-02 12:02:05.256000+02:00 [error] <0.131.0> ===========
2023-05-02 12:02:05.256000+02:00 [error] <0.131.0> 启动期间错误:{error,failed_to_prepare_configuration}
2023-05-02 12:02:05.256000+02:00 [error] <0.131.0>
启动期间错误:{error,failed_to_prepare_configuration}

2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> supervisor: {local,rabbit_prelaunch_sup}
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> errorContext: start_error
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> reason: failed_to_prepare_configuration
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> offender: [{pid,undefined},
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> {id,prelaunch},
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> {mfargs,{rabbit_prelaunch,run_prelaunch_first_phase,[]}},
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> {restart_type,transient},
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> {significant,false},
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> {shutdown,5000},
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0> {child_type,worker}]
2023-05-02 12:02:06.285000+02:00 [error] <0.131.0>
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> crasher:
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> initial call: application_master:init/4
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> pid: <0.129.0>
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> registered_name: []
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> exception exit: {{shutdown,
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> {failed_to_start_child,prelaunch,
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> failed_to_prepare_configuration}},
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> {rabbit_prelaunch_app,start,[normal,[]]}}
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> in function application_master:init/4 (application_master.erl, line 142)
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> ancestors: [<0.128.0>]
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> message_queue_len: 1
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> messages: [{'EXIT',<0.130.0>,normal}]
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> links: [<0.128.0>,<0.44.0>]
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> dictionary: []
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> trap_exit: true
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> status: running
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> heap_size: 233
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> stack_size: 28
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> reductions: 170
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0> neighbours:
2023-05-02 12:02:06.287000+02:00 [error] <0.129.0>
2023-05-02 12:02:06.321000+02:00 [notice] <0.44.0> Application rabbitmq_prelaunch exited with reason: {{shutdown,{failed_to_start_child,prelaunch,failed_to_prepare_configuration}},{rabbit_prelaunch_app,start,[normal,[]]}}
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,failed_to_prepare_configuration}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,failed_to_prepare_configuration}},{rabbit_prelaunch_app,start,[normal,[]]}}})

Crash dump is being written to: erl_crash.dump...done

内容的提问来源于stack exchange,提问作者Taolana

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 06:54:56