Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqld_safe mysqld restarted automatically

Tags:

mysql

mysqld_safe sometimes restart the mysqld when there are huge write operations.

Anyone help what are the main reasons that mysqld will restart, What can I do to avoid this?

log in 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)
like image 540
jlming6 Avatar asked Nov 11 '22 11:11

jlming6


1 Answers

MYSQLID_SAFE AND MYSQLID RESTARTED AUTOMARTICALLY:

This is a little disturbing.

mysqld is always restarted by mysqld_safe because there is an infinite loop in the bottom of mysqld_safe to check for abnormal shutdowns. If the error is too severe, not event mysqld_safe can restart mysqld on subsequent tries.

Given that situation that mysqld_safe is designed for, it may not be a good idea to force mysqld to start if mysqld_safe will reject it anyway.

You need to locate the error log in my.cnf it will be under

[mysqld]
log-error=log-filename

or

[mysqld_safe]
log-error=log-filename

Read the text file (probably by running tail -30 log-filename) and find the source of the mysqld processing shutting down.

Another one to Avoid:

Its would obviously be better to avoid the problem in the first place. Anyway, I am not sure how CentOS manages services but I think it uses service. If so, you can check if the mysql service is running with

/sbin/service mysql status

This command will exit successfully if mysql is running and return a non 0 exit status if i is not. You can therefore start the service if it is not running with this command:

/sbin/service mysql status || service mysql start

You can add this line to /etc/crontab to launch thes command every minute:

* * * * * /sbin/service mysql status || service mysql start
like image 115
jmail Avatar answered Nov 14 '22 22:11

jmail