服务器

DigitalOcean 经常内存不够

By jere on 2015-01-17 2 Comments

架起了 WordPress, 但 mariadb(mysql)很吃内存,经常遇到无法访问数据库的情况。

systemctl restart mariadb 失败

[@ mariadb]# systemctl status mariadb.service
mariadb.service – MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
Active: failed (Result: exit-code) since Fri 2015-01-16 21:33:40 EST; 9min ago
Process: 26100 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 26099 ExecStart=/usr/bin/mysqld_safe –basedir=/usr (code=exited, status=0/SUCCESS)
Process: 26072 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 26099 (code=exited, status=0/SUCCESS)

Jan 16 21:33:39 centos systemd[1]: Starting MariaDB database server…
Jan 16 21:33:39 centos mysqld_safe[26099]: 150116 21:33:39 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Jan 16 21:33:39 centos mysqld_safe[26099]: 150116 21:33:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jan 16 21:33:39 centos mysqld_safe[26099]: 150116 21:33:39 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Jan 16 21:33:40 centos systemd[1]: mariadb.service: control process exited, code=exited status=1
Jan 16 21:33:40 centos systemd[1]: Failed to start MariaDB database server.
Jan 16 21:33:40 centos systemd[1]: Unit mariadb.service entered failed state.

去查看mariadb log

150116 21:27:42 mysqld_safe mysqld from pid file /var/ha/mariadb/mariadb.pid ended
150116 21:33:26 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150116 21:33:26 InnoDB: The InnoDB memory heap is disabled
150116 21:33:26 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150116 21:33:26 InnoDB: Compressed tables use zlib 1.2.7
150116 21:33:26 InnoDB: Using Linux native AIO
150116 21:33:26 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
150116 21:33:26 InnoDB: Completed initialization of buffer pool
150116 21:33:26 InnoDB: Fatal error: cannot allocate memory for the buffer pool
150116 21:33:26 [ERROR] Plugin ‘InnoDB’ init function returned error.
150116 21:33:26 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
150116 21:33:26 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
150116 21:33:26 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
150116 21:33:26 [Note] Plugin ‘FEEDBACK’ is disabled.

 

找到了这篇文章:DigitalOcean:如何在CentOS中添加Swap | 秋水逸冰

先跑两天看看

打赏
  1. 李阳博客说道:

    为什么我的DO老是提示被攻击,我仅仅开个NGINX也会这么提示!

  2. aaron说道:

    我也遇到了这个问题,感谢你的博客提供了有用的信息。

Leave a comment

您的电子邮箱地址不会被公开。