gpt4 book ai didi

mysqld_safe mysqld 自动重启

转载 作者:可可西里 更新时间:2023-11-01 07:08:58 25 4
gpt4 key购买 nike

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)

最佳答案

MYSQLID_SAFE 和 MYSQLID 自动重启:

这有点令人不安。

mysqld总是由 mysqld_safe 重新启动因为在mysqld_safe底层有一个无限循环来检测异常关机。如果错误太严重,则 mysqld_safe 事件无法在后续尝试中重新启动 mysqld

考虑到 mysqld_safe 是为这种情况设计的,如果 mysqld_safe 拒绝它,强制启动 mysqld 可能不是一个好主意无论如何。

您需要在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 正在运行,此命令将成功退出,如果 i 未运行,则返回非 0 退出状态。因此,如果服务未运行,您可以使用此命令启动该服务:

/sbin/service mysql status || service mysql start

您可以将此行添加到/etc/crontab 以每分钟启动一次命令:

* * * * * /sbin/service mysql status || service mysql start

关于mysqld_safe mysqld 自动重启,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22522307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com