4

我已经在 Linux 机器上安装了 Rabbitmq 3.4,它在5672端口上运行。当我尝试声明交换时,它提示我出错。

 ./rabbitmqadmin declare exchange --vhost=localhost name=SAMPLE_EXCHANGE type=direct

使用 rabbitmqadmin 的 python 脚本,它位于/usr/local/bin/

错误 -

Traceback (most recent call last):
  File "/usr/local/bin/rabbitmqadmin", line 953, in <module>
    main()
  File "/usr/local/bin/rabbitmqadmin", line 389, in main
    method()
  File "/usr/local/bin/rabbitmqadmin", line 569, in invoke_declare
    self.put(uri, json.dumps(upload))
  File "/usr/local/bin/rabbitmqadmin", line 415, in put
    return self.http("PUT", "/api%s" % path, body)
  File "/usr/local/bin/rabbitmqadmin", line 441, in http
    resp = conn.getresponse()
  File "/usr/lib64/python2.6/httplib.py", line 990, in getresponse
    response.begin()
  File "/usr/lib64/python2.6/httplib.py", line 391, in begin
    version, status, reason = self._read_status()
  File "/usr/lib64/python2.6/httplib.py", line 349, in _read_status
    line = self.fp.readline()
  File "/usr/lib64/python2.6/socket.py", line 433, in readline
    data = recv(1)
socket.error: [Errno 104] Connection reset by peer

帮我解决这个错误,如果需要,将提供更多信息。

4

1 回答 1

0

I faced same issue but for me works next steps:

Run rabbit with a list of ports

docker run -d --name rabbitmq -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq:3.8.1

And enabling rabbitmq_management

docker exec rabbitmq rabbitmq-plugins enable rabbitmq_management

15672: HTTP API clients, management UI and rabbitmqadmin (only if the management plugin is enabled) Source: https://www.rabbitmq.com/networking.html#ports

Also for declaring exchanges I use this command

rabbitmqadmin -V vhost_name -u rabbit_user -p rabbit_password declare exchange name=test_name type=direct
于 2020-04-21T10:03:06.543 回答