0
votes

Without changing versions of software, how may Celery 3.1 be configured to use port 55672 to access rabbitmq instead of the default 15672?

Situation

RabbitMQ versions 2.* use port 55672 for the management plugin, but Kombu 3.0 defaults to using port 15672 to access the management plugin. (RabbitMQ versions 3.* use port 15672.)

Evidence

The celery command line tool receives [Errno 111] Connection refused.

<!-- language: bash -->
$ celery list bindings
Traceback (most recent call last):
...snip...
pyrabbit.http.NetworkError: Error: <class 'socket.error'> 

The Python debugger shows celery trying to connect to the wrong port: 15672. That's the port for RabbitMQ 3.0+ versions of the Management plugin.

(demo-celery-flask) $ python -m pdb ~/.virtualenvs/demo-celery-flask/bin/celery list bindings
> /home/zeb/.virtualenvs/demo-celery-flask/bin/celery(4)<module>()
-> import re
(Pdb) continue
Traceback (most recent call last):
    ...snip content...
NetworkError: Error: <class 'socket.error'> [Errno 111] Connection refused
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/zeb/.virtualenvs/demo-celery-flask/local/lib/python2.7/site-packages/pyrabbit/http.py(104)do_call()
-> raise NetworkError("Error: %s %s" % (type(out), out))
(Pdb) list 95,104
95             try:
96                 resp, content = self.client.request(url,
97                                                     reqtype,
98                                                     body,
99                                                     headers)
...snip content...
102             except Exception as out:
103                 # net-related exception types from httplib2 are unpredictable.
104  ->             raise NetworkError("Error: %s %s" % (type(out), out))
(Pdb) print url
'http://127.0.0.1:15672/api/bindings'

The string '15672' shows up in kombu's codebase as the default for a parameter called manager_port.

(demo-celery-flask)~/.virtualenvs/demo-celery-flask/lib/python2.7/site-packages$ rgrep 15672 celery/*
(demo-celery-flask)~/.virtualenvs/demo-celery-flask/lib/python2.7/site-packages$ rgrep 15672 kombu/*
...snip content...
kombu/utils/amq_manager.py:    port = port if port is not None else opt('manager_port', 15672)

Searching site:docs.celeryproject.org manager_port shows that it's part of the kombu.Connection object. Neither 15672 nor 55672 shows up in a site search.

The celery configuration documentation does not mention manager. (Celery v3.1, 2014-08-02)

Versions

  • Ubuntu 12.04 (yes, it should be 14.04)
  • Celery 3.1 (Cipater)
  • Kombu 3.0.12
  • RabbitMQ 2.7.1

RabbitMQ Management plugin is enabled and accessible via the rabbitmqadmin commandline at port 55672.

1

1 Answers

0
votes

Add BROKER_TRANSPORT_OPTIONS = {"manager_port": 55672} to the celery configuration module.


Finding this involved the following steps:

  • inspect kombu/util/amq_manager.py file where 15672 showed up as opt('manager_port', 15672)
  • note that opt derived from opt = client.transport_options.get
  • web search site:docs.celeryproject.org transport_options
  • find BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 3600} in the redis transport documentation
  • guess and check using BROKER_TRANSPORT_OPTIONS = {"manager_port": 55672}