您好,登錄后才能下訂單哦!
服務器硬盤空間占用過大,發現二進制日志文件過多,于是刪除mysql的二進制日志文件:
[root@iZbp1b36sef813d0zilqd6Z mysql] # rm -rf dbbin.00010* [root@iZbp1b36sef813d0zilqd6Z mysql] # rm -rf dbbin.00010* [root@iZbp1b36sef813d0zilqd6Z mysql] # rm -rf dbbin.00011* [root@iZbp1b36sef813d0zilqd6Z mysql] # rm -rf dbbin.00012*
然后通過mysql命令行查看:
mysql> show binary logs; +--------------+------------+ | Log_name | File_size | +--------------+------------+ | dbbin.000001 | 0 | | dbbin.000002 | 0 | | dbbin.000003 | 0 | | dbbin.000004 | 0 | | dbbin.000005 | 0 | | dbbin.000006 | 0 | | dbbin.000007 | 0 | | dbbin.000008 | 0 | | dbbin.000009 | 0 | | dbbin.000010 | 0 | | dbbin.000011 | 0 | | dbbin.000012 | 0 | | dbbin.000013 | 0 | | dbbin.000014 | 0 | | dbbin.000015 | 0 | | dbbin.000016 | 0 | | dbbin.000017 | 0 | | dbbin.000018 | 0 | | dbbin.000019 | 0 | | dbbin.000020 | 0 | | dbbin.000021 | 0 | | dbbin.000022 | 0 | | dbbin.000023 | 0 | | dbbin.000024 | 0 | | dbbin.000025 | 0 | | dbbin.000026 | 0 | | dbbin.000027 | 0 | | dbbin.000028 | 0 | | dbbin.000029 | 0 | | dbbin.000030 | 0 | | dbbin.000031 | 0 | | dbbin.000032 | 0 | | dbbin.000033 | 0 | | dbbin.000034 | 0 | | dbbin.000035 | 0 | | dbbin.000036 | 0 | | dbbin.000037 | 0 | | dbbin.000038 | 0 | | dbbin.000039 | 0 | | dbbin.000040 | 0 | | dbbin.000041 | 0 | | dbbin.000042 | 0 | | dbbin.000043 | 0 | | dbbin.000044 | 0 | | dbbin.000045 | 0 | | dbbin.000046 | 0 | | dbbin.000047 | 0 | | dbbin.000048 | 0 | | dbbin.000049 | 0 | | dbbin.000050 | 0 | | dbbin.000051 | 0 | | dbbin.000052 | 0 | | dbbin.000053 | 0 | | dbbin.000054 | 0 | | dbbin.000055 | 0 | | dbbin.000056 | 0 | | dbbin.000057 | 0 | | dbbin.000058 | 0 | | dbbin.000059 | 0 | | dbbin.000060 | 0 | | dbbin.000061 | 0 | | dbbin.000062 | 0 | | dbbin.000063 | 0 | | dbbin.000064 | 0 | | dbbin.000065 | 0 | | dbbin.000066 | 0 | | dbbin.000067 | 0 | | dbbin.000068 | 0 | | dbbin.000069 | 0 | | dbbin.000070 | 0 | | dbbin.000071 | 0 | | dbbin.000072 | 0 | | dbbin.000073 | 0 | | dbbin.000074 | 0 | | dbbin.000075 | 0 | | dbbin.000076 | 0 | | dbbin.000077 | 0 | | dbbin.000078 | 0 | | dbbin.000079 | 0 | | dbbin.000080 | 0 | | dbbin.000081 | 0 | | dbbin.000082 | 0 | | dbbin.000083 | 0 | | dbbin.000084 | 0 | | dbbin.000085 | 0 | | dbbin.000086 | 0 | | dbbin.000087 | 0 | | dbbin.000088 | 0 | | dbbin.000089 | 0 | | dbbin.000090 | 0 | | dbbin.000091 | 0 | | dbbin.000092 | 0 | | dbbin.000093 | 0 | | dbbin.000094 | 0 | | dbbin.000095 | 0 | | dbbin.000096 | 0 | | dbbin.000097 | 0 | | dbbin.000098 | 0 | | dbbin.000099 | 0 | | dbbin.000100 | 0 | | dbbin.000101 | 0 | | dbbin.000102 | 0 | | dbbin.000103 | 0 | | dbbin.000104 | 0 | | dbbin.000105 | 0 | | dbbin.000106 | 0 | | dbbin.000107 | 0 | | dbbin.000108 | 0 | | dbbin.000109 | 0 | | dbbin.000110 | 0 | | dbbin.000111 | 0 | | dbbin.000112 | 0 | | dbbin.000113 | 0 | | dbbin.000114 | 0 | | dbbin.000115 | 0 | | dbbin.000116 | 0 | | dbbin.000117 | 0 | | dbbin.000118 | 0 | | dbbin.000119 | 0 | | dbbin.000120 | 0 | | dbbin.000121 | 0 | | dbbin.000122 | 0 | | dbbin.000123 | 0 | | dbbin.000124 | 0 | | dbbin.000125 | 0 | | dbbin.000126 | 0 | | dbbin.000127 | 0 | | dbbin.000128 | 0 | | dbbin.000129 | 0 | | dbbin.000130 | 0 | | dbbin.000131 | 0 | | dbbin.000001 | 0 | | dbbin.000002 | 0 | | dbbin.000003 | 0 | | dbbin.000004 | 0 | | dbbin.000005 | 0 | | dbbin.000006 | 0 | | dbbin.000007 | 0 | | dbbin.000008 | 0 | | dbbin.000009 | 0 | | dbbin.000010 | 0 | | dbbin.000011 | 0 | | dbbin.000012 | 0 | | dbbin.000013 | 0 | | dbbin.000014 | 0 | | dbbin.000015 | 0 | | dbbin.000016 | 0 | | dbbin.000017 | 0 | | dbbin.000018 | 0 | | dbbin.000019 | 0 | | dbbin.000020 | 0 | | dbbin.000021 | 0 | | dbbin.000022 | 0 | | dbbin.000023 | 0 | | dbbin.000024 | 0 | | dbbin.000025 | 0 | | dbbin.000026 | 0 | | dbbin.000027 | 0 | | dbbin.000028 | 0 | | dbbin.000029 | 0 | | dbbin.000030 | 0 | | dbbin.000031 | 0 | | dbbin.000032 | 0 | | dbbin.000033 | 0 | | dbbin.000034 | 0 | | dbbin.000035 | 0 | | dbbin.000036 | 0 | | dbbin.000037 | 0 | | dbbin.000038 | 0 | | dbbin.000039 | 0 | | dbbin.000040 | 0 | | dbbin.000041 | 0 | | dbbin.000042 | 0 | | dbbin.000043 | 0 | | dbbin.000044 | 0 | | dbbin.000045 | 0 | | dbbin.000046 | 0 | | dbbin.000047 | 0 | | dbbin.000048 | 0 | | dbbin.000049 | 0 | | dbbin.000050 | 0 | | dbbin.000051 | 0 | | dbbin.000052 | 0 | | dbbin.000053 | 0 | | dbbin.000054 | 0 | | dbbin.000055 | 0 | | dbbin.000056 | 0 | | dbbin.000057 | 0 | | dbbin.000058 | 0 | | dbbin.000059 | 0 | | dbbin.000060 | 0 | | dbbin.000061 | 0 | | dbbin.000062 | 0 | | dbbin.000063 | 0 | | dbbin.000064 | 0 | | dbbin.000065 | 0 | | dbbin.000066 | 0 | | dbbin.000067 | 0 | | dbbin.000068 | 0 | | dbbin.000069 | 0 | | dbbin.000070 | 0 | | dbbin.000071 | 0 | | dbbin.000072 | 0 | | dbbin.000073 | 0 | | dbbin.000074 | 0 | | dbbin.000075 | 0 | | dbbin.000076 | 0 | | dbbin.000077 | 0 | | dbbin.000078 | 0 | | dbbin.000079 | 0 | | dbbin.000080 | 0 | | dbbin.000081 | 0 | | dbbin.000082 | 0 | | dbbin.000083 | 0 | | dbbin.000084 | 0 | | dbbin.000085 | 0 | | dbbin.000086 | 0 | | dbbin.000087 | 0 | | dbbin.000088 | 0 | | dbbin.000089 | 0 | | dbbin.000090 | 0 | | dbbin.000091 | 0 | | dbbin.000092 | 0 | | dbbin.000093 | 0 | | dbbin.000094 | 0 | | dbbin.000095 | 0 | | dbbin.000096 | 0 | | dbbin.000097 | 0 | | dbbin.000098 | 0 | | dbbin.000099 | 0 | | dbbin.000100 | 0 | | dbbin.000101 | 0 | | dbbin.000102 | 0 | | dbbin.000103 | 0 | | dbbin.000104 | 0 | | dbbin.000105 | 0 | | dbbin.000106 | 0 | | dbbin.000107 | 0 | | dbbin.000108 | 0 | | dbbin.000109 | 0 | | dbbin.000110 | 0 | | dbbin.000111 | 0 | | dbbin.000112 | 0 | | dbbin.000113 | 0 | | dbbin.000114 | 0 | | dbbin.000115 | 0 | | dbbin.000116 | 0 | | dbbin.000117 | 0 | | dbbin.000118 | 0 | | dbbin.000119 | 0 | | dbbin.000120 | 0 | | dbbin.000121 | 0 | | dbbin.000122 | 0 | | dbbin.000123 | 0 | | dbbin.000124 | 0 | | dbbin.000125 | 0 | | dbbin.000126 | 0 | | dbbin.000127 | 0 | | dbbin.000128 | 0 | | dbbin.000129 | 0 | | dbbin.000130 | 0 | | dbbin.000131 | 0 | | dbbin.000132 | 0 | | dbbin.000133 | 0 | | dbbin.000134 | 0 | | dbbin.000135 | 928716703 | | dbbin.000136 | 959380747 | | dbbin.000137 | 851723423 | | dbbin.000138 | 365674634 | | dbbin.000139 | 1073742052 | | dbbin.000140 | 123579443 | | dbbin.000141 | 30362973 | | dbbin.000142 | 902470948 | | dbbin.000143 | 889738300 | | dbbin.000144 | 923650782 | | dbbin.000145 | 1511748108 | | dbbin.000146 | 290317434 | | dbbin.000147 | 52264 | +--------------+------------+ 278 rows in set (0.00 sec)
看著很不爽,進行下一步的解決:
mysql> purge binary logs to 'dbbin.000133'; Query OK, 0 rows affected, 263 warnings (0.01 sec)
查看處理的結果:
mysql> show binary logs; +--------------+------------+ | Log_name | File_size | +--------------+------------+ | dbbin.000133 | 0 | | dbbin.000134 | 0 | | dbbin.000135 | 928716703 | | dbbin.000136 | 959380747 | | dbbin.000137 | 851723423 | | dbbin.000138 | 365674634 | | dbbin.000139 | 1073742052 | | dbbin.000140 | 123579443 | | dbbin.000141 | 30362973 | | dbbin.000142 | 902470948 | | dbbin.000143 | 889738300 | | dbbin.000144 | 923650782 | | dbbin.000145 | 1511748108 | | dbbin.000146 | 290317434 | | dbbin.000147 | 3826433 | +--------------+------------+ 15 rows in set (0.00 sec)
再處理一下:
mysql> purge binary logs to 'dbbin.000135'; Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> show binary logs; +--------------+------------+ | Log_name | File_size | +--------------+------------+ | dbbin.000135 | 928716703 | | dbbin.000136 | 959380747 | | dbbin.000137 | 851723423 | | dbbin.000138 | 365674634 | | dbbin.000139 | 1073742052 | | dbbin.000140 | 123579443 | | dbbin.000141 | 30362973 | | dbbin.000142 | 902470948 | | dbbin.000143 | 889738300 | | dbbin.000144 | 923650782 | | dbbin.000145 | 1511748108 | | dbbin.000146 | 290317434 | | dbbin.000147 | 4443351 | +--------------+------------+ 13 rows in set (0.00 sec)
看著是不是舒服很多?
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。