9

Install and Use Percona Toolkit on Ubuntu 20.04/18.04 LTS

 2 years ago
source link: https://computingforgeeks.com/how-to-install-and-use-percona-toolkit-on-ubuntu/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Install and Use Percona Toolkit on Ubuntu 20.04/18.04 LTS
Search

In this blog post, we will cover how to install and use Percona Toolkit on Ubuntu 20.04/18.04. Percona Toolkit is a collection of advanced command-line tools that are created by Percona to help you perform a variety of MongoDB and MySQL administration tasks that can be complex to do manually.

The installation of Percona Toolkit comes with a number of scripts which are well documented, easy to use and doesn’t depend on any external libraries. Percona Toolkit is developed and supported by Percona.

Install Percona Toolkit on Ubuntu 20.04/18.04 LTS

The Percona Toolkit is available on the Percona APT repository which can be added to Ubuntu 20.04/18.04 LTS server. Follow steps below to install Percona Toolkit on Ubuntu 20.04/18.04.

Step 1: Download Percona Repository file

Download the repository file using the commands:

sudo apt update
sudo apt -y install gnupg2 wget
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb

Step 2: Install Percona repository package

Once the repository file is downloaded, install it with the dpkgcommand:

sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb

You should get an output similar to below:

Selecting previously unselected package percona-release.
(Reading database ... 194365 files and directories currently installed.)
Preparing to unpack percona-release_latest.focal_all.deb ...
Unpacking percona-release (1.0-17.generic) ...
Setting up percona-release (1.0-17.generic) ...
* Enabling the Percona Original repository
<*> All done!
==> Please run "apt-get update" to apply changes
The percona-release package now contains a percona-release script that can enable additional repositories for our newer products.

For example, to enable the Percona Server 8.0 repository use:

  percona-release setup ps80

Note: To avoid conflicts with older product versions, the percona-release setup command may disable our original repository for some products.

For more information, please visit:
  https://www.percona.com/doc/percona-repo-config/percona-release.html

Step 3: Install Percona Toolkit on Ubuntu 20.04/18.04

Finally, update your  local apt cache and install Percona Toolkit:

sudo apt update
sudo apt install percona-toolkit

Agree to software installation:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  geoip-database gsfonts libapt-pkg5.90 libbind9-161 libcroco3
  libdns-export1107 libdns1107 libdns1109 libgeoip1 libicu65 libirs161
  libisc-export1104 libisc1104 libisc1105 libisccc161 libisccfg163 liblwres161
  libmozjs-60-0 liboauth0 libpoppler95 linux-modules-extra-5.4.0-14-generic
  ubuntu-system-service
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libdbd-mysql-perl libdbi-perl libterm-readkey-perl
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
The following NEW packages will be installed:
  libdbd-mysql-perl libdbi-perl libterm-readkey-perl percona-toolkit
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,732 kB of archives.
After this operation, 10.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Below is a list of Percona Tools provided by the Toolkit.

You now have the Percona Toolkit installed on Ubuntu 18.04. Use the links above to find the Tool description and usage examples.

Example: Pull MySQL Performance summary

pt-mysql-summary conveniently summarizes the status and configuration of a MySQL database server so that you can learn about it at a glance.

pt-mysql-summary --host localhost --user root --ask-pass

When prompted for the MySQL root user password, provide it to get stats.

You can as well redirect the output to a file.

pt-mysql-summary --host localhost --user root --ask-pass > mysql-summary.txt

See sample output below:

# Percona Toolkit MySQL Summary Report #######################
              System time | 2018-12-09 07:10:54 UTC (local TZ: EAT +0300)
# Instances ##################################################
  Port  Data Directory             Nice OOM Socket
  ===== ========================== ==== === ======
# MySQL Executable ###########################################
       Path to executable | /usr/sbin/mysqld
              Has symbols | Yes
# Slave Hosts ################################################
No slaves found
# Report On Port 3306 ########################################
                     User | root@localhost
                     Time | 2018-12-09 10:10:54 (EAT)
                 Hostname | centos-db
                  Version | 10.3.10-MariaDB MariaDB Server
                 Built On | Linux x86_64
                  Started | 2018-12-02 02:01 (up 7+08:08:58)
                Databases | 8
                  Datadir | /var/lib/mysql/
                Processes | 1 connected, 6 running
              Replication | Is not a slave, has 0 slaves connected
                  Pidfile | /var/lib/mysql/cnetos-db.pid (exists)
# Processlist ################################################

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

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

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

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

  State                          COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  Init                                  1       1         0         0
  InnoDB purge coordinator              1       1         0         0
  InnoDB purge worker                   3       3         0         0
  InnoDB shutdown handler               1       1         0         0

# Status Counters (Wait 10 Seconds) ##########################
.....

Recommended articles:

Monitoring MySQL / MariaDB with Prometheus in five minutes

Monitoring MySQL and MongoDB with Prometheus and Grafana – PMM

How to install and use mycli on Ubuntu 18.04 – MySQL client with AutoCompletion and Syntax Highlighting


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK