lulinux 发表于 2017-3-11 14:04:37

lnmp的mysql服务无辜挂掉

军哥你好:
安装好lnmp 1.3之后,运行两个网站,但是mysql会挂掉,也没有时间的规律,突然就挂掉了,每次重启lnmp restart,就恢复了。

err的日志:

170311 11:06:04 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZbp1h44q15c9j13hfqfdeZ.pid ended
170311 12:01:26 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
2017-03-11 12:01:26 0 /usr/local/mysql/bin/mysqld (mysqld 5.6.29-log) starting as process 14585 ...
2017-03-11 12:01:26 14585 Plugin 'FEDERATED' is disabled.
2017-03-11 12:01:26 14585 InnoDB: Using atomics to ref count buffer pool pages
2017-03-11 12:01:26 14585 InnoDB: The InnoDB memory heap is disabled
2017-03-11 12:01:26 14585 InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-11 12:01:26 14585 InnoDB: Memory barrier is not used
2017-03-11 12:01:26 14585 InnoDB: Compressed tables use zlib 1.2.3
2017-03-11 12:01:26 14585 InnoDB: Using CPU crc32 instructions
2017-03-11 12:01:26 14585 InnoDB: Initializing buffer pool, size = 256.0M
2017-03-11 12:01:26 14585 InnoDB: Completed initialization of buffer pool
2017-03-11 12:01:26 14585 InnoDB: Highest supported file format is Barracuda.
2017-03-11 12:01:26 14585 InnoDB: The log sequence numbers 1626130 and 1626130 in ibdata files do not match the log sequence number 1626140 in the ib_logfiles!
2017-03-11 12:01:26 14585 InnoDB: Database was not shutdown normally!
2017-03-11 12:01:26 14585 InnoDB: Starting crash recovery.
2017-03-11 12:01:26 14585 InnoDB: Reading tablespace information from the .ibd files...
2017-03-11 12:01:26 14585 InnoDB: Restoring possible half-written data pages
2017-03-11 12:01:26 14585 InnoDB: from the doublewrite buffer...
2017-03-11 12:01:26 14585 InnoDB: 128 rollback segment(s) are active.
2017-03-11 12:01:26 14585 InnoDB: Waiting for purge to start
2017-03-11 12:01:26 14585 InnoDB: 5.6.29 started; log sequence number 1626140
2017-03-11 12:01:26 14585 Recovering after a crash using mysql-bin
2017-03-11 12:01:27 14585 Starting crash recovery...
2017-03-11 12:01:27 14585 Crash recovery finished.
2017-03-11 12:01:27 14585 Server hostname (bind-address): '*'; port: 3306
2017-03-11 12:01:27 14585 IPv6 is available.
2017-03-11 12:01:27 14585    - '::' resolves to '::';
2017-03-11 12:01:27 14585 Server socket created on IP: '::'.
2017-03-11 12:01:27 14585 Event Scheduler: Loaded 0 events
2017-03-11 12:01:27 14585 /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.6.29-log'socket: '/tmp/mysql.sock'port: 3306Source distribution



麻烦军哥看看,谢谢。

licess 发表于 2017-3-12 13:40:07

回复 1# 的帖子

这个日子上没有具体的信息,可以往前再翻翻看看

lulinux 发表于 2017-3-12 14:31:01

谢谢军哥,今天4点收到短息说挂了,我把4点多的日志截取出来,您看看:
170311 23:43:55 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZbp1h44q15c9j13hfqfdeZ.pid ended
170311 23:47:14 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
2017-03-11 23:47:14 0 /usr/local/mysql/bin/mysqld (mysqld 5.6.29-log) starting as process 22570 ...
2017-03-11 23:47:14 22570 Plugin 'FEDERATED' is disabled.
2017-03-11 23:47:14 22570 InnoDB: Using atomics to ref count buffer pool pages
2017-03-11 23:47:14 22570 InnoDB: The InnoDB memory heap is disabled
2017-03-11 23:47:14 22570 InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-11 23:47:14 22570 InnoDB: Memory barrier is not used
2017-03-11 23:47:14 22570 InnoDB: Compressed tables use zlib 1.2.3
2017-03-11 23:47:14 22570 InnoDB: Using CPU crc32 instructions
2017-03-11 23:47:14 22570 InnoDB: Initializing buffer pool, size = 64.0M
2017-03-11 23:47:14 22570 InnoDB: Completed initialization of buffer pool
2017-03-11 23:47:14 22570 InnoDB: Highest supported file format is Barracuda.
2017-03-11 23:47:14 22570 InnoDB: 128 rollback segment(s) are active.
2017-03-11 23:47:14 22570 InnoDB: Waiting for purge to start
2017-03-11 23:47:14 22570 InnoDB: 5.6.29 started; log sequence number 1626250
2017-03-11 23:47:14 22570 Server hostname (bind-address): '*'; port: 3306
2017-03-11 23:47:14 22570 IPv6 is available.
2017-03-11 23:47:14 22570    - '::' resolves to '::';
2017-03-11 23:47:14 22570 Server socket created on IP: '::'.
2017-03-11 23:47:15 22570 Event Scheduler: Loaded 0 events
2017-03-11 23:47:15 22570 /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.6.29-log'socket: '/tmp/mysql.sock'port: 3306Source distribution
170312 04:27:57 mysqld_safe Number of processes running now: 0
170312 04:27:57 mysqld_safe mysqld restarted
2017-03-12 04:27:57 0 /usr/local/mysql/bin/mysqld (mysqld 5.6.29-log) starting as process 24426 ...
2017-03-12 04:27:57 24426 Plugin 'FEDERATED' is disabled.
2017-03-12 04:27:57 24426 InnoDB: Using atomics to ref count buffer pool pages
2017-03-12 04:27:57 24426 InnoDB: The InnoDB memory heap is disabled
2017-03-12 04:27:57 24426 InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-12 04:27:57 24426 InnoDB: Memory barrier is not used
2017-03-12 04:27:57 24426 InnoDB: Compressed tables use zlib 1.2.3
2017-03-12 04:27:57 24426 InnoDB: Using CPU crc32 instructions
2017-03-12 04:27:57 24426 InnoDB: Initializing buffer pool, size = 64.0M
2017-03-12 04:27:57 24426 InnoDB: Completed initialization of buffer pool
2017-03-12 04:27:57 24426 InnoDB: Highest supported file format is Barracuda.
2017-03-12 04:27:57 24426 InnoDB: The log sequence numbers 1626250 and 1626250 in ibdata files do not match the log sequence number 1626260 in the ib_logfiles!
2017-03-12 04:27:57 24426 InnoDB: Database was not shutdown normally!
2017-03-12 04:27:57 24426 InnoDB: Starting crash recovery.
2017-03-12 04:27:57 24426 InnoDB: Reading tablespace information from the .ibd files...
2017-03-12 04:27:58 24426 InnoDB: Restoring possible half-written data pages
2017-03-12 04:27:58 24426 InnoDB: from the doublewrite buffer...
2017-03-12 04:27:58 24426 InnoDB: 128 rollback segment(s) are active.
2017-03-12 04:27:58 24426 InnoDB: Waiting for purge to start
2017-03-12 04:27:58 24426 InnoDB: 5.6.29 started; log sequence number 1626260
2017-03-12 04:27:58 24426 Recovering after a crash using mysql-bin
2017-03-12 04:27:58 24426 Starting crash recovery...
2017-03-12 04:27:58 24426 Crash recovery finished.
2017-03-12 04:27:58 24426 Server hostname (bind-address): '*'; port: 3306
2017-03-12 04:27:58 24426 IPv6 is available.
2017-03-12 04:27:58 24426    - '::' resolves to '::';
2017-03-12 04:27:58 24426 Server socket created on IP: '::'.
2017-03-12 04:27:58 24426 Event Scheduler: Loaded 0 events
2017-03-12 04:27:58 24426 /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.6.29-log'socket: '/tmp/mysql.sock'port: 3306Source distribution
170312 04:28:38 mysqld_safe Number of processes running now: 0
170312 04:28:38 mysqld_safe mysqld restarted
2017-03-12 04:28:39 0 /usr/local/mysql/bin/mysqld (mysqld 5.6.29-log) starting as process 24471 ...
2017-03-12 04:28:39 24471 Plugin 'FEDERATED' is disabled.
2017-03-12 04:28:39 24471 InnoDB: Using atomics to ref count buffer pool pages
2017-03-12 04:28:39 24471 InnoDB: The InnoDB memory heap is disabled
2017-03-12 04:28:39 24471 InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-12 04:28:39 24471 InnoDB: Memory barrier is not used
2017-03-12 04:28:39 24471 InnoDB: Compressed tables use zlib 1.2.3
2017-03-12 04:28:39 24471 InnoDB: Using CPU crc32 instructions
2017-03-12 04:28:39 24471 InnoDB: Initializing buffer pool, size = 64.0M
InnoDB: mmap(68681728 bytes) failed; errno 12
2017-03-12 04:28:39 24471 InnoDB: Cannot allocate memory for the buffer pool
2017-03-12 04:28:39 24471 Plugin 'InnoDB' init function returned error.
2017-03-12 04:28:39 24471 Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-03-12 04:28:39 24471 Unknown/unsupported storage engine: InnoDB
2017-03-12 04:28:39 24471 Aborting




再次感谢军哥。

lulinux 发表于 2017-3-12 14:32:59

第二段是建中午的时候,疯狂的挂掉,重启之后,不超过5分钟一直挂,我把这部分的日志也截取出来:

170312 11:13:50 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZbp1h44q15c9j13hfqfdeZ.pid ended
170312 11:13:52 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
2017-03-12 11:13:52 0 /usr/local/mysql/bin/mysqld (mysqld 5.6.29-log) starting as process 32613 ...
2017-03-12 11:13:52 32613 Plugin 'FEDERATED' is disabled.
2017-03-12 11:13:52 32613 InnoDB: Using atomics to ref count buffer pool pages
2017-03-12 11:13:52 32613 InnoDB: The InnoDB memory heap is disabled
2017-03-12 11:13:52 32613 InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-12 11:13:52 32613 InnoDB: Memory barrier is not used
2017-03-12 11:13:52 32613 InnoDB: Compressed tables use zlib 1.2.3
2017-03-12 11:13:52 32613 InnoDB: Using CPU crc32 instructions
2017-03-12 11:13:52 32613 InnoDB: Initializing buffer pool, size = 256.0M
2017-03-12 11:13:52 32613 InnoDB: Completed initialization of buffer pool
2017-03-12 11:13:52 32613 InnoDB: Highest supported file format is Barracuda.
2017-03-12 11:13:52 32613 InnoDB: 128 rollback segment(s) are active.
2017-03-12 11:13:52 32613 InnoDB: Waiting for purge to start
2017-03-12 11:13:52 32613 InnoDB: 5.6.29 started; log sequence number 1626350
2017-03-12 11:13:52 32613 Server hostname (bind-address): '*'; port: 3306
2017-03-12 11:13:52 32613 IPv6 is available.
2017-03-12 11:13:52 32613 - '::' resolves to '::';
2017-03-12 11:13:52 32613 Server socket created on IP: '::'.
2017-03-12 11:13:52 32613 Event Scheduler: Loaded 0 events
2017-03-12 11:13:52 32613 /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.6.29-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution
2017-03-12 11:19:47 32613 /usr/local/mysql/bin/mysqld: Normal shutdown

2017-03-12 11:19:47 32613 Giving 0 client threads a chance to die gracefully
2017-03-12 11:19:47 32613 Event Scheduler: Purging the queue. 0 events
2017-03-12 11:19:47 32613 Shutting down slave threads
2017-03-12 11:19:47 32613 Forcefully disconnecting 0 remaining clients
2017-03-12 11:19:47 32613 Binlog end
2017-03-12 11:19:47 32613 Shutting down plugin 'partition'
2017-03-12 11:19:47 32613 Shutting down plugin 'PERFORMANCE_SCHEMA'
2017-03-12 11:19:47 32613 Shutting down plugin 'ARCHIVE'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_DATAFILES'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_TABLESPACES'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_FOREIGN'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_FIELDS'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_COLUMNS'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_INDEXES'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_TABLESTATS'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_SYS_TABLES'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_FT_CONFIG'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_FT_BEING_DELETED'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_FT_DELETED'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_METRICS'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_BUFFER_PAGE'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_CMP_PER_INDEX'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_CMPMEM_RESET'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_CMPMEM'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_CMP_RESET'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_CMP'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_LOCK_WAITS'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_LOCKS'
2017-03-12 11:19:47 32613 Shutting down plugin 'INNODB_TRX'
2017-03-12 11:19:47 32613 Shutting down plugin 'InnoDB'
2017-03-12 11:19:47 32613 InnoDB: FTS optimize thread exiting.
2017-03-12 11:19:47 32613 InnoDB: Starting shutdown...
2017-03-12 11:19:48 32613 InnoDB: Shutdown completed; log sequence number 1626360
2017-03-12 11:19:48 32613 Shutting down plugin 'BLACKHOLE'
2017-03-12 11:19:48 32613 Shutting down plugin 'CSV'
2017-03-12 11:19:48 32613 Shutting down plugin 'MyISAM'
2017-03-12 11:19:48 32613 Shutting down plugin 'MRG_MYISAM'
2017-03-12 11:19:48 32613 Shutting down plugin 'MEMORY'
2017-03-12 11:19:48 32613 Shutting down plugin 'sha256_password'
2017-03-12 11:19:48 32613 Shutting down plugin 'mysql_old_password'
2017-03-12 11:19:48 32613 Shutting down plugin 'mysql_native_password'
2017-03-12 11:19:48 32613 Shutting down plugin 'binlog'
2017-03-12 11:19:48 32613 /usr/local/mysql/bin/mysqld: Shutdown complete

170312 11:19:48 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZbp1h44q15c9j13hfqfdeZ.pid ended
170312 11:19:51 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
2017-03-12 11:19:51 0 /usr/local/mysql/bin/mysqld (mysqld 5.6.29-log) starting as process 815 ...
2017-03-12 11:19:51 815 Plugin 'FEDERATED' is disabled.
2017-03-12 11:19:51 815 InnoDB: Using atomics to ref count buffer pool pages
2017-03-12 11:19:51 815 InnoDB: The InnoDB memory heap is disabled
2017-03-12 11:19:51 815 InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-12 11:19:51 815 InnoDB: Memory barrier is not used
2017-03-12 11:19:51 815 InnoDB: Compressed tables use zlib 1.2.3
2017-03-12 11:19:51 815 InnoDB: Using CPU crc32 instructions
2017-03-12 11:19:51 815 InnoDB: Initializing buffer pool, size = 256.0M
2017-03-12 11:19:51 815 InnoDB: Completed initialization of buffer pool
2017-03-12 11:19:51 815 InnoDB: Highest supported file format is Barracuda.
2017-03-12 11:19:51 815 InnoDB: 128 rollback segment(s) are active.
2017-03-12 11:19:51 815 InnoDB: Waiting for purge to start
2017-03-12 11:19:51 815 InnoDB: 5.6.29 started; log sequence number 1626360
2017-03-12 11:19:51 815 Server hostname (bind-address): '*'; port: 3306
2017-03-12 11:19:51 815 IPv6 is available.
2017-03-12 11:19:51 815 - '::' resolves to '::';
2017-03-12 11:19:51 815 Server socket created on IP: '::'.
2017-03-12 11:19:51 815 Event Scheduler: Loaded 0 events
2017-03-12 11:19:51 815 /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.6.29-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution

licess 发表于 2017-3-13 11:15:36

InnoDB: mmap(68681728 bytes) failed; errno 12
2017-03-12 04:28:39 24471 InnoDB: Cannot allocate memory for the buffer pool
内存可能不足了
你内存多大,建议把 innodb_buffer_pool_size 调小一些,再观察看看

lulinux 发表于 2017-3-13 14:56:37

主机的内存是2G,现在这里设置的是:256M.

调整到128或者64M ?

lulinux 发表于 2017-3-13 15:02:07

军哥您好,另外一个阿里云的ECS,是2核4G内存的;

innodb_buffer_pool_size 之前设置的大小是:512M,也会导致数据库挂掉,但是不是很频繁,一般是1~2天才挂一次,是不是也要调整小一点,比如设置成256M ?

谢谢。

lulinux 发表于 2017-3-13 15:05:39

另外,刚才查看了数据库编码,都是mysiam的,这样是不是可以关闭InnoDB这个数据库引擎?

谢谢。

licess 发表于 2017-3-13 19:33:14

回复 7# 的帖子

2G的话设置128MB把,4G的256MB

mysql 5.6的话,编辑/etc/my.cnf
innodb=OFF
ignore-builtin-innodb
skip-innodb
default_storage_engine = MyISAM
default_tmp_storage_engine = MyISAM

将#loose-innodb 那些行前面的# 删掉

lulinux 发表于 2017-3-20 10:42:23

感谢军哥,这几天一直观察中,数据库没有再挂过,再次感谢军哥。
页: [1]
查看完整版本: lnmp的mysql服务无辜挂掉