juan
By:
juan

Mysql problem

April 25, 2014 2.3k views
I have a vps , 1 core, 1gb ram. ZPanel and two domains, one with hairspire marketing and the other with wordpress, everything has very little traffic The problem is that mysql is dropped, especially when creating a new item in wp, but can be at any time, it can be? Thank you!
6 Answers
my.cnf

# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 1M
thread_stack = 64K
thread_cache_size = 4
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 500
#table_cache = 64
#thread_concurrency = 40
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
log mysql:


140425 15:06:32 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full$
140425 15:06:32 [Note] Plugin 'FEDERATED' is disabled.
140425 15:06:32 InnoDB: The InnoDB memory heap is disabled
140425 15:06:32 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140425 15:06:32 InnoDB: Compressed tables use zlib 1.2.3.4
140425 15:06:33 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140425 15:06:33 InnoDB: Completed initialization of buffer pool
140425 15:06:33 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140425 15:06:33 [ERROR] Plugin 'InnoDB' init function returned error.
140425 15:06:33 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140425 15:06:33 [ERROR] Unknown/unsupported storage engine: InnoDB
140425 15:06:33 [ERROR] Aborting

140425 15:06:33 [Note] /usr/sbin/mysqld: Shutdown complete

140425 15:06:33 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full$
140425 15:06:33 [Note] Plugin 'FEDERATED' is disabled.
140425 15:06:33 InnoDB: The InnoDB memory heap is disabled
140425 15:06:33 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140425 15:06:33 InnoDB: Compressed tables use zlib 1.2.3.4
140425 15:06:33 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140425 15:06:33 InnoDB: Completed initialization of buffer pool
140425 15:06:33 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140425 15:06:33 [ERROR] Plugin 'InnoDB' init function returned error.
140425 15:06:33 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140425 15:06:33 [ERROR] Unknown/unsupported storage engine: InnoDB
140425 15:06:33 [ERROR] Aborting
The key error seems to be:


140425 15:06:33 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140425 15:06:33 InnoDB: Completed initialization of buffer pool
140425 15:06:33 InnoDB: Fatal error: cannot allocate memory for the buffer pool


It looks like you are running out of memory. There are a number of things you could do. You might want to try adding swap: https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04

Let us know how it goes!
by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on Ubuntu 12.04
op - 16:23:12 up 37 min, 1 user, load average: 1.50, 3.05, 1.55
Tasks: 97 total, 5 running, 92 sleeping, 0 stopped, 0 zombie
Cpu(s): 60.5%us, 7.0%sy, 0.0%ni, 31.9%id, 0.0%wa, 0.0%hi, 0.3%si, 0.3%st
Mem: 1018820k total, 739396k used, 279424k free, 10032k buffers
Swap: 0k total, 0k used, 0k free, 49216k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4403 www-data 20 0 354m 52m 4816 S 21.6 5.3 0:01.51 apache2
4428 www-data 20 0 393m 94m 4804 S 19.3 9.5 0:01.39 apache2
4414 www-data 20 0 365m 66m 3920 R 13.0 6.7 0:00.51 apache2
4405 www-data 20 0 349m 85m 4388 R 6.3 8.6 0:01.59 apache2
4417 www-data 20 0 323m 24m 3512 R 2.3 2.5 0:00.19 apache2
4408 www-data 20 0 383m 83m 4700 S 2.0 8.4 0:00.89 apache2
4419 www-data 20 0 315m 17m 3464 S 2.0 1.7 0:00.17 apache2
3120 mysql 20 0 799m 63m 2756 S 0.7 6.3 0:06.06 mysqld
10 root 20 0 0 0 0 R 0.3 0.0 0:01.30 rcu_sched
4442 root 20 0 17344 1240 916 R 0.3 0.1 0:00.08 top
1 root 20 0 24348 924 0 S 0.0 0.1 0:00.98 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:00.14 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
6 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0
7 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0H
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
11 root RT 0 0 0 0 S 0.0 0.0 0:00.09 watchdog/0
12 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 cpuset
13 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
16 root 20 0 0 0 0 S 0.0 0.0 0:00.00 bdi-default
17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd
18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd
19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff
20 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khubd
21 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 md
22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 devfreq_wq
24 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd
25 root 20 0 0 0 0 S 0.0 0.0 1:03.29 kswapd0
26 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd
27 root 39 19 0 0 0 S 0.0 0.0 0:00.00 khugepaged
28 root 20 0 0 0 0 S 0.0 0.0 0:00.00 fsnotify_mark
29 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ecryptfs-kthrea
30 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 crypto
41 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kthrotld
42 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u:1
43 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0
44 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1
46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 binder
66 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 deferwq
67 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 charger_manager
190 root 20 0 0 0 0 S 0.0 0.0 0:00.08 jbd2/vda-8

i think that apache is using all the ram, i changed the keepalive to off

StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 100
MaxRequestsPerChild 600
Your server may lack sufficient RAM to allocate enough memory for MySQL to operate properly. You may want to try increasing RAM to 2GB.
I think it's a configuration problem rather than memory, because the site has no traffic. Just create a post in wordpress and I returned to fall.

Apache Error log:

[Sat April 26 14:51:58 2014] [error] (12) Can not allocate memory: fork: Unable to fork new process
Have another answer? Share your knowledge.