dbRep fuehrt reducelog nicht aus

Begonnen von pc1246, 21 April 2023, 15:52:25

Vorheriges Thema - Nächstes Thema

pc1246

Moin zusammen
Ich habe einen fhem-Server (tagesaktuell), auf dem die dbLog/dbRep fast den ganzen Platz der Micro-SD einnimmt. (27 von 29 GB)
Ja, mir ist klar, dass das riesig ist, aber ich habe dummerweise den OBIS-Zaehler nicht auf ein Intervall eingestellt gehabt, und so kommen natuerlich ohne Ende Daten zusammen.
Jetzt wollte ich die DB etwas zusammenschrumpfen, aber es schlaegt fehl.
2023.04.21 15:22:00 2: DbRep Rep.Energy - ERROR - DBD::mysql::st execute failed: Error writing file '/tmp/MYLpc17y' (Errcode: 28 "No space left on device") at ./FHEM/93_DbRep.pm line 11623.
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root        29G     27G  601M   98% /
devtmpfs        430M       0  430M    0% /dev
tmpfs           462M       0  462M    0% /dev/shm
tmpfs           462M     47M  415M   11% /run
tmpfs           5,0M    4,0K  5,0M    1% /run/lock
tmpfs           462M       0  462M    0% /sys/fs/cgroup
/dev/mmcblk0p1  253M     49M  204M   20% /boot
tmpfs            93M       0   93M    0% /run/user/1000
Meine Vermutung ist, dass der Speicher auf der SD nicht ausreicht. Kann man das irgendwie einschraenken, oder in mehreren Schritten erledigen?
Danke und gruss
Christoph
HP T610
Onkyo_AVR;3 Enigma2; SB_Server ; SB_Player; HM-USB mit 15 HM-CC-RT-DN, 3 HM_WDS10_TH_O, 6 HM-Sec-SCo, 4 HM-Sec-MDIR-2, 1 HM-Sen-MDIR-O-2, 8 Ferion 5000 OW ; PhilipsTV; 4 harmony hub; Jeelink mit 9 PCA301; Somfy; S7-300; 3 LGW; HUE; HM-IP auf Charly

DS_Starter

Hallo Christoph,

das hängt mit dem tmp-Verzeichnis zusammen welches MySQL temporär verwendet.
Das kann man umlegen wenn es nutzt:

https://stackoverflow.com/questions/50140893/mysql-select-query-no-space-left-on-device

Ansonsten kannst du im DbRep mit den time*-Attributen den bearbeiteten Zeitraum eingrenzen oder die device/reading Attribute zur Abgrenzung der Datenmenge benutzen.
Und dadurch Step by Step arbeiten.

Grüße,
Heiko
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

pc1246

Moin Heiko und Danke
Werden die Daten denn auch wirklich geloescht und freigegeben?
Gefuehlt ist das nicht so, da ich den gleichen Befehl zweimal ausgefuehrt habe, und jedesmal das Gleiche als Meldung dastand.
2023.04.22 12:27:51 3: DbRep Rep.Energy - reduceLog deleting 22531 records of day: 2019-09-29
2023.04.22 12:27:52 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 1000
2023.04.22 12:27:53 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 2000
2023.04.22 12:27:53 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 3000
2023.04.22 12:27:54 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 4000
2023.04.22 12:27:55 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 5000
2023.04.22 12:27:56 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 6000
2023.04.22 12:27:57 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 7000
2023.04.22 12:27:57 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 8000
2023.04.22 12:27:58 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 9000
2023.04.22 12:27:59 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 10000
2023.04.22 12:28:00 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 11000
2023.04.22 12:28:01 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 12000
2023.04.22 12:28:02 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 13000
2023.04.22 12:28:02 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 14000
2023.04.22 12:28:04 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 15000
2023.04.22 12:28:04 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 16000
2023.04.22 12:28:05 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 17000
2023.04.22 12:28:06 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 18000
2023.04.22 12:28:07 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 19000
2023.04.22 12:28:09 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 20000
2023.04.22 12:28:10 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 21000
2023.04.22 12:28:11 3: DbRep Rep.Energy - reduceLog deletion progress of day: 2019-09-29 is: 22000
2023.04.22 12:28:11 3: DbRep Rep.Energy - reduceLog finished. Rows processed: 22846, deleted: 22531, updated: 0
Gruss Christoph
HP T610
Onkyo_AVR;3 Enigma2; SB_Server ; SB_Player; HM-USB mit 15 HM-CC-RT-DN, 3 HM_WDS10_TH_O, 6 HM-Sec-SCo, 4 HM-Sec-MDIR-2, 1 HM-Sen-MDIR-O-2, 8 Ferion 5000 OW ; PhilipsTV; 4 harmony hub; Jeelink mit 9 PCA301; Somfy; S7-300; 3 LGW; HUE; HM-IP auf Charly

DS_Starter

#3
Moin Christoph,

natürlich werden die Daten gelöscht. Du kannst ja ein "count" vorher / nachher laufen lassen  ;)

Vermutlich stellst du die Frage weil die Datenbank Filegröße nicht sinkt.
Dazu muß man ab und an mal ein optimize table ausführen.
Dazu gibt es auch ein DbRep Kommando.

Edit:  Ach ich sollte mal richtig lesen ... :)

LG
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

DS_Starter

#4
Also ich habe mal bei mir reducelog laufen lassen.
Erster Lauf:

2023.04.23 13:42:31.711 3: DbRep Rep.CPU - ################################################################
2023.04.23 13:42:31.720 3: DbRep Rep.CPU - ###                    new reduceLog run                     ###
2023.04.23 13:42:31.720 3: DbRep Rep.CPU - ################################################################
2023.04.23 13:42:31.726 3: DbRep Rep.CPU - get initial structure information of database "fhemtest", remaining attempts: 3
2023.04.23 13:42:31.730 3: DbRep Rep.CPU - Connectiontest to database mysql:database=fhemtest;host=192.168.2.44;port=3306 with user fhemtest
2023.04.23 13:42:31.812 3: DbRep Rep.CPU - Index Report_Idx exists. Check ok
2023.04.23 13:42:31.824 3: DbRep Rep.CPU - Initial data information retrieved - total time used: 0.0547 seconds
2023.04.23 13:42:31.875 3: DbRep Rep.CPU - Connectiontest to db mysql:database=fhemtest;host=192.168.2.44;port=3306 successful
2023.04.23 13:42:31.980 3: DbRep Rep.CPU - reduce data older than: 2023-04-30 23:59:59, newer than: 2023-04-08 00:00:00
2023.04.23 13:42:31.982 3: DbRep Rep.CPU - reduceLog requested with options:
INCLUDE -> Devs: SMA_Energymeter Readings: Einspeisung_Wirkleistung_Zaehler
2023.04.23 13:42:34.365 3: DbRep Rep.CPU - reduceLog deleting 1344 records of day: 2023-04-08
2023.04.23 13:42:34.397 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 100
2023.04.23 13:42:34.428 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 200
2023.04.23 13:42:34.460 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 300
2023.04.23 13:42:34.488 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 400
2023.04.23 13:42:34.513 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 500
2023.04.23 13:42:34.540 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 600
2023.04.23 13:42:34.564 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 700
2023.04.23 13:42:34.589 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 800
2023.04.23 13:42:34.613 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 900
2023.04.23 13:42:34.638 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 1000
2023.04.23 13:42:34.662 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 1100
2023.04.23 13:42:34.686 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 1200
2023.04.23 13:42:34.712 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-08 is: 1300
2023.04.23 13:42:34.737 3: DbRep Rep.CPU - reduceLog deleting 1395 records of day: 2023-04-09
2023.04.23 13:42:34.781 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-09 is: 100
2023.04.23 13:42:34.808 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-09 is: 200
2023.04.23 13:42:34.832 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-09 is: 300
2023.04.23 13:42:34.857 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-09 is: 400
.....
2023.04.23 13:42:42.115 3: DbRep Rep.CPU - reduceLog deleting 796 records of day: 2023-04-23
2023.04.23 13:42:42.153 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-23 is: 100
2023.04.23 13:42:42.181 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-23 is: 200
2023.04.23 13:42:42.213 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-23 is: 300
2023.04.23 13:42:42.235 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-23 is: 400
2023.04.23 13:42:42.256 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-23 is: 500
2023.04.23 13:42:42.279 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-23 is: 600
2023.04.23 13:42:42.303 3: DbRep Rep.CPU - reduceLog deletion progress of day: 2023-04-23 is: 700
2023.04.23 13:42:42.329 3: DbRep Rep.CPU - reduceLog finished. Rows processed: 21984, deleted: 21610

Zweiter Lauf:

2023.04.23 13:43:41.178 3: DbRep Rep.CPU - ################################################################
2023.04.23 13:43:41.179 3: DbRep Rep.CPU - ###                    new reduceLog run                     ###
2023.04.23 13:43:41.180 3: DbRep Rep.CPU - ################################################################
2023.04.23 13:43:41.276 3: DbRep Rep.CPU - reduce data older than: 2023-04-30 23:59:59, newer than: 2023-04-08 00:00:00
2023.04.23 13:43:41.277 3: DbRep Rep.CPU - reduceLog requested with options:
INCLUDE -> Devs: SMA_Energymeter Readings: Einspeisung_Wirkleistung_Zaehler
2023.04.23 13:43:41.284 3: DbRep Rep.CPU - reduceLog deleting 1 records of day: 2023-04-23
2023.04.23 13:43:41.287 3: DbRep Rep.CPU - reduceLog finished. Rows processed: 375, deleted: 1
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

pc1246

Moin
Ja danke, eigentlich hast Du mich richtig verstanden. Aufgrund der geringen Restkapazitaet kann ich ja nicht so grosse Aktionen durchfuehren.
Und es kam mir wirklich so vor, als ob zweimal die gleichen Daten reduced wurden.
Ich versuche gleich mal ein optimize table, dann werde ich hoffentlich zum Ziel kommen!
Danke und einen schoenen Restsonntag noch
Christoph
HP T610
Onkyo_AVR;3 Enigma2; SB_Server ; SB_Player; HM-USB mit 15 HM-CC-RT-DN, 3 HM_WDS10_TH_O, 6 HM-Sec-SCo, 4 HM-Sec-MDIR-2, 1 HM-Sen-MDIR-O-2, 8 Ferion 5000 OW ; PhilipsTV; 4 harmony hub; Jeelink mit 9 PCA301; Somfy; S7-300; 3 LGW; HUE; HM-IP auf Charly

pc1246

Moin Heiko
Tja, nun stehe ich doch wieder an!
Es sind ca 586MB frei. Trotzdem reicht der Speicher nicht, um einen Tag zu reduzieren.
Beim letzten funktionierenden Tag waren es ~330.000 Eintraege.
Optimize habe ich danach gemacht.
Any ideas?
Danke und Gruss
Christoph
HP T610
Onkyo_AVR;3 Enigma2; SB_Server ; SB_Player; HM-USB mit 15 HM-CC-RT-DN, 3 HM_WDS10_TH_O, 6 HM-Sec-SCo, 4 HM-Sec-MDIR-2, 1 HM-Sen-MDIR-O-2, 8 Ferion 5000 OW ; PhilipsTV; 4 harmony hub; Jeelink mit 9 PCA301; Somfy; S7-300; 3 LGW; HUE; HM-IP auf Charly

DS_Starter

Im Prinzip brauchst du mehr temporären Speicher.
Je nach deinen Möglichkeiten könntest du dir einen USB Stick/SD Karte mounten und das Verzeichnis der MySQL als tmp zur Verfügung stellen wie weiter oben im Link beschrieben.
Möglich wäre dazu auch ein Netzlaufwerk von einem NAS o.ä. zu verwenden.

LG

ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter