Perconda

Perconda

Perconda

Perconda Monitor Management

PMM是perconda针对MySQL, MongoDB, PostgreSQL等推出的更深层次监控的管理组件

安装

可以参考如下,如果按照官方的脚本执行会报错timeout https://docs.percona.com/percona-monitoring-and-management/setting-up/server/docker.html#tips

通过把下载好的docker images load以后,就可以运行官方的脚本进行安装了

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
➜  ~ wget https://downloads.percona.com/downloads/pmm2/2.42.0/docker/pmm-server-2.42.0.docker
➜  ~ docker load -i pmm-server-2.42.0.docker 
0e2e8dd6d8eb: Loading layer [==================================================>]  115.1MB/115.1MB
c6e5cc92bae4: Loading layer [==================================================>]  2.298GB/2.298GB
Loaded image: percona/pmm-server:2.42.0
➜  ~ curl -fsSL https://www.percona.com/get/pmm | /bin/bash
Gathering/downloading required components, this may take a moment

Checking docker installation - installed.

Starting PMM server...
Created PMM Data Volume: pmm-data
Created PMM Server: pmm-server
	Use the following command if you ever need to update your container by hand:
	docker run -d -p 443:443 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server:2 

PMM Server has been successfully setup on this system!

You can access your new server using one of the following web addresses:
	https://172.17.0.1:443/
	https://192.168.186.105:443/
	https://127.0.0.1:443/
	https://10.25.1.1:443/

The default username is 'admin' and the password is 'admin' :)
Note: Some browsers may not trust the default SSL certificate when you first open one of the urls above.
If this is the case, Chrome users may want to type 'thisisunsafe' to bypass the warning.

Enjoy Percona Monitoring and Management!

使用

web

使用上面给的用户名和密码登陆以后,就提示,如果登陆不了要稍微等一会 ../images/pmm/pmm-tips.png◎ ../images/pmm/pmm-tips.png

1
2
3
4
5
6
7
Percona Monitoring and Management is an open-source database monitoring, management, and observability solution for MySQL, PostgreSQL, MongoDB and other popular databases.

PMM enables you to:

    Spot critical performance issues faster, understand the root cause of incidents better and troubleshoot them more efficiently;
    Ensure optimal database performance with automated health checks and notifications about potential security threats, performance degradation, data loss, and data corruption issues;
    Back up your critical data with zero-downtime and minimal performance impact.
mysql提前赋权限
1
2
3
4
MariaDB [(none)]> CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'pmm@test231' WITH MAX_USER_CONNECTIONS 10;
Query OK, 0 rows affected (0.004 sec)
MariaDB [(none)]> GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm'@'127.0.0.1';
Query OK, 0 rows affected (0.002 sec)
安装pmm-client

debian

1
2
3
➜  ~ wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb
➜  ~ sudo dpkg -i percona-release_latest.generic_all.deb
➜  ~ sudo apt install -y pmm2-client

centos

注册pmm client

你如果没改密码应该是admin:admin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
➜  ~ sudo pmm-admin config --server-insecure-tls --server-url=https://admin:'tA6nxE$TEEGz;~*'@192.168.186.105:443
Checking local pmm-agent status...
pmm-agent is running.
Registering pmm-agent on PMM Server...
Registered.
Configuration file /usr/local/percona/pmm2/config/pmm-agent.yaml updated.
Reloading pmm-agent configuration...
Configuration reloaded.
Checking local pmm-agent status...
pmm-agent is running.
添加mysql监控
1
2
3
4
5
6
➜  ~ sudo pmm-admin add mysql --query-source=perfschema --username=pmm --password='pmm@test231' 
MySQL Service added.
Service ID  : /service_id/82452f74-b54f-41e9-bf2f-bc5788a50608
Service name: liuliancao-com-mysql

Table statistics collection enabled (the limit is 1000, the actual table count is 333).

Perconda ToolKit

https://www.percona.com/percona-toolkit perconda toolkit是比较出名的pt软件

install

我发的链接里面就有下载,可以选择对应的系统进行安装

1
2
/tmp wget https://downloads.percona.com/downloads/percona-toolkit/3.6.0/binary/debian/bookworm/x86_64/percona-toolkit_3.6.0-1.bookworm_amd64.deb
/tmp sudo dpkg -i percona-toolkit_3.6.0-1.bookworm_amd64.deb

安装完成以后就会有很多pt-开头的命令了

1
2
3
4
5
6
7
8
➜  /tmp pt-
pt-align                  pt-fifo-split             pt-ioprofile              pt-mysql-summary          pt-sift                   pt-table-sync           
pt-archiver               pt-find                   pt-k8s-debug-collector    pt-online-schema-change   pt-slave-delay            pt-table-usage          
pt-config-diff            pt-fingerprint            pt-kill                   pt-pg-summary             pt-slave-find             pt-upgrade              
pt-deadlock-logger        pt-fk-error-logger        pt-mext                   pt-pmp                    pt-slave-restart          pt-variable-advisor     
pt-diskstats              pt-galera-log-explainer   pt-mongodb-index-check    pt-query-digest           pt-stalk                  pt-visual-explain       
pt-duplicate-key-checker  pt-heartbeat              pt-mongodb-query-digest   pt-secure-collect         pt-summary                                        
pt-eustack-resolver       pt-index-usage            pt-mongodb-summary        pt-show-grants            pt-table-checksum

具体可以参考对应文档进行操作 https://docs.percona.com/percona-toolkit/index.html

参考文档