简体   繁体   English

rabbitmqadmin [Errno 111] 连接被拒绝

[英]rabbitmqadmin [Errno 111] Connection refused

So I keep getting "connection refused" from rabbitmqadmin.所以我不断收到来自rabbitmqadmin 的“连接被拒绝”。 I'm running debian 7 on a vm as root user.我在虚拟机上以 root 用户身份运行 debian 7。 I installed rabbitmq-server with apt-get, started it up and did the following:我用apt-get安装了rabbitmq-server,启动它并执行以下操作:

rabbitmqctl add_user test 1234
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
rabbitmq-plugins enable rabbitmq_management

cd /usr/local/bin/
wget https://raw.githubusercontent.com/rabbitmq/rabbitmq-management/rabbitmq_v3_5_6/bin/rabbitmqadmin
chmod +x rabbitmqadmin

rabbitmqadmin -H 127.0.0.1 -u test -p 1234 list vhosts

But the call to rabbitmqadmin always results in Could not connect: [Errno 111] Connection refused但是对rabbitmqadmin的调用总是导致无法连接:[Errno 111]连接被拒绝

I have tried the following:我尝试了以下方法:

  • restarting the service (/etc/init.d/rabbitmq-server restart/stop/start)重启服务(/etc/init.d/rabbitmq-server restart/stop/start)
  • verified that rabbitmq-management is enabled via rabbitmq-plugins list and checking /etc/rabbitmq/enabled_plugins通过rabbitmq-plugins列表和检查/etc/rabbitmq/enabled_plugins验证rabbitmq-management已启用
  • verified that rabbitmq-management actually started by checking rabbitmqctl status and the rabbitmq logs通过检查rabbitmqctl状态和rabbitmq日志来验证rabbitmq-management实际上是启动的
  • removing/reinstalling rabbitmq-server删除/重新安装rabbitmq-server
  • removing/reinstalling rabbitmqadmin删除/重新安装rabbitmqadmin
  • i checked that 127.0.0.1 was in fact listed in /etc/hosts我检查了 127.0.0.1 实际上列在/etc/hosts 中

I tried rabbitmqadmin list users and I get the same problem.我试过rabbitmqadmin list users也遇到了同样的问题。 I'm pretty stumped, any ideas?我很困惑,有什么想法吗?

note: i'm not sure if it's relevant, but i had some trouble getting rabbitmq-server installed, i kept getting "unmet dependencies" issues and running apt-get -f install would remove some other packages that i needed.注意:我不确定它是否相关,但是我在安装 rabbitmq-server 时遇到了一些麻烦,我不断遇到“未满足的依赖项”问题,并且运行apt-get -f install会删除我需要的一些其他软件包。 i think the problem actually came from installing erlang, and eventually got it working by going through the tree of unmet dependencies and installing each of them one at a time until erlang and rabbitmq-server were both installed.我认为问题实际上来自安装 erlang,并最终通过遍历未满足的依赖项树并一次安装每个依赖项直到 erlang 和 rabbitmq-server 都安装来使其工作。

ALSO i added "deb http://http.debian.net/debian wheezy-backports main" to /etc/apt/sources.list so i also tried removing rabbitmq-server, removing the repo, apt-get update and reinstalling rabbitmq-server, still nothing.另外我在/etc/apt/sources.list中添加了“deb http://http.debian.net/debian wheezy-backports main”,所以我也尝试删除rabbitmq-server,删除repo,apt-get更新并重新安装rabbitmq - 服务器,仍然没有。

I found this solution:我找到了这个解决方案:

rabbitmqadmin needs to talk to the management-website of the server. rabbitmqadmin需要与服务器的管理网站交谈。 The same which you use as an admin.与您作为管理员使用的相同。 The default seems to be TCP port 15672 , but the config that I am using (also Debian, but 9) is port 8080 .默认似乎是 TCP port 15672 ,但我使用的配置(也是 Debian,但 9)是port 8080

I found which port the management-interface runs on by looking into /etc/rabbitmq/rabbitmq.config where I found this:我通过查看/etc/rabbitmq/rabbitmq.config找到了管理接口运行在哪个端口上,我发现了这个:

       {rabbitmq_management, [{listener, [{port, 8080},

You could probably also try to check which open ports belong to the rabbitmq-server and try them all.您也可以尝试检查哪些开放端口属于rabbitmq-server 并全部尝试。

Finally, to use this information, I have created a config-file for rabbitmqadmin under ~/.rabbitmqadmin.conf and filled it with the info found in the output of rabbitmqadmin help config .最后,为了使用这些信息,我在~/.rabbitmqadmin.conf下为 rabbitmqadmin 创建了一个配置文件,并用在rabbitmqadmin help config的输出中找到的信息填充它。 (It might be important to remove leading spaces.) (删除前导空格可能很重要。)

on debian 10, rabbitmq-server installed a lot of plugins, but enabled none by default.在 debian 10 上,rabbitmq-server 安装了很多插件,但默认情况下都没有启用。

you may list them as root with:您可以将它们列为根用户:

rabbitmq-plugins list

then you may:那么你可以:

rabbitmq-plugins enable rabbitmq_management

now you may run, as non-root user:现在您可以以非 root 用户身份运行:

rabbitmqadmin list queues

and even乃至

rabbitmqadmin delete queue name=rpc_queue

i did no special configuration.我没有特殊配置。

只需删除:/etc/rabbitmq/rabbitmq.conf 并重新启动服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM