I had this problem both on Amazon EC2 and on another VPS from another company that I could not access the rabbitmq server from outside to use the 5672 port for connecting to the server. in both cases the command :
telnet <ip> 5672
returnes this:
telnet: Unable to connect to remote host: Connection timed out
and simple hellow world code example in python using pika library:
import pika
credentials = pika.PlainCredentials('admin', 'password')
connection = pika.BlockingConnection(pika.ConnectionParameters('<ip>', 5672, "/", credentials))
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()
throws this exception :
No handlers could be found for logger "pika.adapters.base_connection"
Traceback (most recent call last):
File "/home/.../Send.py", line 7, in <module>
connection = pika.BlockingConnection(pika.ConnectionParameters('<ip>', 5672, "/", credentials))
File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py", line 61, in __init__
File "/usr/local/lib/python2.7/dist-packages/pika/connection.py", line 513, in __init__
File "/usr/local/lib/python2.7/dist-packages/pika/connection.py", line 804, in _connect
File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 138, in _adapter_connect
File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py", line 120, in _adapter_connect
pika.exceptions.AMQPConnectionError: 2.0
on ec2 I allowed TCP,ICMP,UDP on all security groups on all instances ports ( for test purpose) and did a simple installation explained in this tutorial , I could successfully create a two node cluster of rabbitmq on ec2, but I was not able to access any of the cluster nodes from outside, regarding allowing access on all ports, still the same telnet result, I also enabled the management plugin, issuing:
wget <ip>:15672
on ec2 instances saved an HTML file meaning that the management plugin was working and accessible from each node. I used private IP addresses in /etc/hosts to make nodes find each other in /etc/hosts.
I decided to install a simple rabbitmq server on a ubuntu 14.04 vps, this time my purpose was only to make the access possible, what I did was pretty much the work flow explained in here and everything worked on the server locally but still the same problem explained in the beginning.
disabling ubuntu firewall with :
# ufw disable
and issuing the command :
# iptables -F
in order to remove the firewall or iptable from issuing any problem did not help. I can't think of any additional configuration that I should make to have access from outside to rabbitmq server, any idea?
thanks.
here is my rabbitmq.config :
[
{kernel,
[{inet_dist_listen_min, 45000},
{inet_dist_listen_max, 45000}
]
}
].
in my ec2 security configs :
All ICMP 0.0.0.0/0 everywhere
ALL TCP 0.0.0.0/0 everywhere
ALL UDP 0.0.0.0/0 everywhere
and SSH on port 22.
I am really struggling with this issue and in order to document my question more specifically, in case of a single ubuntu 14.04 instance I tried to access a single rabbitmq server instance on EC2 from my personal computer, this must not be that hard :( here are more information available for the case explained :
Ubuntu 14.04 ec2 instance security group settings :
my /etc/rabbitmq/rabbitmq-env.conf file :
NODE_IP_ADDRESS=<instance private ip taken from ifconfig = 177.31.*.*>
my /etc/hosts file :
127.0.0.1 localhost
172.31.*.* ip-172-31-*-*
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
my netstat -vpln
command output :
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 927/sshd
tcp 0 0 172.31.*.*:5672 0.0.0.0:* LISTEN 4662/beam
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 4662/beam
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 2089/epmd
tcp6 0 0 :::22 :::* LISTEN 927/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 501/dhclient
udp 0 0 0.0.0.0:45419 0.0.0.0:* 501/dhclient
udp6 0 0 :::61763 :::* 501/dhclient
but whenever from my personal computer I perform :
$ telnet <instance public IP > 5672
Trying 54.86.*.*
telnet: Unable to connect to remote host: Connection timed out
I've set the NODE_IP_ADDRESS
to 0.0.0.0
and still no success.
(i have also posted this scenario to the rabbitmq mailing list here )
OK. I found the problem was my VPN. In my case I used Kerio on my local ubuntu machine, the minute I exited the kerio server I could telnet to my server.
it is a good tips to check the following : -your firewall -your connection ( in my case Kerio VPN was causing issues)