阿里云 wordpress 博客从移动端访问 mysql 数据库就会挂掉

2017-01-06 10:00:51 +08:00
 magicdu

先说服务器:

阿里云的 centos7x86_64 +nginx+php-fpm+mysql5.6

1GB 内存

博客用的 wordpress

每次从手机浏览器里访问博客完 mysql 就挂了 监测了内存占用,发现 mysqld 占用的内存飙升, php-fpm 内存飙升

然后重启 mysql 失败了

service mysqld restart
MySQL server PID file could not be found!                  [FAILED]
Starting MySQL.The server quit without updating PID file (/alidata/server/mysql/data/iZ28o516t2sZ.pid).                                                    [FAILED]

下面是 MySQL 的日志:

2017-01-06 09:45:56 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-06 09:45:57 16722 [Note] Plugin 'FEDERATED' is disabled.
2017-01-06 09:45:57 16722 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-01-06 09:45:57 16722 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-06 09:45:57 16722 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-06 09:45:57 16722 [Note] InnoDB: Memory barrier is not used
2017-01-06 09:45:57 16722 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-01-06 09:45:57 16722 [Note] InnoDB: Using Linux native AIO
2017-01-06 09:45:57 16722 [Note] InnoDB: Using CPU crc32 instructions
2017-01-06 09:45:58 16722 [Note] InnoDB: Initializing buffer pool, size = 8.0M
InnoDB: mmap(8585216 bytes) failed; errno 12
2017-01-06 09:45:58 16722 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2017-01-06 09:45:58 16722 [ERROR] Plugin 'InnoDB' init function returned error.
2017-01-06 09:45:58 16722 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-01-06 09:45:58 16722 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-01-06 09:45:58 16722 [ERROR] Aborting

2017-01-06 09:45:58 16722 [Note] Binlog end
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'partition'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'BLACKHOLE'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_METRICS'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_CMPMEM'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_CMP'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_LOCKS'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'INNODB_TRX'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'ARCHIVE'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'MyISAM'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'CSV'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'MRG_MYISAM'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'MEMORY'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'sha256_password'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'mysql_old_password'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'mysql_native_password'
2017-01-06 09:45:58 16722 [Note] Shutting down plugin 'binlog'
2017-01-06 09:45:58 16722 [Note] /alidata/server/mysql/bin/mysqld: Shutdown complete

170106 09:45:58 mysqld_safe mysqld from pid file /alidata/server/mysql/data/iZ28o516t2sZ.pid ended
170106 09:46:45 mysqld_safe Starting mysqld daemon with databases from /alidata/server/mysql/data
2017-01-06 09:46:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-06 09:46:46 17067 [Note] Plugin 'FEDERATED' is disabled.
2017-01-06 09:46:46 17067 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-01-06 09:46:46 17067 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-06 09:46:46 17067 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-06 09:46:46 17067 [Note] InnoDB: Memory barrier is not used
2017-01-06 09:46:46 17067 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-01-06 09:46:46 17067 [Note] InnoDB: Using Linux native AIO
2017-01-06 09:46:46 17067 [Note] InnoDB: Using CPU crc32 instructions
2017-01-06 09:46:46 17067 [Note] InnoDB: Initializing buffer pool, size = 8.0M
2017-01-06 09:46:46 17067 [Note] InnoDB: Completed initialization of buffer pool
InnoDB: Error: pthread_create returned 11
170106 09:46:46 mysqld_safe mysqld from pid file /alidata/server/mysql/data/iZ28o516t2sZ.pid ended

是 php-fpm 的问题?还是 MySQL5.6 的问题 要怎么解决啊! 求大神

2392 次点击
所在节点    问与答
7 条回复
KenYang
2017-01-06 12:10:04 +08:00
出现了同样的问题 现在只能每次手动重启
alect
2017-01-06 12:14:40 +08:00
Cannot allocate memory for the buffer pool
内存不够用么
lzhd24
2017-01-06 12:31:40 +08:00
嗯,我也遇到过好多次, wordpress+mysql 配置,访问过多就会挂,阿里云论坛好像有解决办法。你可以搜搜
cevincheung
2017-01-06 12:35:43 +08:00
内存不够用。阿里云是不是没有 swap
abc123ccc
2017-01-06 13:58:54 +08:00
可能配置也有点问题吧,贴上你的 mysql 的配置文件信息。
icedream728
2017-01-07 08:24:19 +08:00
装 mysqltuner 看看 mysql 是不是要优化
abc123ccc
2017-01-07 09:28:02 +08:00
InnoDB: The InnoDB memory heap is disabled
2017-01-06 09:45:57 16722 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-06 09:45:57 16722 [Note] InnoDB: Memory barrier is not used
2017-01-06 09:45:57 16722 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-01-06 09:45:57 16722 [Note] InnoDB: Using Linux native AIO
2017-01-06 09:45:57 16722 [Note] InnoDB: Using CPU crc32 instructions
2017-01-06 09:45:58 16722 [Note] InnoDB: Initializing buffer pool, size = 8.0M
InnoDB: mmap(8585216 bytes) failed; errno 12

看这里:
The InnoDB memory heap is disabled
InnoDB: Memory barrier is not used
InnoDB: Initializing buffer pool, size = 8.0M
InnoDB: mmap(8585216 bytes) failed; errno 12


到这里就挂了,而且你的配置里似乎没有 innodb 的配置, myisam 的也好少。还有你的 bin-log 日志,如果没有什么用,可以关掉。

最好不要装高版本的 mysql ,除非你的内存大。好像 mysql5.6 及以上版本默认占内存好大。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/332593

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX