2010년 3월 30일 화요일

Mysql 로그

Mysql에서 로그는

The error log
(Problems encountered starting, running, or stopping mysqld , 즉 mysql 기동시 생기는 문제점을 기록한 로그)


The general query log
(Established client connections and statements received from clients , mysql 클라이언트에서 보낸 모든 접속 및 명령을 기록한 로그)

The binary log
(All statements that change data (also used for replication) , 데이터 변경에 대한 명령을 기록한 로그)

The slow query log
(All queries that took more than long_query_time seconds to execute or didn't use indexes , long_query_time에서 지정한 초 이상으로 실행된 성능 저하 쿼리로그)
정상적으로 실행이 종료되야 로그에 기록된다.


위 로그들중
general query log , slow query log 설정
DB에서는 Show Global Variables like '%log%'로 설정 상태 확인 후
Set Global log_output='table' or 'file' 로 로그 기록을 테이블(general_log,slow_log)에 할지 slow_query_log_file에 지정된 경로에 할지 설정 가능

DB재시작 없이 설정 가능 하다.
table에 기록시 데이터 정리는 보관이 필요하면 보관이 필요한 데이터를 다른 테이블로 복사한 후 truncate처리하면 된다.

댓글 없음:

댓글 쓰기