[vz-users] Hilfe bei Setup von dbcopy

Andreas Goetz cpuidle at gmail.com
Tue Dec 6 22:11:07 CET 2016


Servus,

> On 6 Dec 2016, at 21:31, Theo <geocaching.theo at me.com> wrote:
> 
> Hi,
> 
> also ich hab die dbcopy.json um die drei zeilen erleichtert und habe dbcopy upgedatet. Hab ich doch mit sudo git pull richtig gemacht, oder?

git pull sollte reichen. Davon ab- wie gesagt gibt es schon ein dbcopy im vz Ordner. Dann reicht composer update.

> composer sagte mir das nix zum installieren oder updaten da ist.

Wenn du’s im dbcopy Ordner ausführst, ja. Im vz Ordner hätte das geklappt.

> 
> Aber ein erneutes erstellen der Zieldatenbank führte zu folgendem:
> 
> pi at raspberrypi:/var/www/volkszaehler.org/vendor/andig/dbcopy $ /var/www/volkszaehler.org/vendor/bin/dbcopy.php create -c /etc/dbcopy.json
> Creating target schema
> Creating tables
> Updating schema assets for target platform compatibility: sqlite
> table: aggregate
> table: data
> table: entities
> table: entities_in_aggregator
> table: properties
> CREATE TABLE aggregate (id INTEGER NOT NULL, channel_id INTEGER NOT NULL, type BOOLEAN NOT NULL, timestamp BIGINT NOT NULL, value DOUBLE PRECISION NOT NULL, count INTEGER NOT NULL, PRIMARY KEY(id))
> CREATE UNIQUE INDEX ts_uniq ON aggregate (channel_id, type, timestamp)
> CREATE TABLE data (id INTEGER NOT NULL, channel_id INTEGER DEFAULT NULL, timestamp BIGINT NOT NULL, value DOUBLE PRECISION NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_ADF3F36372F5A1AA FOREIGN KEY (channel_id) REFERENCES entities (id) NOT DEFERRABLE INITIALLY IMMEDIATE)
> CREATE UNIQUE INDEX data_unique ON data (channel_id, timestamp)
> CREATE INDEX IDX_ADF3F36372F5A1AA ON data (channel_id)
> CREATE TABLE entities (id INTEGER NOT NULL, uuid VARCHAR(36) NOT NULL, type VARCHAR(255) NOT NULL, class VARCHAR(255) NOT NULL, PRIMARY KEY(id))
> CREATE UNIQUE INDEX UNIQ_50EC64E5D17F50A6 ON entities (uuid)
> CREATE TABLE entities_in_aggregator (parent_id INTEGER NOT NULL, child_id INTEGER NOT NULL, PRIMARY KEY(parent_id, child_id), CONSTRAINT FK_2BD88468727ACA70 FOREIGN KEY (parent_id) REFERENCES entities (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_2BD88468DD62C21B FOREIGN KEY (child_id) REFERENCES entities (id) NOT DEFERRABLE INITIALLY IMMEDIATE)
> CREATE INDEX IDX_2BD88468727ACA70 ON entities_in_aggregator (parent_id)
> CREATE INDEX IDX_2BD88468DD62C21B ON entities_in_aggregator (child_id)
> CREATE TABLE properties (id INTEGER NOT NULL, entity_id INTEGER DEFAULT NULL, pkey VARCHAR(255) NOT NULL, value CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_87C331C781257D5D FOREIGN KEY (entity_id) REFERENCES entities (id) NOT DEFERRABLE INITIALLY IMMEDIATE)
> CREATE UNIQUE INDEX property_unique ON properties (entity_id, pkey)
> CREATE INDEX IDX_87C331C781257D5D ON properties (entity_id)
>                                                                                 
>   [Doctrine\DBAL\Exception\ReadOnlyException]                                   
>   An exception occurred while executing 'CREATE TABLE aggregate (id INTEGER NO  
>   T NULL, channel_id INTEGER NOT NULL, type BOOLEAN NOT NULL, timestamp BIGINT  
>    NOT NULL, value DOUBLE PRECISION NOT NULL, count INTEGER NOT NULL, PRIMARY   
>   KEY(id))':                                                                    
>   SQLSTATE[HY000]: General error: 8 attempt to write a readonly database        
>                                                                                 
> 
>                                                                           
>   [Doctrine\DBAL\Driver\PDOException]                                     
>   SQLSTATE[HY000]: General error: 8 attempt to write a readonly database  
>                                                                           
> 
>                                                                           
>   [PDOException]                                                          
>   SQLSTATE[HY000]: General error: 8 attempt to write a readonly database  
>                                                                           
> 
> scheinbar ist die zieldatenbank readonly. Aber wo und wie kann ich das fixen?

Wo liegt denn die Datei? Was greift parallel darauf zu? Welche Rechte haben Datei und Du? Aus Versehen beim ersten mal als root erstellt?

Suche erstmal nach den logischen Ursachen für eine nicht schreibbare Datei ;)

Viele Grüße, Andreas

> 
> Gruß Tobias
> Am 06.12.2016 um 19:26 schrieb Andreas Goetz:
> 
>> Deine Config funktioniert genau so. Auf der SQlite Seite kannst Du Dir die Punkte sparen:
>> 
>>                 "host": "localhost",
>>                 "user": "vz",
>>                 "password": "xxx"
>> 
>> 
>> Leider gabs einen Fehler in dbcopy, den hab ich gerade gefixt.
>> 
>> Viele Grüße,
>> Andreas
>> 
>> 
>> 2016-12-06 18:26 GMT+01:00 Theo <geocaching.theo at me.com <mailto:geocaching.theo at me.com>>:
>> Hallo,
>> 
>> genau das ist es ja was ich wissen will, habe doch jetzt mehrfach geschrieben das ich nicht weiß was ich bei path angeben muss.
>> 
>> Aber hier ist nochmal die komplette dbcopy.json 
>> 
>> {
>>         "source": {
>>                 // source database connection
>>                 "driver": "pdo_mysql",
>>                 "host": "localhost",
>>                 "user": "vz",
>>                 "password": "xxx",
>>                 "dbname": "volkszaehler"
>>         },
>>         "target": {
>>                 // target database connection
>>                 "driver": "pdo_sqlite",
>>                 "path": "sqlite.db3",           // path is only used if driver =$
>>                 "host": "localhost",
>>                 "user": "vz",
>>                 "password": "xxx"
>>                 // "dbname": "backup"
>>         },
>>         "tables": [
>>                 // table configuration (optional)
>>                 // ------------------------------
>>                 // table name
>>                 //              tables will be processed in the order they are m$
>>                 //              - foreign keys on target will be dropped
>>                 //              - if a table is not listed here, it will not be $
>>                 // transfer mode
>>                 //              skip:           table will not be copied
>>                 //              copy:           entire table will be truncated o$
>>                 //              pk:                     selective copy by primar$
>>                 //                                              will be copied f$
>>                 {
>>                         "name": "entities",
>>                         "mode": "copy"
>>                 }, {
>>                         "name": "properties",
>>                         "mode": "copy"
>>                 }, {
>>                         "name": "entities_in_aggregator",
>>                         "mode": "copy"
>>                 }, {
>>                         "name": "data",
>>             	     "mode": "pk"
>>                 }, {
>>                         "name": "aggregate",
>>                         "mode": "skip"
>>                 }
>>         ]
>> }
>> 
>> ein andere Problem das ich habe, ich wollte für die Zukunft composer global aufrufbar machen, damit mir das gezuchtel erspart bleibt. dazu hab ich wie auf https://getcomposer.org/doc/00-intro.md#globally <https://getcomposer.org/doc/00-intro.md#globally> beschrieben die copmposer.phar in den Ordner /usr/local/bin/ verschoben. Aber wenn ich dann z.b. bei /var/www/voklszaehler.org/vendor/andig/dbcopy <http://voklszaehler.org/vendor/andig/dbcopy>  composer aufrufen möchte mit z.b. composer update, bekomme ich die Meldung -bash: composer: command not found
>> 
>> 
>> Gruß Tobias
>> 
>> 
>> 
>> 
>> 
>> 
>> Am 06.12.2016 um 18:08 schrieb Andreas Götz:
>> 
>>> Statt Rätselraten wäre die Config hilfreich. Hast Du target auf sqlite geändert? Den Pfad zur Datenbankdatei (path) konfiguriert?
>>> 
>>> Viele Grüße,
>>> Andreas
>>> 
>>> Am 06.12.2016 um 16:17 schrieb Theo <geocaching.theo at me.com <mailto:geocaching.theo at me.com>>:
>>> 
>>>> Hallo Andreas,
>>>> 
>>>> Tja so selbsterklärend ist es für mich dann doch nicht. Der source part ist klar. Da muss ich nur den user und das passwort auf das meiner vz installation. Bei target weiß ich es eben nicht was ich da ändern/konfigurieren muss. 
>>>> 
>>>> Bzw wird mit dem create befehl eine datenbank erstellt oder wird in einer vorher erstellten Datenbank die tabellenstruktur erstellt?
>>>> 
>>>> Bei ersterem, wo wird die erstellte datenbankdatei gespeichert, bzw wie kann man den speicherort anpassen. Bei zweiterem, wie erstelle ich vorher eine Datenbank?
>>>> 
>>>> Und ja die php sqlit extrnsion hab ich mit 
>>>> 
>>>> Sudo apt-get install sqlite3 php5-sqlite installiert. So wie es im wiki steht. 
>>>> 
>>>> ich hab jetzt mal sowohl bei source als auch bei target die parameter user und password gesetzt, bei source auf die von der volkszaehler datenbank, bei target hab ich die selben genommen, alles andere hab ich gleich gelassen. Dann hab ich folgendes ausgeführt:
>>>> 
>>>> /var/www/volkszaehler.org/vendor/bin/dbcopy.php <http://volkszaehler.org/vendor/bin/dbcopy.php> create -c /etc/dbcopy.json
>>>> und folgende fehlermeldung bekommen:
>>>> 
>>>>                                                                                
>>>>   [Doctrine\DBAL\Exception\ConnectionException]                                
>>>>   An exception occured in driver: SQLSTATE[HY000] [14] unable to open databas  
>>>>   e file                                                                       
>>>>                                                                                
>>>> 
>>>>                                                      
>>>>   [Doctrine\DBAL\Driver\PDOException]                
>>>>   SQLSTATE[HY000] [14] unable to open database file  
>>>>                                                      
>>>> 
>>>>                                                      
>>>>   [PDOException]                                     
>>>>   SQLSTATE[HY000] [14] unable to open database file  
>>>>                                                      
>>>> 
>>>> create [-c|--config CONFIG]
>>>> 
>>>> 
>>>> dann hab ich den befehl nochmal mit sudo vorangestellt getestet, weil ich dachte er könnte die database nicht öffnen, weil die recht fehlen. dann kam aber folgende Fehlermeldung:
>>>> 
>>>>                                                               
>>>>   [Doctrine\DBAL\Exception\SyntaxErrorException]              
>>>>   An exception occurred while executing 'SET NAMES utf8':     
>>>>   SQLSTATE[HY000]: General error: 1 near "SET": syntax error  
>>>>                                                               
>>>> 
>>>>                                                               
>>>>   [Doctrine\DBAL\Driver\PDOException]                         
>>>>   SQLSTATE[HY000]: General error: 1 near "SET": syntax error  
>>>>                                                               
>>>> 
>>>>                                                               
>>>>   [PDOException]                                              
>>>>   SQLSTATE[HY000]: General error: 1 near "SET": syntax error  
>>>>                                                               
>>>> 
>>>> 
>>>> Also was hab ich falsch gemacht? 
>>>> 
>>>> 
>>>> Am 06.12.2016 um 15:42 schrieb Andreas Goetz <cpuidle at gmail.com <mailto:cpuidle at gmail.com>>:
>>>> 
>>>>> Servus,
>>>>> 
>>>>> 2016-12-06 13:57 GMT+01:00 Theo <geocaching.theo at me.com <mailto:geocaching.theo at me.com>>:
>>>>> Hallo Daniel,
>>>>> 
>>>>> Ja die wikiseite kenn ich, nach dieser hab ich ja bisher versucht zu arbeiten. Aber diese schweigt sich leider über den part Dbcopy.json aus. Nur das man eine kopie derselben verwenden soll.
>>>>> 
>>>>> Die sollte eigentlich selbsterklärend sein.
>>>>>  
>>>>> 
>>>>> Mein Plan war es jetzt ein backup als sqlite datenbank auf dem gleichen raspi zu erstellen.
>>>>> 
>>>>> Kannst Du machen.
>>>>>  
>>>>> Sqlite3 hab ich nach der wikiseite installiert.
>>>>> 
>>>>> D.h. die PHP Sqlite Extension ist installiert?
>>>>>  
>>>>> Und dann die entstandene datenbank datei zusätzlich auf dem speicher der fritzbox zu sichern. Ich hab sonst kein zusätzliches system auf dem ne Datenbank laufen könnte. 
>>>>> 
>>>>> Mir ist halt nicht ganz klar wo die Datenbank, wenn ich eine erstelle, abgespeichert wird.
>>>>> 
>>>>> Ich verstehe Deine Frage nciht. Eine SQlite Datenbank ist eine Datei, nicht mehr und nicht weniger. Wenn Du die Date kpiert hast ist die "Datenbank" da. Was soll da irgendwo laufen???? Du hast ja keinen zweiten VZ isntalliert sondern nur ein Backup gemacht? 
>>>>> 
>>>>> 
>>>>> Tobias
>>>>> 
>>>>> Viele Grüße,
>>>>> Andreas
>>>>>  
>>>>> 
>>>>> > Am 06.12.2016 um 11:50 schrieb Daniel Lauckner <vz at jahp.de <mailto:vz at jahp.de>>:
>>>>> >
>>>>> > Hallo Theo,
>>>>> >
>>>>> >
>>>>> > schon die Wikiseite entdeckt?
>>>>> > http://wiki.volkszaehler.org/software/tools/dbcopy <http://wiki.volkszaehler.org/software/tools/dbcopy>
>>>>> >
>>>>> >
>>>>> > mfg Daniel
>>>>> >
>>>>> 
>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://demo.volkszaehler.org/pipermail/volkszaehler-users/attachments/20161206/d6e0ba78/attachment-0001.html>


More information about the volkszaehler-users mailing list