启动rabbitmq-server服务时,报错 ERROR: could not bind to distribution port 25672, it is in use by another node: rabbit@VM-4-7-centos
BOOT FAILED 启动失败
2022-07-08 14:49:26.578444+08:00 [error] <0.131.0>
2022-07-08 14:49:26.578444+08:00 [error] <0.131.0> BOOT FAILED
2022-07-08 14:49:26.578444+08:00 [error] <0.131.0> ===========
2022-07-08 14:49:26.578444+08:00 [error] <0.131.0> ERROR: could not bind to distribution port 25672, it is in use by another node: rabbit@VM-4-7-centos
2022-07-08 14:49:26.578444+08:00 [error] <0.131.0>
===========
ERROR: could not bind to distribution port 25672, it is in use by another node: rabbit@VM-4-7-centos
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> supervisor: {local,rabbit_prelaunch_sup}
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> errorContext: start_error
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> reason: {dist_port_already_used,25672,"rabbit","VM-4-7-centos"}
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> offender: [{pid,undefined},
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> {id,prelaunch},
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> {mfargs,{rabbit_prelaunch,run_prelaunch_first_phase,[]}},
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> {restart_type,transient},
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> {shutdown,5000},
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0> {child_type,worker}]
2022-07-08 14:49:27.587072+08:00 [error] <0.131.0>
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> crasher:
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> initial call: application_master:init/4
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> pid: <0.129.0>
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> registered_name: []
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> exception exit: {{shutdown,
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> {failed_to_start_child,prelaunch,
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> {dist_port_already_used,25672,"rabbit",
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> "VM-4-7-centos"}}},
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> {rabbit_prelaunch_app,start,[normal,[]]}}
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> in function application_master:init/4 (application_master.erl, line 138)
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> ancestors: [<0.128.0>]
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> message_queue_len: 1
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> messages: [{'EXIT',<0.130.0>,normal}]
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> links: [<0.128.0>,<0.44.0>]
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> dictionary: []
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> trap_exit: true
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> status: running
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> heap_size: 610
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> stack_size: 28
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> reductions: 219
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0> neighbours:
2022-07-08 14:49:27.587472+08:00 [error] <0.129.0>
2022-07-08 14:49:27.594992+08:00 [notice] <0.44.0> Application rabbitmq_prelaunch exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","VM-4-7-centos"}}},{rabbit_prelaunch_app,start,[normal,[]]}}
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,\"rabbit\",\"VM-4-7-centos\"}}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","VM-4-7-centos"}}},{rab
Crash dump is being written to: erl_crash.dump...done
当我启动rabbitmq-server服务,执行命令 [root@VM-4-7-centos bin]# rabbitmq-server start,
就遇到报错,报错的解释是: 不能绑定分配端口25672, 它正在被其他节点使用。
我用的环境、版本等信息:
Linux: 腾讯云CentOS 8.0
erlang : 23.3
rabbitmq : 3.10.5
socat : 1.7.4.1
解决办法:
1、查一下端口25672被谁占用了。
执行命令: lsof -i:25672
[root@VM-4-7-centos bin]#
[root@VM-4-7-centos bin]# lsof -i:25672
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 888747 rabbitmq 18u IPv4 4676158 0t0 TCP *:25672 (LISTEN)
[root@VM-4-7-centos bin]#
可以看出是被 rabbitmq的一个文件占用了,进程号: 888747
以为kill -9 888747,就可以了。
这样就陷入这个泥潭里了。
后来,
执行命令: [root@VM-4-7-centos bin]# rabbitmqctl stop
正在停止和停止节点rabbit@VM-4-7-centos
[root@VM-4-7-centos bin]#
[root@VM-4-7-centos bin]#
Stopping and halting node rabbit@VM-4-7-centos ...
[root@VM-4-7-centos bin]#
[root@VM-4-7-centos bin]#
rabbitmqctl stop 主要是解决停止应用和节点的作用。
再次执行命令 rabbitmq-server start,就不会报错了。
本次分享就结束了,欢迎大家给我留言,相互学习探讨。谢谢。