Solve & quot; mysql-bin.000001 & quot; problems occupying ultra-large space

Source: Internet
Author: User

In recent months, servers have always been on the machine frequently, leading to unguaranteed availability of the Bill lid. But it is also strange, when the server can be normally connected, Nginx also seems to be normal, but the PHP-FPM lost response. Later, I accidentally found out:
Rootfs 7.7G 7.7G 0 100%/

The root directory is full! It is considered that there are too many logs and the logs are cleared. However, logs are full every week. It makes Bill's lid restless. Later, the/var was partitioned independently, but it still did not work. /Var/tmp and/var/cache have been cleared, but the effect is still limited.

Today, the endurance sub-du-ah found/var/lib/mysql space usage exception, cd here ls-lh found:
-Rw ---- 1 mysql 5242880 Feb 27 ib_logfile0
-Rw ---- 1 mysql 5242880 Dec 27 ib_logfile1
-Rw ---- 1 mysql 588 M Mar 12 maria_log.00000003
-Rw ---- 1 mysql 52 Mar 12 0:54 maria_log_control
Drwx ------ 2 mysql root 4.0 K Jan 15 mysql
-Rw ---- 1 mysql 20 K Dec 27 17: 54 mysqld-bin.000001
-Rw ---- 1 mysql 715 K Dec 27 mysqld-bin.000002
-Rw ---- 1 mysql 625 Dec 28 mysqld-bin.000003
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000004
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000005
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000006
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000007
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000008
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000009
-Rw ---- 1 mysql 20 K Dec 27 18:22 mysqld-bin.000010
-Rw ---- 1 mysql 715 K Dec 27 mysqld-bin.000011
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000012
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000013
-Rw ---- 1 mysql 125 Dec 27 mysqld-bin.000014
-Rw ---- 1 mysql 125 Dec 28 mysqld-bin.000015
-Rw ---- 1 mysql 125 Dec 28 mysqld-bin.000016
-Rw ---- 1 mysql 125 Dec 28 mysqld-bin.000017
-Rw ---- 1 mysql 125 Dec 28 mysqld-bin.000018
-Rw ---- 1 mysql 1.4 K Dec 28 mysqld-bin.000019
-Rw ---- 1 mysql 125 Dec 28 mysqld-bin.000020
-Rw ---- 1 mysql 107 M Dec 28 mysqld-bin.000021
-Rw ---- 1 mysql 1.2 M Dec 30 mysqld-bin.000022
-Rw ---- 1 mysql 125 Dec 30 mysqld-bin.000023
-Rw ---- 1 mysql 3.8 K Dec 30 mysqld-bin.000024
-Rw ---- 1 mysql 59 M Jan 11 mysqld-bin.000025
-Rw ---- 1 mysql 10 M Jan 14 mysqld-bin.000026
-Rw ---- 1 mysql 186 K Jan 15 mysqld-bin.000027
-Rw ---- 1 mysql 21 K Jan 15 mysqld-bin.000028
-Rw ---- 1 mysql 13 K Jan 15 mysqld-bin.000029
-Rw ---- 1 mysql 62 M Jan 17 16:36 mysqld-bin.000030
-Rw ---- 1 mysql 63 M Jan 18 mysqld-bin.000031
-Rw ---- 1 mysql 125 Jan 18 mysqld-bin.000032
-Rw ---- 1 mysql 21 K Jan 18 mysqld-bin.000033
-Rw ---- 1 mysql 118 M Jan 22 mysqld-bin.000034
-Rw ---- 1 mysql 209 K Jan 22 mysqld-bin.000035
-Rw ---- 1 mysql 117 M Jan 28 mysqld-bin.000036
-Rw ---- 1 mysql 125 Jan 28 mysqld-bin.000037
-Rw ---- 1 mysql 24 M Jan 28 16:01 mysqld-bin.000038
-Rw ---- 1 mysql 460 K Jan 28 mysqld-bin.000039
-Rw ---- 1 mysql 7.0 M Jan 28 mysqld-bin.000040
-Rw ---- 1 mysql 2.3 M Jan 28 mysqld-bin.000041
-Rw ---- 1 mysql 2.1 M Jan 28 mysqld-bin.000042
-Rw ---- 1 mysql 173 K Jan 28 mysqld-bin.000043
-Rw ---- 1 mysql 378 K Jan 28 mysqld-bin.000044
-Rw ---- 1 mysql 79 K Jan 28 17:50 mysqld-bin.000045
-Rw ---- 1 mysql 272 K Jan 28 mysqld-bin.000046
-Rw ---- 1 mysql 156 K Jan 28 mysqld-bin.000047
-Rw ---- 1 mysql 962 K Jan 28 mysqld-bin.000048
-Rw ---- 1 mysql 43 K Jan 28 mysqld-bin.000049
-Rw ---- 1 mysql 28 M Jan 29 11: 43 mysqld-bin.000050
-Rw ---- 1 mysql 125 Jan 29 mysqld-bin.000051
-Rw ---- 1 mysql 139 K Jan 29 mysqld-bin.000052
-Rw ---- 1 mysql 135 K Jan 29 mysqld-bin.000053
-Rw ---- 1 mysql 409 M Feb 9 mysqld-bin.000054
-Rw ---- 1 mysql 482 M Feb 17 mysqld-bin.000055
-Rw ---- 1 mysql 542 M Feb 27 mysqld-bin.000056
-Rw ---- 1 mysql 125 Feb 27 mysqld-bin.000057
-Rw ---- 1 mysql 125 Feb 27 mysqld-bin.000058
-Rw ---- 1 mysql 854 M Mar 13 mysqld-bin.000059
-Rw ---- 1 mysql 1.1 K Feb 27 mysqld-bin.index

God, what are these logs and bin ?! Finally, find the information:
Files such as mysql-bin.000001, mysql-bin.000002 are database operation logs, such as updating a table, or deleting some data, even if the statement does not match the data, the command is stored in the log file, the execution time of each statement is also recorded. This is mainly used for Operation Review and multi-database synchronization. Ib_logfile is used to record the table consistency of InnoDB. It can only be used after the server is installed. Maria_log.00000003 is a MariaDB-specific file used by the bill lid.

But for the bill lid, there is no master-slave database, and there is no need to review the operation, these files are completely useless! Therefore, first clear these files. Then edit the mysql configuration file, organize it to record the logs, and shovel the grass to remove the root. The MySQL logs of Gentoo are stored in/etc/mysql/my. cnf. Comment out the log-bin line.

Restart the MySQL server to solve the problem! The available space increases by several GB in an instant!



Author: biergaizi2009

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.