'데이터 엔지니어'로 성장하기

정리하는 걸 좋아하고, 남이 읽으면 더 좋아함

Storage/mariadb

Mariadb) binary 파일 정리하기_k8s에서 pvc 넘침

MightyTedKim 2022. 4. 28. 22:18
728x90
반응형

요약

1. disk 용량이 꽉참

2. mysql binary 때문이었음

3. 삭제하고, 저장 주기 조정함

설명

1. disk 용량이 꽉참

 

2. mysql binary 때문이었음

 ls -al | grep mysql
total 14916268
drwxrwsr-x 11 1001 1001       4096 Apr 25 04:24 .
drwxrwsrwx  4 root 1001       4096 Dec  6 09:26 ..
drwxrws---  2 1001 1001       4096 Dec  6 09:26 mysql
-rw-rw----  1 1001 1001       1453 Dec  6 09:26 mysql-bin.000001
-rw-rw----  1 1001 1001  509183729 Dec 14 05:59 mysql-bin.000002
-rw-rw----  1 1001 1001        381 Dec 15 00:32 mysql-bin.000003
-rw-rw----  1 1001 1001   88183478 Dec 16 23:31 mysql-bin.000004
-rw-rw----  1 1001 1001        397 Dec 16 23:31 mysql-bin.000005
-rw-rw----  1 1001 1001        397 Dec 17 00:02 mysql-bin.000006
-rw-rw----  1 1001 1001        397 Dec 17 00:03 mysql-bin.000007
-rw-rw----  1 1001 1001  996512769 Feb 23 00:56 mysql-bin.000008
-rw-rw----  1 1001 1001        413 Feb 23 00:56 mysql-bin.000009
-rw-rw----  1 1001 1001     985809 Feb 23 01:55 mysql-bin.000010
-rw-rw----  1 1001 1001        429 Feb 23 01:55 mysql-bin.000011
-rw-rw----  1 1001 1001 1073742346 Mar  2 18:20 mysql-bin.000012
-rw-rw----  1 1001 1001 1073742191 Mar  8 22:14 mysql-bin.000013
-rw-rw----  1 1001 1001 1073742303 Mar 13 12:49 mysql-bin.000014
-rw-rw----  1 1001 1001  254072651 Mar 14 20:02 mysql-bin.000015
-rw-rw----  1 1001 1001        445 Mar 14 20:02 mysql-bin.000016
-rw-rw----  1 1001 1001 1073742288 Mar 23 04:57 mysql-bin.000017
-rw-rw----  1 1001 1001 1073742479 Mar 26 08:51 mysql-bin.000018
-rw-rw----  1 1001 1001 1073742282 Mar 30 10:32 mysql-bin.000019
-rw-rw----  1 1001 1001 1073742508 Apr  2 11:14 mysql-bin.000020
-rw-rw----  1 1001 1001 1073742028 Apr  6 19:14 mysql-bin.000021
-rw-rw----  1 1001 1001 1073741902 Apr 12 11:55 mysql-bin.000022
-rw-rw----  1 1001 1001  446779392 Apr 14 03:12 mysql-bin.000023
-rw-rw----  1 1001 1001        461 Apr 14 06:10 mysql-bin.000024
-rw-rw----  1 1001 1001  971394406 Apr 16 20:07 mysql-bin.000025
-rw-rw----  1 1001 1001        477 Apr 16 20:07 mysql-bin.000026
-rw-rw----  1 1001 1001 1073742600 Apr 20 15:18 mysql-bin.000027
-rw-rw----  1 1001 1001 1073742440 Apr 25 04:24 mysql-bin.000028
-rw-rw----  1 1001 1001    1514298 Apr 25 04:28 mysql-bin.000029
-rw-rw----  1 1001 1001        551 Apr 25 04:24 mysql-bin.index
-rw-rw-r--  1 1001 1001         15 Dec  6 09:26 mysql_upgrade_info

 

3. 삭제하고, 저장 주기 조정함

show binary logs;
show master status;
show variables like '%expire_logs%'
#하루 주기로 설정
set global expire_logs_days=1;
# purge master logs to 'mysql-bin.000028';
purge binary logs before '2022-04-24' 

 

하루치만 남김

-rw-rw----  1 1001 1001 1.1G Apr 25 04:24 mysql-bin.000028
-rw-rw----  1 1001 1001 6.3M Apr 25 04:41 mysql-bin.000029

 

 

728x90
반응형