由于ProbableAccessDeniedError,无法使用pika连接到Heroku上的RabbitMQ [英] Cannot connect to RabbitMQ on Heroku with pika due to ProbableAccessDeniedError

查看:801
本文介绍了由于ProbableAccessDeniedError,无法使用pika连接到Heroku上的RabbitMQ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在heroku中设置了一个RabbitMQ插件。在开发我的应用程序以排队并使用在本地实例上运行的消息后,我将其部署到Heroku,并且尚未能成功连接。用户名/密码& hostname / port / vhost全部来自 heroku config 。如果我更改用户名或密码,错误更改为 ProbableAuthenticationError ,这使我相信身份验证至少是正确的,但可能是我的虚拟主机或其他一些缺失配置的问题。我还没有看到任何类似的问题,或者一个小时的谷歌搜索后,没有解决我的问题。



我已经尝试了 RABBITMQ_BIGWIG_RX_URL RABBITMQ_BIGWIG_TX_URL 发送和使用环境变量,并且没有任何组合似乎工作。以下是我尝试连接的代码。

  url ='small-laurel-24.bigwig.lshift.net' 
port = 10019
vhost ='/ notmyrealvhost'

credentials = pika.PlainCredentials('username','password')
parameters = pika.ConnectionParameters(url ,port,vhost,credentials = credentials)
connection = pika.BlockingConnection(parameters)

有什么我失踪或任何方式找出具体配置错误?我在这里不知所措。非常感谢提前!

我运行pika 0.9.14,python 2.7.3。

解决方案

我最终通过使用 URLParameters 类来解决我的问题pika解析Heroku环境变量中的URL。

这需要像
amqp:// username:password@small-laurel-24.bigwig.lshift.net这样的字符串: 10018 / notmyrealvhost 并根据需要解析所有内容。我自己做这件事情是不必要的复杂化。

I just set up a RabbitMQ add-on in heroku. After developing my app to queue up and consume messages running on a local instance, I deployed it to Heroku and have not been able to connect successfully yet. The username/password & hostname/port/vhost are all from heroku config. If I change the username or password, the error changes to ProbableAuthenticationError which makes me believe the authentication is at least correct, but likely an issue with my vhost or some other missing configuration. I haven't seen any similar questions on SO or after an hour of Googling that didn't address my issue.

I have tried both the RABBITMQ_BIGWIG_RX_URL and RABBITMQ_BIGWIG_TX_URL environment variables for both sending and consuming, and no combination seems to work. Below is the code I have for attempting to connect.

url = 'small-laurel-24.bigwig.lshift.net'
port = 10019
vhost = '/notmyrealvhost'

credentials = pika.PlainCredentials('username', 'password')
parameters = pika.ConnectionParameters(url, port, vhost, credentials=credentials)
connection = pika.BlockingConnection(parameters)

Is there something I'm missing or any way to figure out what specifically is configured wrong? I'm at a loss here. Much thanks in advance!

I am running pika 0.9.14, python 2.7.3.

解决方案

I ended up solving my problem by using the URLParameters class on pika to parse the URL from Heroku's environment variable.

This takes the string like amqp://username:password@small-laurel-24.bigwig.lshift.net:10018/notmyrealvhost and parses everything as needed. I was unnecessarily complicating things by doing it myself.

这篇关于由于ProbableAccessDeniedError,无法使用pika连接到Heroku上的RabbitMQ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆