[vz-users] Bevorstehender Kartencrash

Andreas Goetz cpuidle at gmail.com
Mi Jun 10 10:48:15 CEST 2020


Mhhm, alles sehr merkwürdig. Versuch bitte nochmal das Schema im Ziel anzulegen:

bin/doctrine orm:schema-tool:create --dump-sql      

Output bitte zeigen. Dann:

bin/doctrine orm:schema-tool:create —force

zum anlegen.

Vielen Dank, Andreas


> On 10. Jun 2020, at 10:44, John Doe <johndoe at null.net> wrote:
> 
> Hallo Andreas,
>  
> das scheint zunächst zu klappen:
>  
> pi at raspberrypi:~ $ /var/www/volkszaehler.org/vendor/bin/dbcopy create -c /etc/dbcopy.yaml
> Creating target schema
> Creating tables
> Updating schema assets for target platform compatibility: sqlite
>  
> Die dbcopy.yaml:
>  
> # DATABASE DEFINITION
> source:
>   driver: pdo_mysql
>   host: localhost
>   user: vz
>   password: demo
>   dbname: volkszaehler
> target:
>   driver: pdo_sqlite
>   host: localhost
>   user: root
>   password: raspberry
>   dbname: volkszaehler_backup
>   path: sqlite.db3        # path is only used if driver = pdo_sqlite
>  
> # influxdb target database connection
> influx:
>   dsn: influxdb://localhost:8086
>   dbname: volkszaehler
>   measurement: data
>  
> # TABLE DEFINITION
> # ----------------
> # tables will be processed in the order they are mentioned:
> #        - foreign keys on target will be dropped
> #        - if a table is not listed here, it will not be touched
> # transfer mode
> #        skip:        table will not be copied
> #        copy:        entire table will be truncated on target and copied from source
> #        pk:            selective copy by primary key. only data not present on target
> #                     will be copied from source.
> tables:
>   entities: copy
>   properties: copy
>   entities_in_aggregator: copy
>   data: pk
>   aggregate: skip
>  
> Bei Vertauschung von sorec und target passiert leider das:
>  
> pi at raspberrypi:~ $ /var/www/volkszaehler.org/vendor/bin/dbcopy copy -c /etc/dbcopy.yaml
> In CopyCommand.php line 49:
>                                                          
>   Table entities doesn't exist.To create the schema run  
>                                                          
>       doctrine.php orm:schema-tool:create --dump-sql        
>                                                          
> copy [-c|--config CONFIG] [-b|--batch BATCH] [-k|--keep-constraints] [--] [<tables>...]
>  
> Hättest Du noch einen Tip, oder ist mein Backup verloren ?
> Grüße
>  
> JD.
>  
>  
> Sent: Wednesday, June 10, 2020 at 10:35 AM
> From: "Andreas Goetz" <cpuidle at gmail.com>
> To: "volkszaehler.org - users" <volkszaehler-users at demo.volkszaehler.org>
> Subject: Re: [vz-users] Bevorstehender Kartencrash
> Klar:
>  
> ❯ ./vendor/bin/dbcopy 
> Database backup tool
>  
> Usage:
>   command [options] [arguments]
>  
> Options:
>   -h, --help  Display this help message.
>  
> Available commands:
>   clear   Clear target tables
>   copy    Run copy
>   create  Create target schema
>   drop    Drop target schema
>   help    Displays help for a command
>   influx  Copy data to InfluxDB
>   list    Lists commands
>  
> create wäre in diesem Fall das Kommando der Wahl!
>  
> Viele Grüße, Andreas
>  
> On 10. Jun 2020, at 09:52, John Doe <johndoe at null.net <mailto:johndoe at null.net>> wrote:
>  
> Hallo zusammen,
>  
> ein
>  
> DROP DATABASE volkszaehler;
> CREATE DATABASE volkszaehler;
>  
> hat nun leider zur Folge, das nach dem Wiederherstellen meines Backups mit
>  
> sudo /var/www/volkszaehler.org/vendor/bin/dbcopy <http://volkszaehler.org/vendor/bin/dbcopy> copy -c /etc/dbcopy.yaml
>  
> meine Kanäle weg sind.
> Hat noch jemand einen Tip, wie ich meine alten Daten wieder herstellen kann ?
> Beste Grüße
>  
> JD.
>  
>  
>  
>  
> Sent: Tuesday, June 09, 2020 at 7:07 PM
> From: "Andreas Goetz" <cpuidle at gmail.com <mailto:cpuidle at gmail.com>>
> To: "volkszaehler.org <http://volkszaehler.org/> - users" <volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>>
> Subject: Re: [vz-users] Bevorstehender Kartencrash
> Sieht aus als wären die Daten schon vorhanden (duplicate key)- hattest Du die Zieldatenbank denn wieder leer gemacht?
>  
> Viele Grüße, Andreas 
>  
> Am 09.06.2020 um 19:02 schrieb John Doe <johndoe at null.net <mailto:johndoe at null.net>>:
>  
> 
> Hallo Andreas,
>  
> es scheint prinzipiell am User, unabhängig vom PW zu liegen:
>  
> mysql -u root -h localhost volkszaehler
> ERROR 1698 (28000): Access denied for user 'root'@'localhost'
>  
> 127.0.0.1 führt zum gleichen Ergebnis.
> Mit
>  
> sudo mysql -u root -h localhost volkszaehler
>  
> klappt das Ganze. Leider hängt es nun hier:
>  
> data: copying 28925979 rows (partial copy)
>  [>---------------------------]   0%  < 1 sec/< 1 sec         0 rows
> In AbstractMySQLDriver.php line 55:
>                                                                                                                 
>   An exception occurred while executing 'INSERT INTO `data` (`id`,`channel_id`,`timestamp`,`value`) VALUES (?,  
>   ?,?,?)' with params ["77446", "1", "1559552806523", "52268.478"]:                                             
>                                                                                                                 
>   SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '77446' for key 'PRIMARY'               
>                                                                                                                 
> In PDOStatement.php line 119:
>                                                                                                    
>   SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '77446' for key 'PRIMARY'  
>                                                                                                    
> In PDOStatement.php line 117:
>                                                                                                    
>   SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '77446' for key 'PRIMARY'  
>                                                                                                    
> copy [-c|--config CONFIG] [-b|--batch BATCH] [-k|--keep-constraints] [--] [<tables>...]
>  
> Grüße
>  
> JD.
>  
>  
>  
> Sent: Tuesday, June 09, 2020 at 6:07 PM
> From: "Andreas Goetz" <cpuidle at gmail.com <mailto:cpuidle at gmail.com>>
> To: "volkszaehler.org <http://volkszaehler.org/> - users" <volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>>
> Subject: Re: [vz-users] Bevorstehender Kartencrash
>  
> On 9. Jun 2020, at 17:28, John Doe <johndoe at null.net <mailto:johndoe at null.net>> wrote:
>  
> Hallo Andreas,
>  
> das klappt nicht:
>  
> pi at raspberrypi:~ $ /var/www/volkszaehler.org/vendor/bin/dbcopy <http://volkszaehler.org/vendor/bin/dbcopy> copy -c /etc/dbcopy.yaml
> In AbstractMySQLDriver.php line 106:
>                                                                                                      
>   An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'  
>                                                                                                      
> In PDOConnection.php line 31:
>                                                                     
>   SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'  
>                                                                     
> In PDOConnection.php line 27:
>                                                                     
>   SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'  
>                                                                     
> copy [-c|--config CONFIG] [-b|--batch BATCH] [-k|--keep-constraints] [--] [<tables>...]
>  
>  
> Ich bin mir hundertprozentig sicher, dass die user/pw-Kombi stimmt ...
>  
> Das ist…. sehr unwahrscheinlich. Was passiert denn beim Login auf der Kommandozeile mit der gleichen Kombination (https://stackoverflow.com/questions/5131931/connecting-to-mysql-from-the-command-line <https://stackoverflow.com/questions/5131931/connecting-to-mysql-from-the-command-line>)?
>  
> Evtl. liegt es auch an https://github.com/volkszaehler/volkszaehler.org/pull/799 <https://github.com/volkszaehler/volkszaehler.org/pull/799>? 
>  
> Viele Grüße, Andreas
>  
> Grüße
>  
> JD.
>  
>  
> Sent: Tuesday, June 09, 2020 at 5:18 PM
> From: "Andreas Goetz" <cpuidle at gmail.com <mailto:cpuidle at gmail.com>>
> To: "volkszaehler.org <http://volkszaehler.org/> - users" <volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>>
> Subject: Re: [vz-users] Bevorstehender Kartencrash
> Sieht nicht offensichtlich falsch aus. Falls sie im Backup ist könntest Du auch noch die aggregate Tabelle kopieren, anderenfalls müsstest Du die im Ziel neu erstellen, sinnigerweise bevor Du Aggregation wieder einschaltest (sonst könnten sich die SQL Queries dazu aufstapeln).
>  
> Viele Grüße, Andreas
>  
>  
> On 9. Jun 2020, at 17:13, John Doe <johndoe at null.net <mailto:johndoe at null.net>> wrote:
>  
> Okay, letzte Frage: Passt das so, bevor ich starte?
>  
> # DATABASE DEFINITION
> source:
>   #driver: pdo_mysql
>   driver: pdo_sqlite
>   #host: localhost
>   #user: vz
>   #password: demo
>   #dbname: volkszaehler
>   path: sqlite.db3
> target:
>   driver: pdo_mysql
>   host: localhost
>   user: root
>   password: raspberry
>   dbname: volkszaehler
>   #path: sqlite.db3        # path is only used if driver = pdo_sqlite
> # influxdb target database connection
> influx:
>   dsn: influxdb://localhost:8086 <>
>   dbname: volkszaehler
>   measurement: data
> # TABLE DEFINITION
> # ----------------
> # tables will be processed in the order they are mentioned:
> #        - foreign keys on target will be dropped
> #        - if a table is not listed here, it will not be touched
> # transfer mode
> #        skip:        table will not be copied
> #        copy:        entire table will be truncated on target and copied from source
> #        pk:            selective copy by primary key. only data not present on target
> #                     will be copied from source.
> tables:
>   entities: copy
>   properties: copy
>   entities_in_aggregator: copy
>   data: pk
>   aggregate: skip
>  
>  
> Beste Grüße
>  
> JD.
>  
>  
> Sent: Tuesday, June 09, 2020 at 5:02 PM
> From: "Andreas Goetz" <cpuidle at gmail.com <mailto:cpuidle at gmail.com>>
> To: "volkszaehler.org <http://volkszaehler.org/> - users" <volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>>
> Subject: Re: [vz-users] Bevorstehender Kartencrash
> Ja genau- und mach auch von der „neuen“ Quelle vorher noch ein Backup! Better be safe than sorry...
>  
> Viele Grüße, Andreas
>  
>  
> Am 09.06.2020 um 17:00 schrieb John Doe <johndoe at null.net <mailto:johndoe at null.net>>:
>  
> 
> Hallo Andreas,
>  
> danke für die schnelle Reaktion.
> Dann opfere ich logischerweise den kleineren Datensatz.
> Die GrundIdee mit dem Vertauschen von Quelle und Ziel klappt aber dann ?
> Beste Grüße
>  
> JD.
>  
>  
> Sent: Tuesday, June 09, 2020 at 4:46 PM
> From: "Andreas Goetz" <cpuidle at gmail.com <mailto:cpuidle at gmail.com>>
> To: "volkszaehler.org <http://volkszaehler.org/> - users" <volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>>
> Subject: Re: [vz-users] Bevorstehender Kartencrash
> Hi,
>  
> On 9. Jun 2020, at 16:43, John Doe <johndoe at null.net <mailto:johndoe at null.net>> wrote:
>  
> Hallo zusammen,
>  
> bevor ich jetzt wieder Mist mit der Datenbank mache, würde ich gerne hier nachfragen.
>  
> 1. Neuer aufgesetzter VZ läuft zunächst mal wieder auf einem RPi3 wie gewünscht.
> 2. dbcopy läuft auch, ich kann lokal eine sqlite.db3 anlegen.
> 3. Da ich noch die Sicherung der alten DB habe (ebenfalls sqlite.db3), würde ich diese mit der aktuellen gerne "mergen". Kann ich das einfach doof und hoffentlich gefahrlos tun, indem ich in der dbcopy.yaml Quelle und Ziel vertausche ? Bleiben meine aktuell schon vorliegenden Daten existent ?
>  
> Das kannst Du auf KEINEN Fall tun:
>  
> - es gibt keinen “merge” Prozess
> - in beiden Datenbanken werden die gleichen IDs existieren
> - die Entities werden bei Default Einstellungen überschrieben
>  
> —> vmtl. Desaster
>  
> DBCopy ist ausschließlich dafür geeignet, “linear” von einer DB in eine andere DB zu kopieren die ein Subset der identischen Daten enthält. Bei Dir scheinen aber in beiden DBs disjunkte Datenbestände zu liegen- Du wirst nicht drum herum kommen einen der DB-Stände zu opfern.
>  
> Viele Grüße, 
> Andreas
>  
>  
> Beste Grüße
>  
> JD.
>  
>  
> Sent: Tuesday, June 09, 2020 at 9:24 AM
> From: "Andreas Goetz" <cpuidle at gmail.com <mailto:cpuidle at gmail.com>>
> To: "volkszaehler.org <http://volkszaehler.org/>- users" <volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>>
> Subject: Re: [vz-users] Bevorstehender Kartencrash
> Hallo Christian,
>  
> On 8. Jun 2020, at 19:46, Christian Wimmer <christian at nega.at <mailto:christian at nega.at>> wrote:
>  
> Hallo JD
>  
> Danke, das hört sich gut an. Ich verwende nur Sandisk.
>  
> Am liebsten würde ich ja die DB auf das NAS auslagern, so dass nur dort geschrieben wird.
> Aber das liest sich alles so kompliziert.
>  
> Jetzt verbreitest Du aber ziemliche Panik ;)
>  
> Eine Datenbank auf dem NAS zu nutzen statt einer Datenbank auf dem Raspi bedeutet einfach nur die Konfigurationsdatei zu ändern (URL, User, Passwort). Wenn Du z.B. schon ein Backup auf dem NAS hättest könnte das direkt Deine “Haupt”Datenbank werden (brauchst Du dann natürlich ein neues Backup).
>  
> Viele Grüße,
> Andreas
>  
>  
>  
>  
>  
> Von: volkszaehler-users <volkszaehler-users-bounces at demo.volkszaehler.org <mailto:volkszaehler-users-bounces at demo.volkszaehler.org>> Im Auftrag von John Doe
> Gesendet: Montag, 8. Juni 2020 19:15
> An:volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>
> Betreff: Re: [vz-users] Bevorstehender Kartencrash
>  
> Hallo Christian,
>  
> das hängt wohl auch von der Aggregation-Time ab. Ich glaube aber tendenziell ausgemacht zu haben, dass Sandisk-Karten bei gleicher vzlogger.conf länger halten als Transcend. Erstere lief bei mir über Jahre, letztere einige Monate bis ca. halbes Jahr.
> Beste Grüße
>  
> JD.
>  
>  
> Sent: Monday, June 08, 2020 at 6:13 PM
> From: "Christian Wimmer" <christian at nega.at <mailto:christian at nega.at>>
> To: "volkszaehler.org <http://volkszaehler.org/>- users" <volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>>
> Subject: Re: [vz-users] Bevorstehender Kartencrash
> Hallo
>  
> Frage zwischendurch: wie lange hält im Durchschnitt eine SD-Karte?
>  
>  
>  
> Von: volkszaehler-users <volkszaehler-users-bounces at demo.volkszaehler.org <mailto:volkszaehler-users-bounces at demo.volkszaehler.org>> Im Auftrag von Andreas Goetz
> Gesendet: Montag, 8. Juni 2020 17:34
> An: volkszaehler-users <volkszaehler-users at demo.volkszaehler.org <mailto:volkszaehler-users at demo.volkszaehler.org>>
> Betreff: Re: [vz-users] Bevorstehender Kartencrash
>  
> Servus
> 
>  
> On 8. Jun 2020, at 16:38, Daniel Lauckner <vz at jahp.de <mailto:vz at jahp.de>> wrote:
>  
> Hallo,
> 
> 
> am Montag, 8. Juni 2020 um 11:02 hat John Doe geschrieben:
>  
> Gibt es ein wiki zum Docker-Image und dessen Installation ?
> 
> Nein.
>  
> Also “Installation” ist ja bei Docker relativ :). Wenn Du schmerzresistent bist (und es am Ende dokumentieren möchtest) lass es uns gerne zusammen ausprobieren ;). Das Image heißt volkszaehler/volkszaehler, die Oberfläche+API lauscht dann auf 8080. Die Configdatei muss nach /vz/etc/middleware.json gemappt werden.
>  
> Falls ich Deinen Weg mit der Datenbank-Installation auf dem NAS
> gehe: Welche DB-Software würdest Du vorschlagen ?
> 
> Am besten die SQL-Datenbank was das NAS anbietet.
> Üblicherweise MySQL oder MariaDB.
>  
> …oder einfach auch einen Docker Container mit Volume Mount für die Datenablage. Normalerweise sind diese Images deutlich besser als jede NAS-gebundelte Funktionalität und bekommen auch häufigere Updates.
> 
>  
> Mit freundlichen Grüßen
> Daniel
>  
> Viele Grüße, Andreas

-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://demo.volkszaehler.org/pipermail/volkszaehler-users/attachments/20200610/45b1292f/attachment-0001.html>


Mehr Informationen über die Mailingliste volkszaehler-users