Name or service not known [tcp://redis:6379]
Asked Answered
A

2

18

i am having a problem setting up redis cache with laravel. i have a redis server runnig on my local machine:

enter image description here

my .env:

enter image description here

i have the localhost on port 6379 ready and listened:

enter image description here

someone plz tell me what's happenig here?enter image description here

Anjanette answered 21/1, 2018 at 0:27 Comment(0)
J
51

Change REDIS_HOST=redis to REDIS_HOST=localhost, it is looking for a host named redis and not finding it, since redis is installed on the same machine you should use localhost or 127.0.0.1.

Once you've done this, make sure you reload the .env config - php artisan config:clear

Jayson answered 21/1, 2018 at 0:31 Comment(7)
allready tried it with localhost and 127.0.0.1 with no luck!!Anjanette
the odd thing is even with REDIS_HOST=localhost or REDIS_HOST=127.0.0.1 it's still searching for tcp://redis:6379Anjanette
You’re running your app and redis on the same machine, correct?Jayson
yes i am runnig the app and redis from the same machineAnjanette
now that's what am talking about!! php artisan config:clear did the trick..thank you man you'r freaking awesome!!!Anjanette
This was not enough for me. Apparently I also needed to run php artisan queue:restart.Opalopalesce
Make sure to update REDIS_HOST on your .env file as well (@oajmi)Execute
K
-1

I've added this to my /etc/hosts and it fixed the error

127.0.0.1 redis

Laradoc + laravel (5.6)

Kowatch answered 4/7, 2022 at 6:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.