问题
This question has been asked before (RabbitMQ Failed to initialize erlang distribution), but I haven't been able to find out how to fix it from the existing answers. Following https://www.rabbitmq.com/man/rabbitmqctl.1.man.html, I'd like to run the rabbitmqctl status
command to display information about the RabbitMQ broker. However, I get an error message:
kurt@kurt-ThinkPad:~$ rabbitmqctl status
Error: Failed to initialize erlang distribution: {{shutdown, {failed_to_start_child, net_kernel, {'EXIT',nodistribution}}}, {child,undefined, net_sup_dynamic, {erl_distribution, start_link, [['rabbitmq-cli-13', shortnames]]}, permanent,1000,supervisor, [erl_distribution]}}.
Only root or rabbitmq should run rabbitmqctl
If I run the command with sudo
, I still get an error message:
kurt@kurt-ThinkPad:~$ sudo rabbitmqctl status
Error: Failed to initialize erlang distribution: {{shutdown, {failed_to_start_child, net_kernel, {'EXIT',nodistribution}}}, {child,undefined, net_sup_dynamic, {erl_distribution, start_link, [['rabbitmq-cli-69', shortnames]]}, permanent,1000,supervisor, [erl_distribution]}}.
How can I fix this?
回答1:
I also faced similar error when trying to enable the rabbitmq management plugin, $rabbitmq-plugins enable rabbitmq_management
Error: Failed to initialize erlang distribution: {{shutdown, {failed_to_start_child, auth, {"Error when reading ./.erlang.cookie: eacces",...}}.
It got solved when I ran with **sudo .**
回答2:
In fact I got the same error:
Only root or rabbitmq should run rabbitmqctl
when I wanted to run the following command:
rabbitmq-plugins enable rabbitmq_mqtt
I just ran it with sudo
and it was resolved!
Try to restart the rabbitmq-server
then try again with sudo
:
sudo service rabbitmq-server restart
来源:https://stackoverflow.com/questions/40980345/error-failed-to-initialize-erlang-distribution-trying-to-run-rabbitmqctl-st