Helo,
I am really new at rabbitmq. I was trying to establish a rabbitmq router and send him a HelloWorld in python using pika.
In terminal i do sudo rabbitmq-server start. I can enter localhost:15672. But when i try to connect to localhost:5672 appears "AMQP" for one second and then "The connection was reset".
When doing sudo rabbitmqctl list_connections, my connection doesn't appear. When doing netstat -tapnl | grep 5672 it appears this:
tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:5672 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN -
My python is giving the error ProbableAccessDeniedError, but I have configured all right i think. Here is a snipet:
import pika
from pika.exceptions import ProbableAccessDeniedError
from pika.exceptions import ProbableAuthenticationError
if __name__ == '__main__':
credentials = pika.PlainCredentials('name', 'pass)
# change the ip in here!
parameters = pika.ConnectionParameters(
host='localhost', port=5672, vhost='test', credentials=credentials)
try:
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.basic_publish(exchange='',
routing_key='hello',
body='Hello World!')
print(" [x] Sent 'Hello World!'")
except ProbableAuthenticationError:
print("Authetication Error")
except ProbableAccessDeniedError:
print("Authetication Denied")
finally:
if channel:
channel.close()
if connection:
connection.close()
And here is my rabbitmq.config:
[
{rabbit, [
% Network Connectivity
% ====================
{tcp_listeners,[{"127.0.0.1",5672}]},
{num_tcp_acceptors, 5},
{handshake_timeout, 10000},
% Default User / VHost
% ====================
{default_vhost, <<"test">>},
{default_user, <<"name">>},
{default_pass, <<"pass">>},
{default_permissions, [<<".*">>, <<".*">>, <<".*">>]},
{loopback_users, []}
]}
].
So I guess the problem is because of the localhost:5672. Any idea?