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

      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
          • apollon77
            apollon77 last edited by

            Mach mal 🙂

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

              So, hab den adapter jetzt neu installiert. Selber fehler cannot find module pg-negative.

              Hier der Install-Log:

              $ ./iobroker add sql
              npm install iobroker.sql --production --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.7 (node-v46 ABI) (falling back to source compile with node-gyp) 
              
              ../src/database.cc: In static member function ‘static void node_sqlite3::Database::Work_BeginOpen(node_sqlite3::Database::Baton*)’:../src/database.cc:144:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),
                       ^
              
              ../src/database.cc: In static member function ‘static void node_sqlite3::Database::Work_BeginClose(node_sqlite3::Database::Baton*)’:../src/database.cc:230:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),
                       ^
              
              ../src/database.cc: In static member function ‘static void node_sqlite3::Database::Work_BeginExec(node_sqlite3::Database::Baton*)’:../src/database.cc:525:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),
                       ^
              
              ../src/database.cc: In static member function ‘static void node_sqlite3::Database::Work_BeginLoadExtension(node_sqlite3::Database::Baton*)’:../src/database.cc:625:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),
                       ^
              
              ../src/statement.cc: In static member function ‘static void node_sqlite3::Statement::Work_BeginPrepare(node_sqlite3::Database::Baton*)’:../src/statement.cc:118:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),
                       ^
              
              In file included from ../src/statement.cc:6:0:../src/statement.cc: In static member function ‘static void node_sqlite3::Statement::Work_BeginBind(node_sqlite3::Statement::Baton*)’:
              ../src/macros.h:125:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),                              \
                       ^
              ../src/statement.cc:322:5: note: in expansion of macro ‘STATEMENT_BEGIN’
                   STATEMENT_BEGIN(Bind);
                   ^
              
              ../src/statement.cc: In static member function ‘static void node_sqlite3::Statement::Work_BeginGet(node_sqlite3::Statement::Baton*)’:../src/macros.h:125:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),                              \
                       ^
              ../src/statement.cc:370:5: note: in expansion of macro ‘STATEMENT_BEGIN’
                   STATEMENT_BEGIN(Get);
                   ^
              
              ../src/statement.cc: In static member function ‘static void node_sqlite3::Statement::Work_BeginRun(node_sqlite3::Statement::Baton*)’:../src/macros.h:125:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),                              \
                       ^
              ../src/statement.cc:438:5: note: in expansion of macro ‘STATEMENT_BEGIN’
                   STATEMENT_BEGIN(Run);
                   ^
              
              ../src/statement.cc: In static member function ‘static void node_sqlite3::Statement::Work_BeginAll(node_sqlite3::Statement::Baton*)’:../src/macros.h:125:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),                              \
                       ^
              ../src/statement.cc:504:5: note: in expansion of macro ‘STATEMENT_BEGIN’
                   STATEMENT_BEGIN(All);
                   ^
              
              ../src/statement.cc: In static member function ‘static void node_sqlite3::Statement::Work_BeginEach(node_sqlite3::Statement::Baton*)’:../src/macros.h:125:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),                              \
                       ^
              ../src/statement.cc:601:5: note: in expansion of macro ‘STATEMENT_BEGIN’
                   STATEMENT_BEGIN(Each);
                   ^
              
              ../src/statement.cc: In static member function ‘static void node_sqlite3::Statement::Work_BeginReset(node_sqlite3::Statement::Baton*)’:../src/macros.h:125:9: warning: unused variable ‘status’ [-Wunused-variable]
                   int status = uv_queue_work(uv_default_loop(),                              \
                       ^
              ../src/statement.cc:724:5: note: in expansion of macro ‘STATEMENT_BEGIN’
                   STATEMENT_BEGIN(Reset);
                   ^
              
              host.raspberrypi install adapter sql
              got /opt/iobroker/node_modules/iobroker.sql/admin
              upload [5] sql.admin /opt/iobroker/node_modules/iobroker.sql/admin/words.js words.js application/javascript
              upload [4] sql.admin /opt/iobroker/node_modules/iobroker.sql/admin/sql.png sql.png image/png
              upload [3] sql.admin /opt/iobroker/node_modules/iobroker.sql/admin/index_m.html index_m.html text/html
              upload [2] sql.admin /opt/iobroker/node_modules/iobroker.sql/admin/index.html index.html text/html
              upload [1] sql.admin /opt/iobroker/node_modules/iobroker.sql/admin/custom_m.html custom_m.html text/html
              upload [0] sql.admin /opt/iobroker/node_modules/iobroker.sql/admin/custom.html custom.html text/html
              host.raspberrypi object system.adapter.sql created
              host.raspberrypi object _design/custom created
              host.raspberrypi create instance sql
              host.raspberrypi object sql.0.info.connection created
              host.raspberrypi object sql.0.info created
              host.raspberrypi object system.adapter.sql.0.outputCount created
              host.raspberrypi object system.adapter.sql.0.inputCount created
              host.raspberrypi object system.adapter.sql.0.uptime created
              host.raspberrypi object system.adapter.sql.0.memRss created
              host.raspberrypi object system.adapter.sql.0.memHeapTotal created
              host.raspberrypi object system.adapter.sql.0.memHeapUsed created
              host.raspberrypi object system.adapter.sql.0.connected created
              host.raspberrypi object system.adapter.sql.0.alive created
              host.raspberrypi object system.adapter.sql.0 created
              process exited with code 0
              
              1 Reply Last reply Reply Quote 0
              • apollon77
                apollon77 last edited by

                node -v

                npm -v

                ?

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

                  node v4.8.7

                  npm v2.15.11

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

                    Bei mir auch. interessant.

                    Erstmal. Wenn ich deinen befehl von oben kopiere sind bei den "zwei Minuszeichen" eines irgendwie komisch. Tipp es am besten mal ab. Dann tut es auch bei mir. Irgendwie sind da wohl komische Zeichen rein gekommen!! vllt sind auch die leerzeichen komisch

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

                      Aja super, jetzt hat er gestartet. zwar auch mit der fehlermeldung aber danach lief sql an. Und jetzt läuft der Converter grad durch 🙂

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

                        Na dann warten wir mal was der nächste Crash sagt (falls einer kommt)

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

                          Hmm zu früh gefreut. Erst kamen jede Menge fehler

                          { [Error: connect ETIMEDOUT]
                            errorno: 'ETIMEDOUT',
                            code: 'ETIMEDOUT',
                            syscall: 'connect',
                            fatal: true }
                          

                          und jetzt

                          { [Error: Connection lost: The server closed the connection.] fatal: true, code: 'PROTOCOL_CONNECTION_LOST' }
                          Reconnection to DB.
                          Reconnection to DB.
                          root@raspberrypi:/opt/iobroker#
                          
                          1 Reply Last reply Reply Quote 0
                          • apollon77
                            apollon77 last edited by

                            Bitte schick mal komplett. Nicht nur auszüge

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

                              Hallo, bin sch 3x umgezogen!

                              Zuerst von XS1 (FS20 protokoll auf SD-Karte) auf den History-Adapter -> auf MySQL -> PostgreSQL wo ich nun seit 1 Jahr bin, nur vom Raspi auf opi2e und dann noch auf einen CSL-NUK umgezogen.

                              Postgres braucht weniger ressourcen und ist meiner Meinung scheller. AUf dem Raspi war das ein Problem da dort der Speicher sehr langsam ist (egal ob SD oder USB), und außerdem .

                              Es gibt ein nettes admin-tool für PostgreSQL, pgAdmin (https://www.pgadmin.org/download/) mit dem ich auf die verschiedenen DB's an den Test-Rechnern oder am Echtzeitsystem zugreifen kann.

                              Momentan hab ich ca 2,2 Millionen Datenpunkte im ts_numbers (und noch mal 200k in ts_bool und ts_string), Daten die teilweise bis 5 Jahre zurückreichen.

                              Wichtig, hab mir ein kleines script geschrieben (hatte das auch auf MySQL) welches ein Backup von ioBroker und ein Backup (dump) der SQL erzeugt und speichere das wöchentlich auf das NAS.

                              Bei MySQL war das

                              sudo mysqldump -uroot -ppi --all-databases ...
                              

                              Jetzt bei PostgreSQL

                              sudo -u postgres pg_dump iobroker | gzip > /mnt/nas/.../postgres.backup.$(date '+%Y%m%d').sql.gz
                              

                              iobroker wird mit

                              BFILE=`sudo iobroker backup | cut -d " " -f 3`
                              cp -v $BFILE /mnt/nas/.../
                              
                              

                              ins gleiche Verzeichnis gespeichert.

                              Das SQL Backup ist bei mir mit gzip momentan 18MB, iobroker ~1MB.

                              Diese Methode hat mir schon mal das Leben (die Daten) gerettet da mir am Raspi eine SD und später auch ein USB-Stick abgeschmiert ist. Das war der Grund warum ich dann auf opi2e und später auf den NUK (alles unter Linux) umgestiegen bin da diese MMC's als Speicher haben.

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

                                { [Error: connect ETIMEDOUT]
                                  errorno: 'ETIMEDOUT',
                                  code: 'ETIMEDOUT',
                                  syscall: 'connect',
                                  fatal: true }
                                { [Error: connect ETIMEDOUT]
                                  errorno: 'ETIMEDOUT',
                                  code: 'ETIMEDOUT',
                                  syscall: 'connect',
                                  fatal: true }
                                { [Error: connect ETIMEDOUT]
                                  errorno: 'ETIMEDOUT',
                                  code: 'ETIMEDOUT',
                                  syscall: 'connect',
                                  fatal: true }
                                { [Error: connect ETIMEDOUT]
                                  errorno: 'ETIMEDOUT',
                                  code: 'ETIMEDOUT',
                                  syscall: 'connect',
                                  fatal: true }
                                Datatype hm-rega.0.3650: Currently: number, StorageType: Number
                                INSERT INTO `iobroker`.ts_number (id, ts, val, ack, _from, q) VALUES(1, 1518537565661, 0, 1, 1, 0);
                                new value received for hm-rega.0.3650, new-value=0.3, ts=1518537581242, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0, new-value=0.3, ts=1518537581242
                                new value received for hm-rega.0.3650, new-value=0.4, ts=1518537585291, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.3, new-value=0.4, ts=1518537585291
                                new value received for hm-rega.0.2477, new-value=0.2, ts=1518537587246, relog=false
                                Min-Delta reached hm-rega.0.2477, last-value=0, new-value=0.2, ts=1518537587246
                                new value received for hm-rega.0.3650, new-value=0.5, ts=1518537587261, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.4, new-value=0.5, ts=1518537587261
                                new value received for hm-rega.0.16972, new-value=27.3, ts=1518537587261, relog=false
                                Min-Delta reached hm-rega.0.16972, last-value=27.2, new-value=27.3, ts=1518537587261
                                new value received for hm-rega.0.3650, new-value=0.7, ts=1518537591260, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.5, new-value=0.7, ts=1518537591260
                                new value received for hm-rega.0.3650, new-value=0.6, ts=1518537593263, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.7, new-value=0.6, ts=1518537593263
                                new value received for hm-rega.0.3650, new-value=0.5, ts=1518537595256, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.6, new-value=0.5, ts=1518537595256
                                new value received for hm-rega.0.3650, new-value=0.6, ts=1518537599251, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.5, new-value=0.6, ts=1518537599251
                                new value received for hm-rega.0.3650, new-value=0.7, ts=1518537601267, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.6, new-value=0.7, ts=1518537601267
                                new value received for hm-rega.0.3650, new-value=0.6, ts=1518537607279, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.7, new-value=0.6, ts=1518537607279
                                new value received for hm-rpc.0.MEQ0690418.1.FILLING_LEVEL, new-value=100, ts=1518537607722, relog=false
                                value not changed hm-rpc.0.MEQ0690418.1.FILLING_LEVEL, last-value=100, new-value=100, ts=1518537607722
                                new value received for hm-rega.0.3650, new-value=0.5, ts=1518537609267, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.6, new-value=0.5, ts=1518537609267
                                new value received for hm-rega.0.3650, new-value=0.6, ts=1518537611280, relog=false
                                Min-Delta reached hm-rega.0.3650, last-value=0.5, new-value=0.6, ts=1518537611280
                                Datatype hm-rega.0.2477: Currently: number, StorageType: Number
                                INSERT INTO `iobroker`.ts_number (id, ts, val, ack, _from, q) VALUES(2, 1518537587246, 0.2, 1, 1, 0);
                                Datatype hm-rega.0.16972: Currently: number, StorageType: Number
                                INSERT INTO `iobroker`.ts_number (id, ts, val, ack, _from, q) VALUES(4, 1518537587261, 27.3, 1, 1, 0);
                                Datatype hm-rega.0.3650: Currently: number, StorageType: Number
                                INSERT INTO `iobroker`.ts_number (id, ts, val, ack, _from, q) VALUES(1, 1518537611280, 0.6, 1, 1, 0);
                                { [Error: Connection lost: The server closed the connection.] fatal: true, code: 'PROTOCOL_CONNECTION_LOST' }
                                Reconnection to DB.
                                Reconnection to DB.
                                root@raspberrypi:/opt/iobroker#
                                
                                1 Reply Last reply Reply Quote 0
                                • apollon77
                                  apollon77 last edited by

                                  Also mein Tipp ist das die Mysql die Verbindung geschlossen hat. Schau mal ob das MySQL Log irgendwas hergibt. Ansonsten nutze mal die Parameter um die Geschwindigkeit etwas zu verlangsamen von dem Skript

                                  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

                                  869
                                  Online

                                  32.0k
                                  Users

                                  80.4k
                                  Topics

                                  1.3m
                                  Posts

                                  5
                                  38
                                  3803
                                  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