问题描述
app = Celery(’tasks’, backend=’amqp’, broker=’amqp://’)Or if you want to use Redis as the result backend, but still use RabbitMQ as the message broker (a popular combination):app = Celery(’tasks’, backend=’redis://localhost’, broker=’amqp://’)
=========
Redis 命令行结果 127.0.0.1:6379> keys * 1) 'emails' 2) 'mmtest' 3) '_kombu.binding.celery' 4) '_kombu.binding.celeryev' 5) 'celery-task-meta-f418abea-7827-4220-b72e-a0669e8b8a08' 6) 'celery-task-meta-43105310-a8e2-483b-bd8a-8a54affc9192' 7) '_kombu.binding.celery.pidbox' 8) 'name' 9) 'unacked_mutex'10) 'email'11) 'mygmail'12) 'myyahoo'
如何产看redis里面的存储内容?
问题解答
回答1:这个其实可以算Redis的问题。
使用 type 命令查看对应的数据类型,再使用其他命令查看内容
> type $key
例如对于最基本的键值,使用 get $key 即可。对于 list ,使用 lrange (由于是拿一个范围,需要先用 llen 获取长度作为参数)。
当然,在Python下调用Redis客户端的相关命令也是可以实现的。
回答2:可以让 Celery 把 task 执行结果保存起来,参考下 result 相关的设置。 http://docs.celeryproject.org...
result_backendresult_cache_maxresult_compressionresult_exchangeresult_exchange_typeresult_expiresresult_persistentresult_serializer
至于查看办法,除了直接去对应的 backend 里翻,也可以用 flower