Rausfinden warum Datenbank stehen bleibt?

brenner

Commander
Registriert
Apr. 2002
Beiträge
3.037
Warum auch immer, seit ein paar Tagen habe ich das Problem das meine MYSQL DB ab und zu stehen bleibt.

Wenn ich dann über einen Browser die GUI vom Cacti aufrufen will, steht nur noch
Code:
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'


Versuch die DB wieder zu starten:
Code:
root@cacti04:~# /etc/init.d/mysql status
[info] MySQL is stopped..
root@cacti04:~# /etc/init.d/mysql start
[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
root@cacti04:~# /etc/init.d/mysql restart
[ ok ] Stopping MySQL database server: mysqld.
[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
root@cacti04:~#



Wenn ich den Rechner (Raspi mit aktuellen Debian) neu starte bekomme ich von der Datenbank diese Antwort:
Code:
root@cacti04:~# /etc/init.d/mysql status
/usr/bin/mysqladmin: Unknown OS character set 'ISO-8859-15'.
/usr/bin/mysqladmin: Switching to the default character set 'latin1'.
[info] /usr/bin/mysqladmin  Ver 8.42 Distrib 5.5.31, for debian-linux-gnu on armv5tel
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.5.31-0+wheezy1
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/run/mysqld/mysqld.sock
Uptime:                 2 min 23 sec

Threads: 2  Questions: 3664  Slow queries: 1  Opens: 390  Flush tables: 1  Open tables: 96  Queries per second avg: 25.622.



Und ein paar Minuten später:
Code:
root@cacti04:~# /etc/init.d/mysql status
/usr/bin/mysqladmin: Unknown OS character set 'ISO-8859-15'.
/usr/bin/mysqladmin: Switching to the default character set 'latin1'.
[info] /usr/bin/mysqladmin  Ver 8.42 Distrib 5.5.31, for debian-linux-gnu on armv5tel
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.5.31-0+wheezy1
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/run/mysqld/mysqld.sock
Uptime:                 6 min 10 sec

Threads: 2  Questions: 18347  Slow queries: 1  Opens: 399  Flush tables: 1  Open tables: 97  Queries per second avg: 49.586.
root@cacti04:~#



Wie kann ich herausfinden warum sich die DB nicht mehr neu starten lässt und ich den Rechner neu starten muss?
 
brenner schrieb:
Queries per second avg: 49.586

irgendwas feuert 50 anfragen pro sec. an die db...

was sagt den top/htop
ich würde mal drauf wetten, dass dir die db dem ram & den swap wegschreibt, danach
sich dann verabschiedet und du sie dann auch nicht mehr starten kannst
 
Zuletzt bearbeitet:
Code:
root@cacti04:~# top
top - 22:27:32 up  1:22,  1 user,  load average: 0,92, 0,83, 0,80
Tasks:  82 total,   1 running,  81 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2,4 us,  0,7 sy,  0,0 ni, 96,9 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
KiB Mem:    496944 total,   224412 used,   272532 free,    19228 buffers
KiB Swap:   102396 total,        0 used,   102396 free,    93868 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
16296 root      20   0  4896 1376 1000 R   1,6  0,3   0:00.14 top
 2495 mysql     20   0  312m  35m 6132 S   0,7  7,4   3:07.40 mysqld
 3126 root      20   0  9884 3344 2696 S   0,7  0,7   0:01.94 sshd
 2692 root      20   0  184m  18m 5824 S   0,3  3,9   0:40.45 java
    1 root      20   0  2140  728  628 S   0,0  0,1   0:01.87 init
    2 root      20   0     0    0    0 S   0,0  0,0   0:00.00 kthreadd
    3 root      20   0     0    0    0 S   0,0  0,0   0:03.48 ksoftirqd/0
    5 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 kworker/0:0H
    7 root      20   0     0    0    0 S   0,0  0,0   0:04.46 rcu_preempt
    8 root      20   0     0    0    0 S   0,0  0,0   0:00.00 rcu_bh
    9 root      20   0     0    0    0 S   0,0  0,0   0:00.00 rcu_sched
   10 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 khelper
   11 root      20   0     0    0    0 S   0,0  0,0   0:00.00 kdevtmpfs
   12 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 netns
   13 root      20   0     0    0    0 S   0,0  0,0   0:16.17 kworker/0:1
   14 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 writeback
   15 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 bioset
   16 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 kblockd
   17 root      20   0     0    0    0 S   0,0  0,0   0:00.30 khubd
   18 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 rpciod
   19 root      20   0     0    0    0 S   0,0  0,0   0:00.00 khungtaskd
   20 root      20   0     0    0    0 S   0,0  0,0   0:00.00 kswapd0
   21 root      20   0     0    0    0 S   0,0  0,0   0:00.00 fsnotify_mark
   22 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 nfsiod
   23 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 crypto
   29 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 kthrotld
   30 root       1 -19     0    0    0 S   0,0  0,0   0:00.00 VCHIQ-0
   31 root       1 -19     0    0    0 S   0,0  0,0   0:00.00 VCHIQr-0
   32 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 VCHIQs-0
   33 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 iscsi_eh
   34 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 dwc_otg
   35 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 DWC Notificatio
   37 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 deferwq
   39 root      20   0     0    0    0 S   0,0  0,0   1:38.69 mmcqd/0
   40 root      20   0     0    0    0 S   0,0  0,0   0:00.46 jbd2/mmcblk0p2-
   41 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 ext4-dio-unwrit
  156 root      20   0  2892 1264  736 S   0,0  0,3   0:00.50 udevd
  298 root      20   0  2888  968  436 S   0,0  0,2   0:00.01 udevd
  305 root      20   0  2888  912  384 S   0,0  0,2   0:00.00 udevd
 1501 root      20   0  1732  500  416 S   0,0  0,1   0:02.79 ifplugd
 1552 root      20   0  1732  496  420 S   0,0  0,1   0:00.91 ifplugd
root@cacti04:~#

.
Ergänzung ()

.
Code:
root@cacti04:~# /etc/init.d/mysql status
/usr/bin/mysqladmin: Unknown OS character set 'ISO-8859-15'.
/usr/bin/mysqladmin: Switching to the default character set 'latin1'.
[info] /usr/bin/mysqladmin  Ver 8.42 Distrib 5.5.31, for debian-linux-gnu on armv5tel
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.5.31-0+wheezy1
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/run/mysqld/mysqld.sock
Uptime:                 1 hour 24 min 58 sec

Threads: 12  Questions: 311772  Slow queries: 1  Opens: 557  Flush tables: 1  Open tables: 97  Queries per second avg: 61.155.
root@cacti04:~#
Ergänzung ()

So sieht es heute morgen aus:

Code:
root@cacti04:~# /etc/init.d/mysql status ?
/usr/bin/mysqladmin: Unknown OS character set 'ISO-8859-15'.
/usr/bin/mysqladmin: Switching to the default character set 'latin1'.
[info] /usr/bin/mysqladmin  Ver 8.42 Distrib 5.5.31, for debian-linux-gnu on armv5tel
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.5.31-0+wheezy1
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/run/mysqld/mysqld.sock
Uptime:                 12 hours 51 min 2 sec

Threads: 4  Questions: 2709000  Slow queries: 1  Opens: 1929  Flush tables: 1  Open tables: 97  Queries per second avg: 58.557.
root@cacti04:~#


Code:
root@cacti04:~# top
top - 09:57:48 up 12:52,  1 user,  load average: 0,68, 0,84, 0,85
Tasks:  82 total,   1 running,  81 sleeping,   0 stopped,   0 zombie
%Cpu(s): 21,4 us, 13,2 sy,  0,0 ni, 63,4 id,  0,1 wa,  0,0 hi,  1,9 si,  0,0 st
KiB Mem:    496944 total,   267232 used,   229712 free,    40388 buffers
KiB Swap:   102396 total,        0 used,   102396 free,   117768 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
28581 root      20   0  4892 1276  908 R  15,5  0,3   0:00.09 top
   13 root      20   0     0    0    0 S   5,2  0,0   2:31.86 kworker/0:1
    1 root      20   0  2140  728  628 S   0,0  0,1   0:03.73 init
    2 root      20   0     0    0    0 S   0,0  0,0   0:00.01 kthreadd
    3 root      20   0     0    0    0 S   0,0  0,0   0:30.13 ksoftirqd/0
    5 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 kworker/0:0H
    7 root      20   0     0    0    0 S   0,0  0,0   0:35.80 rcu_preempt
    8 root      20   0     0    0    0 S   0,0  0,0   0:00.00 rcu_bh
    9 root      20   0     0    0    0 S   0,0  0,0   0:00.00 rcu_sched
   10 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 khelper
   11 root      20   0     0    0    0 S   0,0  0,0   0:00.00 kdevtmpfs
   12 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 netns
   14 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 writeback
   15 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 bioset
   16 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 kblockd
   17 root      20   0     0    0    0 S   0,0  0,0   0:00.30 khubd
   18 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 rpciod
   19 root      20   0     0    0    0 S   0,0  0,0   0:00.05 khungtaskd
   20 root      20   0     0    0    0 S   0,0  0,0   0:00.00 kswapd0
   21 root      20   0     0    0    0 S   0,0  0,0   0:00.00 fsnotify_mark
   22 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 nfsiod
   23 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 crypto
   29 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 kthrotld
   30 root       1 -19     0    0    0 S   0,0  0,0   0:00.00 VCHIQ-0
   31 root       1 -19     0    0    0 S   0,0  0,0   0:00.00 VCHIQr-0
   32 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 VCHIQs-0
   33 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 iscsi_eh
   34 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 dwc_otg
   35 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 DWC Notificatio
   37 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 deferwq
   39 root      20   0     0    0    0 S   0,0  0,0  13:32.94 mmcqd/0
   40 root      20   0     0    0    0 S   0,0  0,0   0:03.71 jbd2/mmcblk0p2-
   41 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 ext4-dio-unwrit
  156 root      20   0  2892 1264  736 S   0,0  0,3   0:00.50 udevd
  298 root      20   0  2888  968  436 S   0,0  0,2   0:00.01 udevd
  305 root      20   0  2888  912  384 S   0,0  0,2   0:00.00 udevd
 1501 root      20   0  1732  500  416 S   0,0  0,1   0:26.06 ifplugd
 1552 root      20   0  1732  496  420 S   0,0  0,1   0:08.51 ifplugd
 1630 root       0 -20     0    0    0 S   0,0  0,0   0:00.00 cifsiod
 1692 root      20   0     0    0    0 S   0,0  0,0   0:00.00 kworker/0:2
 1745 root      20   0     0    0    0 S   0,0  0,0  11:44.90 cifsd
root@cacti04:~#


Soweit ich sehen kann ist das alles unkritisch oder?
 
Zuletzt bearbeitet: (QUOTE durch CODE ersetzt ;))
So wie es inzwischen ausschaut ist php der Bösewicht:

Code:
root@cacti04:~# top
top - 14:48:30 up 18:19,  1 user,  load average: 13,11, 9,72, 5,46
Tasks: 170 total,   3 running, 167 sleeping,   0 stopped,   0 zombie
%Cpu(s): 84,7 us, 15,3 sy,  0,0 ni,  0,0 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
KiB Mem:    496944 total,   474204 used,    22740 free,    42184 buffers
KiB Swap:   102396 total,        0 used,   102396 free,   104172 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
19515 www-data  20   0  132m 105m 5580 R  50,6 21,8   0:35.78 php
20304 www-data  20   0 38324  10m 5752 R  36,0  2,2   0:08.55 php
19986 mysql     20   0  317m  34m 6060 S   8,2  7,2   0:04.18 mysqld
20294 root      20   0  4996 1436 1000 R   2,1  0,3   0:01.14 top
 
Warum heißt dein Prozess denn php, und warum gehört er www-data?
Was hast du für einen Apache MPM? Doch hoffentlich nicht mehr Prefork... Wie lässt du PHP laufen? Als Modul? Oder machst du Nägel mit Köpfen und verwendest PHP-FMP? Und wieso verhängst du kein rigoroses Memory Limit für PHP, wenn deine Maschine eh schon arg begrenzt lebensfähig ist?
 
Limit ist wohl drauf

www-data 21082 21066 0 14:54 ? 00:00:00 /bin/sh -c php --define suhosin.memory_limit=512M /usr/share/cacti/site/poller.php 2>&1 >/dev/null | if [ -f /usr/bin/t

Eventuell etwas zu hoch da ja auch nur 512MB RAM gesamt vorhanden sind.

"Ich" verwende speziell gar nichts bestimmtes, alles mit apt-get Abhängigkeiten der Programme mitgekommen.

root@cacti04:~# apache2 -v
Server version: Apache/2.2.22 (Debian)
Server built: Mar 4 2013 22:24:31

root@cacti04:~# php -v
PHP 5.4.4-14+deb7u5 (cli) (built: Oct 5 2013 23:17:30)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

root@cacti04:~# uname -a
Linux cacti04 3.10.23+ #608 PREEMPT Mon Dec 9 21:11:23 GMT 2013 armv6l GNU/Linux
 
Zurück
Oben