RabbitMQ,麻烦得到你好世界的例子,除了本地主机之外的任何工作

我正在学习RabbitMQ,并在http://www.rabbitmq.com/tutorials/tutorial-one-python.html上运行hello world示例,在localhost上没有问题。 现在我想testing从我的电脑到另一台服务器的消息,receive.py似乎从来没有得到任何消息。 也许我没有正确指定主机名?

Receive.py:

#!/usr/bin/env python import pika import json connection = pika.BlockingConnection(pika.ConnectionParameters( host='66.175.x.x')) channel = connection.channel() channel.queue_declare(queue='hello') print ' [*] Waiting for messages. To exit press CTRL+C' def callback(ch, method, properties, body): data = json.loads(body) print "Log filename is " + data["filename"] print data["content"] channel.basic_consume(callback, queue='hello', no_ack=True) channel.start_consuming() 

send.py:

 #!/usr/bin/env python import pika import json import sys filename = sys.argv[1] logdata = open(filename, 'r').read() connection = pika.BlockingConnection(pika.ConnectionParameters( host='66.175.x.x')) channel = connection.channel() channel.queue_declare(queue='logupload') n = filename.rfind('\\') if n != -1: filename = filename[n + 1:] data = {"filename":filename, "logdata":logdata} channel.basic_publish(exchange='', routing_key='logupload', body=json.dumps(data)) connection.close() print "sent %s %d bytes" % (filename, len(logdata)) 

RabbitMQ – http://www.rabbitmq.com/configure.html

看到frame_max。 似乎默认支持128KB。 您可能需要检查安装中的设置。

确保rabbitmq实际上在端口5672上侦听,并且端口在您的Linode服务器的防火墙中是打开的。

在你的configuration中,RABBITMQ_NODE_IP_ADDRESS应该是空的,RABBITMQ_NODE_PORT应该是5672。