NEWS
History: Migration von File zu MySQL mit Daten-Mitnahme möglich?
-
Hallo,
der Thread-Titel sagt eigentlich schon alles: ich bin am überlegen, von filebasierter Datenbank auf MySQL zu wechseln. Gibt es eine Möglichkeit, die in den Files liegenden Daten zu transferieren? Ich würde ungern die Daten verlieren..
Vielen Dank und viele Grüße
Christian
-
Github is your friend: https://github.com/ioBroker/ioBroker.hi … -converter
-
Hmm nachdem ich nun schon 2x an mir selbst verzweifelt bin, muss ich doch nochmal nachfragen… ich habe mir die Anleitung durchgelesen und das analyze Script angeworfen. Das Ziel ist eine MySQL, der Adapter sql.0 zeigt auch auf genau diese Datenbank und die Verbindung ist getestet und funktioniert).
Ich bin mir aber nicht sicher, ob ich irgendwas falsch mache:
root@iobroker:/opt/iobroker/node_modules/iobroker.history/converter# nodejs analyzesql.js sql.0 info Query Data from sql.0 2018-01-14 20:42:45.666 - info: history.0 starting. Version 1.6.3 in /opt/iobroker/node_modules/iobroker.history, node: v4.8.4 Send
Dies bleibt so da stehen. Heute jetzt etwa eine Stunde, beim letzten Mal noch erheblich länger. Hat jemand einen Tipp für mich? Die CPU Last ist währenddessen minimal, es scheint nicht so als würde er wirklich was tun…
Danke und viele Grüße
Christian
-
ruf mal mit "debug" anstelle "info" auf …
-
Danke, habe ich ausprobiert. Hier das Ergebnis (fast vier Stunden Laufzeit):
root@iobroker:/opt/iobroker/node_modules/iobroker.history/converter# nodejs analyzesql.js sql.0 debug Query Data from sql.0 2018-01-17 19:55:06.219 - debug: history.0 objectDB connected 2018-01-17 19:55:06.281 - debug: history.0 statesDB connected 2018-01-17 19:55:06.328 - info: history.0 starting. Version 1.6.3 in /opt/iobroker/node_modules/iobroker.history, node: v4.8.4 Send
-
Was läuft denn unten drunter? ne SD Karte?
Ansonsten: Eine sql.0 Instanz gibt es, oder ?! Welche Version ist installiert?
Steht ggf im "Normalen" iobroker Log noch irgendwas von sql.0 an Logging? Ansonsten mal sql.0 in Debug laufen lassen. Was kommt da?
-
Hallo,
ich häng mich da mal dran weil ich auch nicht weiterkomme…
Bis jetzt habe ich meine Daten mit dem history-adapter geloggt (Verzeichnis /mnt/history). Jetzt möchte ich das ganze auf mysql umstellen und die vorhandenen Daten dorthin kopieren.
Datenbank ist auf meinem Nas eingerichtet und funktioniert, sql.0 Instanz läuft ebenfalls und loggt brav die neuen Daten.
Wenn ich jetzt folgendes eintippe:
root@raspberrypi:/opt/iobroker/node_modules/iobroker.history/converter# nodejs history2db.js sql.0 info 0 /mnt/history --processAllDPs
bekomme ich als Antwort
Send Data to sql.0 Use historyDir /mnt/history EarliesDBValues initialized from cache 0 No stored existingDBTypes found started processFiles with 0 known db values We start earliest at 19700101 DONE
Was mache ich falsch?
Nachtrag: bin jetzt ein bisschen weiter, mit
root@raspberrypi:/opt/iobroker/node_modules/iobroker.history/converter# nodejs history2db.js sql.0 debug 20160810 /mnt/history --ignoreExistingDBValues --processAllDPs
bekomme ich
Send Data to sql.0 Start at 20160810 Use historyDir /mnt/history No stored earliesDBValues found No stored existingDBTypes found started processFiles with 0 known db values We start earliest at 20160810 Day 20160810 - history.hm-rpc.0.MEQ0690418.1.FILLING_LEVEL.json datapoints reduced from 1 --> 1
Ab da hängts aber. Im Log steht:
sql.0 2018-01-20 11:31:56.135 error TypeError: Cannot read property 'index' of undefined at pushValueIntoDB (/opt/iobroker/node_modules/iobroker.sql/main.js:925:19) at storeState (/opt/iobroker/node_modules/iobroker.sql/main.js: sql.0 2018-01-20 11:31:56.134 error message messagebox.system.adapter.sql.0 [object Object] Cannot read property 'index' of undefined
-
Schaue ich mir morgen Abend an.
-
Danke, ich bin inzwischen ein bisschen weiter aber doch nicht erfolgreich.
Hab inzwischen herausgefunden das ich die instanz history.0 beenden muss damit es funktioniert.
Aber: Sobald ich das ganze starte mit
nodejs history2db.js sql.0 debug 20180120 /mnt/history 2 --logChangesOnly 60 ---processAllDPs
bekomme ich folgende Fehlermeldung und der SQL Adapter startet sich neu:
host.raspberrypi 2018-01-21 10:53:58.512 info Restart adapter system.adapter.sql.0 because enabled host.raspberrypi 2018-01-21 10:53:58.505 error instance system.adapter.sql.0 terminated with code 6 (uncaught exception) sql.0 2018-01-21 10:53:42.969 error Error: connect EMFILE 10.0.0.130:3307 - Local (undefined:undefined)
-
Also an sich kann history.0 nebenher laufen. Sollte nicht stören.
Den Fehler von sql kenne ich nicht, sieht mir aber nach was andere aus: https://stackoverflow.com/questions/103 … in-node-js Schau mal eher warum sql.0 solche Probleme macht ...
Wegen dem anderen Fehler schaue ich noch
-
Bitte mal neu mit sql 1.6.4 (Github) versuchen. Kommen jetzt andere Fehler? Wenn ja bitte posten
-
Hallo,
entschuldige das ich mich erst so spät wieder melde, aber ich war gerade beruflich ziemlich beschäftigt.
Leider kann ich die sql-Version von github nicht installieren, bekomme immer folgende Fehler:
$ ./iobroker url "https://github.com/ioBroker/ioBroker.sql" install https://github.com/ioBroker/ioBroker.sql/tarball/master npm install https://github.com/ioBroker/ioBroker.sql/tarball/master --production --save --prefix "/opt/iobroker" (System call) npm WARN deprecated node-uuid@1.4.8: Use uuid module instead npm WARN deprecated sprintf@0.1.5: The sprintf package is deprecated in favor of sprintf-js. node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v46-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@4.8.4 (node-v46 ABI) (falling back to source compile with node-gyp)
-
Was kommt danach im log? Das ist kein Fehler. Wenn es danach „hängt“ einfach warten.
-
Hm ich hab jetzt den adapter aktualisert. Wenn ich nun
nodejs history2db.js sql.0 debug 20180120 /mnt/history 2 --logChangesOnly 60 ---processAllDPs
starte fängt er auch an
root@raspberrypi:/opt/iobroker/node_modules/iobroker.history/converter# nodejs history2db.js sql.0 debug 20180120 /mnt/history 2 --logChangesOnly 60 ---processAllDPs Send Data to sql.0 Start at 20180120 Use historyDir /mnt/history Use Delay multiplicator 2 Log changes only once per 60 minutes EarliesDBValues initialized from cache 21 ExistingDBTypes initialized from cache 21 started processFiles with 21 known db values We start earliest at 20180120 Day 20180120 - history.hm-rega.0.11818.json cut filedata to 0 Day 20180120 - history.hm-rega.0.11819.json cut filedata to 0 Day 20180120 - history.hm-rega.0.11820.json cut filedata to 0 Day 20180120 - history.hm-rega.0.11821.json cut filedata to 0 Day 20180120 - history.hm-rega.0.11822.json cut filedata to 0 Day 20180120 - history.hm-rega.0.11823.json cut filedata to 0 Day 20180120 - history.hm-rega.0.11824.json cut filedata to 0 Day 20180120 - history.hm-rega.0.16971.json cut filedata to 0 Day 20180120 - history.hm-rega.0.16972.json cut filedata to 0 Day 20180120 - history.hm-rega.0.2477.json cut filedata to 0 Day 20180120 - history.hm-rega.0.2478.json cut filedata to 0 Day 20180120 - history.hm-rega.0.2829.json cut filedata to 0 Day 20180120 - history.hm-rega.0.2830.json cut filedata to 0 Day 20180120 - history.hm-rega.0.3650.json cut filedata to 9520 datapoints reduced from 9520 --> 9520 sorted out 0 values
aber im ioBroker Log sehe ich folgendes:
host.raspberrypi 2018-02-10 11:53:38.228 info Restart adapter system.adapter.sql.0 because enabled host.raspberrypi 2018-02-10 11:53:38.227 error instance system.adapter.sql.0 terminated with code 6 (uncaught exception) history.0 2018-02-10 11:53:07.332 info starting. Version 1.7.2 in /opt/iobroker/node_modules/iobroker.history, node: v4.8.7
Der SQL-Adapter startet also neu…
-
Steht auch die Meldung bzw dir exception im log??
-
Hallo,
geht auch über : http://forum.iobroker.net/viewtopic.php … sql#p15757
-
Ich wollte mich auch nochmal bedanken, es funktioniert perfekt. Einziger Nachteil: ich habe eine Datensammlung von über einem Jahr und z.T. sind es über 1000 Werte pro Tag bei insgesamt ca. 25 protokollierten Objekten :lol: Zweimal ist mir jetzt die SSH Session abgeschmiert so dass ich mich jetzt entschieden habe das auf der Konsole der VM zu machen, da bricht der Task wenigstens nicht ab
Verursacht aber schon ganz schön Load auf der CPU so ne Konvertierung..
-
Hättest auch Screen nehmen können. Aber Konsole auf hm geht auch.
Ja last passiert dabei. Dafür gibt es die zusatzparameter für Wartezeiten und so um das ein Bissl zu steuern. Muss man im Zweifel Bissl experimentieren.
-
Steht auch die Meldung bzw dir exception im log?? `
Gerade nochmal probiert:
sql.0 2018-02-11 13:01:12.707 info Connected to mysql sql.0 2018-02-11 13:01:12.623 info enabled logging of hm-rpc.0.OEQ0086710.1.TEMPERATURE sql.0 2018-02-11 13:01:12.623 info enabled logging of hm-rpc.0.OEQ0086710.1.HUMIDITY sql.0 2018-02-11 13:01:12.623 info enabled logging of hm-rega.0.16972 sql.0 2018-02-11 13:01:12.623 info enabled logging of hm-rega.0.16971 sql.0 2018-02-11 13:01:12.622 info enabled logging of hm-rpc.2.CUX4000001.7.CONTROL sql.0 2018-02-11 13:01:12.622 info enabled logging of hm-rpc.0.OEQ0023416.2.POWER sql.0 2018-02-11 13:01:12.622 info enabled logging of hm-rpc.0.OEQ0023416.2.ENERGY_COUNTER sql.0 2018-02-11 13:01:12.622 info enabled logging of hm-rega.0.11824 sql.0 2018-02-11 13:01:12.622 info enabled logging of hm-rega.0.11823 sql.0 2018-02-11 13:01:12.622 info enabled logging of hm-rega.0.11822 sql.0 2018-02-11 13:01:12.622 info enabled logging of hm-rega.0.11821 sql.0 2018-02-11 13:01:12.622 info enabled logging of hm-rega.0.11820 sql.0 2018-02-11 13:01:12.621 info enabled logging of hm-rega.0.11819 sql.0 2018-02-11 13:01:12.621 info enabled logging of hm-rega.0.11818 sql.0 2018-02-11 13:01:12.620 info enabled logging of hm-rega.0.6951 sql.0 2018-02-11 13:01:12.620 info enabled logging of hm-rega.0.3650 sql.0 2018-02-11 13:01:12.620 info enabled logging of hm-rega.0.2830 sql.0 2018-02-11 13:01:12.620 info enabled logging of hm-rega.0.2829 sql.0 2018-02-11 13:01:12.620 info enabled logging of hm-rega.0.2478 sql.0 2018-02-11 13:01:12.619 info enabled logging of hm-rega.0.2477 sql.0 2018-02-11 13:01:12.618 info enabled logging of hm-rpc.0.MEQ0690418.1.FILLING_LEVEL sql.0 2018-02-11 13:01:12.549 info starting. Version 1.6.9 in /opt/iobroker/node_modules/iobroker.sql, node: v4.8.7 host.raspberrypi 2018-02-11 13:01:09.270 info instance system.adapter.sql.0 started with pid 6276 host.raspberrypi 2018-02-11 13:00:39.238 info Restart adapter system.adapter.sql.0 because enabled host.raspberrypi 2018-02-11 13:00:39.237 error instance system.adapter.sql.0 terminated with code 6 (uncaught exception) history.0 2018-02-11 13:00:06.863 info starting. Version 1.7.2 in /opt/iobroker/node_modules/iobroker.history, node: v4.8.7
-
Klingt nach "mal Host neu starten"