Local EmonCMS server died (old version) Upgrade to new help

Hi,

Its been a while since I have been dabbling with this side of the monitoring, it has beenin going strong for the last year or so.

I have been using the server for more and more, since the monitoring does not load it up and like a fool, made one change to the OS and it has wiped out a load of info that makes it run the way it should.

Currently I am still running rfm12piphp and this is still logging and working, but it no longer works as DNS server etc. etc so I'm going to do a bare bones install again, and get this sucker up and running again.

Dailey I take a mysql dump and an emoncms folder dump, zip and backup to nas drive, (cron job) so data is not too bad, dont mind loosing a day or so, but dont want to loose the years worth.

Now I can copy over the apache config, and be cool and up and running, but I wouldnt mind trying out the new(er) versions of emoncms, so when I do the new install going to virtualise the servers and have a couple running which I think will be better, however all the feeds I have are mysql feeds from something like V5/6, are these still valid or will I need to convert to something else / table structure etc?

Many thanks

Jimmy

manicmoddin's picture

Re: Local EmonCMS server died (old version) Upgrade to new help

Found out using the way bach machine how to put it all together and have thesystem working, but it took an age to copy over the database.

I've been using percona xtrabackup to get hot backups from the server, and last night I looked into the swap over again, With a 4 Gb database, The backup and restore using the percona took approx 30 mins including the copy over to the new machine for testing.

However after firing it all into life and installing emoncms V8 I cannot see my feeds etc. If I go into the database check, it wants to alter the structure of the database, which I have no problem doing, but it gives be errors about not being able to find a object.

Unfortunatley I cannot get onto the server at the moment as the box is down, but I will update the error message when it comes back alive.

I am guessing that I will need to convert to time store to get the feeds working again, but not sure how to go about this.

Also looking into the issues lastnight (while tired) I noticed that the settings.php ask for a timestore key?

Many thanks for any info that can be shed.

Jimmy

TrystanLea's picture

Re: Local EmonCMS server died (old version) Upgrade to new help

Hello Jimmy

You should be able to view your mysql data ok using the master branch of emoncms. However if I remember correctly you may be missing the engine field in the feeds table which is a newer addition.

Try running the database update tool in admin -> check & update db.

Then check if the engine field for your feeds are 0 in the mysql table, you could try manually changing them to 0 if not.

To convert to the newer engines you will want to skip timestore and go straight to the newer engines, the easiest conversion from MYSQL is to phptimeseries (it uses the same data file format), but maybe see if you can see the data in MYSQL first and then I can try and help you move them to phptimeseries.

Can you elaborate on the missing object error?

 

manicmoddin's picture

Re: Local EmonCMS server died (old version) Upgrade to new help

Hi Trystan

The Missing object, error is when I go into the admin and do the update db.

It tkes me to the URL http://<ip>/emoncms/admin/db and tells me it needs to update the following:

Update database

Todo: - these changes need to be applied

 

Database schema

ALTER TABLE `event_settings` ADD `mqttbrokerip` varchar(60) NOT NULL
ALTER TABLE `event_settings` ADD `mqttbrokerport` varchar(5) NOT NULL
ALTER TABLE `event_settings` ADD `mqttusername` varchar(60) NOT NULL
ALTER TABLE `event_settings` ADD `mqttpassword` varchar(60) NOT NULL
ALTER TABLE `event` ADD `mqtttopic` text NOT NULL
ALTER TABLE `event` ADD `mqttqos` int(3) NOT NULL DEFAULT '0'
ALTER TABLE input MODIFY `nodeid` text;
CREATE TABLE myelectric (`userid` int(11), `data` text) ENGINE=MYISAM
CREATE TABLE node (`userid` int(11), `data` text) ENGINE=MYISAM
CREATE TABLE notify (`userid` int(11) not null primary key, `email` varchar(30), `enabled` int(11) not null) ENGINE=MYISAM
CREATE TABLE openbem_projects_v3 (`project_id` int(11) not null auto_increment primary key, `project_name` varchar(30), `project_description` text, `project_owner` int(11), `project_collaborators` text, `project_mdate` int(11)) ENGINE=MYISAM
CREATE TABLE openbem_scenarios_v3 (`scenario_id` int(11) not null auto_increment primary key, `project_id` int(11), `scenario_meta` text, `scenario_data` text) ENGINE=MYISAM
CREATE TABLE report (`userid` int(11) primary key, `settings` text) ENGINE=MYISAM
CREATE TABLE applist (`id` int(11) not null auto_increment primary key, `userid` int(11), `name` text, `list` text) ENGINE=MYISAM

To which I click Apply, and then it appends the ?apply=true to the URL, and gives the following error

Notice: Trying to get property of non-object in /var/www/emoncms/Lib/dbschemasetup.php on line 41

Notice: Trying to get property of non-object in /var/www/emoncms/Lib/dbschemasetup.php on line 41

Notice: Trying to get property of non-object in /var/www/emoncms/Lib/dbschemasetup.php on line 41

Fatal error: Call to a member function fetch_object() on a non-object in /var/www/emoncms/Modules/user/user_model.php on line 440

Now looking in the code on line 440, which to me is where the main error is
 (the fatal one) this is querying the db looking for my api write key, but this
 is as far as I can get.

I think it is a simple fix that I am over looking.

As for the feeds table, I get the following:
mysql> show columns in feeds;
+----------+------------+------+-----+---------+----------------+
| Field    | Type       | Null | Key | Default | Extra          |
+----------+------------+------+-----+---------+----------------+
| id       | int(11)    | NO   | PRI | NULL    | auto_increment |
| name     | text       | YES  |     | NULL    |                |
| userid   | int(11)    | YES  |     | NULL    |                |
| tag      | text       | YES  |     | NULL    |                |
| time     | datetime   | YES  |     | NULL    |                |
| value    | float      | YES  |     | NULL    |                |
| datatype | int(11)    | NO   |     | NULL    |                |
| public   | tinyint(1) | YES  |     | NULL    |                |
| size     | int(11)    | NO   |     | NULL    |                |
| engine   | int(11)    | NO   |     | 0       |                |
+----------+------------+------+-----+---------+----------------+
10 rows in set (0.00 sec)

which all looks fine to what you say.

Many thanks for the info so far, I am looking through the code and if I get to it I will post what I find.

Jimmy

 

Edit - fixed table - BT

manicmoddin's picture

Re: Local EmonCMS server died (old version) Upgrade to new help

Ok a fresh install of the version 8 seems to have worked.

At least on the test machine, now I need to get a Jeenode plugged in and have that updating in tandem with current live system, then when happy it all works, migrate over to the new version, and try to keep up to date.

I think it may have been a permissions thisg, an owner etc, not 100% sure, but version 8 seems light years ahead of what I used to use.

Also I need to figure out how to convert to phptimeseries now... Think I've found something in the useful scripts for that though

Jimmy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.