Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Instalar e usar o Percona Toolkit no Centos 7


O Percona Toolkit é um grupo de ferramentas de linha de comando de código aberto de ponta que foram construídas e usadas pela equipe técnica da Percona, construídas para executar uma variedade de tarefas de servidor e sistema MySQL® e MongoDB® automaticamente que são executadas manualmente são muito difíceis ou complicado de fazer.

Instale o Percona Toolkit no Centos 7:


O rpm do kit de ferramentas Percona pode ser baixado do repositório Percona:
wget https://www.percona.com/downloads/percona-toolkit/3.2.0/binary/redhat/7/x86_64/percona-toolkit-3.2.0-1.el7.x86_64.rpm

você pode instalar o rpm do percona-toolkit usando o yum, ele resolverá todas as dependências do repositório Percona
yum install -y percona-toolkit-3.2.0-1.el7.x86_64.rpm

Assim que a instalação estiver concluída, você encontrará toda a lista abaixo de ferramentas instaladas em seu servidor.

você pode verificar abaixo se as ferramentas percona foram instaladas ou não no diretório /usr/bin/
[[email protected] bin]# ll /usr/bin/pt-*
-rwxr-xr-x. 1 root root    41747 Apr 23 20:41 /usr/bin/pt-align
-rwxr-xr-x. 1 root root   272634 Apr 23 20:41 /usr/bin/pt-archiver
-rwxr-xr-x. 1 root root   171698 Apr 23 20:41 /usr/bin/pt-config-diff
-rwxr-xr-x. 1 root root   168893 Apr 23 20:41 /usr/bin/pt-deadlock-logger
-rwxr-xr-x. 1 root root   166450 Apr 23 20:41 /usr/bin/pt-diskstats
-rwxr-xr-x. 1 root root   172014 Apr 23 20:41 /usr/bin/pt-duplicate-key-checker
-rwxr-xr-x. 1 root root    50157 Apr 23 20:41 /usr/bin/pt-fifo-split
-rwxr-xr-x. 1 root root   152724 Apr 23 20:41 /usr/bin/pt-find
-rwxr-xr-x. 1 root root    67304 Apr 23 20:41 /usr/bin/pt-fingerprint
-rwxr-xr-x. 1 root root   135870 Apr 23 20:41 /usr/bin/pt-fk-error-logger
-rwxr-xr-x. 1 root root   225525 Apr 23 20:41 /usr/bin/pt-heartbeat
-rwxr-xr-x. 1 root root   229128 Apr 23 20:41 /usr/bin/pt-index-usage
-rwxr-xr-x. 1 root root    32405 Apr 23 20:41 /usr/bin/pt-ioprofile
-rwxr-xr-x. 1 root root   257728 Apr 23 20:41 /usr/bin/pt-kill
-rwxr-xr-x. 1 root root    21913 Apr 23 20:41 /usr/bin/pt-mext
-rwxr-xr-x. 1 root root  9908136 Apr 23 20:42 /usr/bin/pt-mongodb-query-digest
-rwxr-xr-x. 1 root root 10307464 Apr 23 20:42 /usr/bin/pt-mongodb-summary
-rwxr-xr-x. 1 root root   108113 Apr 23 20:41 /usr/bin/pt-mysql-summary
-rwxr-xr-x. 1 root root   431516 Apr 23 20:41 /usr/bin/pt-online-schema-change
-rwxr-xr-x. 1 root root  5889136 Apr 23 20:42 /usr/bin/pt-pg-summary
-rwxr-xr-x. 1 root root    24598 Apr 23 20:41 /usr/bin/pt-pmp
-rwxr-xr-x. 1 root root   529350 Apr 23 20:41 /usr/bin/pt-query-digest
-rwxr-xr-x. 1 root root  4412272 Apr 23 20:42 /usr/bin/pt-secure-collect
-rwxr-xr-x. 1 root root    79159 Apr 23 20:41 /usr/bin/pt-show-grants
-rwxr-xr-x. 1 root root    37784 Apr 23 20:41 /usr/bin/pt-sift
-rwxr-xr-x. 1 root root   147867 Apr 23 20:41 /usr/bin/pt-slave-delay
-rwxr-xr-x. 1 root root   133040 Apr 23 20:41 /usr/bin/pt-slave-find
-rwxr-xr-x. 1 root root   186580 Apr 23 20:41 /usr/bin/pt-slave-restart
-rwxr-xr-x. 1 root root    76185 Apr 23 20:41 /usr/bin/pt-stalk
-rwxr-xr-x. 1 root root    90816 Apr 23 20:41 /usr/bin/pt-summary
-rwxr-xr-x. 1 root root   461826 Apr 23 20:41 /usr/bin/pt-table-checksum
-rwxr-xr-x. 1 root root   406316 Apr 23 20:41 /usr/bin/pt-table-sync
-rwxr-xr-x. 1 root root   248658 Apr 23 20:41 /usr/bin/pt-table-usage
-rwxr-xr-x. 1 root root   334033 Apr 23 20:41 /usr/bin/pt-upgrade
-rwxr-xr-x. 1 root root   179330 Apr 23 20:41 /usr/bin/pt-variable-advisor
-rwxr-xr-x. 1 root root   103460 Apr 23 20:41 /usr/bin/pt-visual-explain

Ferramentas

  • pt-align
  • pt-archiver
  • pt-config-diff
  • pt-deadlock-logger
  • pt-diskstats
  • pt-duplicate-key-checker
  • pt-fifo-split
  • pt-encontrar
  • pt-impressão digital
  • pt-fk-error-logger
  • pt-heartbeat
  • pt-index-usage
  • pt-ioprofile
  • pt-kill
  • pt-mext
  • pt-mongodb-query-digest
  • pt-mongodb-resumo
  • pt-mysql-summary
  • pt-online-schema-change
  • pt-pg-resumo
  • pt-pmp
  • pt-query-digest
  • pt-secure-collect
  • pt-show-grants
  • pt-sift
  • pt-slave-delay
  • pt-slave-find
  • pt-slave-restart
  • pt-stalk
  • pt-resumo
  • pt-table-checksum
  • pt-table-sync
  • pt-table-usage
  • pt-upgrade
  • pt-variable-advisor
  • pt-visual-explain

Agora você tem o Percona Toolkit instalado no Centos 7. Use os links acima para encontrar a descrição da ferramenta e exemplos de uso
[[email protected] ~]# pt-summary

# Percona Toolkit System Summary Report ######################
Date | 2020-06-22 16:07:15 UTC (local TZ: +03 +0300)
Hostname | localhost.localdomain
Uptime | 8:06, 4 users, load average: 0.02, 0.02, 0.05
System | innotek GmbH; VirtualBox; v1.2 (Other)
Service Tag | 0
Platform | Linux
Release | CentOS Linux release 7.8.2003 (Core)
Kernel | 3.10.0-1127.10.1.el7.x86_64
Architecture | CPU = 64-bit, OS = 64-bit
Threading | NPTL 2.17
SELinux | Enforcing
Virtualized | KVM
# Processor ##################################################
Processors | physical = 1, cores = 1, virtual = 1, hyperthreading = no
Speeds | 1x2394.466
Models | 1xIntel(R) Core(TM) i7-5500U CPU @ 2.40GHz
Caches | 1x4096 KB
# Memory #####################################################
Total | 3.7G
Free | 648.4M
Used | physical = 1.1G, swap allocated = 2.5G, swap used = 0.0, virtual = 1.1G
Shared | 18.7M
Buffers | 2.0G
Caches | 2.3G
Dirty | 112 kB
UsedRSS | 1.5G
Swappiness | 30
DirtyPolicy | 30, 10
DirtyStatus | 0, 0
Locator Size Speed Form Factor Type Type Detail
========= ======== ================= ============= ============= ===========
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/mapper/centos-root 37G 22% xfs rw,relatime,seclabel,attr2,inode64,noquota /
/dev/sda1 1014M 24% xfs rw,relatime,seclabel,attr2,inode64,noquota /boot
.
.
.
tmpfs 377M 1% tmpfs ro,nosuid,nodev,noexec,seclabel,mode=755 /run/user/0
# Disk Schedulers And Queue Size #############################
dm-0 | 128
dm-1 | 128
sda | [deadline] 128
sr0 | [deadline] 128
# Disk Partioning ############################################
Device Type Start End Size
============ ==== ========== ========== ==================
/dev/dm-0 Disk 39183187968
/dev/dm-1 Disk 2684354560
/dev/sda Disk 42949672960
/dev/sda1 Part 2048 2099199 1073741312
/dev/sda2 Part 2099200 83886079 41874882048
# Kernel Inode State #########################################
dentry-state | 50193 30566 45 0 3904 0
file-nr | 8672 0 378007
inode-nr | 64170 21818
# LVM Volumes ################################################
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 36.49g
swap centos -wi-ao---- 2.50g
# LVM Volume Groups ##########################################
VG VSize VFree
centos <39.00g 4.00m
# RAID Controller ############################################
Controller | No RAID controller detected
# Network Config #############################################
Controller | Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
Controller | Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
FIN Timeout | 60
Port Range | 60999
# Interface Statistics #######################################
interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors
========= ========= ========== ========== ========== ========== ==========
lo 5000 60 0 5000 60 0
enp0s3 300000 3000 0 600000 3000 0
enp0s8 600000000 450000 0 3500000 60000 0
virbr0 0 0 0 0 0 0
virbr0-nic 0 0 0 0 0 0
vboxnet0 0 0 0 3500 20 0
# Network Devices ############################################
Device Speed Duplex
========= ========= =========
virbr0-nic 10Mb/s Full
vboxnet0 10Mb/s Full
enp0s3 1000Mb/s Full
virbr0
enp0s8 1000Mb/s Full
# Network Connections ########################################

22 1
States of connections
ESTABLISHED 1
LISTEN 10
# Top Processes ##############################################
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15551 root 20 0 162128 2188 1516 R 18.8 0.1 0:00.04 top
.
.
10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 lru-add-dra+
# Notable Processes ##########################################
PID OOM COMMAND
1231 -17 sshd
# Memory mamagement ##########################################
Transparent huge pages are enabled.
# The End ####################################################


pt-mysql-summary pode ser usado como menção no exemplo abaixo
[[email protected] ~]# pt-mysql-summary --host localhost --user root --ask-pass



O exemplo abaixo mostra o uso de estatísticas de discos no nível do SO:
[[email protected] ~]#pt-diskstats
# A software update is available:
#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 7.0 10.8 0.1 12% 0.0 2.2 1% 0 7.0 1.5 0.8
1.0 sda2 0.0 0.0 0.0 0% 0.0 0.0 6.0 12.6 0.1 14% 0.0 2.4 1% 0 6.0 1.7 0.7
1.0 dm-0 0.0 0.0 0.0 0% 0.0 0.0 7.0 10.8 0.1 0% 0.0 2.9 1% 0 7.0 2.0 0.9

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 sda2 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 dm-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.0