我希望每个人都很好。我的云服务器上有2GB内存和40GB硬盘存在问题,该主机托管一个Wordpress网站,每天接收1000-2000次点击。我的问题是MySQL总是崩溃,我唯一的选择是重启服务器。我注意到日志没有启用所以我启用了它们,这就是我发现的:
150207 17:31:42 [Note] Plugin 'FEDERATED' is disabled.
150207 17:31:42 InnoDB: The InnoDB memory heap is disabled
150207 17:31:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150207 17:31:42 InnoDB: Compressed tables use zlib 1.2.3.4
150207 17:31:42 InnoDB: Initializing buffer pool, size = 1.2G
InnoDB: mmap(1285636096 bytes) failed; errno 12
150207 17:31:42 InnoDB: Completed initialization of buffer pool
150207 17:31:42 InnoDB: Fatal error: cannot allocate memory for the buffer pool
150207 17:31:42 [ERROR] Plugin 'InnoDB' init function returned error.
150207 17:31:42 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150207 17:31:42 [ERROR] Unknown/unsupported storage engine: InnoDB
150207 17:31:42 [ERROR] Aborting
150207 17:31:42 [Note] /usr/sbin/mysqld: Shutdown complete
我猜这与内存分配或my.cnf文件中的某些设置有关。这些是内容:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
log_error = /var/log/mysql/mysql_error.log
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysql.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
datadir = /var/lib/mysql
thread_cache_size = 4
table_open_cache = 800
table_cache = 800
key_buffer = 32M
query_cache_type = 1
query_cache_size = 64M
query_cache_limit = 8M
innodb_buffer_pool_size = 1G
innodb_io_capacity = 2000
innodb_read_io_threads = 64
innodb_thread_concurrency = 0
innodb_write_io_threads = 64
log_error = /var/log/mysql/mysql_error.log
slow_query_log = 1
slow_query_log_file = /var/lib/mysql/ib_slow_log.log
非常感谢任何帮助。
问候!
答案 0 :(得分:0)
我知道这已经过时但我想分享一些简单的东西。所有我必须将服务器RAM升级到4GB并相应地加倍我的key_buffer,query_cache_size。从那时起,我的MySQL数据库中没有崩溃。谢谢!