E
E
Egor Petrov2015-02-28 13:11:27
CentOS
Egor Petrov, 2015-02-28 13:11:27

How to fix mariadb out of memory on digitalocean server CentOS 7.0 x64?

From time to time, a problem arises on one server - the number of processes grows explosively, memory runs out, Maria falls and does not rise. Most often, it is not even possible to connect via ssh and you have to restart the server from the web interface.
Software used:
apache x86_64, 2.4.6, 19.el7.centos
mariadb x86_64, 5.5.40, 2.el7_0
php (not php-fpm) 5.4.1 6 23.el7_0.3 Put
some configs here: https:// yadi.sk/d/YTGniF9TeuzaL but there, consider, everything is standard.
In Maria's logs, here's what:
cat mariadb.log | grep -C 10 'Out':

InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 5077155453
150223  4:42:38  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
InnoDB: Apply batch completed
150223  4:42:38  InnoDB: Waiting for the background threads to start
150223  4:42:39 Percona XtraDB (http://www.percona.com) 5.5.40-MariaDB-36.1 started; log sequence number 5077155453
150223  4:42:39 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
150223  4:42:39 [Note] Plugin 'FEEDBACK' is disabled.
150223  4:42:40 [Note] Server socket created on IP: '0.0.0.0'.
150223  4:42:40 [Note] Event Scheduler: Loaded 0 events
150223  4:42:40 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.40-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
150223 04:42:47 mysqld_safe Number of processes running now: 0
150223 04:42:47 mysqld_safe mysqld restarted
150223  4:42:47 InnoDB: The InnoDB memory heap is disabled
150223  4:42:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150223  4:42:47 InnoDB: Compressed tables use zlib 1.2.7
150223  4:42:47 InnoDB: Using Linux native AIO
150223  4:42:47 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
150223  4:42:47 InnoDB: Completed initialization of buffer pool
150223  4:42:47 InnoDB: Fatal error: cannot allocate memory for the buffer pool
150223  4:42:47 [ERROR] Plugin 'InnoDB' init function returned error.
150223  4:42:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150223  4:42:47 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
150223  4:42:47 [Note] Plugin 'FEEDBACK' is disabled.
150223  4:42:47 [ERROR] Unknown/unsupported storage engine: InnoDB
150223  4:42:47 [ERROR] Aborting

150223  4:42:47 [Note] /usr/libexec/mysqld: Shutdown complete

150223 04:42:47 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
150223 05:45:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150223  5:45:22 InnoDB: The InnoDB memory heap is disabled
150223  5:45:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins

Munin draws such graphs while he can:
rDvYj.pngs5Pvp.png7pC72.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Zhivotnev, 2015-03-02
@inkvizitor68sl

1) add swap, it will save you from OOM (but it will slow down)
2) go through mysqltuner.pl , it will tell you how much memory your maria is allowed to use. Then turn the parameters down to fit in the amount of droplet memory.
For example, you can look at this config - keithscode.com/blog/23-running-mysql-on-a-small-12...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question