Deploy Percona PMM with Docker for Real‑Time MySQL Monitoring
This guide walks you through installing Ubuntu, Docker, and the Percona Monitoring and Management (PMM) server, configuring a PMM client, and connecting it to MySQL to enable real‑time performance metrics and slow‑query analysis.
For anyone experienced with MySQL performance tuning, the lack of real‑time monitoring is a pain point; this article introduces a new tool for slow‑log analysis in a MySQL environment.
Why Write This Article
MySQL has several forks such as Percona Server and AliSQL (open‑sourced by Alibaba). Percona not only offers a server product but also a monitoring suite called Percona Monitoring and Management (PMM), which fills the gap of MySQL’s missing real‑time monitoring capabilities.
Below is a screenshot of the PMM server monitoring dashboard.
The most attractive feature for me is the slow‑log analysis view.
Steps
Install an Ubuntu 14.04 Server image on VMware or VirtualBox (use the Tsinghua mirror for fast download).
Install Docker on Ubuntu: curl -sSL https://get.daocloud.io/docker | sh Verify installation with: docker -v Expected output: Docker version 17.04.0-ce, build 4845c56 Pull the PMM server image. Because foreign mirrors are slow, add the USTC Docker registry mirror: --registry-mirror=https://docker.mirrors.ustc.edu.cn For systemd users, edit /etc/default/docker or run sudo systemctl edit docker.service to include the mirror option.
Download the PMM image: docker pull percona/pmm-server:1.1.3 Create a data container for 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:1.1.3 /bin/trueRun the PMM server container:
docker run -d \
-p 80:80 \
--volumes-from pmm-data \
--name pmm-server \
--restart always \
percona/pmm-server:1.1.3Install the PMM client on the MySQL host:
wget https://www.percona.com/downloads/pmm-client/pmm-client-1.1.3/binary/debian/trusty/x86_64/pmm-client_1.1.3-1.trusty_amd64.deb sudo dpkg -i pmm-client_1.1.3-1.trusty_amd64.debConfigure the PMM client to point to the server (replace with your server IP): pmm-admin config --server 192.168.111.129 Add MySQL monitoring (replace with your MySQL host IP and password):
pmm-admin add mysql --user root -p123456 --host 192.168.111.129 --port 3306Note: The client collects system metrics, performance_schema data, and slow‑log entries. For full coverage of system and slow‑log metrics, install the client on the MySQL machine.
Verify the setup by accessing the PMM landing page and its components:
PMM landing page: http://192.168.100.1 Query Analytics (QAN web app): http://192.168.100.1/qan/ Metrics Monitor (Grafana): http://192.168.100.1/graph/ (user: admin, password: admin)
Orchestrator: http://192.168.100.1/orchestrator The IP addresses above refer to the PMM server.
Below is a screenshot from the Orchestrator website.
Reference articles: 1. http://www.tuicool.com/articles/6fAfQ3j 2. https://lug.ustc.edu.cn/wiki/mirrors/help/docker
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
