Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't start rabbitmq-server after installation

Tags:

rabbitmq

I'm trying to use rabbitmq for a django tutorial but when I want to start the server I get this error:

~$ sudo rabbitmq-server 
Configuring logger redirection
14:49:57.041 [error] 

14:49:57.044 [error] BOOT FAILED
BOOT FAILED
14:49:57.044 [error] ===========
===========
14:49:57.044 [error] ERROR: could not bind to distribution port 25672, it is in use by another node: rabbit@wss
ERROR: could not bind to distribution port 25672, it is in use by another node: rabbit@wss
14:49:57.045 [error] 

14:49:58.046 [error] Supervisor rabbit_prelaunch_sup had child prelaunch started with rabbit_prelaunch:run_prelaunch_first_phase() at undefined exit with reason {dist_port_already_used,25672,"rabbit","wss"} in context start_error
14:49:58.046 [error] CRASH REPORT Process <0.153.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","wss"}}},{rabbit_prelaunch_app,start,[normal,[]]}} in application_master:init/4 line 138
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,\"rabbit\",\"wss\"}}},{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","wss"}}},{rabbit_prelau

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

I've searched for port to see that if it's in use or not and I used lsof -i :25672 and I get nothing.


I don't know too much about these things so if you need anything please tell me.

like image 799
Kurosh Ghanizadeh Avatar asked Aug 05 '20 10:08

Kurosh Ghanizadeh


People also ask

How do I start RabbitMQ after installation?

The RabbitMQ batch files expect to execute %ERLANG_HOME%\bin\erl.exe. Go to Start > Settings > Control Panel > System > Advanced > Environment Variables. Create the system environment variable ERLANG_HOME and set it to the full path of the directory which contains bin\erl.exe.


3 Answers

Try:

  1. sudo lsof -i :25672
  2. sudo kill <PID>
  3. sudo rabbitmq-server

Where <PID> is the process ID that is occupying port 25672

like image 197
Mário Alexandre Rodrigues Avatar answered Oct 08 '22 09:10

Mário Alexandre Rodrigues


I have encountered this issue. I figured out that this issue is coming because the rabbitmq-server is already running on the machine.

I have used the following command

rabbitmqctl.bat status to know the status of the rabbitmq-server. This helped me to know if the server is up or down.

If it is up, this could the reason you are getting the error that you have specified in your post.

You can issue the following command to make the server down

rabbitmqctl.bat stop

Now you can try starting the rabbitmq-server by issuing the following command

rabbitmq-server start

Note that I am using Windows. And I have executed these commands by pointing the command prompt to C:\Program Files\RabbitMQ\rabbitmq_server-3.8.14\sbin as my rabbitmq installation directory is C:\Program Files\RabbitMQ\rabbitmq_server-3.8.14.

like image 43
Rajkumar Alagar Avatar answered Oct 08 '22 09:10

Rajkumar Alagar


I have encountered this before. Here is what caused it and how I fixed it:

This is one of those commands which requires the magic word sudo (i.e it needs a superuser privilege). If you forget to add sudo to the command, it begins the process but later fails when it hits a superuser-only roadblock. This leaves you with an incomplete process. Now when you decide to add sudo, it attempts the same process again but finds out that someone without the right privilege has made a mess or is still messing around. Then the solution will be to cancel out whatever the first command has started and try again.

sudo lsof -i :25672

This list out details about the port 25672

You will see the PID (process ID) e.g 1301

Then stop the process on that port with:

sudo kill <PID>

for example, sudo kill 1301 And make sure you are killing the right process if not you may get into trouble.

Now, retry the command with sudo:

sudo rabbitmq-server

ALSO,

In most cases, this error occurs because without deliberately stopping the rabbitmq-server, it always keeps running even after you restart you system.

like image 4
John Johnson Avatar answered Oct 08 '22 09:10

John Johnson