I'am trying to connect two hosts with RabbitMQ & python pika.
Here is worker:
#!/usr/bin/env python
import pika, time
NEW_TASK_HOST_IP = '192.168.0.2'
credentials = pika.PlainCredentials('login-to-remote', 'pass')
connection = pika.BlockingConnection(
pika.ConnectionParameters(host=NEW_TASK_HOST_IP))
channel = connection.channel()
channel.queue_declare(queue='task_queue', durable=True)
print(' [*] Waiting for messages. To exit press CTRL+C')
def callback(ch, method, properties, body):
ch.basic_ack(delivery_tag = method.delivery_tag)
channel.basic_qos(prefetch_count=1)
channel.basic_consume(callback,
queue='task_queue')
#!/usr/bin/env python
import pika, sys
WORKER_IP = '192.168.0.3'
credentials = pika.PlainCredentials('login-to-remote', 'pass')
connection = pika.BlockingConnection(pika.ConnectionParameters(
host=WORKER_IP, socket_timeout=300, credentials=credentials))
channel = connection.channel()
channel.queue_declare(queue='task_queue', durable=True)
message = ' '.join(sys.argv[1:]) or "Hello World!"
channel.basic_publish(exchange='',
routing_key='task_queue',
body=message,
properties=pika.BasicProperties(
delivery_mode = 2, # make message persistent
))
print(" [x] Sent %r" % message)
connection.close()
I've created two users on both hosts with command:
sudo rabbitmqctl add_user login-to-remote pass
And when i trying to run anything i've got:
Traceback (most recent call last):
File "worker.py", line 5, in <module>
connection = pika.BlockingConnection(pika.ConnectionParameters(host=NEW_TASK_HOST_IP, socket_timeout=300, credentials=credentials))
File "/home/anna/.local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 374, in __init__
self._process_io_for_connection_setup()
File "/home/anna/.local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 414, in _process_io_for_connection_setup
self._open_error_result.is_ready)
File "/home/anna/.local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 466, in _flush_output
raise maybe_exception
pika.exceptions.ProbableAccessDeniedError: (-1, "error(104, 'Connection reset by peer')")
iperf for both udp and tcp in both directions:iperf -s -p 5672
iperf -p 5672 -c 192.168.0.2
So the traffic goes.
I'am completely stack, what can be a problem?
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--MKStaff Software Engineer, Pivotal/RabbitMQ