Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. History: Migration von File zu MySQL mit Daten-Mitnahme möglich?

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    History: Migration von File zu MySQL mit Daten-Mitnahme möglich?

    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Dax last edited by

      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
      
      1 Reply Last reply Reply Quote 0
      • apollon77
        apollon77 last edited by

        Schaue ich mir morgen Abend an.

        1 Reply Last reply Reply Quote 0
        • D
          Dax last edited by

          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)
          
          1 Reply Last reply Reply Quote 0
          • apollon77
            apollon77 last edited by

            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

            1 Reply Last reply Reply Quote 0
            • apollon77
              apollon77 last edited by

              Bitte mal neu mit sql 1.6.4 (Github) versuchen. Kommen jetzt andere Fehler? Wenn ja bitte posten

              1 Reply Last reply Reply Quote 0
              • D
                Dax last edited by

                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) 
                
                
                1 Reply Last reply Reply Quote 0
                • apollon77
                  apollon77 last edited by

                  Was kommt danach im log? Das ist kein Fehler. Wenn es danach „hängt“ einfach warten.

                  1 Reply Last reply Reply Quote 0
                  • D
                    Dax last edited by

                    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…

                    1 Reply Last reply Reply Quote 0
                    • apollon77
                      apollon77 last edited by

                      Steht auch die Meldung bzw dir exception im log??

                      1 Reply Last reply Reply Quote 0
                      • sissiwup
                        sissiwup last edited by

                        Hallo,

                        geht auch über : http://forum.iobroker.net/viewtopic.php … sql#p15757

                        1 Reply Last reply Reply Quote 0
                        • C
                          ChristianF last edited by

                          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..
                          455_iobro.jpg

                          1 Reply Last reply Reply Quote 0
                          • apollon77
                            apollon77 last edited by

                            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.

                            1 Reply Last reply Reply Quote 0
                            • D
                              Dax last edited by

                              @apollon77:

                              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
                              
                              1 Reply Last reply Reply Quote 0
                              • C
                                ChristianF last edited by

                                Klingt nach "mal Host neu starten"

                                1 Reply Last reply Reply Quote 0
                                • apollon77
                                  apollon77 last edited by

                                  Alternative ist: sql Adapter beenden über Admin. In /opt/iobroker folgendes an der Konsole ausführen:

                                  node node_modules/iobroker.sql/main.js —force —logs

                                  Damit startest du den sql Adapter manuell. Dann in zweiter Shell den Converter starten. Falls es wieder abstürzt dann solltest du ggf einen besseren Fehler bekommen.

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    Dax last edited by

                                    wenn ich den sql adapter mit deinem befehl starten will bekomme ich die Meldung

                                    Cannot find module 'pg-native'
                                    
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • apollon77
                                      apollon77 last edited by

                                      Komplette Fehlermeldung? Und das was hier nach einem langen "-" aussieht sind immer "zwei Minuszeichen"

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        Dax last edited by

                                        root@raspberrypi:~# cd /opt/iobroker
                                        root@raspberrypi:/opt/iobroker# node node_modules/iobroker.sql/main.js -—force -—logs                             
                                        Cannot find module 'pg-native'
                                        root@raspberrypi:/opt/iobroker#
                                        
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • apollon77
                                          apollon77 last edited by

                                          Er findet das Postgres Modul nicht … interessant. SQL Adapter war korrekt und ohne Fehler installiert?

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            Dax last edited by

                                            ja soweit ich mich erinnern kann schon. soll ich mal neu installieren?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            729
                                            Online

                                            32.0k
                                            Users

                                            80.5k
                                            Topics

                                            1.3m
                                            Posts

                                            5
                                            38
                                            3907
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo