RabbitMQ accepting connections but closing them before accepting any input

喜你入骨 提交于 2019-12-23 03:18:27

问题


So I just installed the latest version of rabbitmq and I've been trying to get it to work. The server is running and I've restarted it once just to be sure it's a consistent problem.

If I telnet localhost 5672, I get

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

As you can see, the connection is accepted but rabbitmq does not accept any input. The connection is closed immediately. No further information shows up in logs.

rabbitmqctl works without any problems.

This is running on Windows Subsystem for Linux / Ubuntu. I don't have any other options for a local dev environment because I'm on a work computer which is locked down pretty tightly.


回答1:


I ran into the same issue, using Ubuntu(16.04) as a subsystem on Windows and rabbitmq 3.7.8. I noticed that when running sudo rabbitmqctl status the listeners showed the following:

{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]}

I fixed this issue by creating a rabbitmq config file and specifying the localhost and port 5762

Here is what i did step by step.

  1. Using sudo && vim, I created a 'rabbitmq.conf' file, located in /etc/rabbitmq/

    sudo vim /etc/rabbimq/rabbitmq.conf
    
  2. I specified the localhost(127.0.0.1) and port(5672) for the default tcp listener in the rabbitmq.conf file

    listeners.tcp.default = 127.0.0.1:5672
    
  3. Restart rabbitmq

    sudo service rabbitmq-server stop

    then

    sudo service rabbitmq-server start

  4. Check sudo rabbitmqctl status and look at the listeners, you should see your new tcp listener with the localhost ip sepcified

    {listeners,[{clustering,25672,"::"},{amqp,5672,"127.0.0.1"}]}

Here is the config docs from rabbitmq that may help clarify some of these steps.




回答2:


Telnet lets you confirm the system is listening and allows incoming connections. But even an "out of the box" install of RabbitMQ expects credentials for connections.

rabbitmqctl list_users to see which users are configured.

If guest present, typical creds are guest / guest

Either install management plugin (or confirm it is installed), or script your test, most languages have a package available for connecting to RabbitMQ.



来源:https://stackoverflow.com/questions/49285088/rabbitmq-accepting-connections-but-closing-them-before-accepting-any-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!