Percona Monitoring and Management
也就是percona公司的数据库监控和管理的开源工具。
Percona Monitoring and Management (PMM) is a free and open-source platform for managing and monitoring MySQL® and MongoDB® performance. You can run PMM in your own environment for maximum security and reliability. It provides thorough time-based analysis for MySQL, MariaDB® and MongoDB servers to ensure that your data works as efficiently as possible.
今天介绍pmm监控MySQL服务器
一、首先安装pmm server
我们这边使用docker安装pmm server 方便快捷
使用Docker运行PMM服务器
PMM服务器的Docker映像位于percona / pmm-server公共存储库中。如果您打算从Docker镜像运行PMM Server,则主机必须能够运行Docker 1.12.6或更高版本,并具有网络访问权限。 注意:确保主机的防火墙和路由规则不限制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-server --restart always percona/pmm-server:latest
至此 pmm 构建完毕
二、被监控MySQL服务端安装pmm-client
在要被监控的MySQL服务器上安装
安装pmm-client
rpm -ivh pmm-client-1.15.0-1.el6.x86_64.rpm
安装percona工具
源码安装percona-tookit,见以下博客
https://blog.youkuaiyun.com/mchdba/article/details/14209765
客户端连接pmm server
pmm-admin config --server 192.168.8.30 OK, PMM server is alive. PMM Server | 192.168.8.30 Client Name | localhost.localdomain Client Address | 192.168.8.32
增加pmm-client监控账号
grant all privileges on *.* to 'pmm'@'192.168.8.%' identified by 'mysql'; flush privileges;
增加pmm客户端监控mysql到pmm服务器
[root@mysql ~]# pmm-admin add mysql --user pmm --password mysql --host 192.168.8.32 --port 3306 [linux:metrics] OK, now monitoring this system. [mysql:metrics] OK, now monitoring MySQL metrics using DSN pmm:***@tcp(192.168.8.32:3306) [mysql:queries] OK, now monitoring MySQL queries from perfschema using DSN pmm:***@tcp(192.168.8.32:3306) [root@mysql ~]# pmm-admin list pmm-admin 1.15.0 PMM Server | 192.168.8.30 Client Name | localhost.localdomain Client Address | 192.168.8.32 Service Manager | linux-systemd -------------- ---------------------- ----------- -------- ------------------------------- --------------------------------------------- SERVICE TYPE NAME LOCAL PORT RUNNING DATA SOURCE OPTIONS -------------- ---------------------- ----------- -------- ------------------------------- --------------------------------------------- mysql:queries localhost.localdomain - YES pmm:***@tcp(192.168.8.32:3306) query_source=perfschema, query_examples=true linux:metrics localhost.localdomain 42000 YES - mysql:metrics localhost.localdomain 42002 YES pmm:***@tcp(192.168.8.32:3306)
访问pmm server 192.168.8.30 http://IP地址
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30135314/viewspace-2216723/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30135314/viewspace-2216723/