最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】crifan.com网站又挂了

MySQL crifan 360浏览 0评论
突然发现:
https://www.crifan.com/
Safari 浏览器无法打开页面 “https://www.crifan.com/”。 错误是:“FetchEvent.respondWith received an error: Returned response is null.” (WebKitServiceWorker:0)
看了下又是空间问题:
[[email protected] ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        79G   75G   73M 100% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           1.9G  193M  1.7G  11% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs           379M     0  379M   0% /run/user/0
->
看来要抽空好好解决一下问题了
为何mysql的binlog,始终报错?
[[email protected] mysql]# ls -lh
total 8.4G
-rw-r----- 1 mysql mysql   56 May  9  2019 auto.cnf
drwxr-x--- 2 mysql mysql 4.0K Sep  7 22:46 crifan_wp_db
-rw-r----- 1 mysql mysql  809 Sep  9 14:02 ib_buffer_pool
-rw-r----- 1 mysql mysql  12M Sep  9 14:03 ibdata1
-rw-r----- 1 mysql mysql  32M Sep  9 14:03 ib_logfile0
-rw-r----- 1 mysql mysql  32M May  9  2019 ib_logfile1
-rw-r----- 1 mysql mysql  32M May  9  2019 ib_logfile2
-rw-r----- 1 mysql mysql  12M Sep 20 18:16 ibtmp1
drwxr-x--- 2 mysql mysql 4.0K May  9  2019 mysql
-rw-r----- 1 mysql mysql 201M Sep 19 17:31 mysql-bin.000833
-rw-r----- 1 mysql mysql 201M Sep 19 18:13 mysql-bin.000834
-rw-r----- 1 mysql mysql 201M Sep 19 18:55 mysql-bin.000835
-rw-r----- 1 mysql mysql 201M Sep 19 19:29 mysql-bin.000836
-rw-r----- 1 mysql mysql 201M Sep 19 20:05 mysql-bin.000837
-rw-r----- 1 mysql mysql 201M Sep 19 20:54 mysql-bin.000838
-rw-r----- 1 mysql mysql 201M Sep 19 21:35 mysql-bin.000839
-rw-r----- 1 mysql mysql 201M Sep 19 22:19 mysql-bin.000840
-rw-r----- 1 mysql mysql 201M Sep 19 22:54 mysql-bin.000841
-rw-r----- 1 mysql mysql 201M Sep 19 23:12 mysql-bin.000842
-rw-r----- 1 mysql mysql 201M Sep 19 23:27 mysql-bin.000843
-rw-r----- 1 mysql mysql 201M Sep 19 23:58 mysql-bin.000844
-rw-r----- 1 mysql mysql 201M Sep 20 00:32 mysql-bin.000845
-rw-r----- 1 mysql mysql 201M Sep 20 01:13 mysql-bin.000846
-rw-r----- 1 mysql mysql 201M Sep 20 02:00 mysql-bin.000847
-rw-r----- 1 mysql mysql 201M Sep 20 02:36 mysql-bin.000848
-rw-r----- 1 mysql mysql 201M Sep 20 03:14 mysql-bin.000849
-rw-r----- 1 mysql mysql 201M Sep 20 03:51 mysql-bin.000850
-rw-r----- 1 mysql mysql 201M Sep 20 04:27 mysql-bin.000851
-rw-r----- 1 mysql mysql 201M Sep 20 05:11 mysql-bin.000852
-rw-r----- 1 mysql mysql 201M Sep 20 05:57 mysql-bin.000853
-rw-r----- 1 mysql mysql 201M Sep 20 06:59 mysql-bin.000854
-rw-r----- 1 mysql mysql 201M Sep 20 07:35 mysql-bin.000855
-rw-r----- 1 mysql mysql 201M Sep 20 08:19 mysql-bin.000856
-rw-r----- 1 mysql mysql 201M Sep 20 08:53 mysql-bin.000857
-rw-r----- 1 mysql mysql 201M Sep 20 09:32 mysql-bin.000858
-rw-r----- 1 mysql mysql 201M Sep 20 10:14 mysql-bin.000859
-rw-r----- 1 mysql mysql 201M Sep 20 10:56 mysql-bin.000860
-rw-r----- 1 mysql mysql 201M Sep 20 11:37 mysql-bin.000861
-rw-r----- 1 mysql mysql 201M Sep 20 12:22 mysql-bin.000862
-rw-r----- 1 mysql mysql 201M Sep 20 13:05 mysql-bin.000863
-rw-r----- 1 mysql mysql 201M Sep 20 13:35 mysql-bin.000864
-rw-r----- 1 mysql mysql 201M Sep 20 13:45 mysql-bin.000865
-rw-r----- 1 mysql mysql 201M Sep 20 13:56 mysql-bin.000866
-rw-r----- 1 mysql mysql 201M Sep 20 14:06 mysql-bin.000867
-rw-r----- 1 mysql mysql 201M Sep 20 14:17 mysql-bin.000868
-rw-r----- 1 mysql mysql 201M Sep 20 14:44 mysql-bin.000869
-rw-r----- 1 mysql mysql 201M Sep 20 15:17 mysql-bin.000870
-rw-r----- 1 mysql mysql 201M Sep 20 15:39 mysql-bin.000871
-rw-r----- 1 mysql mysql 201M Sep 20 16:17 mysql-bin.000872
-rw-r----- 1 mysql mysql 201M Sep 20 17:03 mysql-bin.000873
-rw-r----- 1 mysql mysql 178M Sep 21 03:16 mysql-bin.000874
-rw-r----- 1 mysql mysql  798 Sep 20 17:03 mysql-bin.index
-rw-r----- 1 mysql mysql 175K Sep 21 03:16 mysql-error.log
-rw-r----- 1 mysql mysql    5 Sep  9 14:03 mysql.pid
-rw-r----- 1 mysql mysql  94M Sep 21 03:16 mysql-slow.log
drwxr-x--- 2 mysql mysql 4.0K May  9  2019 performance_schema
drwxr-x--- 2 mysql mysql  12K May  9  2019 sys
好像只占用了8G
也不是很多?
[[email protected] /]# cd /data/
[[email protected] data]# ll
total 12
drwxr-xr-x 6 mysql mysql 4096 Sep 20 17:03 mysql
drwxr-xr-x 2 root  root  4096 Sep 22 03:36 wwwlogs
drwxr-xr-x 5 root  root  4096 May 24  2019 wwwroot
[[email protected] data]# du -sh
26G     .
[[email protected] data]# cd mysql/
[[email protected] mysql]# du -sh
8.7G    .
[[email protected] mysql]# cd ..
[[email protected] data]# du -sh wwwlogs/
36M     wwwlogs/
[[email protected] data]# du -sh wwwroot/
17G     wwwroot/
继续研究空间占用:
[[email protected] www.crifan.com]# du --max-depth=1 -h
16K     ./d3
15M     ./uploads
16K     ./released
2.9M    ./chenmo
37M     ./wp-includes
12G     ./files
4.0K    ./cgi-bin
9.2M    ./wp-admin
2.6G    ./wp-content
73M     ./wp-myadmin
15G     .
看了半天,感觉还是:
mysql的bin的log占用8G,太大,需要去删除掉
参考:
【已解决】WordPress网站crifan.com又出现:建立数据库连接时出错
以及再去参考:
【已解决】CentOS中mysql的bin的log日志文件占用太多空间
把之前的:
去配置,默认保存1天:
SET GLOBAL expire_logs_days = 1;
单个bin的log最大200M=209715200:
SET GLOBAL max_binlog_size = 209715200;
去把默认保存时间再去改短一些,比如2小时
mysql SET GLOBAL expire_logs
mysql set global binlog_expire_logs_seconds
mysql set global binlog_expire_logs_hours
logging – Can expire_logs_days be less than 1 day in MySQL? – Server Fault
replication – MySql – Changing expire_logs_days without restarting the server – Database Administrators Stack Exchange
How to set MySQL binlog retention in hours? – Database Administrators Stack Exchange
MySQL :: MySQL 8.0 Reference Manual :: 17.1.6.4 Binary Logging Options and Variables
GET GLOBAL binlog_expire_logs_seconds;
show variables like binlog_expire_logs_seconds;
show variables like "binlog_expire_logs";
结果都不行:
MySQL [(none)]> GET GLOBAL binlog_expire_logs_seconds;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GLOBAL binlog_expire_logs_seconds' at line 1
MySQL [(none)]> show variables like binlog_expire_logs_seconds;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'binlog_expire_logs_seconds' at line 1
MySQL [(none)]> show variables like "binlog_expire_logs";
Empty set (0.01 sec)


MySQL [(none)]> show variables like "binlog_expire";
Empty set (0.00 sec)
直接:
SET GLOBAL binlog_expire_logs_seconds = 2400;
结果:
MySQL [(none)]> SET GLOBAL binlog_expire_logs_seconds = 2400;
ERROR 1193 (HY000): Unknown system variable 'binlog_expire_logs_seconds'
然后:
MySQL [(none)]> SET GLOBAL expire_logs_days = 1;
Query OK, 0 rows affected (0.01 sec)
是可以的。
但是郁闷的是:
此处设置的最多保留1天的binlog
但是此处是9月22号
按道理,最多只能看到9月21号的log才对
但是上面binlog最早的有:
9月19的
即3,4天前的log,都没有自动清理。。。
MySQL [(none)]> show variables like expire_log_*;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'expire_log_*' at line 1
MySQL [(none)]> show variables like 'expire_log_*';
Empty set (0.00 sec)
发现了,此处mysql是旧版本:
[[email protected] 12]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2505843
Server version: 5.7.26-log MySQL Community Server (GPL)
看来是:没有新的变量:
binlog_expire_logs_seconds
只能用旧的变量:
expire_logs_days
那算了,暂时只能:手动删除多余的binlog
对了,那可以去:
把binlog最大文件大小改为:
10M
然后至少单次能撑很长时间
如果后续还是会导致:
很多天的binlog还会出现,且不会自动删除掉
那么再去:彻底禁止掉binlog
MySQL [(none)]> PURGE BINARY LOGS TO 'mysql-bin.000874';
Query OK, 0 rows affected (0.08 sec)
以及:
设置单个binlog最大为10M
MySQL [(none)]> SET GLOBAL max_binlog_size = 10485760;
Query OK, 0 rows affected (0.00 sec)
退出mysql,看到:
[[email protected] mysql]# ls -lh
total 392M
-rw-r----- 1 mysql mysql   56 May  9  2019 auto.cnf
drwxr-x--- 2 mysql mysql 4.0K Sep  7 22:46 crifan_wp_db
-rw-r----- 1 mysql mysql  809 Sep  9 14:02 ib_buffer_pool
-rw-r----- 1 mysql mysql  12M Sep  9 14:03 ibdata1
-rw-r----- 1 mysql mysql  32M Sep  9 14:03 ib_logfile0
-rw-r----- 1 mysql mysql  32M May  9  2019 ib_logfile1
-rw-r----- 1 mysql mysql  32M May  9  2019 ib_logfile2
-rw-r----- 1 mysql mysql  12M Sep 20 18:16 ibtmp1
drwxr-x--- 2 mysql mysql 4.0K May  9  2019 mysql
-rw-r----- 1 mysql mysql 178M Sep 21 03:16 mysql-bin.000874
-rw-r----- 1 mysql mysql   19 Sep 22 09:59 mysql-bin.index
-rw-r----- 1 mysql mysql 175K Sep 21 03:16 mysql-error.log
-rw-r----- 1 mysql mysql    5 Sep  9 14:03 mysql.pid
-rw-r----- 1 mysql mysql  94M Sep 21 03:16 mysql-slow.log
drwxr-x--- 2 mysql mysql 4.0K May  9  2019 performance_schema
drwxr-x--- 2 mysql mysql  12K May  9  2019 sys
空间暂时恢复了:
[[email protected] 12]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        79G   67G  8.1G  90% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           1.9G  193M  1.7G  11% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs           379M     0  379M   0% /run/user/0
希望以后不要轻易导致空间占用完毕,导致网站挂了。
以待后观。
再去登录vultr,重启VPS服务器
终于正常了。
【20200924】
结果没到1天,空间占用又满了:
[[email protected] ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        79G   75G   11M 100% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           1.9G   17M  1.9G   1% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs           379M     0  379M   0% /run/user/0
导致网站又挂了
所以去禁止掉binlog吧
刚发现
[[email protected] ~]# cd /data/mysql/
[[email protected] mysql]# ls -lh
total 7.2G
-rw-r----- 1 mysql mysql   56 May  9  2019 auto.cnf
drwxr-x--- 2 mysql mysql 4.0K Sep  7 22:46 crifan_wp_db
-rw-r----- 1 mysql mysql  809 Sep  9 14:02 ib_buffer_pool
-rw-r----- 1 mysql mysql  12M Sep 22 10:06 ibdata1
-rw-r----- 1 mysql mysql  32M Sep 24 10:40 ib_logfile0
-rw-r----- 1 mysql mysql  32M May  9  2019 ib_logfile1
-rw-r----- 1 mysql mysql  32M May  9  2019 ib_logfile2
drwxr-x--- 2 mysql mysql 4.0K May  9  2019 mysql
-rw-r----- 1 mysql mysql 178M Sep 22 10:06 mysql-bin.000874
-rw-r----- 1 mysql mysql 1.1G Sep 22 17:07 mysql-bin.000875
-rw-r----- 1 mysql mysql 1.1G Sep 23 02:53 mysql-bin.000876
-rw-r----- 1 mysql mysql 1.1G Sep 23 12:34 mysql-bin.000877
-rw-r----- 1 mysql mysql 1.1G Sep 23 20:21 mysql-bin.000878
-rw-r----- 1 mysql mysql 1.1G Sep 24 03:47 mysql-bin.000879
-rw-r----- 1 mysql mysql 1.1G Sep 24 08:10 mysql-bin.000880
-rw-r----- 1 mysql mysql 800M Sep 24 10:39 mysql-bin.000881
-rw-r----- 1 mysql mysql  152 Sep 24 08:10 mysql-bin.index
-rw-r----- 1 mysql mysql 278K Sep 24 10:40 mysql-error.log
-rw-r----- 1 mysql mysql  95M Sep 24 09:40 mysql-slow.log
drwxr-x--- 2 mysql mysql 4.0K May  9  2019 performance_schema
drwxr-x--- 2 mysql mysql  12K May  9  2019 sys
即:
之前配置无效,现在默认binlog最小是,默认值,1G了
所以干脆的确是需要去关闭binlog
【已解决】给WordPress的crifan.com的Vultr的VPS中禁止mysql的binlog
目前是关闭了binlog,希望和应该以后不会再有这类问题了。

转载请注明:在路上 » 【已解决】crifan.com网站又挂了

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
87 queries in 0.126 seconds, using 20.59MB memory