Received a monitor message today that blog access failed. Open the page a look, the huge 502 bad gateway,ping a VPS found is pass, SSH connection up to see the Nginx log found no problem, restart Lnmp when found MySQL, the problem source basically found.
| The code is as follows |
Copy Code |
Tail/usr/local/mysql/var/slyar.err |
Look at the error log MySQL, the unexpected situation appears ...
Disk is full writing './mysql-bin.~rec~ ' (errcode:28). Waiting for someone. (Expect up to secs delay for server to continue after freeing disk spaces)
Amazing situation, incredibly because the disk is full, unable to write to the log caused MySQL not to start
| The code is as follows |
Copy Code |
root@slyar# DF FileSystem 1k-blocks Used Available use% mounted on /DEV/SDA1 3016688 2877540 0 100%/ |
Sure enough, the/var catalog exploded.
| code is as follows |
copy code |
| root@slyar:/ usr/local/mysql/var# ll--BLOCK-SIZE=MB Total 504MB -rw-rw----1 mysql mysql 26MB June June mysql-bin.000011 -RW-RW----1 MySQL mysql 5MB June mysql-bin.000012 -RW-RW----1 mysql mysql 27MB Aug 8 mysql-bin.000013-rw-rw----1 mysql mysql 43MB Aug mysql-bin.000014 -rw-rw----1 mysql mysql 270MB Feb 9 17:05 mysql-bin.000 020 -rw-rw----1 mysql mysql 115MB Apr 12:27 mysql-bin.000021 -rw-rw----1 mysql mysql 1MB Feb ten 12:07 Mysql-b In.index -RW-RW----1 mysql mysql 0MB Apr 12:34 mysql-bin.~rec~ |
Basically, it's all over the stuff. mysql manual found that these things are not useful, direct deletion (this operation is best done when the MySQL service is stopped, because the current log can not be used to delete, and may cause some other problems, but with Mysql>reset Master command to clear the log directly)
| The code is as follows |
Copy Code |
root@slyar:/usr/local/mysql/var# rm-f mysql-bin.* |
To prevent such a situation from recurring, turn off MySQL's log-bin log function directly
| The code is as follows |
Copy Code |
Vim/etc/my.cnf |
Found it:
| The code is as follows |
Copy Code |
Log-bin=mysql-bin Binlog_format=mixed |
In front Plus # comment out,: Wq Save exit
At last
| The code is as follows |
Copy Code |
/etc/init.d/mysql restart |
Start the MySQL service, everything is OK.