Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Celery to talk to Redis via Unix socket

I would like Celery to build on Redis rather than the default RabbitMQ.

The Celery documentation explains:

Configuration is easy, just configure the location of your Redis database:

BROKER_URL = 'redis://localhost:6379/0'

Where the URL is in the format of:

redis://:password@hostname:port/db_number

all fields after the scheme are optional, and will default to localhost on port 6379, using database 0.

However, I have Redis set up NOT to listen to a port, but instead to listen to a socket.

Is there a URI scheme to support this?

like image 387
Oddthinking Avatar asked Apr 22 '13 17:04

Oddthinking


1 Answers

Redis sockets are available since Celery 1.3. The syntax is:

BROKER_URL = 'redis+socket:///tmp/redis.sock'

If you want to use a specific database:

BROKER_URL = 'redis+socket:///tmp/redis.sock?virtual_host=1'

The documentation is not up-do-date, but you can check this issues for more details:

  • https://github.com/celery/celery/issues/1283
  • https://github.com/celery/kombu/pull/238
like image 55
David Arcos Avatar answered Oct 23 '22 23:10

David Arcos