If you are a database administrator, you may want to be able to track the performance of those servers. Jack Wallen shows you how with Percona and Docker.
A responsibility of database administrators is to monitor the performance of their databases. But how does one do that? Thanks to numerous open source projects, there are plenty of ways to manage this task. Once such a method is through the Percona Monitoring and Management System, which features:
- Support for MySQL, MariaDB, PostgreSQL, MongoDB and ProxySQL
- ACID compliance
- Simultaneous management of multiple versions
- Support for triggers, views, subqueries, stored procedures and more
- Support for InnoDB resource groups
- Supports the InnoDB, XtraDB and MyRocks storage engines for MySQL/MariaDB and WiredTire, MMAPv1, InMemory and RocksDB for MongoDB
- SQL roles
- Monitors for both query analytics and metrics
- Supports checks for common security vulnerabilities
TO SEE: Hiring Kit: Database Engineer (Tech Republic Premium)
If you need a database performance monitor, Percona might be just what you’re looking for and I’m going to show you how to get this system up and running using Docker.
What you need to implement Percona
All you need to implement this database performance monitor is at least one Docker-supporting machine and a user with sudo privileges. I will demonstrate using two copies of Ubuntu Server 22.04. With those pieces at the ready, let’s get the ball rolling.
How to install Docker
The first thing to do is install the GPG key for the official Docker repository with:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Then add the official Docker repository with the command:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install the necessary dependencies with the command:
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
Finally, we can install the latest version of the Docker engine:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
Add your user to the docker group with:
sudo usermod -aG docker $USER
Log out and back in for the changes to take effect.
How to implement Percona
First create a volume for the deployment with:
docker create -v /srv --name pmm-data percona/pmm-server:latest /bin/true
Then deploy Percona with:
docker run -d -p 8000:80 -p 8443:443 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server:latest
How to access the Percona web interface
You should now be able to access the Percona web interface by pointing a browser to https://SERVER:8443 where SERVER is the IP address of the hosting server. You must log in with the default admin/admin credentials.
After successful authentication, you will be prompted to change the administrator password. This is essential not only for security, but also for connecting the Percona monitoring agent.
How to deploy the Percona monitoring agent
In order for Percona to monitor the performance of your database servers, you must connect those servers to the monitor. For that, we’ll continue with Docker. For this you need three pieces of information:
- IP address of Percona server
- Admin username for Percona, that is
admin
- Password for Percona admin user, which you changed on first login
You also need to make sure that Docker is installed on the database server you want to monitor. You can use the same instructions from earlier for this. With Docker installed, pull down the latest Percona pmm client with:
docker pull percona/pmm-client:2
Create a volume for persistent data with:
docker create --volume /srv --name pmm-client-data percona/pmm-client:2 /bin/true
Finally, deploy the PMM agent with the following command (make sure to customize SERVER and PWORD to suit your deployment):
docker run -d \
--rm \
--name pmm-client \
-e PMM_AGENT_SERVER_ADDRESS=SERVER \
-e PMM_AGENT_SERVER_USERNAME=admin \
-e PMM_AGENT_SERVER_PASSWORD=PWORD \
-e PMM_AGENT_SERVER_INSECURE_TLS=1 \
-e PMM_AGENT_SETUP=1 \
-e PMM_AGENT_CONFIG_FILE=config/pmm-agent.yaml \
--volumes-from pmm-client-data \
percona/pmm-client:2
Where SERVER is the IP address of the hosting Percona surveillance server you deployed earlier and PWORD is the new password you created for the administrator.
We can now connect the client to the server with the command:
docker exec pmm-client pmm-admin config --server-insecure-tls --server-url=https://admin:PWORD@SERVER:8443
Where PWORD is the administrator password you created and SERVER is the IP address of your Percona server.
You should see in the output:
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.
At this point you should see the new node appear in your Percona dashboard (Image A).
Image A

Congratulations, thanks to Docker, you now have a database performance monitor up and running. For more information about Percona, be sure to check out the official documentation here.
Subscribe to TechRepublic’s How to make technology work on YouTube for the latest technical advice for business professionals from Jack Wallen.