我在 ubuntu 服务器上运行 drupal 实例。但是,mysql 服务器似乎会定期崩溃。
我正在获取的日志是这样的:
131221 4:22:54 [Note] /usr/sbin/mysqld: Shutdown complete
131221 4:22:55 [Note] Plugin 'FEDERATED' is disabled.
131221 4:22:55 InnoDB: The InnoDB memory heap is disabled
131221 4:22:55 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131221 4:22:55 InnoDB: Compressed tables use zlib 1.2.3.4
131221 4:22:55 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
131221 4:22:55 InnoDB: Completed initialization of buffer pool
131221 4:22:55 InnoDB: Fatal error: cannot allocate memory for the buffer pool
131221 4:22:55 [ERROR] Plugin 'InnoDB' init function returned error.
131221 4:22:55 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
131221 4:22:55 [ERROR] Unknown/unsupported storage engine: InnoDB
131221 4:22:55 [ERROR] Aborting
131221 4:22:55 [Note] /usr/sbin/mysqld: Shutdown complete
131223 8:22:00 [Note] Plugin 'FEDERATED' is disabled.
131223 8:22:00 InnoDB: The InnoDB memory heap is disabled
131223 8:22:00 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131223 8:22:00 InnoDB: Compressed tables use zlib 1.2.3.4
131223 8:22:00 InnoDB: Initializing buffer pool, size = 128.0M
131223 8:22:00 InnoDB: Completed initialization of buffer pool
131223 8:22:00 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 4844461078
131223 8:22:00 InnoDB: Database was not shut down normally!
您对如何解决这个问题有什么建议吗?我尝试在 my.cnf 中尝试各种数字,但没有成功。
答案1
您的系统似乎没有足够的备用内存用于 innodb 缓冲池。您可以尝试减少 my.cnf 文件中 innodb_buffer_pool 的大小
innodb_buffer_pool_size = 10M
例如,然后重新启动 mysql。减少 innodb 缓冲池大小可能会影响系统的性能,因此您需要注意这一点,也许还需要考虑其他一些调整。