简体   繁体   中英

Celery cannot connect to RabbitMQ server

I am trying to run celery and it is unable to connect to the RabbitMQ server even though I have correctly set the user, vhost and assigned the appropriate tags

celery -A proj worker -l info

The above command returns the error

[2021-09-28 18:05:37,649: ERROR/MainProcess] consumer: Cannot connect to amqp://test:**@12:5672//: timed out.
Trying again in 2.00 seconds... (1/100)

I have initialized the celery app as follows

app = Celery('proj',
             broker=f'amqp://test:test@12#4@localhost/test_vhost')

I believe this is not working because the password test@12#4 has the special characters @ and # in it.

How do I get this to work without changing the password.


Sorry there is no way to use such passwords with '@' characters , this is already a known issue with the Celery and the reason is due to urllib3 parse functionality . The only way around is to remove such characters from the password.

For reference please look up the corresponding github issue here

This issue can be solved using escape sequences.

The issue is not with the @ character but with the #

So if your password is test@12#4 , you can simply use the escape sequence for the # character which is %23

The password can be written as test@12%234

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM