首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mysqld_safe mysqld自动重新启动

mysqld_safe mysqld自动重新启动
EN

Stack Overflow用户
提问于 2014-03-20 02:31:12
回答 1查看 15.9K关注 0票数 6

当有大量的写操作时,mysqld_safe有时会重新启动mysqld。

如果有人帮忙,那么mysqld重启的主要原因是什么,我能做些什么来避免这种情况呢?

登录mysql.log:

代码语言:javascript
复制
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)
EN

回答 1

Stack Overflow用户

发布于 2014-03-20 05:07:15

MYSQLID_SAFE和MYSQLID重新启动AUTOMARTICALLY:

这有点令人不安。

mysqld总是由mysqld重新启动,因为mysqld_safe的底部有一个无限循环来检查是否有异常关闭。如果错误太严重,则在以后的尝试中不会发生mysqld_safe restart mysqld事件。

鉴于mysqld_safe是针对这种情况而设计的,如果mysqld无论如何都会拒绝它,那么强制mysqld启动可能不是一个好主意。

您需要在my.cnf中找到它下面的错误日志

代码语言:javascript
复制
[mysqld]
log-error=log-filename

代码语言:javascript
复制
[mysqld_safe]
log-error=log-filename

读取文本文件(可能通过运行tail -30日志文件名)并找到关闭mysqld处理的源。

另一个要避免的问题:

显然,最好从一开始就避免这个问题。无论如何,我不知道CentOS如何管理服务,但我认为它使用服务。如果是的话,您可以检查mysql服务是否运行在

代码语言:javascript
复制
/sbin/service mysql status

如果mysql正在运行,此命令将成功退出,如果不运行,则返回非0退出状态。因此,如果服务没有使用以下命令运行,则可以启动该服务:

代码语言:javascript
复制
/sbin/service mysql status || service mysql start

您可以将这一行添加到/etc/crontab中,以便每分钟启动该命令:

代码语言:javascript
复制
* * * * * /sbin/service mysql status || service mysql start
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22522307

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档