一、报错信息
启动MQ,rabbitmq-server start
报错:
zhaohui@zhaohuideMacBook-Pro rabbitmq % rabbitmq-server start
BOOT FAILED
===========
ERROR: epmd error for host localhost: nxdomain (non-existing domain)2023-08-10 09:19:51.202102+08:00 [error] <0.135.0>
2023-08-10 09:19:51.202102+08:00 [error] <0.135.0> BOOT FAILED
2023-08-10 09:19:51.202102+08:00 [error] <0.135.0> ===========
2023-08-10 09:19:51.202102+08:00 [error] <0.135.0> ERROR: epmd error for host localhost: nxdomain (non-existing domain)
2023-08-10 09:19:51.202102+08:00 [error] <0.135.0>
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> supervisor: {local,rabbit_prelaunch_sup}
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> errorContext: start_error
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> reason: {epmd_error,"localhost",nxdomain}
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> offender: [{pid,undefined},
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> {id,prelaunch},
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> {mfargs,{rabbit_prelaunch,run_prelaunch_first_phase,[]}},
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> {restart_type,transient},
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> {significant,false},
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> {shutdown,5000},
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0> {child_type,worker}]
2023-08-10 09:19:52.220312+08:00 [error] <0.135.0>
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> crasher:
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> initial call: application_master:init/4
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> pid: <0.133.0>
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> registered_name: []
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> exception exit: { {shutdown,
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> {failed_to_start_child,prelaunch,
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> {epmd_error,"localhost",nxdomain}}},
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> {rabbit_prelaunch_app,start,[normal,[]]}}
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> in function application_master:init/4 (application_master.erl, line 142)
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> ancestors: [<0.132.0>]
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> message_queue_len: 1
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> messages: [{'EXIT',<0.134.0>,normal}]
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> links: [<0.132.0>,<0.44.0>]
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> dictionary: []
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> trap_exit: true
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> status: running
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> heap_size: 376
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> stack_size: 28
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> reductions: 170
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0> neighbours:
2023-08-10 09:19:52.221082+08:00 [error] <0.133.0>
2023-08-10 09:19:52.241139+08:00 [notice] <0.44.0> Application rabbitmq_prelaunch exited with reason: { {shutdown,{failed_to_start_child,prelaunch,{epmd_error,"localhost",nxdomain}}},{rabbit_prelaunch_app,start,[normal,[]]}}
Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{ {shutdown,{failed_to_start_child,prelaunch,{epmd_error,"localhost",nxdomain}}},{rabbit_prelaunch_app,start,[normal,[]]}}})Crash dump is being written to: erl_crash.dump...done
二、原因 及解决
根据错误信息,出现了epmd error for host localhost: nxdomain (non-existing domain)的错误。这个错误一般是由于DNS解析问题引起的。
解决方法如下:
-
检查你的主机是否能够成功解析localhost域名。可以使用以下命令进行测试:
ping localhost
-
如果无法解析,可能是DNS配置有问题。你可以尝试修改
/etc/hosts
文件,将localhost
映射到正确的IP地址,例如:127.0.0.1 localhost ::1 localhost
-
确保你的网络连接正常。有时候网络连接不稳定或者断开会导致DNS解析失败。
-
检查RabbitMQ配置文件中是否有错误。你可以检查
rabbitmq.conf
或者其他相关配置文件中的配置项,确保没有错误或者不合法的配置。