Re: [vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl

2021-08-17 Diskussionsfäden John Doe
Hallo Thomas,

 

auf Demo-Daten hatte ich nicht geachtet, werde ich zeitnah nachholen.

Die DB sollte intakt sein, da ich zuerst ein älteres Backup der sqlite.db3 auf dem RPi 3 auf einer frischen Karte wieder eingespielt und einige Tage laufen gelassen habe. Bis hierher sieht alles einwandfrei aus. Die nun von mir verwendete sqlite.db3 ist ein tagesaktuelles Backup von heute.

Grüße

 

JD.

 
 

Sent: Tuesday, August 17, 2021 at 5:17 PM
From: "Thomas Höpfner" 
To: "volkszaehler.org - users" 
Subject: Re: [vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl


Hi,
sorry so weit habe ich nicht gelesen.
Bei der Installation werden meiner Meinung nach Demo-Daten angeboten. Hast du diese probiert? Dbcopy braucht sehr lange, aber ein Fortschritt sollte erkennbar sein..

 

Eventuell ist DB auch kaputter wie du denkst.

 
Thomas 
 



Am 17.08.2021 um 14:38 schrieb John Doe :
 





Hallo Thomas,

 

wie ich unter 7. schrieb hatte ich source und target in der dbcopy.yaml vor dem copy getauscht. Aber nochmal zur Eindeutigkeit:

 

Mit dieser dbcopy.yaml

 


pi@raspberrypi:~ $ cat /etc/dbcopy.yaml
# DATABASE DEFINITION
target:
  driver: pdo_mysql
  host: localhost
  user: root
  password: demo
  dbname: volkszaehler

source:
  driver: pdo_sqlite
  host: localhost
  user: root
  password: raspberry
  dbname: volkszaehler_backup
  path: /home/pi/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

 

 

ergibt sich das genannte Symptom.

Grüße

 

JD.

 

 


 

 

 
 

Sent: Tuesday, August 17, 2021 at 2:29 PM
From: "Thomas Höpfner" 
To: "volkszaehler.org - users" 
Subject: Re: [vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl



deine dbcopy.yaml ist noch vom Backup 

 

Thomas 
 

 


 
Am 17.08.2021 um 14:18 schrieb John Doe :
 



dbcopy.yaml


















Re: [vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl

2021-08-17 Diskussionsfäden Thomas Höpfner
Hi,
sorry so weit habe ich nicht gelesen.
Bei der Installation werden meiner Meinung nach Demo-Daten angeboten. Hast du 
diese probiert? Dbcopy braucht sehr lange, aber ein Fortschritt sollte 
erkennbar sein..

Eventuell ist DB auch kaputter wie du denkst.

Thomas 

Am 17.08.2021 um 14:38 schrieb John Doe :


Hallo Thomas,
 wie ich unter 7. schrieb hatte ich source und target in der dbcopy.yaml vor 
dem copy getauscht. Aber nochmal zur Eindeutigkeit:
 Mit dieser dbcopy.yaml
 pi@raspberrypi:~ $ cat /etc/dbcopy.yaml
# DATABASE DEFINITION
target:
  driver: pdo_mysql
  host: localhost
  user: root
  password: demo
  dbname: volkszaehler
source:
  driver: pdo_sqlite
  host: localhost
  user: root
  password: raspberry
  dbname: volkszaehler_backup
  path: /home/pi/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
  ergibt sich das genannte Symptom.
Grüße
 JD.
  Sent: Tuesday, August 17, 2021 at 2:29 PM
From: "Thomas Höpfner" 
To: "volkszaehler.org - users" 
Subject: Re: [vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl
deine dbcopy.yaml ist noch vom Backup 
 Thomas 
    Am 17.08.2021 um 14:18 schrieb John Doe :
 dbcopy.yaml


Re: [vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl

2021-08-17 Diskussionsfäden John Doe
Hallo Thomas,

 

wie ich unter 7. schrieb hatte ich source und target in der dbcopy.yaml vor dem copy getauscht. Aber nochmal zur Eindeutigkeit:

 

Mit dieser dbcopy.yaml

 


pi@raspberrypi:~ $ cat /etc/dbcopy.yaml
# DATABASE DEFINITION
target:
  driver: pdo_mysql
  host: localhost
  user: root
  password: demo
  dbname: volkszaehler

source:
  driver: pdo_sqlite
  host: localhost
  user: root
  password: raspberry
  dbname: volkszaehler_backup
  path: /home/pi/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

 

 

ergibt sich das genannte Symptom.

Grüße

 

JD.

 

 


 

 

 
 

Sent: Tuesday, August 17, 2021 at 2:29 PM
From: "Thomas Höpfner" 
To: "volkszaehler.org - users" 
Subject: Re: [vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl



deine dbcopy.yaml ist noch vom Backup 

 

Thomas 
 

 


 
Am 17.08.2021 um 14:18 schrieb John Doe :
 



dbcopy.yaml









Re: [vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl

2021-08-17 Diskussionsfäden Thomas Höpfner
deine dbcopy.yaml ist noch vom Backup 

Thomas 



Am 17.08.2021 um 14:18 schrieb John Doe :

dbcopy.yaml


[vz-users] Datenbank-Umzug auf neuen Raspi schlägt fehl

2021-08-17 Diskussionsfäden John Doe
Hallo zusammen,

 

nach einigen Kartencrashs möchte ich mein System auf etwas stabilere Füße in Form eines RPi 4, der von SSD bootet, stellen.

Was ich bisher getan habe:

 

1. Aktuelles Image installiert (der Fehler beim Booten lag tatsächlich an einem zu schwachen Netzteil, mit 18W läuft alles).

 

2. Ein sqlite.db3 (Backup) ins home-Verzeichnis des RPi4 kopiert.

 

3. dbcopy.yaml und vzlogger.conf kopiert:

 

dbcopy.yaml:

 


# DATABASE DEFINITION
source:
  driver: pdo_mysql
  host: localhost
  user: root
  password: demo
  dbname: volkszaehler

target:
  driver: pdo_sqlite
  host: localhost
  user: root
  password: raspberry
  dbname: volkszaehler_backup
  path: /home/pi/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

 

 

vzlogger.conf:

 


{
  "retry": 0,
  "daemon": true,
  "verbosity": 0,
  "log": "/var/log/vzlogger.log",
  "local": {
    "enabled": false,
    "port": 8080,
    "index": false,
    "timeout": 0,
    "buffer": 0
  },
  "meters": [
    {
  "enabled": true,
  "allowskip": false,
  "interval": -1,
  "aggtime": -1,
  "aggfixedinterval": false,
  "channels": [
    {
  "uuid": "36743eb0-8518-11e9-a32c-2f8e238be491",
  "identifier": "1-0:1.8.1*255",
  "api": "volkszaehler",
  "middleware": "http://localhost/middleware.php",
  "secretKey": "",
  "type": "device",
  "scaler": 1,
  "aggmode": "none",
  "duplicates": 0
    }
  ],
  "protocol": "d0",
  "device": "/dev/ttyUSB0",
  "baudrate": 9600,
  "parity": "7e1",
    },
    {
  "enabled": true,
  "allowskip": false,
  "interval": -1,
  "aggtime": -1,
  "aggfixedinterval": false,
  "channels": [
    {
  "uuid": "d28a7a20-8518-11e9-8699-198afa78ae1b",
  "identifier": "1-0:1.8.1*255",
  "api": "volkszaehler",
  "middleware": "http://localhost/middleware.php",
  "secretKey": "",
  "type": "device",
  "scaler": 1,
  "aggmode": "none",
  "duplicates": 0
    }
  ],
  "protocol": "d0",
  "device": "/dev/ttyUSB1",
  "baudrate": 9600,
  "parity": "7e1",
   }
  ]
}

 

4. Auf dem neuen RPi 4:

 

 


pi@raspberrypi:~ $ sudo /var/www/volkszaehler.org/vendor/bin/dbcopy create -c /etc/dbcopy.yaml

In AbstractMySQLDriver.php line 112:
   
  An exception occurred in driver: SQLSTATE[HY000] [1049] Unknown database 'volkszaehler'  
   

In Exception.php line 18:
  
  SQLSTATE[HY000] [1049] Unknown database 'volkszaehler'  
  

In PDOConnection.php line 38:
  
  SQLSTATE[HY000] [1049] Unknown database 'volkszaehler'  
  

create [-c|--config CONFIG]

 

5.

 


pi@raspberrypi:~ $ sudo mysql --user=root -praspberry
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 316
Server version: 10.3.29-MariaDB-0+deb10u1 Raspbian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW DATABASES;
++
| Database   |
++
| information_schema |
| mysql  |
| performance_schema |
++
3 rows in set (0.001 sec)

MariaDB [(none)]> CREATE DATABASE volkszaehler;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> SHOW DATABASES;
++
| Database   |
++
| information_schema |
| mysql  |
| performance_schema |
| volkszaehler   |
++
4 rows in set (0.001 sec)

MariaDB [(none)]> exit
Bye

 


 


6.

 


pi@raspberrypi:~ $ sudo /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