RONALD BRADFORD씨(MySQL Expert)가 제안하는
MySQL 무엇을 감시 해야할까.
먼저
1. Log file
1) Error Log : OS의 log도 포함한다.
2) Slow Query log : mysqladmin의 status 명령 또는 mysql 프롬프트에서
show status 로 확인할 수 있다.
2. Process
1) mysqld : ps로 죽었나 살았나
2) Memory usage : MySQL에는 RSS 와 VSZ 메모리를 감시할 필요가 있다는데 이 둘에 대해선 다음에 상세히 음.
3) System variables : my.cnf 의 configuration / show global variables 로 확인
4) Status variables : Show [Global | Session] status [LIKE 'pattern' | where expr] 명령으로 확인
디비의 상태를 파악하고 분석하는데 중요한 명령이다.
5) Connections : show full processlist
6) Storage Engines : show engine innoDB status / 마이아쌈 이노디비 엔디비 메모리(힙)등 몇가지 엔진이 있는데 그 특성은 다음에 음.
7) MySQL date : 데이터의 증가세, 디스크 용량 등을 체크
3. Instance Summary : 다음 쿼리를 통해 인스턴스의 요약정보를 얻을 수 있다.
select table_schema,
sum(data_length+index_length)/1024/1024 as total_mb,
sum(data_length)/1024/1024 as data_mb,
sum(index_length)/1024/1024 as index_mb,
count(*) as tables
from information_schema.tables
group by table_schema
order by 2 desc;
인스턴스 이름, 전체 사이즈, 게중 데이터 사이즈, 인덱스사이즈, 테이블 갯수
4. Schema Summary : 스키마 요약정보다.
select table_name, engine, row_format, table_rows, avg_row_length,
(data_length+index_length)/1024/1024 as total_mb,
(data_length)/1024/1024 as data_mb,
(index_length)/1024/1024 as index_mb
from information_schema.tables
where table_schema =DATABASE()
order by 6 desc;
테이블명, 엔진, 포맷, 로우가 몇개인지, 평균 로우 길이, 사이즈,
위의 쿼리의 경우에는 가장 큰 테이블 부터 정렬.
5. 스키마 속성
1) Collations
select table_schema, engine, table_collation,
count(*) as tables
from information_schema.tables
where table_schema=DATABASE()
group by table_schema, engine, table_collation;
2)Text/Blob
select table_schema, table_name, column_name, data_type
from information_schema.columns
where table_schema= DATABASE()
and (data_type LIKE '%TEXT' OR data_type like '%BLOB');
6. 지속적인 모니터링
1) 시간단위
OS의 경우 : vmstat, ps, uptime
mysql : variables. status, processlist, innodb engine status, table status
2) 분석 (statpack)
database activity
statement activity
prepared statements
admin commands
thread cache
table cache
myisam key cache

댓글목록
등록된 댓글이 없습니다.