Brought to you by your Belgian waffle man!
1
Brought to you by your Belgian waffle man! 2 Dimitri - - PowerPoint PPT Presentation
1 Brought to you by your Belgian waffle man! 2 Dimitri "Dim0" Vanoverbeke Solutions Engineer 3 Table of contents What is Percona Toolkit? pt-stalk pt-table-checksum pt-table-sync pt-online-schema-change pt-query-digest Other
1
2
3
4
5
6
7
8
9
10
11
$ pt-stalk --no-stalk -- --defaults-file=./my.default.cnf
$ pt-stalk --function processlist --variable Host\
$ pt-stalk --function ./pt-stalk-function \
12
13
14
15
16
17
18
19
20
[root@master]# pt-table-checksum --replicate=percona.checksums \--ignore-databases mysql h=localhost,u=checksum_user,p=checksum_password TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE 09-28T18:21:12 0 1 1992 1 0 1.044 moehaha.perfectissimo 09-28T18:21:20 0 0 351 1 0 1.044 moehaha.meh
21
22
23
24
[root@slave]# pt-table-sync --print --replicate=percona.checksums \--sync-to-master h=localhost,u=checksum_user,p=checksum_password REPLACE INTO test.dummy(id, name) VALUES ('6', 'f') /*percona-toolkit \ src_db:moehahaha src_tbl:perfectissimo src_dsn:P=3306,h=192.168.0.20,p=...,=\ u=checksum_user dst_db:test dst_tbl:dummy dst_dsn:h=localhost,\ p=...,u=checksum_user lock:1 transaction:1 changing_src:percona.checksums\ replicate:percona.checksums bidirectional:0 pid:24683 user:root host:slave*/;
25
26
27
28
29
30
31
32
33
dim0@littlebasterd:~$ pt-online-schema-change --user root --ask-pass \--alter "ADD COLUMN ratings INT" D=tutorials,t=tutorials_tbl --execute Operation, tries, wait: copy_rows, 10, 0.25 create_triggers, 10, 1 drop_triggers, 10, 1 swap_tables, 10, 1 update_foreign_keys, 10, 1 Altering tutorials.tutorials_tbl... Creating new table... Created new table tutorials._tutorials_tbl_new OK. Altering new table... Altered tutorials._tutorials_tbl_new OK. 2016-10-01T08:50:55 Creating triggers... 2016-10-01T08:50:55 Created triggers OK. 2016-10-01T08:50:55 Copying approximately 2 rows... 2016-10-01T08:50:55 Copied rows OK. 2016-10-01T08:50:55 Swapping tables... 2016-10-01T08:50:55 Swapped original and new tables OK. 2016-10-01T08:50:55 Dropping old table... 2016-10-01T08:50:55 Dropped old table tutorials._tutorials_tbl_old OK. 2016-10-01T08:50:55 Dropping triggers... 2016-10-01T08:50:55 Dropped triggers OK. Successfully altered tutorials.tutorials_tbl.
34
35
36
37
38
# Current date: Sat Oct 1 09:06:06 2016 # Hostname: ip-172-31-20-145 # Files: ip-172-31-20-145-slow.log # Overall: 28.68k total, 79 unique, 87.99 QPS, 0.00x concurrency _________ # Time range: 2016-10-01 09:00:15 to 09:05:41 # Attribute total min max avg 95% stddev median # ============ ======= ======= ======= ======= ======= ======= ======= # Exec time 640ms 1us 15ms 22us 40us 155us 9us # Lock time 11ms 0 487us 0 0 5us 0 # Rows sent 237.43k 0 112 8.48 107.34 26.48 0.99 # Rows examine 1.77k 0 154 0.06 0 2.61 0 # Query size 2.43M 17 34.15k 88.90 299.03 214.80 69.19 # Boolean: # QC hit 62% yes, 37% no # Profile # Rank Query ID Response time Calls R/Call V/M Item # ==== ================== ============= ===== ====== ===== =============== # 1 0x92F3B1B361FB0E5B 0.0958 15.0% 1891 0.0001 0.00 SELECT wp_options # 2 0xF0265D81808CE240 0.0708 11.1% 1891 0.0000 0.00 SELECT # 3 0xF1B6F473642E5770 0.0687 10.7% 1868 0.0000 0.00 SELECT # 4 0x7AEDF19FDD3A33F1 0.0465 7.3% 3003 0.0000 0.00 SELECT wp_options # 5 0x28BF5A31C1125B0B 0.0398 6.2% 15 0.0027 0.00 UPDATE wp_options # 6 0x746D96521AE5B82C 0.0366 5.7% 1891 0.0000 0.00 SET # 7 0x6498E5CBE1B003AB 0.0334 5.2% 1891 0.0000 0.00 SET # 8 0x8AE5000CAF43D53F 0.0275 4.3% 8 0.0034 0.01 INSERT UPDATE wp_options # 9 0x7D18C5C503757896 0.0261 4.1% 2808 0.0000 0.00 SELECT wp_postmeta
39
# Query 1: 6.00 QPS, 0.00x concurrency, ID 0x92F3B1B361FB0E5B at byte 258935 # This item is included in the report because it matches --limit. # Scores: V/M = 0.00 # Time range: 2016-10-01 09:00:26 to 09:05:41 # Attribute pct total min max avg 95% stddev median # ============ === ======= ======= ======= ======= ======= ======= ======= # Count 6 1891 # Exec time 14 96ms 18us 8ms 50us 33us 279us 28us # Lock time 4 494us 0 57us 0 0 3us 0 # Rows sent 85 203.15k 109 112 110.01 107.34 0 107.34 # Rows examine 75 1.33k 0 154 0.72 0 10.07 0 # Query size 5 131.11k 71 71 71 71 0 71 # Boolean: # QC hit 99% yes, 0% no # String: # Databases njieh # Hosts localhost # Users oldfart # Query_time distribution # 1us # 10us ################################################################ # 100us # # 1ms # # 10ms # 100ms # 1s
40
# 10s+
41
42
43
http://www.percona.com/downloads/percona-toolkit /LATEST/''
wget percona.com/get/percona-toolkit.tgz''
wget percona.com/get/TOOL ''
44
45