Redis队列失败作业正在记录到MySQL [英] Redis Queue Failed Job is being logged to MySQL

查看:151
本文介绍了Redis队列失败作业正在记录到MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

队列驱动程序设置为使用Redis

Queue driver is set to use Redis

QUEUE_DRIVER=redis

使用

php /opt/artisan queue:work --tries=1 --queue="data-ingestion-default" --daemon

我们收到的错误是

[2016-09-14 08:32:40] lumen.ERROR: InvalidArgumentException: Database 
[mysql] not 
configured. in /opt/vendor/illuminate/database/DatabaseManager.php:239
Stack trace:
#0 /opt/vendor/illuminate/database/DatabaseManager.php(158):     
Illuminate\Database\DatabaseManager->getConfig('mysql')
#1 /opt/vendor/illuminate/database/DatabaseManager.php(68):   
Illuminate\Database\DatabaseManager->makeConnection('mysql')
#2 /opt/vendor/illuminate/queue/Failed/DatabaseFailedJobProvider.php(110): 
Illuminate\Database\DatabaseManager->connection('mysql')
#3 /opt/vendor/illuminate/queue/Failed/DatabaseFailedJobProvider.php(58):    
Illuminate\Queue\Failed\DatabaseFailedJobProvider->getTable()
#4 /opt/vendor/illuminate/queue/Worker.php(313): 
Illuminate\Queue\Failed\DatabaseFailedJobProvider->log('redis', 'data-ingestion-...',    
'{"job":"Illumin...')
#5 /opt/vendor/illuminate/queue/Worker.php(204): Illuminate\Queue\Worker-
>logFailedJob('redis', Object(Illuminate\Queue\Jobs\RedisJob))
#6 /opt/vendor/illuminate/queue/Worker.php(156): Illuminate\Queue\Worker->process('redis',   
Object(Illuminate\Queue\Jobs\RedisJob), '1', 0)
#7 /opt/vendor/illuminate/queue/Worker.php(111): Illuminate\Queue\Worker->pop(NULL, 'data-   
ingestion-...', 0, 3, '1')
#8 /opt/vendor/illuminate/queue/Worker.php(85): Illuminate\Queue\Worker-
>runNextJobForDaemon(NULL, 'data-ingestion-...', 0, 3, '1')
#9 /opt/vendor/illuminate/queue/Console/WorkCommand.php(119): Illuminate\Queue\Worker-
>daemon(NULL, 'data-ingestion-...', 0, 128, 3, '1')
#10 /opt/vendor/illuminate/queue/Console/WorkCommand.php(78): 
Illuminate\Queue\Console\WorkCommand->runWorker(NULL, 'data-ingestion-...', 0, 128, true)

该错误似乎是由于Worker尝试将失败的作业记录到mysql数据库所致.

It appears that the error is due to the Worker attempting to log the failed job to a mysql database.

但是,在这种情况下,我们没有使用MySQL,如果在config/database.php中,则连接中没有"mysql",默认数据库称为"development".

However, we are not using MySQL in this instance, and if we were in config/database.php there is no 'mysql' in connection, and the default db is called 'development'.

推荐答案

在config/queue.php中,查看失败的配置 默认值为:

In config/queue.php take a look at failed config the default is:

'failed' => [
        'database' => env('DB_CONNECTION', 'mysql'),
        'table'    => 'failed_jobs',
    ],

将其更改为使用Redis

change it to use redis

您可以在 github reop laravel/config中看到整个配置文件/queue.php

这篇关于Redis队列失败作业正在记录到MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆