반응형
mysql DB에서 replication을 이용할 경우 bin-log를 활성화 시켜놔야 하는데
default 상태에서는 무한정 bin-log가 커지게 된다.
어느정도 운영한 DB 시스템의 <hostname>.bin 파일을 보면 많이 커져 있을 수 있다.
이때는 bin-log 크기를 줄이기 위한 옵션을 설정해 주면 된다.
/etc/my.cnf 파일 수정
binlog_cache_size = 1M # binlog cache 사이즈
max_binlog_size = 500M # bin로그 maximum 사이즈
expire_logs_days = 3 # 로그 만료기간
로그 만료기간 수정법2 : mysql 접속후 수정하기
mysql> show variables;
에서 나오는 expire_logs_days 항목을 확인하고
mysql> set global expire_logs_days=3;
과 같이 수정해준다.
바이너리 로그 리스트 확인
mysql> show binary logs;
mysql> show master logs;
바이너리 로그 삭제
mysql> purge master logs to 'mysql-bin.000010';
지정된 바이너리 로그 이하의 파일이 삭제됨.
mysql-bin.000001~0000009 까지 삭제됨.
반응형
'연구개발 > MYSQL' 카테고리의 다른 글
MySQL 데이터 형식 (0) | 2014.06.27 |
---|---|
MySQL : GROUP_CONCAT 사이즈 조절하기 (0) | 2014.06.25 |
slow query 분석 (0) | 2014.05.23 |
mysql { timestamp | datetime } default current_timestamp on update current_timestamp (0) | 2014.05.22 |
MySQL 백업과 복원 (0) | 2014.05.14 |