Percona Monitoring and Management (PMM) is an open-source database monitoring, management, and observability solution for MySQL, PostgreSQL, and MongoDB.
Add the following to my.cnf
all MariaDB nodes:
performance_schema=ON
query_response_time_stats=ON
userstat=ON
# Uncomment the following lines if needed
# performance-schema-instrument='stage/%=ON'
# performance-schema-consumer-events-stages-current=ON
# performance-schema-consumer-events-stages-history=ON
# performance-schema-consumer-events-stages-history-long=ON
Restart MariaDB:
systemctl restart mariadb
Percona Monitoring and Management - MySQL Client
Install the plugins using the MySQL/MariaDB prompt:
-- For MariaDB 10.3:
INSTALL PLUGIN QUERY_RESPONSE_TIME_AUDIT SONAME 'query_response_time.so';
INSTALL PLUGIN QUERY_RESPONSE_TIME SONAME 'query_response_time.so';
SET GLOBAL query_response_time_stats = ON;
Update and install necessary packages for AlmaLinux:
dnf update
dnf -y install epel-release
dnf -y install podman buildah
Verify the installation:
podman --version
buildah --version
Configure Red Hat's registry:
vi /etc/containers/registries.conf
Uncomment the following lines:
[registries.insecure]
registries = ['docker.io']
insecure = true
For Ubuntu:
apt update
apt install podman buildah
Install slirp4netns
:
apt install slirp4netns
Set up non-root user:
usermod --add-subuids 100000-165535 --add-subgids 100000-165535 your-username
grep your-username /etc/subuid /etc/subgid
podman system migrate
podman pull percona/pmm-server:latest
podman run --detach --privileged --restart always \
--publish 5443:443 \
-v pmm-data:/srv \
--name pmm-server \
-v /etc/localtime:/etc/localtime:ro \
percona/pmm-server:latest
Change password:
podman exec -t pmm-server change-admin-password ChangeYour0wnP455word
Percona Monitoring and Management - Client
Web access https://192.168.0.148:5443
dnf install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
dnf install -y pmm2-client
pmm-admin --version
wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb
dpkg -i percona-release_latest.generic_all.deb
apt update
apt install -y pmm2-client
pmm-admin --version
(IP 192.168.0.148 with the name pmm-server as an example, and request to open the port in the firewall)
PMM_SERVER=192.168.0.148:5443
pmm-admin config --server-insecure-tls --server-url=https://admin:ChangeYour0wnP455word@$PMM_SERVER
systemctl enable pmm-agent --now
Ensure all nodes, PMM, and MariaDB nodes in /etc/hosts
have the IP and names of all servers, PMM, and MariaDB nodes.
-- Replace 'ChangeYour0wnP566word' with the desired password
CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'ChangeYour0wnP566word' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm'@'127.0.0.1';
CREATE USER 'pmm'@'pmm-server' IDENTIFIED BY 'ChangeYour0wnP566word' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm'@'pmm-server';
CREATE USER 'pmm'@'192.68.0.148' IDENTIFIED BY 'ChangeYour0wnP566word' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm'@'192.168.0.148';
pmm-admin add mysql --username=pmm --password=pass --query-source=perfschema
Web access https://192.168.0.148:5443
- Select Configuration
- Inventory.
- In the Services tab, verify the Service name, Addresses, and any other relevant information in the form.
- In the Options column, expand the Details section and check that the Agents are using the desired data source.
Look for your service in the output of this command:
pmm-admin inventory list services --service-type=mysql
- Open the MySQL Instance Summary dashboard.
- Set the Service Name to the newly-added service.
Percona Server for MySQL, MariaDB
If the query response time plugin was installed, check for data in the MySQL Query Response Time Details dashboard or select a query in PMM Query Analytics to see the Query time distribution bar.