Percona Toolkit 사용(1)
Percona Toolkit is a collection of advanced command-line tools used by Percona (http://www.percona.com/) support staff to perform a variety of MySQL and system tasks that are too difficult or complex to perform manually.
다음은 Percona Toolkit 가 할 수 있 는 일:
주종 데이터 일치 성 검사:
유효한 기록 압축 파일:
중복 색인 찾기
서버 정보 압축
로그 와 tcpdump 에서 온 검색 분석
시스템 에 문제 가 생 겼 을 때 중요 한 시스템 정 보 를 수집 합 니 다.
사용 가능 한 명령 은:
pt-align
pt-archiver
pt-config-diff
pt-deadlock-logger
pt-diskstats
pt-duplicate-key-checker
pt-fifo-split
pt-find
pt-fingerprint
pt-fk-error-logger
pt-heartbeat
pt-index-usage
pt-ioprofile
pt-kill
pt-mext
pt-mysql-summary
pt-online-schema-change
pt-pmp
pt-query-digest
pt-show-grants
pt-sift
pt-slave-delay
pt-slave-find
pt-slave-restart
pt-stalk
pt-summary
pt-table-checksum
pt-table-sync
pt-table-usage
pt-upgrade
pt-variable-advisor
pt-visual-explain
pt-align - Align output from other tools to columns.
ex:
netstat -aniv |pt-align
vmstat 2 5 | pt-align
pt-align [file]
pt-archiver Archive rows from a MySQL table into another table or a file.
ex:
1.온라인 서버 에서 데 이 터 를 오프라인 서버 와 로 컬 파일 로 압축
pt-archiver --source h=localhost,D=test,t=tbl --dest h=localhost \
--file '/var/log/archive/%Y-%m-%d-%D.%t' \
--where "id=1" --limit 1000 --commit-each
2.청소 만 하기
pt-archiver --source h=host,D=db,t=child --purge \
--where 'NOT EXISTS(SELECT * FROM parent WHERE col=child.col)'
3.1000 줄 마다 제출 하고 2000 줄 마다 제목 표시 진 도 를 인쇄 하 며 원본 표 데 이 터 를 삭제 하지 않 고 압축 파일 이 완 료 된 후에 통계 정 보 를 인쇄 합 니 다.
pt-archiver --source h=127.0.0.1,P=3306,u='xxxx',p='xxxx',D=db,t=tbl \
--file '/tmp/%D.%t_%Y%m%d%H%i%s.txt' --charset 'utf8' \
--where "Time < '2015-01-01 00:00:00'" --limit 1000 --commit-each \
--progress 2000 --statistics --no-delete
OPTIONS
:
--dest, --file --purge
--ignore and --replace
--txn-size and --commit-each
--low-priority-insert and --delayed-insert
--share-lock and --for-update
--analyze and --optimize
--no-ascend and --no-delete
,--dest --source DSN . , MySQL Server .
--analyze , ANALYZE TABLE .d ,s .
--analyze=ds
--ascend-first .
--ask-pass
--buffer --file , . (5-15)% : , , .
--bulk-delete sql , . . . , , .
--[no]bulk-delete-limit --bulk-delete limit
--bulk-insert "LOAD DATA INFILE" INSERT .
--charset ,
--charset 'utf8'
--[no]check-charset , .
--[no]check-columns source dest ( , ). , .
--check-interval 1s --check-slave-lag , ( ).
--check-slave-lag DSN , , --max-lag, .
--columns ( ), . : , . , , .
--commit-each --limit ,
--config " "
--delayed-insert DELAYED
--dry-run , .
--file , SELECT INTO OUTFILE , :
%d Day of the month, numeric (01..31)
%H Hour (00..23)
%i Minutes, numeric (00..59)
%m Month, numeric (01..12)
%s Seconds (00..59)
%Y Year, numeric, four digits
%D Database name
%t Table name
--file '/var/log/archive/%Y-%m-%d-%D.%t'
--for-update SELECT FOR UPDATE
--header . , LOAD DATA INFILE , .
--high-priority-select HIGH_PRIORITY See http://dev.mysql.com/doc/en/select.html for details.
--limit 1 .
--local OPTIMZE ANALYZE , binlog, .
--low-priority-delete Adds the LOW_PRIORITY modifier to DELETE statements.See http://dev.mysql.com/doc/en/delete.html for details.
--low-priority-insertAdds the LOW_PRIORITY modifier to INSERT or REPLACE statements.See http://dev.mysql.com/doc/en/insert.html for details.
--max-lag 1s, .
--no-ascend
--no-delete source
--optimize , OPTIMIZE TABLE
--pid pid
--progress , .
--purge , . --file --dest
--quiet
--replace dest , REPLACE INSERT
--retries , . 1
--run-time . , ,
s=seconds, m=minutes, h=hours, d=days
--sentinel : /tmp/pt-archiver-sentinel , .
--set-vars mysql , .
--set-vars wait_timeout=500
--skip-foreign-key-checks , SET FOREIGN_KEY_CHECKS=0
--sleep SELECT sleep . sleep . commit-each ,commit flush sleep .
--stop , pt-archiver . session1 , session2 , session1 .
--txn-size .
--where ( ) .
--why-quit , .
--dry-run ,
--file
--limit --commit-each , commit
--purge
cat /etc/percona-toolkit/pt-archiver.conf <<EOF
purge
limit = 10
commit-each
source = A=utf8,D=test,P=3306,h=127.0.0.1,p=...,t=t1,u=username
where = id<515
pt-archiver --config /etc/percona-toolkit/pt-archiver.conf
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
MySQL에서 JSON 인덱싱 - aarondfrancis사람들은 종종 MySQL로 JSON을 인덱싱할 수 없다고 말하지만 완전히 정확하지는 않습니다. MySQL로 JSON 열을 인덱싱하는 것은 완전히 가능합니다! 사람들은 종종 MySQL로 JSON을 인덱싱할 수 없다고 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.