Celery - Cent/7 中的 Flower 服务在重启后不显示数据
Celery - Flower service in Cent/7 doesn't show data after a restart
我的服务如下:
[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 之后,我创建了一个用于测试目的的简单任务...
celery.ini for Supervisord
[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
Flower 作为全新安装加载,没有任何数据...
我是不是对代理/后端 URL 做错了什么?
好吧,这是对 Flower 中配置的额外更改,我稍微更改了方法!
所需的配置 属性 是 db
我将服务更新为
/etc/systemd/system/flower.服务
[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 没有显示数据,但 Tasks 页面在刷新之前加载了任务列表!
向http://flower.readthedocs.io/en/latest/config.html#db
学习
A database file to use if persistent mode is enabled (by default,
db=flower)
我已经提交了和 issue/observation in flower 一样的 -- https://github.com/mher/flower/issues/787
希望这对其他面临类似问题的人有所帮助!!
我的服务如下:
[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 之后,我创建了一个用于测试目的的简单任务...
celery.ini for Supervisord
[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
Flower 作为全新安装加载,没有任何数据...
我是不是对代理/后端 URL 做错了什么?
好吧,这是对 Flower 中配置的额外更改,我稍微更改了方法!
所需的配置 属性 是 db
我将服务更新为
/etc/systemd/system/flower.服务
[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 没有显示数据,但 Tasks 页面在刷新之前加载了任务列表!
向http://flower.readthedocs.io/en/latest/config.html#db
学习A database file to use if persistent mode is enabled (by default, db=flower)
我已经提交了和 issue/observation in flower 一样的 -- https://github.com/mher/flower/issues/787
希望这对其他面临类似问题的人有所帮助!!