我的服务如下:
[Service]
User=vagrant
Group=vagrant
WorkingDirectory=/home/vagrant/
ExecStart=/usr/bin/celery -A tasks /usr/bin/flower --port=5000 --basic_auth=sun:flower --persistent=true --/var/log/supervisord.log
Restart=on-failure
Type=simple
在创建REDIS主从复制并将Celery和flower指向Master后,我已经为测试目的创建了一个简单的任务...
Supervisord的celery.ini
[program:SPSimpleTasks]
directory = /home/vagrant/
command = celery -A tasks worker --loglevel=DEBUG -n SimpleTasks
user=vagrant
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisord.log
stderr_logfile=/var/log/supervisord.log
celery_app.py
from celery import Celery
app = Celery('tasks', backend='redis://:<PASSWORD>@192.168.100.20:6379/0')
#app.config_from_object('celeryconfig')
app.conf.update(
enable_utc = True,
broker_url = 'redis://:<PASSWORD>@192.168.100.20:6379/0',
result_backend = 'redis://:<PASSWORD>@192.168.100.20:6379/1',
result_persistent = True,
task_serializer = 'json',
result_serializer = 'json',
accept_content = ['json']
)
再次,工人们工作正常,花朵显示任务结果。但是一旦我使用
重启服务sudo service flower restart
花卉装载作为全新安装而没有任何数据......
我是否对经纪人/后端网址做错了什么?
答案 0 :(得分:0)
那么这是对Flower中配置的一个额外更改,我稍微改变了方法!
所需的配置属性为 db
我将服务更新为
<强> /etc/systemd/system/flower.service 强>
[Unit]
Description=Flower Celery Service
[Service]
User=vagrant
Group=vagrant
WorkingDirectory=/home/vagrant/
ExecStart=/usr/bin/flower --/var/log/supervisord.log
Restart=on-failure
Type=simple
[Install]
WantedBy=multi-user.target
<强> /home/vagrant/flowerconfig.py 强>
port = 5000
broker = 'redis://:<password>@192.168.100.20:6379/0'
broker_api = 'redis://:<password>@192.168.100.20:6379/0'
basic_auth = ['sun:flower']
persistent = True
db = '/home/vagrant/flower.db'
提供 db 属性后,一切正常。除了一个问题.. Flower Dashboard没有显示数据,但任务页面在刷新之前加载了任务列表!
从http://flower.readthedocs.io/en/latest/config.html#db
了解到启用持久模式时要使用的数据库文件(默认情况下为 分贝=花)
我已经提交了与花朵中的问题/观察相同的内容 - https://github.com/mher/flower/issues/787
希望这有助于其他类似的问题!!