Recently there is a server MySQL often crash, in order to further locate the problem, the MySQL core file function is opened, the following steps for reference
"Open Step"
1. Add 2 configuration options in the My.cnf file
[Mysqld]
Core_file
[Mysqld_safe]
core-file-size=unlimited
2, modify the system parameters, configuration Suid_dumpable
Echo 1 >/proc/sys/fs/suid_dumpable
3, restart the MySQL service, the configuration takes effect
Service MySQL Restart
"Generate Core file"
1, simulation of MySQL crash scene, KILL–SEGV
2. After MySQL crash, the time to generate the core file depends on the amount of memory that MySQL occupies
The test environment generates a 21G core file, which takes about 3 minutes, during which the MySQL process exists, but the MySQL service cannot respond. In this case, the MHA switch occurs.
3, during the generation of core file, can not manually kill the MySQL process, otherwise the resulting core file will be truncated, unable to parse properly, after core dump, MySQL will automatically restart
4. After the core file is generated, you can use GDB to analyze
"Issues to be aware of"
1. You need to reserve enough disk space for the directory where the core file is generated, the default path will be generated in the data directory, file size reference mysql occupied memory size
2. Generating core file will prolong the time of automatic recovery of MySQL crash
"Original" to get MySQL crash when the core file