本篇文章来简要介绍一下MySQL监控利器-PMM的部署过程。
环境:
主机名 | IP | 功能 | 系统 | 数据库版本 |
pmmclient | 192.168.91.34 | PMM-client(1.16.0) | RHEL7.4 | MySQL5.7.26 |
pmmserver | 192.168.91.35 | PMM-server | RHEL7.4 |
部署:
server端:
[root@pmmserver ~]#yum -y install docker
[root@pmmserver ~]# systemctl start docker
[root@pmmserver ~]# systemctl enable docker
[root@pmmserver ~]# docker pull pmm-server
[root@pmmserver ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/percona/pmm-server latest cc8e60d34a15 7 weeks ago 1.2 GB
[root@pmmserver ~]# docker create -v /u02/monitor/prometheus/data -v /u02/monitor/consul-data -v /u02/monitor/lib/mysql -v /u02/monitor/lib/grafana --name pmm-data docker.io/percona/pmm-server:latest
[root@pmmserver ~]# docker run -d -p 80:80 -p 3000:3000 -p 13306:3306 --volumes-from pmm-data --name pmm-server --restart always docker.io/percona/pmm-server:latest
[root@pmmserver ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
569aaaca23a1 docker.io/percona/pmm-server:latest "/opt/entrypoint.sh" 21 hours ago Up 21 hours 0.0.0.0:80->80/tcp, 0.0.0.0:3000->3000/tcp, 443/tcp, 0.0.0.0:13306->3306/tcp pmm-server
访问server的IP地址就可以访问了(默认用户名密码:admin)
client端(被监控的服务器上)
[root@pmmclient soft]# ll pmm-client-1.16.0-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 23057592 Dec 18 10:44 pmm-client-1.16.0-1.el6.x86_64.rpm
[root@pmmclient soft]# rpm -ivh pmm-client-1.16.0-1.el6.x86_64.rpm
[root@pmmclient soft]# pmm-admin --version
1.16.0
OK, PMM server is alive.
Client Name | master
Client Address | 192.168.91.34
pmm客户端监控MySQL到pmm服务器
[root@pmmclient soft]# mysql -uroot -pkavl7kAkkle! 建立监控用户
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
OK, PMM server is alive.
Client Name | master
Client Address | 192.168.91.34
[linux:metrics] OK, already monitoring this system.
[mysql:metrics] OK, now monitoring MySQL metrics using DSN pmm_monitor:***@tcp(192.168.91.34:3306)
[mysql:queries] OK, now monitoring MySQL queries from slowlog using DSN pmm_monitor:***@tcp(192.168.91.34:3306)
![](https://img2018.cnblogs.com/blog/1178901/201912/1178901-20191219151501492-1071403969.png)
如果对PMM有兴趣的朋友可以加博主QQ,大家相互学习相互成长。
QQ:1127000483