Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Frage : Migrate MySQL nach Influxdb

    NEWS

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    • Save The Date: ioBroker@Smart Living Forum Solingen, 14.06.

    Frage : Migrate MySQL nach Influxdb

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      marco-mh @JackGruber last edited by

      @jackgruber hab ich jetzt auch gemerkt. mein Gott ist das kompliziert grrr

      1 Reply Last reply Reply Quote 0
      • JackGruber
        JackGruber @marco-mh last edited by

        @marco-mh das kommt auf die konfig an. Die policys geben an wie lange die Daten in der Datenbank bleiben sollen.
        Ich hab policys für 1 Woche, 1 Monat, 2 Monate, 1 Jahr, 2 Jahre und 10 Jahre.

        M 1 Reply Last reply Reply Quote 0
        • M
          marco-mh @JackGruber last edited by

          @jackgruber in Iobroker hab ich auf nie löschen eingestellt

          JackGruber 1 Reply Last reply Reply Quote 0
          • JackGruber
            JackGruber @marco-mh last edited by

            @marco-mh Ich vermute mal er nutzt die global da diese auf default bei dir steht.

            M 2 Replies Last reply Reply Quote 0
            • M
              marco-mh @JackGruber last edited by

              @jackgruber kann ich das umstellen?

              JackGruber 1 Reply Last reply Reply Quote 0
              • JackGruber
                JackGruber @marco-mh last edited by

                @marco-mh In ioBroker InfluxDB Adapter, keine Ahnung, ich nutze den nicht.

                1 Reply Last reply Reply Quote 1
                • M
                  marco-mh @JackGruber last edited by

                  @jackgruber eine Grafische Oberfläche über den Browser gibt es nicht für Influx oder?

                  JackGruber 1 Reply Last reply Reply Quote 0
                  • JackGruber
                    JackGruber @marco-mh last edited by

                    @marco-mh Keine ahnung, ich arbeit auf fast allen systemen nur auf der console.

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      marco-mh @JackGruber last edited by

                      @jackgruber ich dank dir erstmal für heute. Super Arbeit und Support von dir.

                      7D8E2B7A-57F5-40B0-B654-C64DD2E1C4E4.jpeg

                      1 Reply Last reply Reply Quote 0
                      • K
                        Kueppert @JackGruber last edited by Kueppert

                        @jackgruber sagte in Frage : Migrate MySQL nach Influxdb:

                        @marco-mh Verschiedene kennwörter für den user iobroker je nach dem von wo er kommt, oder das kennwort in der Json falsch?
                        Meld dich mal im phpMyAdmin mit dem iobrokeran.

                        Ich hab mir jetzt auch ne InfluxDB auf einer LXC aufgesetzt, Datenbank angelegt, User etc, was halt sein muss. Ich habe den User für MySQL eben via phpMyAdmin geprüft (user & Passwort), diese auch in der JSON eingetragen, IP & Ports geprüft, ich erhalte trotzdem folgende Fehlermeldung:

                        C:\GitHub>migrate.py ALL
                        (1045, "Access denied for user 'admin'@'Houston-OLD.fritz.box' (using password: YES)")
                        

                        Die Requirements hab ich installiert wie in der Readme steht, Python 3.8.10 hab ich drauf. Hab mich jetzt mehrere Stunden damit befasst und komm nicht weiter 😞

                        Das Skript will ich auf meinem Windows10-PC ausführen, MySQL = VM Proxmox, InfluxDB = LXC Proxmox unpriviligiert

                        Die Eingabeaufforderung unter Win10 hab ich als Admin ausgeführt.

                        Und hier das, was ich auf dem Win-PC in der Eingabeaufforderung alles gemacht hab:

                        C:\GitHub>dir
                         Volume in Laufwerk C: hat keine Bezeichnung.
                         Volumeseriennummer: 507A-0C37
                        
                         Verzeichnis von C:\GitHub
                        
                        08.06.2021  20:25    <DIR>          .
                        08.06.2021  20:25    <DIR>          ..
                        08.06.2021  20:25                38 .gitignore
                        08.06.2021  20:25               353 database.json.example
                        08.06.2021  20:24             4.038 iobroker_mysql_2_influxdb-master.zip
                        08.06.2021  20:25             6.811 migrate.py
                        08.06.2021  20:25             1.143 README.md
                        08.06.2021  20:25                33 requirements.txt
                                       6 Datei(en),         12.416 Bytes
                                       2 Verzeichnis(se), 34.135.502.848 Bytes frei
                        
                        C:\GitHub>python --version
                        Python 3.8.10
                        
                        C:\GitHub>python -m pip install -U pip
                        Requirement already satisfied: pip in c:\users\thorsten\appdata\local\programs\python\python38\lib\site-packages (21.1.1)
                        Collecting pip
                          Downloading pip-21.1.2-py3-none-any.whl (1.5 MB)
                             |████████████████████████████████| 1.5 MB 3.3 MB/s
                        Installing collected packages: pip
                          Attempting uninstall: pip
                            Found existing installation: pip 21.1.1
                            Uninstalling pip-21.1.1:
                              Successfully uninstalled pip-21.1.1
                        Successfully installed pip-21.1.2
                        
                        C:\GitHub>pip install -r requirements.txt
                        Collecting influxdb>=5.3.1
                          Downloading influxdb-5.3.1-py2.py3-none-any.whl (77 kB)
                             |████████████████████████████████| 77 kB 1.2 MB/s
                        Collecting PyMySQL>=1.0.2
                          Downloading PyMySQL-1.0.2-py3-none-any.whl (43 kB)
                             |████████████████████████████████| 43 kB 709 kB/s
                        Collecting requests>=2.17.0
                          Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
                             |████████████████████████████████| 61 kB 3.8 MB/s
                        Collecting six>=1.10.0
                          Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
                        Collecting pytz
                          Downloading pytz-2021.1-py2.py3-none-any.whl (510 kB)
                             |████████████████████████████████| 510 kB 6.8 MB/s
                        Collecting msgpack
                          Downloading msgpack-1.0.2-cp38-cp38-win_amd64.whl (69 kB)
                             |████████████████████████████████| 69 kB 2.0 MB/s
                        Collecting python-dateutil>=2.6.0
                          Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
                             |████████████████████████████████| 227 kB 6.8 MB/s
                        Collecting idna<3,>=2.5
                          Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
                             |████████████████████████████████| 58 kB 3.0 MB/s
                        Collecting urllib3<1.27,>=1.21.1
                          Downloading urllib3-1.26.5-py2.py3-none-any.whl (138 kB)
                             |████████████████████████████████| 138 kB 6.8 MB/s
                        Collecting chardet<5,>=3.0.2
                          Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
                             |████████████████████████████████| 178 kB 6.8 MB/s
                        Collecting certifi>=2017.4.17
                          Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
                             |████████████████████████████████| 145 kB ...
                        Installing collected packages: urllib3, six, idna, chardet, certifi, requests, pytz, python-dateutil, msgpack, PyMySQL, influxdb
                        Successfully installed PyMySQL-1.0.2 certifi-2021.5.30 chardet-4.0.0 idna-2.10 influxdb-5.3.1 msgpack-1.0.2 python-dateutil-2.8.1 pytz-2021.1 requests-2.25.1 six-1.16.0 urllib3-1.26.5
                        
                        C:\GitHub>migrate.py ALL
                        (1045, "Access denied for user 'iobroker'@'Houston-OLD.fritz.box' (using password: YES)")
                        
                        C:\GitHub>migrate.py ALL
                        (1045, "Access denied for user 'admin'@'Houston-OLD.fritz.box' (using password: YES)")
                        
                        C:\GitHub>migrate.py ALL
                        (1045, "Access denied for user 'admin'@'Houston-OLD.fritz.box' (using password: YES)")
                        
                        C:\GitHub>
                        
                        1 Reply Last reply Reply Quote 0
                        • K
                          Kueppert last edited by

                          LÄÄÄÄÄÄÄÄÄÄÄÄUFT, ich werd bekloppt...hab nen anderen User genommen. Habe bei diesem User unter phpMyAdmin => Benutzerkonten => Anmeldeinformationen unter "Hostname" = Jeder Host % eingetragen:
                          566a059b-defd-462d-90e4-abf99b475734-image.png

                          Falls jmd mal das gleiche Problem haben sollte 🙂

                          1 Reply Last reply Reply Quote 0
                          • K
                            Kueppert last edited by Kueppert

                            Hmmmm....hab nur jetzt, wo ich in die InfluxDB schreiben will, echt bei jedem Objekt, das ich logge, Fehlermeldungen im LOG 😞

                            influxdb.0 2021-06-08 22:11:28.416	warn	Add alias.0.Spritpreise.JETDiesel to conflicting Points (4 now)
                            influxdb.0 2021-06-08 22:11:28.413	warn	Error on writePoint("{"value":"1,29","time":"2021-06-08T20:11:28.392Z","from":"system.adapter.tankerkoenig.0","q":0,"ack":true}): Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Spritpreise.JETDiesel\" is type string, already exists as type float dropped=1"} / "{\"error\":\"partial write: field type conflict: input field \\\"value\\\" on measurement \\\"alias.0.Spritpreise.JETDiesel\\\" is type string, already exists as type float dropped=1\"}\n"
                            influxdb.0 2021-06-08 22:11:28.310	warn	Add alias.0.Spritpreise.ESSODiesel to conflicting Points (4 now)
                            influxdb.0 2021-06-08 22:11:28.308	warn	Error on writePoint("{"value":"1,32","time":"2021-06-08T20:11:28.238Z","from":"system.adapter.tankerkoenig.0","q":0,"ack":true}): Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Spritpreise.ESSODiesel\" is type string, already exists as type float dropped=1"} / "{\"error\":\"partial write: field type conflict: input field \\\"value\\\" on measurement \\\"alias.0.Spritpreise.ESSODiesel\\\" is type string, already exists as type float dropped=1\"}\n"
                            influxdb.0 2021-06-08 22:10:16.094	warn	Add alias.0.Spritpreise.JETDiesel to conflicting Points (4 now)
                            influxdb.0 2021-06-08 22:10:16.093	warn	Error on writePoint("{"value":"1,29","time":"2021-06-08T20:01:28.348Z","from":"system.adapter.tankerkoenig.0","q":0,"ack":true}): Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Spritpreise.JETDiesel\" is type string, already exists as type float dropped=1"} / "{\"error\":\"partial write: field type conflict: input field \\\"value\\\" on measurement \\\"alias.0.Spritpreise.JETDiesel\\\" is type string, already exists as type float dropped=1\"}\n"
                            influxdb.0 2021-06-08 22:10:16.070	warn	Add alias.0.Spritpreise.JETDiesel to conflicting Points (4 now)
                            influxdb.0 2021-06-08 22:10:16.069	warn	Error on writePoint("{"value":"1,29","time":"2021-06-08T19:56:28.376Z","from":"system.adapter.tankerkoenig.0","q":0,"ack":true}): Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Spritpreise.JETDiesel\" is type string, already exists as type float dropped=1"} / "{\"error\":\"partial write: field type conflict: input field \\\"value\\\" on measurement \\\"alias.0.Spritpreise.JETDiesel\\\" is type string, already exists as type float dropped=1\"}\n"
                            influxdb.0 2021-06-08 22:10:16.039	warn	Add alias.0.Spritpreise.JETDiesel to conflicting Points (4 now)
                            influxdb.0 2021-06-08 22:10:16.038	warn	Error on writePoint("{"value":"1,29","time":"2021-06-08T19:51:28.283Z","from":"system.adapter.tankerkoenig.0","q":0,"ack":true}): Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Spritpreise.JETDiesel\" is type string, already exists as type float dropped=1"} / "{\"error\":\"partial write: field type conflict: input field \\\"value\\\" on measurement \\\"alias.0.Spritpreise.JETDiesel\\\" is type string, already exists as type float dropped=1\"}\n"
                            influxdb.0 2021-06-08 22:10:16.007	warn	Try to write 3 Points separate to find the conflicting one
                            influxdb.0 2021-06-08 22:10:16.006	warn	Error on writePoints for alias.0.Spritpreise.JETDiesel: Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Spritpreise.JETDiesel\" is type string, already exists as type float dropped=3"}
                            influxdb.0 2021-06-08 22:10:15.982	warn	Add alias.0.Spritpreise.ESSODiesel to conflicting Points (4 now)
                            influxdb.0 2021-06-08 22:10:15.980	warn	Error on writePoint("{"value":"1,32","time":"2021-06-08T20:01:28.220Z","from":"system.adapter.tankerkoenig.0","q":0,"ack":true}): Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Spritpreise.ESSODiesel\" is type string, already exists as type float dropped=1"} / "{\"error\":\"partial write: field type conflict: input field \\\"value\\\" on measurement \\\"alias.0.Spritpreise.ESSODiesel\\\" is type string, already exists as type float dropped=1\"}\n"
                            influxdb.0 2021-06-08 22:10:15.952	warn	Add alias.0.Spritpreise.ESSODiesel to conflicting Points (4 now)
                            influxdb.0 2021-06-08 22:10:15.945	warn	Error on writePoint("{"value":"1,32","time":"2021-06-08T19:56:28.229Z","from":"system.adapter.tankerkoenig.0","q":0,"ack":true}): Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Spritpreise.ESSODiesel\" is type string, already exists as type float dropped=1"} / "{\"error\":\"partial write: field type conflict: input field \\\"value\\\" on measurement \\\"alias.0.Spritpreise.ESSODiesel\\\" is type string, already exists as type float dropped=1\"}\n"
                            influxdb.0 2021-06-08 22:10:15.476	warn	Error on writePoint("{"value":true,"time":"2021-06-08T20:06:06.182Z","from":"system.adapter.sonoff.0","q":0,"ack":true}): Error: {"error":"partial write: field type conflict: input field \"value\" on measurement \"alias.0.Steckdosen.Serverschrank\" is type boolean, already exists as type float dropped=1"} / "{\"error\":\"partial write: field type conflict: input field \\\"value\\\" on measurement \\\"alias.0.Steckdosen.Serverschrank\\\" is type boolean, already exists as type float dropped=1\"}\n"
                            

                            Hab nur einige wenige gepostet...wie bekomm ich das behoben?

                            JackGruber 1 Reply Last reply Reply Quote 0
                            • JackGruber
                              JackGruber @Kueppert last edited by

                              @kueppert
                              Es schaut so aus, als ob system.adapter.tankerkoenig mal strings und mal float values enthält und dies natürlich nicht in ein schema passen.

                              Du könntest mir einen export aus der MySQL zukommen lassen. Die ID (Angezeigt beim start des jeweiligen imports) kannst du für eine WHERE bedingung beim Datenexport nutzen.

                              K 1 Reply Last reply Reply Quote 0
                              • K
                                Kueppert @JackGruber last edited by Kueppert

                                @jackgruber hab vermutlich den Fehler gefunden. Ich hab im Alias den "." zu einem "," konvertiert und den Typ auf string stehen gehabt...hab die Konvertierung jetzt rausgenommen und auf number umgestellt. Sollte das reichen? Entspricht das einem float?
                                Wenn nein, lösche ich wieder die InfluxDB (das measurement) und importiere nochmal alles neu...
                                Danke dir und vG. Thorsten 🙂

                                NACHTRAG: Tankerkönig schreibt wirklich nen String in seine Objekte beim Spritpreis, ich konvertiere zu number im Alias 😕 Kann ich dir "einfach" aus phpMyAdmin einen Export zukommen lassen? Ich weiß nur nicht, wie ich zB nur die Spritpreise da raus bekomme ^^ Hab aktuell 3Mio Datensätze, viele wollte ich in der Influx nach "Migration" löschen. Aber den string vom Tankerkönig bekomm ich ja nicht mit meinen ALias-Werten (number) gemerged so ohne weiteres...

                                JackGruber 1 Reply Last reply Reply Quote 0
                                • JackGruber
                                  JackGruber @Kueppert last edited by

                                  @Kueppert

                                  Ersetz das XYZ durch die ID aus der python ausgabe und führ beide Querys unter SQL im PhPMyAdmin aus.

                                  SELECT * FROM ts_string WHERE id = XYZ LIMIT 0, 100
                                  
                                  SELECT * FROM datapoints WHERE id = XYZ
                                  

                                  Dann für beide abfragen ganz unten auf der Seite Operationen für das Abfrageergebnis > Exportieren wählen.

                                  Dann kann ich es mir anschauen und evtl. ne Option reinbauen um Datensätze zu konvertieren.

                                  1 Reply Last reply Reply Quote 1
                                  • K
                                    Kueppert last edited by Kueppert

                                    @jackgruber danke dir für deine Rückmeldung. Ich habe herausgefunden, dass die Fehlermeldungen "nur" kamen bei neuen Eintragungen in die InfluxDB, die ich im Alias-DP falsch konvertiert hatte. Hab im ALias auf Zahl umgestellt und voila, InfluxDB schmeißt keine Fehler mehr 🙂
                                    Bin gerade dabei in der Konsole alle Maisurements zusammenzuführen, die zusammen gehören (hab zu oft die Bezeichnungen gewechselt). Werde zukünftig nur noch die Alias-Objekte loggen und dahinterliegende Geräte, sofern nötig, austauschen. Dann bleibt es immer bei der gleichen Bezeichnung.
                                    DANKE für dein tolles Skript für den Import in InfluxDB 👍 👍 👍 👍

                                    1 Reply Last reply Reply Quote 0
                                    • S
                                      schweigel last edited by

                                      Hallo,

                                      erstmal vielen Dank für das Skript.

                                      ts_numeric lässt sich ohne Probleme überführen, aber mit bool gibt es Probleme. Scheinbar sind die Daten in der Quelle nicht als bool sondern als float abgelegt. Daher wird eine Konvertierung nach boolean benötigt. Was muss an dem Skript angepasst werden, damit ts_bool vor der Überführung entsprechen konvertiert wird?

                                      Total metrics in ts_bool: 1
                                      wolf.0.cwl.158(ID: 98) (1/1)
                                      Processing row 1 to 1,000 from LIMIT 0 / 100,000 ts_bool - wolf.0.cwl.158 (1/1)
                                      InfluxDB error
                                      400: {"error":"partial write: field type conflict: input field \"value\" on measurement \"wolf.0.cwl.158\" is type float, already exists as type boolean dropped=200"}
                                      

                                      Grüße

                                      JackGruber 1 Reply Last reply Reply Quote 0
                                      • JackGruber
                                        JackGruber @schweigel last edited by JackGruber

                                        @schweigel was für float werte stehen in der ts_bool für den Datenpunkt?

                                        SELECT * FROM ts_bool WHERE id = 98 AND val != 0 AND val != 1 LIMIT 0, 10;
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • S
                                          schweigel last edited by

                                          @JackGruber Es sind nur 0 und 1 enthalten, deine Abfrage liefert also keine Zeilen zurück.

                                          JackGruber 1 Reply Last reply Reply Quote 0
                                          • JackGruber
                                            JackGruber @schweigel last edited by

                                            @schweigel
                                            Du hast in der InfluxDB bereits daten vom selben messpunkt, die float (Zahlen mit nachkommastellen) sind. Diese in bool (Wahrheitswerte) zu konvertieren macht eigentlich kein Sin.

                                            Aber du kannst versuchen das Script für dich anzupassen.
                                            Füge soetwas wie fields["value"] = float(record["value"]),nach Zeile 108 ein, dann wird versucht alle Werte in float zu wandeln.

                                            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

                                            1.1k
                                            Online

                                            31.6k
                                            Users

                                            79.4k
                                            Topics

                                            1.3m
                                            Posts

                                            31
                                            151
                                            18294
                                            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