English 中文(简体)
RabbitMQ gives a "access refused, login refused for user" error when attempting to follow the celery tutorial
原标题:

I m attempting to follow the celery tutorial, but I run into a problem when I run python manage.py celeryd: my RabbitMQ server (installed on a virtual machine on my dev box) won t let my user login.

I get the following on my Django management console:

[ERROR/MainProcess] AMQP Listener: Connection Error: Socket closed. Trying again in 2 seconds...

and this shows up in my rabbit.log file on my RabbitMQ server:

exception on TCP connection <0.5814.0> from $DJANGO_BOX_IP
{channel0_error,starting,{amqp,access_refused,"login refused for user  $CONFIGURED_USER ", connection.start_ok }}

I ve double-checked my user, permissions, and vhost info, and they all seem to match up. Any help troubleshooting is greatly appreciated.

UPDATE: Following the advice of @asksol I get the following traceback:

$MY_VIRTUAL_ENV/lib/python2.6/site-packages/carrot/connection.pyc in connection(self)
    118             return
    119         if not self._connection:
--> 120             self._connection = self._establish_connection()
    121             self._closed = False
    122         return self._connection

$MY_VIRTUAL_ENV/lib/python2.6/site-packages/carrot/connection.pyc in _establish_connection(self)
    131 
    132     def _establish_connection(self):
--> 133         return self.create_backend().establish_connection()
    134 
    135     def get_backend_cls(self):

$MY_VIRTUAL_ENV/lib/python2.6/site-packages/carrot/backends/pyamqplib.pyc in establish_connection(self)
    110                                insist=conninfo.insist,
    111                                ssl=conninfo.ssl,
--> 112                                connect_timeout=conninfo.connect_timeout)
    113 
    114     def close_connection(self, connection):

$MY_VIRTUAL_ENV/lib/python2.6/site-packages/amqplib/client_0_8/connection.pyc in __init__(self, host, userid, password, login_method, login_response, virtual_host, locale, client_properties, ssl, insist, connect_timeout, **kwargs)
    138                 self.wait(allowed_methods=[
    139                     (10, 20), # secure
--> 140                     (10, 30), # tune
    141                     ])
    142 

$MY_VIRTUAL_ENV/lib/python2.6/site-packages/amqplib/client_0_8/abstract_channel.pyc in wait(self, allowed_methods)
     88         method_sig, args, content = self.connection._wait_method(
---> 89             self.channel_id, allowed_methods)
     90 
     91         if content 

$MY_VIRTUAL_ENV/lib/python2.6/site-packages/amqplib/client_0_8/connection.pyc in _wait_method(self, channel_id, allowed_methods)
    196         while True:
    197             channel, method_sig, args, content = 
--> 198                 self.method_reader.read_method()
    199 
    200             if (channel == channel_id) 

$MY_VIRTUAL_ENV/lib/python2.6/site-packages/amqplib/client_0_8/method_framing.pyc in read_method(self)
    213         m = self.queue.get()
    214         if isinstance(m, Exception):
--> 215             raise m
    216         return m
    217 

IOError: Socket closed
最佳回答

Are you running django? If so, then try this:

>>> from carrot.connection import DjangoBrokerConnection
>>> c = DjangoBrokerConnection()
>>> c.connection

Does it give the same thing? Are you sure you re connecting to the right hostname, and that the username and password has access to the virtual host?

UPDATE:

>>> from carrot.connection import DjangoBrokerConnection
>>> c = DjangoBrokerConnection()
>>> for n in ("host", "userid", "password", "virtual_host", "ssl"):
...     print("%s -> %s" % (n, repr(getattr(c, n, None))))

UPDATE: You have to do the above before running c.connection, as the connection is established lazily in carrot.

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签