Percona监控和管理(PMM)是一个用于管理和监控MySQL和MongoDB性能的开源平台。 它由Percona与托管数据库服务,支持和咨询领域的专家合作开发。 PMM是一个免费的开源解决方案,您可以在自己的环境中运行,以实现最大的安全性和可靠性。 它为MySQL和MongoDB服务器提供全面的基于时间的分析,以确保您的数据尽可能高效地工作。
包含以下模块:
1)PMM Client安装在您要监视的每个数据库主机上。它收集服务器指标,一般系统指标和查询分析数据,以获得完整的性能概述。收集的数据发送到PMM服务器。
2)PMM Server是PMM的核心部分,它聚合收集的数据,并以Web界面的表格,仪表板和图形的形式呈现。
一. 安装PMM Server
- 查找pmm server 镜像
➜ ~ docker search pmm-server
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
percona/pmm-server Percona Monitoring and Management - PMM Serv… 68
perconalab/pmm-server PMM Server dev repo 6
perconalab/pmm-server-openshift 1
perconalab/pmm-server-fb 1
manjots/pmm-server-orchestrator 0
zytek/pmm-server-ecs pmm-server ready to be deployed to ECS with … 0
dreambeam/pmm-server 0
ignatev/pmm-server 0
eason2403/pmm-server 0
gywndi/pmm-server-kkb 0
nlpsecure/pmm-server-aio 0
salrin/pmm-server 0
pdawn/pmm-server pmm server 0 [OK]
gywndi/pmm-server 0
aleksi/pmm-server-alertmanager 0
flyer103/pmm-server 0
avinashgudapati/pmm-server 0
yinjie/pmm-server1.7 0
michaelcoburn1/pmm-server 0
dockerhernan/pmm-sever pmm-server Container : to the tdp2 course's … 0
hfadhloun/pmm percona/pmm-server:latest 0
- 拉取镜像
➜ ~ docker pull percona/pmm-server
Using default tag: latest
latest: Pulling from percona/pmm-server
a02a4930cb5d: Pull complete
4b99a7c4492f: Pull complete
Digest: sha256:6bf9b76415409abce044c4eb8f3ddfe1794ae4707462e7a158a027b434bc47e4
Status: Downloaded newer image for percona/pmm-server:latest
- 创建PMM数据容器
➜ ~ docker create \
-v /opt/prometheus/data \
-v /opt/consul-data \
-v /var/lib/mysql \
-v /var/lib/grafana \
--name pmm-data \
percona/pmm-server /bin/true
62151cb1d095f65b2d6abe0a0866034d16ad4122a126a309bab50bc0cacbde98
- 创建PMM服务器容器
// 设置登陆用户名:test,密码:test,默认使用80端口
➜ ~ docker run -d -p 80:80 \
--volumes-from pmm-data \
--name pmm-server \
-e SERVER_USER=test \
-e SERVER_PASSWORD=test \
--restart always \
percona/pmm-server
2877eb783c1b563141b27ec3f831030a609f51f2859e44d83e6bf551899080b7
此时访问localhost:80
二. 安装PMM Client
在监控服务器上安装
- 安装pmm-client客户端
# wget https://www.percona.com/downloads/pmm/1.17.1/binary/redhat/7/x86_64/pmm-client-1.17.1-1.el7.x86_64.rpm
# yum install -y pmm-client-1.17.1-1.el7.x86_64.rpm
- 连接到服务器并向服务器上报数据
# pmm-admin config --server 10.107.14.136:80 --server-user test --server-password test
OK, PMM server is alive.
PMM Server | 10.107.14.136:80
Client Name | 10.103.27.205
Client Address | 10.103.27.205
- 添加监控项MySQL
# pmm-admin add mysql --user root --password 123123
[linux:metrics] OK, already monitoring this system.
[mysql:metrics] OK, now monitoring MySQL metrics using DSN root:***@unix(/var/lib/mysql/mysql.sock)
[mysql:queries] OK, now monitoring MySQL queries from slowlog using DSN root:***@unix(/var/lib/mysql/mysql.sock)
三. Grafana添加远程mysql实例
此时,即可查看到远程mysql的监控数据: