jhoedram
By:
jhoedram

Mysql stops and my wordpress stops working

March 30, 2015 6.7k views
Configuration Management Apache MySQL NoSQL Scaling WordPress Control Panels CentOS

Hello everyone:

I am new to this server, apparently it is a mysql problem that stops when you consume too many resources, someone can help me.

I have a VPS with 500MB Ram digitalocean with Centos 6.5 x64

This is the configuration file of my mysql, the logs can see below. I hope someone can help, of course many thanks.

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
max_connections=70
max_user_connections=30
wait_timeout=10
interactive_timeout=50
long_query_time=5
#log-queries-not-using-indexes
#log-slow-queries=/var/log/mysql/log-slow-queries.log

key_buffer = 16M
myisam_sort_buffer_size = 32M
join_buffer_size=1M
read_buffer_size=1M
sort_buffer_size=2M
table_cache=1024
thread_cache_size=286
interactive_timeout=25
connect_timeout=5
max_allowed_packet=1M
max_connect_errors=1000
query_cache_limit=1M
query_cache_size=8M
query_cache_type=1
tmp_table_size=16M

#innodb_use_native_aio = 0
innodb_file_per_table

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
140912  9:27:44 [Warning] IP address '118.123.119.110' could not be resolved: Name or service not known
140912 12:01:02 mysqld_safe Number of processes running now: 0
140912 12:01:02 mysqld_safe mysqld restarted
140912 12:01:02 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
140912 12:01:02 [Note] Plugin 'FEDERATED' is disabled.
140912 12:01:02 InnoDB: The InnoDB memory heap is disabled
140912 12:01:02 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140912 12:01:02 InnoDB: Compressed tables use zlib 1.2.3
140912 12:01:02 InnoDB: Using Linux native AIO
140912 12:01:02 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140912 12:01:02 InnoDB: Completed initialization of buffer pool
140912 12:01:02 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140912 12:01:02 [ERROR] Plugin 'InnoDB' init function returned error.
140912 12:01:02 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140912 12:01:02 [ERROR] Unknown/unsupported storage engine: InnoDB
140912 12:01:02 [ERROR] Aborting

140912 12:01:02 [Note] /usr/libexec/mysqld: Shutdown complete

140912 12:01:02 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
140912 16:57:29 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140912 16:57:29 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
140912 16:57:29 [Note] Plugin 'FEDERATED' is disabled.
140912 16:57:29 InnoDB: The InnoDB memory heap is disabled
140912 16:57:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140912 16:57:29 InnoDB: Compressed tables use zlib 1.2.3
140912 16:57:29 InnoDB: Using Linux native AIO
140912 16:57:29 InnoDB: Initializing buffer pool, size = 128.0M
140912 16:57:29 InnoDB: Completed initialization of buffer pool
140912 16:57:29 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
140912 16:57:29  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
140912 16:57:30  InnoDB: Waiting for the background threads to start
140912 16:57:31 InnoDB: 5.5.39 started; log sequence number 14584556
140912 16:57:31 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140912 16:57:31 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
140912 16:57:31 [Note] Server socket created on IP: '0.0.0.0'.
140912 16:57:31 [Note] Event Scheduler: Loaded 0 events
140912 16:57:31 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.39'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL) by Remi
1 comment
4 Answers

You're out of memory, so it cannot allocate the needed memory to innodb:

failed; errno 12

I'd recommend that you upgrade your server.

Failing that, stop apache, restart mysql, then start apache.

  • I know it's a matter of memory, I know I need to add more memory and I have to optimize.

    Restarting the server or services, know to be arranged, however this is one momentary solution, and I want a solution.

    I hope you can help me.

    Greetings.

  • There's no magic solution to not having memory. It's like running out of space in your trunk, sure you can squeeze some things by tuning how much space they use but you're still faced with the reality that your trunk contains a finite amount of space, and that some things cannot possibly be squeezed smaller than they are already.

    Try the tuning tips that Freelancer described, if that doesn't work, resize to a 1 GB droplet.

  • i have same problem with a 2gb+swap droplet

Hi, really thanks for your comment. I already did, but the problem persists, I insist that it is an optimization problem. Now I have a drop with 1GB of ram and I run out of memory.

Do not know what to do

  • Can you at least start the server if you set it to 1 GB of RAM?

    What about 2 GB?

    If your application is leaking memory, there's nothing we can do for you other than tell you to fix it.

Adding some SWAP to mysql will give you that extra memory for it to run though it's recommended that you get the 1gb ram droplet.

Have another answer? Share your knowledge.