部署Mysql监控Percona Monitoring and Management

SuKai December 6, 2024

安装Docker

ping download.docker.com
openssl s_client -CApath /etc/ssl/certs/ -connect 65.9.66.72:443
sudo yum -y install docker-ce docker-ce-cli containerd.io wget tmux

sudo vi /etc/docker/daemon.json
{
    "insecure-registries" : [ "reg.sukai.com:7443" ]
}

启动PMM server

sudo docker run --detach --restart always --publish 443:443 -v /data/pmm-server:/srv --name pmm-server reg.sukai.com:7443/percona/pmm-server:2

sudo docker exec -t pmm-server change-admin-password '555555555555555'

MySQL节点启动PMM client

sudo yum -y install pmm2-client

// Mysql 创建用户
CREATE USER 'pmm'@'127.0.0.1' IDENTIFIED BY 'EEEEEEEEEEEEEEEEEE' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, PROCESS, REPLICATION CLIENT, RELOAD, BACKUP_ADMIN ON *.* TO 'pmm'@'127.0.0.1';

// 密码字符串URL转义
sudo pmm-admin config --server-insecure-tls --server-url=https://admin:55%235555%7C55555@10.11.1.140:443

pmm-admin add mysql --query-source=slowlog --size-slow-logs=1GiB --username=pmm --password='EEEEEEEEEEEEEEEEEE' MYSQL_DB01