系统类工具
1. pt-diskstats
功能介绍:
是一个对GUN/LINUX的交互式监控工具
用法介绍:
pt-diskstats [OPTION...] [FILES]
为GUN/LINUX打印磁盘io统计信息,和iostat有点像,但是这个工具是交互式并且比iostat更详细。可以分析从远程机器收集的数据。
使用示例:
范例1:查看本机所有的磁盘的状态情况:
pt-diskstats
范例2:只查看本机sda2磁盘的状态情况
pt-diskstats --devices-regex sda2
2. pt-fifo-split
功能介绍:
模拟切割文件并通过管道传递给先入先出队列而不用真正的切割文件
用法介绍:
pt-fifo-split [options] [FILE ...]
pt-fifo-split读取大文件中的数据并打印到fifo文件,每次达到指定行数就往fifo文件中打印一个EOF字符,读取完成以后,关闭掉fifo文件并移走,然后重建fifo文件,打印更多的行。这样可以保证你每次读取的时候都能读取到制定的行数直到读取完成。注意此工具只能工作在类unix操作系统。这个程序对大文件的数据导入数据库非常有用,具体的可以查看http://www.mysqlperformanceblog.com/2008/07/03/how-to-load-large-files-safely-into-innodb-with-load-data-infile/。
使用示例:
范例1:一个每次读取一百万行记录的范例:
pt-fifo-split --lines 1000000 hugefile.txt while [ -e /tmp/pt-fifo-split ]; do cat /tmp/pt-fifo-split; done
范例2:一个每次读取一百万行,指定fifo文件为/tmp/my-fifo,并使用load data命令导入到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
功能介绍:
友好地收集和显示系统信息概况,此工具并不是一个调优或者诊断工具,这个工具会产生一个很容易进行比较和发送邮件的报告。
用法介绍:
pt-summary
原理:此工具会运行和多命令去收集系统状态和配置信息,先保存到临时目录的文件中去,然后运行一些unix命令对这些结果做格式化,最好是用root用户或者有权限的用户运行此命令。
使用示例:
范例1:查看本地系统信息概况
pt-summary
4. pt-stalk
功能介绍:
出现问题的时候收集mysql的用于诊断的数据
用法介绍:
pt-stalk [OPTIONS] [-- MYSQL OPTIONS]
pt-stalk等待触发条件触发,然后收集数据帮助错误诊断,它被设计成使用root权限运行的守护进程,因此你可以诊断那些你不能直接观察的间歇性问题。默认的诊断触发条件为SHOW GLOBAL STATUS。也可以指定processlist为诊断触发条件 ,使用--function参数指定。
使用示例:
范例1:指定诊断触发条件为status,同时运行语句超过20的时候触发,收集的数据存放在/tmp/test目录下:
pt-stalk --function status --variable Threads_running --threshold 20 --dest /tmp/test -- -uroot -pzhang@123 -h192.168.3.135
范例2:指定诊断触发条件为processlist,超过20个状态为statistics触发,收集的数据存放在/tmp/test目录下:
pt-stalk --function processlist --variable State --match statistics --threshold 20 --dest /tmp/test -- -uroot -pzhang@123 -h192.168.3.135
贴一下达到触发条件以后收集的信息:
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-mutex-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
性能类工具
1. pt-index-usage
功能介绍:
从log文件中读取插叙语句,并用explain分析他们是如何利用索引。完成分析之后会生成一份关于索引没有被查询使用过的报告。
用法介绍:
pt-index-usage [OPTION...] [FILE...]
可以直接从慢查询中获取sql,FILE文件中的sql格式必须和慢查询中个是一致,如果不是一直需要用pt-query-digest转换一下。也可以不生成报告直接保存到数据库中,具体的见后面的示例
使用示例:
从满查询中的sql查看索引使用情况范例:
pt-index-usage /data/dbdata/localhost-slow.log --host=localhost --user=root --password=zhang@123
将分析结果保存到数据库范例:
pt-index-usage /data/dbdata/localhost-slow.log --host=localhost --user=root --password=zhang@123 --no-report --create-save-results-database
使用--create-save-results-database会自动生成数据库和表来保存结果。
2. pt-pmp
功能介绍:
为查询程序执行聚合的GDB堆栈跟踪,先进性堆栈跟踪,然后将跟踪信息汇总。
用法介绍:
pt-pmp [OPTIONS] [FILES]
使用示例:
pt-pmp -p 21933 pt-pmp -b /usr/local/mysql/bin/mysqld_safe
3. pt-visual-explain
功能介绍:
格式化explain出来的执行计划按照tree方式输出,方便阅读。
用法介绍:
pt-visual-explain [OPTION...] [FILE...]
option请参阅官方网站,这里不一一例举!
使用示例:
查看包含explain结果的aaa文件的范例:
pt-visual-explain aaa
查看包含查询语句的aaa文件的范例:
pt-visual-explain --connect aaa --user=root --password=zhang@123
通过管道直接查看explain输出结果的范例:
mysql -uroot -pzhang@123 -e "explain select email from test.collect_data where id=101992419" |pt-visual-explain

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

InnoDB effectively prevents phantom reading through Next-KeyLocking mechanism. 1) Next-KeyLocking combines row lock and gap lock to lock records and their gaps to prevent new records from being inserted. 2) In practical applications, by optimizing query and adjusting isolation levels, lock competition can be reduced and concurrency performance can be improved.

MySQL is not a programming language, but its query language SQL has the characteristics of a programming language: 1. SQL supports conditional judgment, loops and variable operations; 2. Through stored procedures, triggers and functions, users can perform complex logical operations in the database.

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL is an open source relational database management system suitable for data storage, management, query and security. 1. It supports a variety of operating systems and is widely used in Web applications and other fields. 2. Through the client-server architecture and different storage engines, MySQL processes data efficiently. 3. Basic usage includes creating databases and tables, inserting, querying and updating data. 4. Advanced usage involves complex queries and stored procedures. 5. Common errors can be debugged through the EXPLAIN statement. 6. Performance optimization includes the rational use of indexes and optimized query statements.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

InnoDB's lock mechanisms include shared locks, exclusive locks, intention locks, record locks, gap locks and next key locks. 1. Shared lock allows transactions to read data without preventing other transactions from reading. 2. Exclusive lock prevents other transactions from reading and modifying data. 3. Intention lock optimizes lock efficiency. 4. Record lock lock index record. 5. Gap lock locks index recording gap. 6. The next key lock is a combination of record lock and gap lock to ensure data consistency.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.