我们在我们的Python网站上使用Django。我们正在使用celery==4.1.1
来运行后台任务。一切都有罚款。但是,我无法监控已处理或处理的任务,就像我们使用djcelery
的旧芹菜一样。我听说过flower
。
我用过
flower==0.9.2
tornado==4.5.2
babel==2.5.3
这是Supervisor中的命令:
[program:celery-flower]
command=flower -A lbb --natural-time --url_prefix=flower --port=5555 --inspect --enable-events
这是我的Nginx配置:
upstream application {
server lbb-app:8000;
}
upstream application2 {
server lbb-app:5555;
}
server {
listen 80 default_server;
charset utf-8;
client_max_body_size 4G; # adjust to taste
server_tokens off;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Cache-Control "no-store";
add_header Pragma "no-cache";
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
location /work {
include uwsgi_params;
uwsgi_pass application;
}
# Finally, send all non-media requests to the Django server.
location / {
include uwsgi_params;
uwsgi_pass application;
}
location /flower/ {
include uwsgi_params;
uwsgi_pass application2;
}
}
我无法打开仪表板。它显示504错误。
以下是来自celery-flower-stderr的日志。
[I 180605 08:25:06 command:106] Visit me at http://localhost:5555
[I 180605 08:25:06 command:107] Broker: amqp://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:5672//
[W 180605 08:25:06 state:74] Broker info is not available if --broker_api option is not configured. Also make sure RabbitMQ Management Plugin is enabled (rabbitmq-plugins enable rabbitmq_management)
[I 180605 08:25:06 mixins:224] Connected to amqp://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:5672//
--broker-api
是否必须出现花卉仪表板?我的设置有问题吗?我该怎么办?我怀疑这与我的nginx conf有关。请指出其中的任何错误。
我添加了broker-api=http://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:15672/api/
和rabbitmq管理命令。
现在celery-flower-stderr中的消息:
[I 180606 03:56:15 command:139] Visit me at http://localhost:5555
[I 180606 03:56:15 command:144] Broker: amqp://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:5672//
[I 180606 03:56:15 command:147] Registered tasks:
['(redacted)',
'celery.accumulate',
'celery.backend_cleanup',
'celery.chain',
'celery.chord',
'celery.chord_unlock',
'celery.chunks',
'celery.group',
'celery.map',
'celery.starmap',
'celery_haystack.tasks.CeleryHaystackSignalHandler',
'celery_haystack.tasks.CeleryHaystackUpdateIndex',]
[I 180606 03:56:15 mixins:224] Connected to amqp://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:5672//
[W 180606 03:56:17 control:44] 'stats' inspect method failed
[W 180606 03:56:17 control:44] 'active_queues' inspect method failed
[W 180606 03:56:17 control:44] 'registered' inspect method failed
[W 180606 03:56:17 control:44] 'scheduled' inspect method failed
[W 180606 03:56:17 control:44] 'active' inspect method failed
[W 180606 03:56:17 control:44] 'reserved' inspect method failed
[W 180606 03:56:17 control:44] 'revoked' inspect method failed
[W 180606 03:56:17 control:44] 'conf' inspect method failed