skip to Main Content

Server throwing below error may be on heavy site traffic or loss of redis connection.
But unable to found the cause of this error that can help to resolve.

Also server stops due to below errors at specific UK time around every day at 4 AM.

So any help regarding this will be helpful.

Server : Digital Ocean
Frontend : React JS
Backend : laravel (5.8)
Used spiritix/lada-cache library for mysql cashing to manage large amount of data.
Application is running on Docker containers.

1) error:

production.ERROR: php_network_getaddresses: getaddrinfo failed: Name
or service not known [tcp://redis:6379] {“exception”:”[object] (PredisConnectionConnectionException(code: 0):
php_network_getaddresses: getaddrinfo failed: Name or service not
known [tcp://redis:6379] at
/var/www/vendor/predis/predis/src/Connection/AbstractConnection.php:155)

2) error :-

Redis – LOADING Redis is loading the dataset in memory:

3) error :-

production.ERROR: Connection refused [tcp://127.0.0.1:6379]

This error will stops the server as well.

I have tried to restart docker down containers on cron scheduler. But the actual issue is not with docker container, some internal laravel packages like Predis | Ladacash throwing above error for that unable to find exact solution.

2

Answers


  1. Since you are using docker, you no longer should refer to your redis server (docker container) using an IP (say 127.0.0.1). Instead use the container name.

    1) Run: docker ps to list all containers, then find the redis server, and copy and paste the name under container name column to your .env file as the host.

    2) Make sure that both your app container and redis container are in the same network:

    docker network ls
    docker network inspect <network_name>
    
    Login or Signup to reply.
  2. A bit irrelevant as it could be a lot of causes to this problem but in my 2 cases I’ve solved this problem by:

    1. Reloading my .env: clear the cache: php artisan config:cache and reloads the env file into cache: php artisan config:clear
    2. My Docker service was actually down on one of my Docker Swarm nodes (a worker in this case) so restarting my node / server restarted Docker which restarted my PHP-FPM container that was "broken" and not communicating with the Redis container on my Manager node anymore
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search