pt-config-diff
比较mysql配置文件和服务器参数
示例:
pt-config-diff /etc/my.cnf h=192.168.53.11 --user=root --password=123456 --socket=/tmp/mysql.sock pt-config-dirr /etc/my.cnf /etc/my_slave.cnf
内容如下:
21 config differences Variable /etc/my.cnf M11 ========================= =============================== =================== event_scheduler OFF ON expire_logs_days 21 14 innodb_io_capacity 1200 800 innodb_max_dirty_pages... 75 70 innodb_thread_concurrency 26 50 join_buffer_size 8388608 4194304 key_buffer_size 16777216 33554432 max_connections 350 450 query_cache_limit 4194304 2097152 query_cache_size 201326592 157286400 read_buffer_size 8388608 4194304 read_rnd_buffer_size 8388608 4194304 relay_log 12-relay-bin relay_log_index 2-relay-bin.index server_id 2 1 slave_skip_errors 1007,1008,1051,1062,1109,115... OFF socket /tmp/mysql.sock /var/tmp/mysql.sock sort_buffer_size 8388608 4194304 table_open_cache 500 750 thread_cache_size 36 60 tmp_table_size 16777216 25165824
pt-deadlock-logger
记录mysql死锁的信息。
mysql: show engine innodb status只能查看最后一个死锁信息。
参数: --create-dest-table :创建指定的表。 --dest :创建存储死锁信息的表。 --database :-D,指定链接的数据库。 --table :-t,指定存储的表名。 --log :指定死锁日志信息写入到文件。 --run-time :运行次数,默认永久 --interval :运行间隔时间,默认30s。 u,p,h,P :链接数据库的信息。
例子: pt-deadlock-logger --ask-pass --run-time=10 --interval=3 --create-dest-table --dest D=test,t=deadlocks u=root,P=3306,h=127.0.0.1
执行此命令后,可以在mysql,test库中通过select查询到锁表信息。
例子: pt-deadlock-logger --ask-pass --run-time=10 --interval=3 --log=‘/tmp/deadlock.log‘u=root,P=3306,h=127.0.0.1
pt-diskstats :
功能:查看服务器的IO Usage: pt-diskstats [OPTIONS] [FILES] Options: --columns-regex=s Print columns that match this Perl regex (default .) --config=A Read this comma-separated list of config files; if specified, this must be the first option on the command line --devices-regex=s Print devices that match this Perl regex --group-by=s Group-by mode: disk, sample, or all (default all) --headers=H If group is present, each sample will be separated by a blank line, unless the sample is only one line (default group,scroll) --interval=i When in interactive mode, wait N seconds before printing to the screen (default 1) --iterations=i When in interactive mode, stop after N samples --sample-time=i In --group-by sample mode, include N seconds of samples per group (default 1) --save-samples=s File to save diskstats samples in; these can be used for later analysis --show-inactive Show inactive devices --show-timestamps Show a ‘HH:MM:SS‘ timestamp in the #ts column Option types: s=string, i=integer, f=float, h/H/a/A=comma-separated list, d=DSN, z=size, m=time Rules: This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details. Options and values after processing arguments: --columns-regex . --config /etc/percona-toolkit/percona-toolkit.conf,/etc/percona-toolkit/pt-diskstats.conf,/root/.percona-toolkit.conf,/root/.pt-diskstats.conf --devices-regex (No value) --group-by all --headers group,scroll --help TRUE --interval 1 --iterations (No value) --sample-time 1 --save-samples (No value) --show-inactive FALSE --show-timestamps FALSE --version FALSE --version-check TRUE
例子1:pt-diskstats --interval=5 --show-timestamps --columns-regex=wr* 例子2:pt-diskstats --interval=5 --show-timestamps --columns-regex=rd* 结果如下: #ts device wr_s wr_avkb wr_mb_s wr_mrg wr_cnc wr_rt 16:29:30 sda 14.5 13.0 0.2 69% 0.0 0.4 16:29:30 sda3 14.5 13.0 0.2 69% 0.0 0.4
时间: 2024-10-27 08:39:00