Redis problem

Hi,

I have been using a raspberry pi 3 for over a year now adding sensors to it every now and then.

Today i started adding a new sensor and a dashboard to go with it, when i saved the dashboard i started getting this error, although redis is installed and as far as i can see running correctly.

Warning: Redis::connect(): php_network_getaddresses: getaddrinfo failed: System error in /var/www/emoncms/index.php on line 32
Can’t connect to redis at localhost:6379 , it may be that redis-server is not installed or started see readme for redis installation

This comes up 70% of the time trying to access anything from emoncms, i have managed to log back in and delete the newly created dashboard but am still encountering the problem although less frequent.

Before i recreate the dashboard and encounter the same problem, has anyone seen this before or have any idea how to stop it happening?

I’m running emoncms V9.8.3, redis V2.8.17, mqtt V 1.4.11, if that helps.

Regards,
Matt.

Hello @spike3312, Im afraid I dont think I have seen this one before - at least on a pi, have you updated redis or php recently?

Perhaps you could try flushing the redis database? assuming that your not using redis for other applications you could run: $ redis-cli “flushall”

Are you able to access redis from the command line with redis-cli when you see this error? Is redis just temporarily missing?

If you check your Pi load with $ top is redis using a lot of resources?

Hi @TrystanLea.

I have updated php-redis this morning from 2.2.5 to 3.1.2, which has made the errors less frequent, other than that they’re the same versions which have been installed since build, i did a system update when i migrated to emoncms 9.8.3 20 days ago which may have updated somthing but not since then and until today everything has been OK.

I’ve just tried redis-cli “flushall” i got an OK message, but the issue is still there, i can access redis through the redis-cli while i have this error.

Top is reporting 1.2% CPU usage for redis and a total load average of 0.13.

On trying to edit a dashboard i am also getting this error.

ERROR: Could not save Dashboard. undefined

Cheers.

Thinking back, i had this problem last year when i had an attempt at creating my own widget for the dashboard, i cleared the issue by deleting the files i created, last week i updated my battery widget, via topic:

wonder if that has something to do with it.

FYI @TrystanLea and for anyone else it may affect.

I appear to have solved this issue by replacing ‘host’ => ‘localhost’ with ‘host’ => ‘127.0.0.1’ in my settings.php file for emoncms in the redis section.

1 Like

Great to hear that you resolved it!

What version of PHP are you running?

Due to an issue with rounding, v2.2.8 is the latest version currently recommended with php5, v3.1.2 will be ok for php7 though. The release of v3.1.3 is imminent but not quite here yet and that should be ok on both versions.

I am running PHP version 5.6.30, only because thats what happened to be installed when i set it up, not through any other choice, I’m not against upgrading if it will cause issues.

I’ve not noticed any issues, but i can see from your link how it could be an issue, especially as one of my next projects is to employ an ESP8266 with a light sensor to count the pulses from my electricity meter and hopefully somehow optically from my gas meter in a way that wont upset the supplier.