简体   繁体   中英

Django Celery Eventlet - Getting “No address found” error

I am currently using celery default prefork for concurrency and I want to use Eventlet.

I tried to install Eventlet and used it for concurrency, but I am getting following error:

[2017-01-01 04:11:14,233: ERROR/MainProcess] consumer: Cannot connect to amqp://application:**@rabbit:5672//: [Errno -2] No address found.

But it is working good with default prefork and I could execute jobs async.

I am currently using django 1.10 and Celery 4.0.1

 -------------- celery@worker v4.0.1 (latentcall)
---- **** ----- 
--- * ***  * -- Linux-4.4.0-57-generic-x86_64-with-Ubuntu-16.04-xenial 2017-01-01 03:59:11
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         fivefrets:0x7f97ca281a58
- ** ---------- .> transport:   amqp://fivefrets:**@rabbit:5672//
- ** ---------- .> results:     disabled://
- *** --- * --- .> concurrency: 10 (eventlet)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
            .> celery           exchange=celery(direct) key=celery

can anyone help please, I could not get the answers googling.

Please us me know, if anyone have any questions.

Not sure what I am missing

"No address found" looks like an error with DNS resolution. If you can resolve the address of your rabbitmq server, the problem may lie with Eventlet.

If you're using Eventlet 0.20.0, it looks like that might break DNS resolution. See: https://github.com/nameko/nameko/issues/392

If that's the case, maybe you can use a different version of eventlet with something like pip install --upgrade eventlet==0.19.0 or pip install --upgrade eventlet==0.20.1 .

If you hit that error with eventlet==0.20.0 , then it means you have malformed configuration. /etc/resolv.conf with search domain but you're issuing a relative hostname rabbit for which proper DNS resolution must attempt only rabbit.domain query to nameservers.

Proper solution options:

  • introduce .local domain to your network, change resolv.conf, DNS records and application configs to rabbit.local . All things considered, this is the best way.
  • remove search line from /etc/resolv.conf
  • add trailing dot to single level hostnames in application configs rabbit. - that makes fully qualified hostname that is always resolved correctly

For less than perfect way, upgrade eventlet>=0.20.1 it contains patch that attempts top level queries as if they were fully qualified (in this case rabbit. )

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