[gelöst: es ist die Engine von mysql] freezes und MQTT?

Begonnen von andies, 26 Dezember 2022, 13:13:14

Vorheriges Thema - Nächstes Thema

andies

Und nun noch htop
20049 mysql      20   0  710M  229M   872 S 101. 24.9 20:51.41 /usr/sbin/mysqld
  977 fhem       20   0  311M  219M  3896 S  0.0 23.7 36h55:16 /usr/bin/perl fhem.pl fhem.cf
24912 fhem       20   0  311M  216M  1676 S  0.0 23.5  0:00.06 /usr/bin/perl fhem.pl fhem.cf
2281 signal-cl  20   0  365M 80624  2380 S  0.7  8.5 54:45.30 /home/pi/.sdkman/candidates/j
  847 grafana    20   0 1008M 47004 16304 S  0.0  5.0  2h53:20 /usr/sbin/grafana-server --co
9672 www-data   20   0  198M 10404  4532 S  0.0  1.1  0:00.49 /usr/sbin/apache2 -k start
9676 www-data   20   0  198M  9696  4048 S  0.0  1.0  0:00.25 /usr/sbin/apache2 -k start
9674 www-data   20   0  198M  8964  4128 S  0.0  0.9  0:00.17 /usr/sbin/apache2 -k start
9673 www-data   20   0  198M  8924  3524 S  0.0  0.9  0:00.09 /usr/sbin/apache2 -k start
19501 www-data   20   0  198M  8804  4080 S  0.0  0.9  0:00.13 /usr/sbin/apache2 -k start
19500 www-data   20   0  198M  8644  3944 S  0.0  0.9  0:00.08 /usr/sbin/apache2 -k start
9675 www-data   20   0  198M  8596  3932 S  0.0  0.9  0:00.07 /usr/sbin/apache2 -k start
19556 www-data   20   0  198M  8500  3868 S  0.0  0.9  0:00.07 /usr/sbin/apache2 -k start
19499 www-data   20   0  198M  8484  3940 S  0.0  0.9  0:00.10 /usr/sbin/apache2 -k start
��838 root       20   0  197M  6260  2512 S  0.0  0.7  3:52.29 /usr/sbin/apache2 -k start
1550 pi�������  20   0  313M  6080     0 S  0.0  0.6  0:01.79 zenity --warning --width=400
1531 pi         20   0  403M  5308  1576 S  0.0  0.6 24:22.93 lxpanel --profile LXDE-pi
4274 root       20   0 35276  5156  4340 S  0.0  0.5  0:38.14 /lib/systemd/systemd-journald
����1 root       20   0 34880  4032  2568 S  0.0  0.4  2:53.66 /sbin/init splash
��765 root       20   0  186M  3804  1308 S  0.0  0.4  7:23.87 /usr/lib/xorg/Xorg :0 -seat s
�1552 pi�������  20   0 46432  3628     8 S  0.0  0.4  0:01.59 /usr/bin/python3 /usr/share/s
25123 pi������   20   0  8220  3084  2368 R  1.3  0.3  0:02.87 htop
24996 pi         20   0  8888  2332   972 S  0.0  0.2  0:00.34 -bash

Wieso gibt es denn da zwei fhem Prozesse?
FHEM 6.3 auf RaspPi4 (Raspbian:  6.6.28+; Perl: v5.36.0)
SIGNALduino (433 MHz) und HM-UART (868 MHz), Sonoff, Blitzwolf, Somfy RTS, CAME-Gartentor, Volkszähler, Keyence-Sensor, Homematic-Sensoren und -thermostat, Ferraris-Zähler für Wasseruhr, Openlink-Nachbau Viessmann

Wernieman

Ich befürchte, da ist wenig zu machen ... der Pi ist für Deine Aufgabe zu klein ....

Eventuell könntest Du (Speicherangaben aus Deiner ps-Ausgabe)
- Weniger apache forks (ich glaube ServerLimit, habe aber keinen apache zum testen da) (pro fork bei Dir c.a. 1% Speicher)
- Oder gleich kein apache grafana etc (c.a. 16% Speicher)
- mysql runtertunen (Weniger Speicherverbrauch)(Keine pauschale Aussage möglich)
- auf jedem Falle kein Grafischer Desktop (min 1% Speicher)
- Und kille den htop, wenn Du Ihn nicht brauchst!

Zum Grundsätzlichen Lösen:
- Wenn Du wirklich eine echte mysql-DB haben willst, würde ich die auf ein anderes Gerät (Pi, NAS, etc.)
- Server OHNE Grafische Oberfläche, macht das nächste Update auch einfacher (Wenn Du für Anzeige einen brauchst, eigenes Gerät)
Alternativ einfach ein Größeren Pi, wie z.B. ein Pi4 mit mindestens 4G. Du wirst da aber (meiner Meinung nach) auch nicht Glücklich werden, wenn DU nicht Anfängst sinnvoll die Ressourcen zu verwalten.
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

andies

#17
Ich glaube, ich habe jetzt eine Lösung und das geht schon in die Richtung von Wernieman (danke an alle für die Hilfe):

Die Probleme traten auf, als ich den Zeitraum der Speicherung der Daten von 3 Monaten auf 6 Monate ausgedehnt habe. Nach einiger Zeit kamen diese merkwürdigen Ausfälle. Ich habe jetzt, wie im Post #12 beschrieben, die Engine von MySQL geändert (das geht mit einem SQL Befehl und dauert etwas, steht alles in dem Beitrag). Die von mir verwendete Engine MylASM soll für wenige Insert und eher häufige Select (was ja bei DbLog üblich ist) besser geeignet sein.

Und siehe da, seitdem sind die Beschwerden weg.

Für mich ist das ein typischer Fall von Fehlermeldung. Man wird auf eine völlig falsche Fährte geschickt (MQTT) und am Ende liegt das Problem wo ganz anders. Gibt es eigentlich eine Stelle, wo man solche Hinweise im Wiki sammeln kann? Da sucht man sich doch sonst einen Wolf...
FHEM 6.3 auf RaspPi4 (Raspbian:  6.6.28+; Perl: v5.36.0)
SIGNALduino (433 MHz) und HM-UART (868 MHz), Sonoff, Blitzwolf, Somfy RTS, CAME-Gartentor, Volkszähler, Keyence-Sensor, Homematic-Sensoren und -thermostat, Ferraris-Zähler für Wasseruhr, Openlink-Nachbau Viessmann

Wernieman

Poste trotzdem mal Deine mysql-Config .... wenn Du nur myISAM verwendest,m könntest Du Speicher für die "anderen" eventuell sehr drücken ...
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

andies

Da brauche ich einen Tipp, wo ich die finde (ich habe da ja nichts verändert). Ist es diese
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#
user                    = mysql
pid-file                = /run/mysqld/mysqld.pid
socket                  = /run/mysqld/mysqld.sock
#port                   = 3306
basedir                 = /usr
datadir                 = /var/lib/mysql
tmpdir                  = /tmp
lc-messages-dir         = /usr/share/mysql
#skip-external-locking

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

#
# * Fine Tuning
#
#key_buffer_size        = 16M
#max_allowed_packet     = 16M
#thread_stack           = 192K
#thread_cache_size      = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
#myisam_recover_options = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

#
# * Query Cache Configuration
#
#query_cache_limit      = 1M
query_cache_size        = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file       = /var/log/mysql/mysql.log
#general_log            = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file    = /var/log/mysql/mariadb-slow.log
#long_query_time        = 10
#log_slow_rate_limit    = 1000
#log_slow_verbosity     = query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
#max_binlog_size        = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = exclude_database_name

#
# * Security Features
#
# Read the manual, too, if you want chroot!
#chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
#ssl-ca = /etc/mysql/cacert.pem
#ssl-cert = /etc/mysql/server-cert.pem
#ssl-key = /etc/mysql/server-key.pem
#
# Accept only connections using the latest and most secure TLS protocol version.
# ..when MariaDB is compiled with OpenSSL:
#ssl-cipher = TLSv1.2
# ..when MariaDB is compiled with YaSSL (default in Debian):
#ssl = on

#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!

#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.3 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.3]
FHEM 6.3 auf RaspPi4 (Raspbian:  6.6.28+; Perl: v5.36.0)
SIGNALduino (433 MHz) und HM-UART (868 MHz), Sonoff, Blitzwolf, Somfy RTS, CAME-Gartentor, Volkszähler, Keyence-Sensor, Homematic-Sensoren und -thermostat, Ferraris-Zähler für Wasseruhr, Openlink-Nachbau Viessmann

Wernieman

#20
Muß gestehen, das ich bisher mich nur mit performance-Tuning beschäftigt habe, nicht mit "Speicherminnimierung" ... bin deshalb gerade etwas "Hilflos" .. aber auf jedem Falle kannst Du mal die Connection Zahl minimieren:
#max_connections        = 100
Ich glaube nicht, das Du 100 gleichzeitige DB-Verbindungen haben wirst ...

Edit
Gibt es auf Deinem System ein /usr/share/doc/mysql-server-5.0/examples/my-small.cnf?
Habe gerade kein pi mit mySQL zur Hand ....

Edit2:
Etwas Googeln ....
key_buffer = 2M
query_cache_limit = 128K
query_cache_size = 2M
table_cache = 10
# Wenn du kein InnoDB brauchst
skip-innodbkey_buffer = 2M


ABER .. alles bitte TESTEN! Alle Angaben definitiv ohne Gewähr!
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

andies

Zitat von: Wernieman am 30 Dezember 2022, 22:46:59
Edit
Gibt es auf Deinem System ein /usr/share/doc/mysql-server-5.0/examples/my-small.cnf?
Habe gerade kein pi mit mySQL zur Hand ....
Siehe Anhang: Nein.

Zitat von: Wernieman am 30 Dezember 2022, 22:46:59
ABER .. alles bitte TESTEN! Alle Angaben definitiv ohne Gewähr!
Wehe, wenn das nicht klappt, dann gibt es solchen Ärger!!!

Nein, Scherz. Ist doch selbstverständlich - vielen Dank für die Hilfe.
FHEM 6.3 auf RaspPi4 (Raspbian:  6.6.28+; Perl: v5.36.0)
SIGNALduino (433 MHz) und HM-UART (868 MHz), Sonoff, Blitzwolf, Somfy RTS, CAME-Gartentor, Volkszähler, Keyence-Sensor, Homematic-Sensoren und -thermostat, Ferraris-Zähler für Wasseruhr, Openlink-Nachbau Viessmann

Wernieman

Bezüglich ScreenShot: Du solltest Dir das arbeiten mit der Konsole angewöhnen ......  ;)
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html