4

I have installed Rabbitmq 3.4 in Linux machine, its running on 5672 port. When I try to declare an exchange, its prompting me with error.

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

using, python script for rabbitmqadmin , which is places in /usr/local/bin/

Error --

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

Help me out with this error, will provide more info if needed.

  • Do you have the vhost `localhost` on your machine? Usually the default vhost on RabbitMQ is called `/` – old_sound Jan 12 '15 at 08:02
  • hi, thanks for responding. It was not there,I added with below command `rabbitmqctl add_vhost test` but same error still there! –  Jan 12 '15 at 13:06
  • on the command you have on the question you use the vhost `localhost` not `test`: `--vhost=localhost`; why don't you use the default vhost? – old_sound Jan 13 '15 at 13:18
  • I created localhost only as vhost, just for example I wrote it as test. I tried in default host as well (without mentioning host) `rabbitmqadmin declare exchange name=SAMPLE_EXCHANGE type=direct` But still no luck, same error! –  Jan 13 '15 at 14:00
  • I just a similar issue and found success figuring out the root of my issue by looking at rabbitmq logs in /var/log/rabbitmq (for *nix, obviously :P ). Don't forget you can always use tail -f to watch the log file while you try running your command. – bmhkim Feb 13 '15 at 23:14

1 Answers1

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