标签:pmm 监控mysql
Percona Monitoring and Management注意:确保主机的防火墙和路由规则不限制Docker容器
监控服务器安装docker
yum install -y docker
systemctl start docker
设置阿里云镜像库加速docker下载
mkdir -p /etc/docker
cat >/etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://kli7phym.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
第1步。拉取PMM服务器映像
docker pull percona / pmm-server:latest
第2步。创建一个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:latest /bin/true
第三步。创建和运行 PMM Server Container
docker run -d -p 80:80 --volumes-from pmm-data --name pmm-server1 --restart always percona/pmm-server:latest
至此 pmm 构建完毕
二、被监控MySQL服务端安装pmm-client
(pmm-client与percona-toolkit请自行到percona官方下载)
在要被监控的MySQL服务器上安装
安装pmm-client
yum localinstall pmm-client-1.5.2-1.x86_64.rpm
安装percona工具
yum localinstall percona-toolkit-3.0.5-1.el7.x86_64.rpm
客户端连接pmm server
[root@mysql opt]# pmm-admin config --server 192.168.56.20
OK, PMM server is alive.
PMM Server | 192.168.56.20
Client Name | mysql
Client Address | 192.168.56.20
增加pmm-client监控账号
GRANT ALL PRIVILEGES ON?.?TO ‘pmm‘@‘192.168.56.%‘ IDENTIFIED BY ‘pmm‘;
flush privileges;
增加pmm客户端监控mysql到pmm服务器
pmm-admin add mysql --user pmm --password pmm --host 192.168.56.20 --port 3306
[root@mysql opt]# pmm-admin list
pmm-admin 1.5.2
PMM Server | 192.168.56.20
Client Name | mysql
Client Address | 192.168.56.20
Service Manager | linux-systemd
SERVICE TYPE NAME LOCAL PORT RUNNING DATA SOURCE OPTIONS
mysql:queries mysql - YES pmm:@tcp(192.168.56.20:3306) query_source=slowlog, query_examples=true
mysql:metrics mysql 42002 YES pmm:@tcp(192.168.56.20:3306)
访问pmm-server
192.168.56.20
界面如下
监控界面如上
标签:pmm 监控mysql
原文地址:http://blog.51cto.com/412166174/2048954