gpt4 book ai didi

php - Redis 队列失败作业正在记录到 MySQL

转载 作者:可可西里 更新时间:2023-11-01 00:19:07 24 4
gpt4 key购买 nike

队列驱动设置为使用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 数据库。

但是,我们在这个实例中没有使用 MySQL,如果我们在 config/database.php 中,则连接中没有“mysql”,默认数据库称为“development”。

最佳答案

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

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

改为使用redis

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

编辑:任何阅读本文的人,这个答案不正确抱歉,我无法删除已接受的答案

关于php - Redis 队列失败作业正在记录到 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39487252/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com