部署PMM监控mysql

Percona Monitoring and Management (PMM)是一款监控和管理Mysql和Mongodb的开源工具
包括 PMM-Client和PMM-Server
操作系统:CentOS 7
PMM-Client: 192.168.200.1
PMM-Server: 192.168.100.1

安装PMM-Client

  1. 配置yum源并安装

yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
yum install pmm-client

安装PMM-Server

采用docker方式安装PMM-Server
docker安装过程参考https://www.jianshu.com/p/d9e1fa0997ca

  1. 下载镜像

docker pull percona/pmm-server:latest

  1. 创建pmm-data容器

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

  1. 创建和运行PMM-Server容器

docker run -d \
-p 80:80 \
--volumes-from pmm-data \
--name pmm-server \
--restart always \
percona/pmm-server:latest

  1. 连接PMM-Client和PMM-Server

pmm-admin config --server 192.168.100.1

  1. 收集数据
    如果在my.cnf文件中有如下配置
    [client]
    password=123456
    直接运行

pmm-admin add mysql

如果没有配置密码,在后面加上合适的参数
Use additional flags --user, --password, --host, --port, --socket if needed.

  1. 查看添加效果
[root@localhost ~]# pmm-admin list
pmm-admin 1.9.0

PMM Server      | 192.168.100.1 
Client Name     | localhost.localdomain
Client Address  | 192.168.200.1
Service Manager | linux-upstart

-------------- ---------------------- ----------- -------- ----------------------------------------- ------------------------------------------
SERVICE TYPE   NAME                   LOCAL PORT  RUNNING  DATA SOURCE                               OPTIONS                                   
-------------- ---------------------- ----------- -------- ----------------------------------------- ------------------------------------------
mysql:queries  localhost.localdomain  -           YES      root:***@unix(/var/lib/mysql/mysql.sock)  query_source=slowlog, query_examples=true 
linux:metrics  localhost.localdomain  42000       YES      -                                                                                   
mysql:metrics  localhost.localdomain  42002       YES      root:***@unix(/var/lib/mysql/mysql.sock)

网页登陆:192.168.100.1


部署PMM监控mysql_第1张图片
pmm.jpg

你可能感兴趣的:(部署PMM监控mysql)