1

How do I tell celery about the service name I am looking for on redis? I am trying to use the built-in Sentinel support in Celery 4. I am passing a broker URL configured as it says to in the documentation: sentinel://0.0.0.0:26379

But redis appears to complain about not being passed a service_name:

File "/usr/local/lib/python2.7/dist-packages/redis/sentinel.py", line 222, in discover_master
    raise MasterNotFoundError("No master found for %r" % (service_name,))
OperationalError: No master found for None

Is it possible to pass a service_name using this URL format? I have tried

sentinel://0.0.0.0:26379/my_service
sentinel://0.0.0.0:26379/0/my_service

I haven't been able to find any documentation on the connection URLs—I have found redis-sentinel-URL but I don't see it included in the redis package, so I am not even sure it is being used by redis.

Desiree Cox
  • 349
  • 4
  • 13

1 Answers1

5

I managed to sort this out: celery needs both the broker_url and broker_transport_options configuration to be set.

1) broker_url takes the form of a sentinel URL: sentinel://localhost:26379

2) broker_transport_options is a dictionary that needs the name of the sentinel service you are trying to connect to. i.e., if you want to push jobs to a queue called 'fiddlesticks': {"master_name":"fiddlesticks"}

Though the error message above is complaining that you passed in the wrong 'service_name', you actually want to pass in using the key 'master_name'.

Desiree Cox
  • 349
  • 4
  • 13
  • Hi Desiree, what does "fiddlesticks" mean here? Can you specify a default job queue if you don't know a specific one? – platypus Nov 19 '17 at 09:30
  • In my example my queue name is 'fiddlesticks', I don't know how to specify a default job queue. – Desiree Cox Nov 28 '17 at 22:26