laravel队列via redis:local.error:read error on connection to 127.0.0.1:6379

wbgh16ku  于 2021-06-10  发布在  Redis
关注(0)|答案(0)|浏览(636)

我试图通过redis连接运行laravel队列,当worker启动几秒钟后,我得到以下错误。
队列命令:

$> php artisan queue:work --tries=1 --queue=test_queue

错误:

local.ERROR: read error on connection to 127.0.0.1:6379 {"exception":"[object] (RedisException(code: 0): read error on connection to 127.0.0.1:6379 at vendor\\laravel\\framework\\src\\Illuminate\\Redis\\Connections\\Connection.php:116)
[stacktrace]

# 0 vendor\\laravel\\framework\\src\\Illuminate\\Redis\\Connections\\Connection.php(116): Redis->blPop(Array, 0)

# 1 vendor\\laravel\\framework\\src\\Illuminate\\Redis\\Connections\\PhpRedisConnection.php(440): Illuminate\\Redis\\Connections\\Connection->command('blpop', Array)

# 2 vendor\\laravel\\framework\\src\\Illuminate\\Redis\\Connections\\PhpRedisConnection.php(179): Illuminate\\Redis\\Connections\\PhpRedisConnection->command('blpop', Array)

# 3 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\RedisQueue.php(233): Illuminate\\Redis\\Connections\\PhpRedisConnection->blpop(Array, 0)

# 4 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\RedisQueue.php(169): Illuminate\\Queue\\RedisQueue->retrieveNextJob('queues:test_queue')

# 5 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Worker.php(270): Illuminate\\Queue\\RedisQueue->pop('test_queue')

# 6 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Worker.php(123): Illuminate\\Queue\\Worker->getNextJob(Object(Illuminate\\Queue\\RedisQueue), 'test_queue')

# 7 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Console\\WorkCommand.php(112): Illuminate\\Queue\\Worker->daemon('redis', 'test_queue', Object(Illuminate\\Queue\\WorkerOptions))

# 8 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Console\\WorkCommand.php(96): Illuminate\\Queue\\Console\\WorkCommand->runWorker('redis', 'test_queue')

# 9 [internal function]: Illuminate\\Queue\\Console\\WorkCommand->handle()

# 10 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(32): call_user_func_array(Array, Array)

# 11 vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(36): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()

# 12 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(90): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))

# 13 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))

# 14 vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(590): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)

# 15 vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(201): Illuminate\\Container\\Container->call(Array)

# 16 vendor\\symfony\\console\\Command\\Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))

# 17 vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(188): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))

# 18 vendor\\symfony\\console\\Application.php(1012): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))

# 19 vendor\\symfony\\console\\Application.php(272): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Queue\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))

# 20 vendor\\symfony\\console\\Application.php(148): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))

# 21 vendor\\laravel\\framework\\src\\Illuminate\\Console\\Application.php(93): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))

# 22 vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(131): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))

# 23 artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))

# 24 {main}

"}

以下是队列配置:

'redis' => [
    'driver' => 'redis',
    'connection' => 'laravel_queues',
    'queue' => env('REDIS_QUEUE', 'default'),
    'retry_after' => 190, 
    'block_for' => 0,
],

以下是连接配置:

'laravel_queues' => [
    'host' => env('REDIS_HOST', 'localhost'),
    'password' => env('REDIS_PASSWORD', null),
    'port' => env('REDIS_PORT', '6379'),
    'database' => 2,
],

编辑1
redis服务器已启动并运行,其他一切正常:


编辑2
正如建议的那样,我跑了 monitor 在cli上,会发生以下情况:

1596784000.713047 [2 127.0.0.1:62141] "EVAL" "-- Get all of the jobs with an expired \"score\"...\nlocal val = redis.call('zrangebyscore', KEYS[1], '-inf', ARGV[1])\n\n-- If we have values in the array, we will remove them from the first queue\n-- and add them onto the destination queue in chunks of 100, which moves\n-- all of the appropriate jobs onto the destination queue very safely.\nif(next(val) ~= nil) then\n    redis.call('zremrangebyrank', KEYS[1], 0, #val - 1)\n\n    for i = 1, #val, 100 do\n        redis.call('rpush', KEYS[2], unpack(val, i, math.min(i+99, #val)))\n        -- Push a notification for every job that was migrated...\n        for j = i, math.min(i+99, #val) do\n            redis.call('rpush', KEYS[3], 1)\n        end\n    end\nend\n\nreturn val" "3" "LOCALHOSTqueues:test_queue:delayed" "LOCALHOSTqueues:test_queue" "LOCALHOSTqueues:test_queue:notify" "1596784000"
1596784000.713180 [2 lua] "zrangebyscore" "LOCALHOSTqueues:test_queue:delayed" "-inf" "1596784000"
1596784000.713362 [2 127.0.0.1:62141] "EVAL" "-- Get all of the jobs with an expired \"score\"...\nlocal val = redis.call('zrangebyscore', KEYS[1], '-inf', ARGV[1])\n\n-- If we have values in the array, we will remove them from the first queue\n-- and add them onto the destination queue in chunks of 100, which moves\n-- all of the appropriate jobs onto the destination queue very safely.\nif(next(val) ~= nil) then\n    redis.call('zremrangebyrank', KEYS[1], 0, #val - 1)\n\n    for i = 1, #val, 100 do\n        redis.call('rpush', KEYS[2], unpack(val, i, math.min(i+99, #val)))\n        -- Push a notification for every job that was migrated...\n        for j = i, math.min(i+99, #val) do\n            redis.call('rpush', KEYS[3], 1)\n        end\n    end\nend\n\nreturn val" "3" "LOCALHOSTqueues:test_queue:reserved" "LOCALHOSTqueues:test_queue" "LOCALHOSTqueues:test_queue:notify" "1596784000"
1596784000.713563 [2 lua] "zrangebyscore" "LOCALHOSTqueues:test_queue:reserved" "-inf" "1596784000"
1596784000.713972 [2 127.0.0.1:62141] "EVAL" "-- Pop the first job off of the queue...\nlocal job = redis.call('lpop', KEYS[1])\nlocal reserved = false\n\nif(job ~= false) then\n    -- Increment the attempt count and place job on the reserved queue...\n    reserved = cjson.decode(job)\n    reserved['attempts'] = reserved['attempts'] + 1\n    reserved = cjson.encode(reserved)\n    redis.call('zadd', KEYS[2], ARGV[1], reserved)\n    redis.call('lpop', KEYS[3])\nend\n\nreturn {job, reserved}" "3" "LOCALHOSTqueues:test_queue" "LOCALHOSTqueues:test_queue:reserved" "LOCALHOSTqueues:test_queue:notify" "1596784190"
1596784000.714130 [2 lua] "lpop" "LOCALHOSTqueues:test_queue"
1596784000.714340 [2 127.0.0.1:62141] "BLPOP" "LOCALHOSTqueues:test_queue:notify" "0"

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题