Redis Connection refuse [tcp://127.0.0.1:6379]

Ali Özen picture Ali Özen · Apr 20, 2018 · Viewed 7.6k times · Source

I just setup GeneaLabs/laravel-model-caching packages. When running serve i got redis class missing. Then i run

composer required predis/predis

After that I got this error

No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379]

and i got this error. Still working but I have not made any progress yet. Any idea?

PS: i am working localhost with mysql. Not homestead.

Answer

Isuru Dilshan picture Isuru Dilshan · May 24, 2018

Install Redis.

https://redis.io/download or if the os is windows then https://github.com/MicrosoftArchive/redis/releases

Run Redis.

$ src/redis-server or in windows then run redis-server.exe

Set the .env variables

REDIS_HOST=127.0.0.1

REDIS_PASSWORD=null

REDIS_PORT=6379

Add redist code to database.php

'redis' => [

'client' => 'predis',

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

],