mysql监控工具之percona-toolkit集合

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,高可用系列 2核4GB
简介:

1.下载安装percona-toolkit软件

[root@tong1 ~]# wget http://www.percona.com/downloads/percona-toolkit/2.2.13/deb/percona-toolkit_2.2.13.tar.gz

[root@tong1 ~]# tar xvf percona-toolkit_2.2.13.tar.gz  -C /usr/local/

[root@tong1 ~]# cd /usr/local/percona-toolkit-2.2.13/

[root@tong1 percona-toolkit-2.2.13]# perl Makefile.PL 
Checking if your kit is complete...
Looks good
Writing Makefile for percona-toolkit
[root@tong1 percona-toolkit-2.2.13]# make && make install 
[root@tong1 percona-toolkit-2.2.13]# echo $?
0
[root@tong1 percona-toolkit-2.2.13]# 
[root@tong1 percona-toolkit-2.2.13]# cd bin/

[root@tong1 bin]# 


2.使用pt-mysql-summary脚本查看mysql的详细信息

[root@tong1 bin]# ./pt-mysql-summary --user root --password system --socket /tmp/mysql.sock 
Warning: Using a password on the command line interface can be insecure.
# Percona Toolkit MySQL Summary Report #######################
              System time | 2015-03-13 09:17:08 UTC (local TZ: CST +0800)
# Instances ##################################################
  Port  Data Directory             Nice OOM Socket
  ===== ========================== ==== === ======
   3306 /usr/local/mysql-5.7.4/data 0    0   /tmp/mysql.sock
# MySQL Executable ###########################################
       Path to executable | /usr/local/mysql-5.7.4/bin/mysqld
              Has symbols | Yes
# Report On Port 3306 ########################################
                     User | root@localhost
                     Time | 2015-03-13 17:17:08 (CST)
                 Hostname | tong1
                  Version | 5.7.4-m14-log MySQL Community Server (GPL)
                 Built On | linux-glibc2.5 x86_64
                  Started | 2015-03-05 14:31 (up 8+02:45:46)
                Databases | 4
                  Datadir | /usr/local/mysql-5.7.4/data/
                Processes | 1 connected, 1 running
              Replication | Is not a slave, has 0 slaves connected
                  Pidfile | /usr/local/mysql-5.7.4/data/tong1.pid (exists)
# Processlist ################################################

  Command                        COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  Query                                 1       1         0         0

  User                           COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  root                                  1       1         0         0

  Host                           COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  localhost                             1       1         0         0

  db                             COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  NULL                                  1       1         0         0

  State                          COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  starting                              1       1         0         0

# Status Counters (Wait 10 Seconds) ##########################
Variable                                Per day  Per second     10 secs
Bytes_received                             5000                     350
Bytes_sent                               350000           4        2250
Com_admin_commands                           90                        
Com_select                                    2                       1
Com_set_option                                1                        
Com_show_fields                              30                        
Com_show_master_status                       25                        
Com_show_processlist                         25                        
Com_show_slave_status                        25                        
Com_show_status                              45                        
Com_show_tables                               1                        
Com_show_variables                            1                        
Connections                                   2                       1
Created_tmp_disk_tables                       5                       1
Created_tmp_tables                           60                       6
Handler_external_lock                        25                        
Handler_read_key                              1                        
Handler_read_rnd_next                      9000                      40
Handler_write                              9000                      40
Innodb_buffer_pool_bytes_data            400000           4            
Innodb_buffer_pool_pages_flushed              4                        
Innodb_buffer_pool_read_requests            150                        
Innodb_buffer_pool_reads                     20                        
Innodb_buffer_pool_write_requests            40                        
Innodb_data_read                         350000           3            
Innodb_data_reads                            20                        
Innodb_data_writes                            6                        
Innodb_data_written                      150000           1            
Innodb_dblwr_pages_written                    4                        
Innodb_os_log_written                        60                        
Innodb_pages_created                          4                        
Innodb_pages_read                            20                        
Innodb_pages_written                          4                        
Innodb_num_open_files                         1                        
Innodb_available_undo_logs                   15                        
Key_read_requests                             1                        
Open_table_definitions                       15                        
Opened_files                                 45                       5
Opened_table_definitions                     15                        
Opened_tables                                15                        
Qcache_not_cached                             2                       1
Queries                                     250                       4
Questions                                   125                       4
Select_scan                                  30                        
Table_locks_immediate                        15                        
Table_open_cache_hits                        20                        
Table_open_cache_misses                      15                        
Uptime                                    90000           1           1
# Table cache ################################################
                     Size | 2000
                    Usage | 5%
# Key Percona Server features ################################
      Table & Index Stats | Not Supported
     Multiple I/O Threads | Enabled
     Corruption Resilient | Not Supported
      Durable Replication | Not Supported
     Import InnoDB Tables | Not Supported
     Fast Server Restarts | Not Supported
         Enhanced Logging | Not Supported
     Replica Perf Logging | Disabled
      Response Time Hist. | Not Supported
          Smooth Flushing | Not Supported
      HandlerSocket NoSQL | Not Supported
           Fast Hash UDFs | Unknown
# Percona XtraDB Cluster #####################################
# Plugins ####################################################
       InnoDB compression | ACTIVE
# Query cache ################################################
         query_cache_type | OFF
                     Size | 1.0M
                    Usage | 1%
         HitToInsertRatio | 0%
# Schema #####################################################
Specify --databases or --all-databases to dump and summarize schemas
# Noteworthy Technologies ####################################
                      SSL | No
     Explicit LOCK TABLES | No
           Delayed Insert | No
          XA Transactions | No
              NDB Cluster | No
      Prepared Statements | No
 Prepared statement count | 0
# InnoDB #####################################################
                  Version | 5.7.4
         Buffer Pool Size | 128.0M
         Buffer Pool Fill | 2%
        Buffer Pool Dirty | 0%
           File Per Table | ON
                Page Size | 16k
            Log File Size | 2 * 48.0M = 96.0M
          Log Buffer Size | 8M
             Flush Method | 
      Flush Log At Commit | 1
               XA Support | ON
                Checksums | ON
              Doublewrite | ON
          R/W I/O Threads | 4 4
             I/O Capacity | 200
       Thread Concurrency | 0
      Concurrency Tickets | 5000
       Commit Concurrency | 0
      Txn Isolation Level | REPEATABLE-READ
        Adaptive Flushing | ON
      Adaptive Checkpoint | 
           Checkpoint Age | 0
             InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
       Oldest Transaction | 0 Seconds
         History List Len | 18
               Read Views | 0
         Undo Log Entries | 0 transactions, 0 total undo, 0 max undo
        Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
       Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
      Pending I/O Flushes | 0 buf pool, 0 log
       Transaction States | 1xnot started
# MyISAM #####################################################
                Key Cache | 8.0M
                 Pct Used | 20%
                Unflushed | 0%
# Security ###################################################
                    Users | 2 users, 0 anon, 0 w/o pw, 0 old pw
            Old Passwords | 0
# Binary Logging #############################################
                  Binlogs | 4
               Zero-Sized | 0
               Total Size | 6.7k
            binlog_format | STATEMENT
         expire_logs_days | 0
              sync_binlog | 0
                server_id | 10
             binlog_do_db | 
         binlog_ignore_db | 
# Noteworthy Variables #######################################
     Auto-Inc Incr/Offset | 1/1
   default_storage_engine | InnoDB
               flush_time | 0
             init_connect | 
                init_file | 
                 sql_mode | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
         join_buffer_size | 256k
         sort_buffer_size | 256k
         read_buffer_size | 128k
     read_rnd_buffer_size | 256k
       bulk_insert_buffer | 0.00
      max_heap_table_size | 16M
           tmp_table_size | 16M
       max_allowed_packet | 4M
             thread_stack | 256k
                      log | 
                log_error | /usr/local/mysql-5.7.4/data/tong1.err
             log_warnings | 2
         log_slow_queries | 
log_queries_not_using_indexes | OFF
        log_slave_updates | OFF
# Configuration File #########################################
              Config File | /etc/my.cnf

[mysqld]
basedir                             = /usr/local/mysql-5.7.4
datadir                             = /usr/local/mysql-5.7.4/data
port                                = 3306
server_id                           = 10
socket                              = /tmp/mysql.sock
log-bin                             = mysql-bin
sql_mode                            = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
# The End ####################################################
[root@tong1 bin]# 


3.使用pt-diskstats脚本查看数据库对磁盘的信息

[root@tong1 bin]# ./pt-diskstats 
  #ts device    rd_s rd_avkb rd_mb_s rd_mrg rd_cnc   rd_rt    wr_s wr_avkb wr_mb_s wr_mrg wr_cnc   wr_rt busy in_prg    io_s  qtime stime
  1.0 sda        0.0     0.0     0.0     0%    0.0     0.0     3.0     8.0     0.0    50%    0.0     8.0   5%      0     3.0    0.0   8.0
  1.0 sda3       0.0     0.0     0.0     0%    0.0     0.0     3.0     8.0     0.0    50%    0.0     8.0   5%      0     3.0    0.0   8.0

  1.0 sda        0.0     0.0     0.0     0%    0.0     0.0     0.0     0.0     0.0     0%    0.0     0.0   0%      0     0.0    0.0   0.0
  1.0 sda3       0.0     0.0     0.0     0%    0.0     0.0     0.0     0.0     0.0     0%    0.0     0.0   0%      0     0.0    0.0   0.0

  1.0 sda        0.0     0.0     0.0     0%    0.0     0.0     0.0     0.0     0.0     0%    0.0     0.0   0%      0     0.0    0.0   0.0
  1.0 sda3       0.0     0.0     0.0     0%    0.0     0.0     0.0     0.0     0.0     0%    0.0     0.0   0%      0     0.0    0.0   0.0

[root@tong1 bin]# 










本文转自 z597011036 51CTO博客,原文链接:http://blog.51cto.com/tongcheng/1620158,如需转载请自行联系原作者
相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
6月前
|
算法 Java 数据库连接
Spring+MySQL+数据结构+集合,Alibaba珍藏版mybatis手写文档
Spring+MySQL+数据结构+集合,Alibaba珍藏版mybatis手写文档
|
关系型数据库 MySQL 数据库
MySql 数据库 - 安装时提示缺失VCRUNTIME140_1.dll文件导致的无法启动此程序解决方法,vc++2015-2019运行库集合包获取
MySql 数据库 - 安装时提示缺失VCRUNTIME140_1.dll文件导致的无法启动此程序解决方法,vc++2015-2019运行库集合包获取
375 0
MySql 数据库 - 安装时提示缺失VCRUNTIME140_1.dll文件导致的无法启动此程序解决方法,vc++2015-2019运行库集合包获取
|
SQL 存储 监控
MySQL 内置的监控工具介绍及使用篇(一)
MySQL 内置的监控工具介绍及使用篇
1877 0
|
6月前
|
存储 SQL 关系型数据库
Mysql鸡础(从数据库中导入学生数据用list集合存储emp成员)
Mysql鸡础(从数据库中导入学生数据用list集合存储emp成员)
|
存储 关系型数据库 MySQL
mysql语句的集合
mysql语句的集合
45 1
|
存储 关系型数据库 MySQL
MySQL数据库(12):数据类型-Set集合
MySQL数据库(12):数据类型-Set集合
223 0
|
存储 关系型数据库 MySQL
mysql语句集合
mysql语句集合
67 0
|
SQL 缓存 监控
MySQL 内置的监控工具介绍及使用篇(三)
MySQL 内置的监控工具介绍及使用篇(三)
185 0
|
SQL 监控 关系型数据库
MySQL 内置的监控工具介绍及使用篇(二)
MySQL 内置的监控工具介绍及使用篇(二)
291 0
|
关系型数据库 MySQL 数据库
idea里面mysql数据库统一配置文件和存放到集合中读取出来详细步骤
统一配置可以方便后期代码的维护,比如更改mysql的密码或者什么就可以直接在资源配置文件里面更改就好,不用到代码里面去更改了。
173 0
idea里面mysql数据库统一配置文件和存放到集合中读取出来详细步骤

推荐镜像

更多
下一篇
无影云桌面