Community
OpenEnergyMonitor

Community

Hardware migration....simple manual way?

Hi there!
I setup a few monthes ago emoncms on a “test server” (an old thin client reconverted with ubuntu server). I have emoncms 9.9.9 on this one.
This server is for playing around, so as I want to setup now emoncms for long term use, I setup a new hardware (also a thin client reconverted with ubuntu server, but smaller and smaller consumption).

On this new device, I have emoncms Version: low-write 10.1.11

I struggled a while with the “backup” module, but I’m done with it… the documentation is very small and I was not able to make it work.

as I have only a few inputs and not so much fancy tuning…is there a chance that I could just copy paste database files from old server to new one ? I mean the directories /var/lib/php*
I assume I have to dump and import the emoncms table in mysql too ?

I have a couple of item I wonder about:

  • where is stored my input/feeds settings ? if it’s in database, I assume it will follow ?
  • I see in config file that mysql user / password seems different between my server.
    in /var/www/emoncms/default.settings.php on old one and in /var/www/emoncms/settings.ini on new one.
    Can I just update user/password from old device in config file of new one?

if some minor setting needs to be re done on new server, it’s not a big deal.

What did you struggle with? At a minimum you can just run the script from the command line or use the recent USB backup mechanism (search here for the post).

The backup module never show up in gui.
The commande line “emoncms_export.sh” stopped with error messages :smiley:

PHP Notice:  Undefined variable: settings in /home/fred/test_emon_module/backup/get_emoncms_mysql_auth.php on line 31
PHP Notice:  Undefined variable: settings in /home/fred/test_emon_module/backup/get_emoncms_mysql_auth.php on line 31
PHP Notice:  Undefined variable: settings in /home/fred/test_emon_module/backup/get_emoncms_mysql_auth.php on line 31
Error: Cannot read MYSQL authentication details from Emoncms settings.php

Documentation to fill config.cfg…where there is no :grimacing:

Anyway, I give a try moving the database (my setup is fresh install on new server, not a big deal if I break it).

I move content as following:
oldserver /var/lib/phpfina => new server /var/opt/emoncms/phpfina
oldserver /var/lib/phpfiwa => new server /var/opt/emoncms/phpfiwa (well, it’s empty anyway)
oldserver /var/lib/phptimeseries => new server /var/opt/emoncms/phptimeseries

I dumped sql database with :grimacing:
sudo mysqldump -uemoncms -p<mysql_password> emoncms > emoncms_backup.sql

<mysql_password> is a password I had stored in my password manager but I was not able to find it in any config file default.emonpi.settings.php, default.settings.php or settings.php
I assume it was asked a password when I setup emoncms 1st time so I created one? but I cannot remember exactly.
Not sure where it was stored ?
Anyway, I have my emoncms_backup.sql, I copied it to my new server and imported with:

mysql -uemoncms -pemonpiemoncmsmysql2016 emoncms < emoncms_backup.sql

This time, I used the password from settings.ini

So far it works not too bad:

  • Inputs source are here.
  • graphics are here.
  • The feeds are here, like stopped (shows “N/A” values)
  • It seems only missing the link from inputs to feeds.

The settings object has changed. The solution is here…