大家好,今天晚上,我将一个非常大的导入导入到了我的服务器(带有 ubuntu 的 Linux 512Mb Ram 服务器)中,导入的数据库是 Magento(电子商务)。当我打开我的网站时,mysql 无法工作,我发现服务器中的服务已关闭、停止。我已重新启动所有 apache 2 和 memcache,现在可以正常工作。但我想知道 mysql 停止的原因。在 /var/log/mysql/error.log 中,我发现了以下行:
InnoDB: Progress in percents: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52$
InnoDB: Rolling back of trx id 1CA46C3 completed
130126 14:29:58 InnoDB: Rollback of non-prepared transactions completed
130128 6:05:51 [Note] Plugin 'FEDERATED' is disabled.
130128 6:05:59 InnoDB: The InnoDB memory heap is disabled
130128 6:05:59 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130128 6:05:59 InnoDB: Compressed tables use zlib 1.2.3.4
130128 6:06:11 InnoDB: Initializing buffer pool, size = 128.0M
130128 6:06:19 InnoDB: Completed initialization of buffer pool
130128 6:11:51 [Note] Plugin 'FEDERATED' is disabled.
130128 6:12:01 InnoDB: The InnoDB memory heap is disabled
130128 6:12:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130128 6:12:01 InnoDB: Compressed tables use zlib 1.2.3.4
130128 6:12:19 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
130128 6:12:23 InnoDB: Completed initialization of buffer pool
130128 6:12:23 InnoDB: Fatal error: cannot allocate memory for the buffer pool
130128 6:12:28 [ERROR] Plugin 'InnoDB' init function returned error.
130128 6:12:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130128 6:12:30 [ERROR] Unknown/unsupported storage engine: InnoDB
130128 6:12:30 [ERROR] Aborting
130128 6:12:32 [Note] /usr/sbin/mysqld: Shutdown complete
130128 6:21:04 [Note] /usr/sbin/mysqld: Shutdown complete
130128 6:21:03 [Note] Plugin 'FEDERATED' is disabled.
130128 6:21:03 InnoDB: The InnoDB memory heap is disabled
130128 6:21:03 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130128 6:21:03 InnoDB: Compressed tables use zlib 1.2.3.4
130128 6:21:03 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
130128 6:21:03 InnoDB: Completed initialization of buffer pool
130128 6:21:03 InnoDB: Fatal error: cannot allocate memory for the buffer pool
130128 6:21:03 [ERROR] Plugin 'InnoDB' init function returned error.
130128 6:21:03 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130128 6:21:03 [ERROR] Unknown/unsupported storage engine: InnoDB
130128 6:21:03 [ERROR] Aborting
130128 6:21:04 [Note] /usr/sbin/mysqld: Shutdown complete
您能帮我找到问题吗?此行有助于理解问题吗?
答案1
答案2
首先,我无法想象你为什么要用 512MB 的 RAM 来运营 Magento 商店 -这是灾难的根源。
130128 6:21:03 InnoDB:致命错误:无法为缓冲池分配内存
这是两件事之一。
您的 my.cnf
如果您从互联网上复制粘贴了“优化”的 Magento MySQL 配置,而没有注意您的硬件和 OP 的硬件的区别,这并不奇怪。
您可以通过执行以下来验证,
mysql> show variables like 'innodb_buffer%';
如果该数字超出了您的 RAM 数量 - 则在 MySQL 配置中减少它/etc/mysql/my.cnf
或/etc/my.cnf
重新启动 MySQL。
您受到以下限制 ulimit
即使您的 MySQL 配置在可接受的内存限制内 - 您也可能会受到服务器设置的限制。
您可以通过执行以下来验证,
ulimit -a
virtual memory
并检查和的值max memory size
。通过执行
ulimit -v unlimited
ulimit -m unlimited
然后启动 MySQL
/etc/init.d/mysql start