开发者社区> 问答> 正文

Amazon EC2,mysql中止启动,因为InnoDB:mmap(x字节)失败;埃尔?mysql

我已根据此处的内容在EC2上设置了微型实例服务器

mysql服务器频繁失败,并且第三次mysql服务器不见了。日志仅显示

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 到底是什么failed; errno 12?以及如何给我更多的空间/内存或进行修复所需的一切。

我每次通过重新启动整个系统并删除所有日志并重新启动mysql服务器来解决此问题。但是我知道我的配置有问题。

我的“ my.cnf”也如下所示:

[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

展开
收起
保持可爱mmm 2020-05-17 11:14:38 510 0
1 条回答
写回答
取消 提交回答
  • 当我尝试在没有RDS的微型实例上运行wordpress时遇到了相同的问题。

    添加交换页面为我解决了这个问题。

    您可以按照以下步骤设置交换页面:

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

    如果仍然无法使用,请考虑使用RDS服务。

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

    指向博客的链接有时会失败。我复制了以下内容作为记录。感谢博客作者Pedram Moubed:

    Amazon EC2微型实例交换空间-Linux

    我有一个Amazon EC2 Linux Micro实例。由于Micro实例只有613MB的内存,因此MySQL有时会崩溃。在长时间搜索MySQL,微型实例和内存管理后,我发现微型实例没有默认的SWAP空间。因此,如果要避免崩溃,可能需要为微型实例设置交换空间。实际上,明智的做法是启用交换更好。

    下面的步骤显示了如何为Micro实例创建交换空间。我假设您有运行Micro实例的AWS账户。

    跑 dd if=/dev/zero of=/swapfile bs=1M count=1024 跑 mkswap /swapfile 跑 swapon /swapfile 将此行添加/swapfile swap swap defaults 0 0到/etc/fstab 如果您想在每次重新启动后自动启用交换文件,则需要执行步骤4。

    一些与SWAP空间有关的有用命令:

    $ swapon -s
    $ free -k

    $ swapoff -a $ swapon -a 参考文献:

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

    2020-05-18 11:12:26
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
搭建电商项目架构连接MySQL 立即下载
搭建4层电商项目架构,实战连接MySQL 立即下载
PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

相关镜像