Anson Kho
Anson Kho

Reputation: 5

Celery and RabbitMQ not starting

I installed RabbitMQ, Celery, Flask and Python but when I tried to run celery worker to test. It does not work, these are the error that was pop out in the cmd.

[2019-01-18 09:56:37,443: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
  File "c:\users\ansonkho\anaconda3\lib\site-packages\celery\worker\consumer\consumer.py", line 317, in start
    blueprint.start(self)
  File "c:\users\ansonkho\anaconda3\lib\site-packages\celery\bootsteps.py", line 119, in start
    step.start(parent)
  File "c:\users\ansonkho\anaconda3\lib\site-packages\celery\worker\consumer\mingle.py", line 40, in start
    self.sync(c)
  File "c:\users\ansonkho\anaconda3\lib\site-packages\celery\worker\consumer\mingle.py", line 44, in sync
    replies = self.send_hello(c)
  File "c:\users\ansonkho\anaconda3\lib\site-packages\celery\worker\consumer\mingle.py", line 57, in send_hello
    replies = inspect.hello(c.hostname, our_revoked._data) or {}

below is my code:

from celery import Celery

app = Celery('test_celery', broker='amqp://myuser:mypassword@localhost/myvhost',backend='rpc://')

Upvotes: 0

Views: 361

Answers (1)

bumblebee
bumblebee

Reputation: 1841

[2019-01-18 09:56:37,443: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...

As mentioned in the error, there is no broker running. You need to start Rabbitmq before making a connection to it. That is why the consumer is throwing Connection to broker lost as the broker is not running.

Upvotes: 2

Related Questions