当有大量写操作时,mysqld_safe有时会重启mysqld。
任何人都可以帮助mysqld重启的主要原因是什么?我该怎么做才能避免这种情况?
登录mysql.log:
140319 15:07:09 mysqld_safe Number of processes running now: 0
140319 15:07:09 mysqld_safe mysqld restarted
2014-03-19 15:07:13 7166 [Note] Plugin 'FEDERATED' is disabled.
2014-03-19 15:07:13 7fed47cc4720 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2014-03-19 15:07:13 7166 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-03-19 15:07:13 7166 [Note] InnoDB: The InnoDB memory heap is disabled
2014-03-19 15:07:13 7166 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-03-19 15:07:13 7166 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-03-19 15:07:13 7166 [Note] InnoDB: Using Linux native AIO
2014-03-19 15:07:13 7166 [Note] InnoDB: Using CPU crc32 instructions
2014-03-19 15:07:13 7166 [Note] InnoDB: Initializing buffer pool, size = 4.0G
2014-03-19 15:07:14 7166 [Note] InnoDB: Completed initialization of buffer pool
2014-03-19 15:07:14 7166 [Note] InnoDB: Highest supported file format is Barracuda.
2014-03-19 15:07:14 7166 [Note] InnoDB: The log sequence numbers 8849779176 and 8849779176 in ibdata files do not match the log sequence number 11847803192 in the ib_logfiles!
2014-03-19 15:07:14 7166 [Note] InnoDB: Database was not shutdown normally!
2014-03-19 15:07:14 7166 [Note] InnoDB: Starting crash recovery.
2014-03-19 15:07:14 7166 [Note] InnoDB: Reading tablespace information from the .ibd files...
2014-03-19 15:07:14 7166 [Note] InnoDB: Restoring possible half-written data pages
2014-03-19 15:07:14 7166 [Note] InnoDB: from the doublewrite buffer...
2014-03-19 15:07:14 7166 [Note] InnoDB: 128 rollback segment(s) are active.
2014-03-19 15:07:14 7166 [Note] InnoDB: Waiting for purge to start
2014-03-19 15:07:14 7166 [Note] InnoDB: 5.6.16 started; log sequence number 11847803192
2014-03-19 15:07:14 7166 [Note] Server hostname (bind-address): '*'; port: 3306
2014-03-19 15:07:14 7166 [Note] IPv6 is available.
2014-03-19 15:07:14 7166 [Note] - '::' resolves to '::';
2014-03-19 15:07:14 7166 [Note] Server socket created on IP: '::'.
2014-03-19 15:07:14 7166 [Note] Event Scheduler: Loaded 0 events
2014-03-19 15:07:14 7166 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.16' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
答案 0 :(得分:1)
自动重启MYSQLID_SAFE和MYSQLID:
这有点令人不安。
mysqld始终由mysqld_safe重新启动,因为mysqld
_ safe的底部有一个无限循环来检查异常关闭。如果错误太严重,则事件mysqld_safe
在后续尝试中不能restart mysqld
。
鉴于mysqld_safe
设计的情况,如果mysqld
无论如何都会拒绝它,强制mysqld_safe
启动可能不是一个好主意。
您需要在my.cnf
中找到错误日志
[mysqld]
log-error=log-filename
或
[mysqld_safe]
log-error=log-filename
读取文本文件(可能是通过运行tail -30 log-filename)并找到关闭的mysqld处理源。
要避免的另一个:
首先避免这个问题显然会更好。无论如何,我不确定CentOS
如何管理服务,但我认为它使用服务。如果是这样,您可以检查mysql服务是否正在运行
/sbin/service mysql status
如果mysql正在运行,此命令将成功退出,如果不是,则返回非0退出状态。因此,如果服务未使用此命令运行,则可以启动该服务:
/sbin/service mysql status || service mysql start
您可以将此行添加到/ etc / crontab以每分钟启动一次命令:
* * * * * /sbin/service mysql status || service mysql start