亚马逊EC2,MySQL的中止开始因为InnoDB:MMAP(X字节)失败;错误号12 [英] Amazon EC2, mysql aborting start because InnoDB: mmap (x bytes) failed; errno 12

查看:571
本文介绍了亚马逊EC2,MySQL的中止开始因为InnoDB:MMAP(X字节)失败;错误号12的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个根据我读的这里

MySQL服务器经常和第三次MySQL服务器已经一去不复返了失败。该日志只能说明

 从pid文件120423九时13分38秒mysqld_safe的mysqld的/var/run/mysqld/mysqld.pid结束
120423 9点14分27秒mysqld_safe的启动mysqld守护进程在/ var / lib中/ MySQL数据库
120423九时14分27秒[注意]插件FEDERATED被禁用。
120423九时14分27秒的InnoDB:InnoDB的内存堆被禁用
120423九时14分27秒的InnoDB:互斥和rw_locks使用GCC原子建宏
120423九时14分27秒的InnoDB:COM pressed表使用的zlib 1.2.3
120423九时14分27秒的InnoDB:使用Linux原生AIO
120423九时14分27秒的InnoDB:初始化缓冲池,大小= 512.0M
InnoDB的:MMAP(549453824字节)失败;错误号12
120423九时14分27秒的InnoDB:缓冲池完成初始化
120423九时14分27秒的InnoDB:致命错误:无法为缓冲池分配内存
120423九时14分27秒[错误]插件InnoDB的初始化函数返回的错误。
120423九时14分27秒[错误]插件的InnoDB'注册为一个存储引擎失败。
120423九时14分27秒[错误]未知/不支持的存储引擎:InnoDB的
120423九时14分27秒[错误]中止
 

什么是真正的失败;错误号12 ?我怎么可以给更多的空间/内存或任何需要做出这个固定。

我解决这个问题,每次通过重新启动整个系统并删除所有日志并重新启动MySQL服务器。但我知道什么是错的我的配置。

也是我'的my.cnf'类似如下:

 的[mysqld]
当systemd使用#设置用户和组都将被忽略。
#如果你需要根据不同的用户或组运行的mysqld,
#根据自定义systemd单元文件的mysqld
在http://fedoraproject.org/wiki/Systemd#指示
#的max_allowed_pa​​cket = 500M
DATADIR =的/ var / lib中/ MySQL的
插座=的/ var / lib中/ MySQL的/的mysql.sock
#禁止符号,链接,建议prevent各类安全隐患
符号,链接= 0


innodb_buffer_pool_size = 512M


[mysqld_safe的]
日志错误=的/ var /日志/ mysqld.log
PID文件=的/ var /运行/ mysqld的/ mysqld.pid
 

解决方案

我遇到了同样的问题,当我试图不RDS在我的微实例上运行一个字preSS。

添加一个交换页面解决了这个问题对我来说。

您可以按照这个设置交换页面:

<一个href="http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html">http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html

如果仍然无法为你工作,考虑使用RDS服务。

===============================================

链接到博客有时会失败。我复制下面的内容备案。幸得博客作者 Pedram Moubed 的:

亚马逊EC2实例微交换空间 - Linux的

我有一个Amazon EC2上的Linux微实例。由于微型实例只有613MB的内存,MySQL的坠毁飘飞。之后关于MySQL,微型实例和内存枭雄一个漫长的寻找,我发现有微比如没有默认的交换空间。所以,如果你想避免撞车,你可能需要设置为你的微实例的交换空间。其实性能方面不如中启用交换。

下面显示的步骤如何让你的微实例的交换空间。我假设你有AWS账户与微实例运行。

  1. 运行 DD若= /开发/的= /交换文件BS零= 1M计算= 1024
  2. 运行再用mkswap /交换文件
  3. 运行 swapon命令/交换文件
  4. 在添加此行 /交换文件交换交换默认0 0 / etc / fstab文件

步骤4,如果你想为每次开机后自动启用交换文件需要。

有关交换空间的一些有用的命令:

  $ swapon命令-s
$免费-k

$的swapoff -a
$ swapon命令-a
 

参考文献:

  1. <一个href="http://www.thegeekstuff.com/2010/08/how-to-add-swap-space/">http://www.thegeekstuff.com/2010/08/how-to-add-swap-space/
  2. <一个href="http://cloudstory.in/2012/02/getting-the-best-out-of-amazon-ec2-micro-instances/">http://cloudstory.in/2012/02/getting-the-best-out-of-amazon-ec2-micro-instances/
  3. <一个href="http://cloudstory.in/2012/02/adding-swap-space-to-amazon-ec2-linux-micro-instance-to-increase-the-performance/">http://cloudstory.in/2012/02/adding-swap-space-to-amazon-ec2-linux-micro-instance-to-increase-the-performance/
  4. http://aws.amazon.com/ec2/instance-types/

I have set up a micro instance server on EC2 based on what I read here

mysql server fails frequently and for the third time mysql server is gone. The logs only shows

120423 09:13:38 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
120423 09:14:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120423  9:14:27 [Note] Plugin 'FEDERATED' is disabled.
120423  9:14:27 InnoDB: The InnoDB memory heap is disabled
120423  9:14:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120423  9:14:27 InnoDB: Compressed tables use zlib 1.2.3
120423  9:14:27 InnoDB: Using Linux native AIO
120423  9:14:27 InnoDB: Initializing buffer pool, size = 512.0M
InnoDB: mmap(549453824 bytes) failed; errno 12
120423  9:14:27 InnoDB: Completed initialization of buffer pool
120423  9:14:27 InnoDB: Fatal error: cannot allocate memory for the buffer pool
120423  9:14:27 [ERROR] Plugin 'InnoDB' init function returned error.
120423  9:14:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120423  9:14:27 [ERROR] Unknown/unsupported storage engine: InnoDB
120423  9:14:27 [ERROR] Aborting

What is really failed; errno 12? And how could I give more space/memory or whatever needed to make this fixed.

I fix this each time by rebooting the whole system and deleting all logs and restart the mysql server. But I know something is wrong with my configuration.

Also my `my.cnf' is like below :

[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# max_allowed_packet=500M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0


innodb_buffer_pool_size         = 512M


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

解决方案

I met the same problem when I tried to run a wordpress on my micro instance without RDS.

Adding a Swap page solved the problem for me.

You can follow this to setup the swap page:

http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html

If it still doesn't work for you, consider using the RDS service.

===============================================

The link to the blog sometimes fails. I copied the content below for the record. Credit goes to the blog author Pedram Moubed:

Amazon EC2 Micro Instance Swap Space - Linux

I have a Amazon EC2 Linux Micro instance. Since Micro instances have only 613MB of memory, MySQL crashed every now and then. After a long search about MySQL, Micro Instance and Memory Managment I found out there is no default SWAP space for Micro instance. So if you want to avoid the crash you may need to setup a swap space for your micro instance. Actually performance wise is better to enable swap.

Steps below show how to make a swap space for your Micro instance. I assume you have AWS Account with a Micro instance running.

  1. Run dd if=/dev/zero of=/swapfile bs=1M count=1024
  2. Run mkswap /swapfile
  3. Run swapon /swapfile
  4. Add this line /swapfile swap swap defaults 0 0 to /etc/fstab

Step 4 is needed if you would like to automatically enable swap file after each reboot.

Some useful command related to SWAP space:

$ swapon -s   
$ free -k

$ swapoff -a
$ swapon  -a

References:

  1. http://www.thegeekstuff.com/2010/08/how-to-add-swap-space/
  2. http://cloudstory.in/2012/02/getting-the-best-out-of-amazon-ec2-micro-instances/
  3. http://cloudstory.in/2012/02/adding-swap-space-to-amazon-ec2-linux-micro-instance-to-increase-the-performance/
  4. http://aws.amazon.com/ec2/instance-types/

这篇关于亚马逊EC2,MySQL的中止开始因为InnoDB:MMAP(X字节)失败;错误号12的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆