rabbitmq - Need help identify host name -
i'm new rabbitmq, installed rabbitmq-server on 1 ec2 instance, , want create consumer on ec2 instance.
but i'm getting error:
socket.gaierror: [errno -2] name or service not known
that's node status:
ubuntu@ip-10-147-xxx-xxx:~$ sudo rabbitmq-server restart error: node name "rabbit" running on "ip-10-147-xxx-xxx" diagnostics =========== nodes in question: ['rabbit@ip-10-147-xxx-xxx'] hosts, running nodes , ports: - ip-10-147-xxx-xxx: [{rabbit,46074},{rabbitmqprelaunch4603,51638}] current node details: - node name: 'rabbitmqprelaunch4603@ip-10-147-xxx-xxx' - home dir: /var/lib/rabbitmq - cookie hash: gsnt2qhd7wwdeoaofby=
and that's consumer code:
import pika cred = pika.plaincredentials('guest', 'guest') conn_params = pika.connectionparameters('10-147-xxx-xxx', credentials=cred) conn_broker = pika.blockingconnection(conn_params) conn_broker = pika.blockingconnection(conn_params) channel = conn_broker.channel() channel.exchange_declare(exchange='hello-exchange', type='direct', passive=false, durable=true, auto_delete=false) channel.queue_declare(queue='hello-queue') channel.queue_bind(queue='hello-queue', exchange='hello-exchange', routing_key='hola') def msg_consumer(channel, method, header, body): channel.basic_ack(delivery_tag=method.delivery_tag) if body == 'quit': channel.basic_cancel(consumer_tag='hello-consumer') channel.stop_consuming() else: print body return channel.basic_consume(msg_consumer, queue='hello-queue', consumer_tag='hello-consumer') channel.start_consuming()
you should check security group allows use rabbitmq port, seems not using rabbit default's port (5672) should in connection parameters
Comments
Post a Comment