Percona-toolkit-System Tools
1. pt-diskstats
Function introduction:
Is an interactive monitoring tool for GUN/LINUX.
Usage:
Pt-diskstats [OPTION...] [FILES]
Print disk io statistics for GUN/LINUX, which is a bit like iostat, but this tool is interactive and more detailed than iostat. Data collected from remote machines can be analyzed.
Example:
Example 1: view the status of all disks on the local machine:
Pt-diskstats
Example 2: only view the status of the local sda2 Disk
Pt-diskstats -- devices-regex sda2
2. pt-fifo-split
Function introduction:
Simulate a cut file and pass it to the first-in-first-out queue through a pipe without actually cutting the file
Usage:
Pt-fifo-split [options] [FILE...]
Pt-fifo-split reads data from large files and prints the data to the fifo file. Each time it reaches the specified number of rows, it prints an EOF character to the fifo file. After reading the data, disable and remove the fifo file, then recreate the fifo file and print more rows. This ensures that you can read the specified number of rows each time you read until the read is completed. Note that this tool can only work in unix-like operating systems. This program is very useful for importing data from large files to the database. For details, refer to examples /.
Example:
Example 1: An Example of Reading 1 million rows of records each time:
Pt-fifo-split -- lines 1000000 hugefile.txt
While [-e/tmp/pt-fifo-split]; do cat/tmp/pt-fifo-split; done
Example 2: Specify/tmp/my-fifo file for each 1 million rows read, and use the load data command to import the file to mysql:
Pt-fifo-split infile.txt -- fifo/tmp/my-fifo -- lines 1000000
While [-e/tmp/my-fifo]; do
Mysql-e "set foreign_key_checks = 0; set SQL _log_bin = 0; set unique_checks = 0; load data local infile '/tmp/my-fifo' into table load_test fields terminated by '\ t' lines terminated by' \ n' (col1, col2 );"
Sleep 1;
Done
3. pt-summary
Function introduction:
Collects and displays system information in a friendly manner. This tool is not an optimization or diagnosis tool. It generates a report that is easy to compare and send emails.
Usage:
Pt-summary
Principle: This tool will run and run multiple commands to collect system status and configuration information, first save it to the files in the temporary directory, and then run some unix commands to format the results, it is best to run this command using a root user or a user with permissions.
Example:
Example 1: view the local system information
Pt-summary
4. pt-stalk
Function introduction:
Collect mysql data for diagnosis when a problem occurs.
Usage:
Pt-stalk [OPTIONS] [-- mysql options]
Pt-stalk waits for trigger conditions to trigger, and then collects data to help diagnose errors. It is designed as a daemon that runs with root permissions. Therefore, you can diagnose intermittent problems that you cannot directly observe. The default diagnostic trigger condition is show global status. You can also specify processlist as the diagnostic trigger condition and use the -- function parameter.
Example:
Example 1: Specify the diagnostic trigger condition as status. When the statement is run more than 20 times, the collected data is stored in the/tmp/test directory:
Pt-stalk -- function status -- variable Threads_running -- threshold 20 -- dest/tmp/test ---uroot-pzhang @ 123-h192.168.3.135
Example 2: Set the diagnosis trigger condition to processlist. If more than 20 statuses are set to statistics trigger, the collected data is stored in the/tmp/test directory:
Pt-stalk -- function processlist -- variable State -- match statistics -- threshold 20 -- dest/tmp/test ---uroot-pzhang @ 123-h192.168.3.135
Paste the information collected after the trigger condition is met:
2012_06_04_17_31_49-df
2012_06_04_17_31_49-disk-space
2012_06_04_17_31_49-diskstats
2012_06_04_17_31_49-hostname
2012_06_04_17_31_49-innodbstatus1
2012_06_04_17_31_49-innodbstatus2
2012_06_04_17_31_49-interrupts
2012_06_04_17_31_49-log_error
2012_06_04_17_31_49-lsof
2012_06_04_17_31_49-meminfo
2012_06_04_17_31_49-mu1_status1
2012_06_04_17_31_49-mysqladmin
2012_06_04_17_31_49-netstat
2012_06_04_17_31_49-netstat_s
2012_06_04_17_31_49-opentables1
2012_06_04_17_31_49-opentables2
2012_06_04_17_31_49-output
2012_06_04_17_31_49-pmap
2012_06_04_17_31_49-processlist
2012_06_04_17_31_49-procstat
2012_06_04_17_31_49-procvmstat
2012_06_04_17_31_49-ps
2012_06_04_17_31_49-slabinfo
2012_06_04_17_31_49-sysctl
2012_06_04_17_31_49-top
2012_06_04_17_31_49-trigger
2012_06_04_17_31_49-variables
2012_06_04_17_31_49-vmstat
2012_06_04_17_31_49-vmstat-overall
Percona Toolkit: click here
Percona Toolkit: click here