1

I have installed RabbitMQ on Ubuntu 14.04 and I am unable to connect to the RabbitMQ server from other computers on the network.

There are no problems connecting to the server from the machine where RabbitMQ is installed, only from other computers on the network.

This page states that "By default, RabbitMQ will listen on port 5672 on all available interfaces".

When trying to connect from another serverusing pika in python, I get the following error:

ERROR:pika.adapters.base_connection:Socket Error: 104
ERROR:pika.adapters.base_connection:Socket closed while authenticating indicating a probable authentication error

I've added a new user with permissions set_permissions newuser ".*" ".*" ".*" and have tried the URI authentication method however I still receive the same error.

I also can't connect to RabbitMQ management from other computers on the network but can access it on the local pc.

Also, by checking open ports, I can see the following:

tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      1122/beam.smp   
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      1122/beam.smp   
tcp6       0      0 :::5672                 :::*                    LISTEN      1122/beam.smp   

I am using the python code from RabbitMQ's tutorials:

import pika

connection = pika.BlockingConnection(pika.ConnectionParameters(host='AAA.AAA.AAA.AAA'))
channel = connection.channel()

channel.queue_declare(queue='hello')

channel.basic_publish(exchange='',routing_key='hello',body='Hello World!')

print(" [x] Sent 'Hello World!'")

connection.close()

What am I missing?

Greg
  • 8,175
  • 16
  • 72
  • 125

2 Answers2

3

The code in question doesn't supply a username or password. You'll likely need to update your connection parameters to include those


credentials = pika.PlainCredentials('guest', 'guest')

parameters = pika.ConnectionParameters('rabbit-server1', 5672, '/', credentials)

connection = pika.BlockingConnection(parameters)

Check the docs for pika, for more info: http://pika.readthedocs.org/en/0.10.0/modules/parameters.html?highlight=connectionParameters

Also, check to ensure you have a valid username and password. the "guest" username / password may not be enabled on your server

Sajjan Singh
  • 2,523
  • 2
  • 27
  • 34
Derick Bailey
  • 72,004
  • 22
  • 206
  • 219
2

By default, RabbitMQ accepts connections for the guest user from localhost only. This is explained in the documentation about access control.

To allow connections for the guest user from remote hosts, you need to change the loopback_users configuration parameter (usually in /etc/rabbitmq/rabbitmq.config on Unix):

[
  {rabbit, [
    {loopback_users, []}
  ]}
].

You can read more about this parameter in the configuration documentation.

That said, be careful: this user created by default, with a weak known password, has admin priviledges. So changing this configuration parameter like this must be done only on a trusted network.