Updated EMONCMS, Now Doesn't Load with Uncaught RedisException Connection Refused

I run EMONCMS on a VM, rather than a RPI. Overnight it stopped working, and the log2ram was full. As I am not on an SD card, I disabled log2ram and then ran the usual apt updates, as the VM was out of date.
EMONCMS stopped working.
Going through the forum, I found instructions on how to fire a manual update script, which appeared to pass through correctly. However EMONCMS still doesn’t work.

This is the error.

Fatal error : Uncaught RedisException: Connection refused in /var/www/emoncms/index.php:39 Stack trace: #0 /var/www/emoncms/index.php(39): Redis->connect(‘localhost’, 6379) #1 {main} thrown in /var/www/emoncms/index.php on line 39

As it is a VM, I could rebuild it, but I don’t really want to lose the history.
Any suggestions on a fix?
Many thanks.

If you simply disabled the service that might be the issue.

If you clean out the log files and reenable log2ram, does it work again?

You can create a new VM with the scripts and leave out the things you don’t need/want, then transfer over the data.

This is the process I followed.

I have tried to reverse the process after removing some logs and it is still the same error.

Is there a guide on moving content to a new server?

Yes, that probably isn’t going to work as other things are expecting it to be there and that is just a generic process.

The emonscripts docs - follow the Ubuntu guide (best base OS as close to RaspberryOS).

Simplest is to take a backup and do a restore on the new server. Depending on the volume of data that can take a while and you may wish to use the ‘sync’ functionality to line the two sets up (I’ve not done that yet so no experience) as it does it via binary (so @TrystanLea saya).

You can initially leave the old one running. You then just need to sort out IP addresses etc so everything works as before but it will always result in at least a small amount of data loss as you switch.

I couldn’t do a backup as the web interface wouldn’t load. Can you run the backup process manually from the command line?

I have managed to copy the data across, mainly by taking a backup of a blank new installation and seeing what you are including in that backup and copying the files across. All the data seems to be there, except it is all negative! Have I missed something?

Thanks for your assistance on this matter.

Probably a permission issue or the backup config file not being quite right. I’d investigate this error first.

Yes I think you can.

You need the SQL database as well.

No idea, sorry.

There is a backup/transfer script in the usefulscripts repo (that should be installed) usefulscripts/backup/backup.php at master · emoncms/usefulscripts · GitHub

[edit]
The backup module (which is installed) has a couple of shell scripts there as well

Running the backup using the backup module was the key.
I did that and after a few hiccups with permissions and it failing from the browser window, I imported the data again using the command line method and it appears to be working correctly, with the values no longer negative.

Lessons learned - do a backup regularly. If it fails, use the backup module from the command line to get a backup file and import from the command line.

Thank you for your assistance.

1 Like