银河麒麟部署PMM

本文档详细介绍了如何部署Percona Monitoring and Management (PMM)的Server和Client端,包括Docker容器的使用、数据库用户的创建与授权、监控数据源的添加等步骤,确保PMM能够有效监控MySQL和PostgreSQL服务。
摘要由CSDN通过智能技术生成

PMM逻辑架构图

在这里插入图片描述

安装server端

[root@localhost ~]# docker pull percona/pmm-server:2
2: Pulling from percona/pmm-server
2d473b07cdd5: Pull complete 
e05cef0f5a85: Pull complete 
Digest: sha256:57a7a150218e35c0126466294367c18de12fe7d4b0076ab587684cc2110691ee
Status: Downloaded newer image for percona/pmm-server:2
#创建数据卷容器
[root@localhost ~]# docker create --volume /srv --name pmm-data percona/pmm-server:2 /bin/true
8caf217e44cf0cf18c5342c917e333375ef266378a243b5fc378e75b0c2779d4
#运行server容器,防火墙放行映射的端口
[root@localhost ~]# docker run -d -p 443:443 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server:2
47ebbbcdb79016e94caf79a3c585cf96424df2f160e322b6a55ed31fe328a85a

安装client端(server端必须通过容器部署,client端可以通过容器或者二进制包部署)

[root@localhost ~]# yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
[root@localhost ~]# yum install pmm2-client
[root@localhost ~]# pmm-admin --version
ProjectName: pmm-admin
Version: 2.25.0
PMMVersion: 2.25.0
Timestamp: 2021-12-13 09:38:36 (UTC)
FullCommit: 4b81157ad02975c417daef2600cb0dcd3907ffa1

向server注册(注册强制TLS连接,默认使用443端口注册,如果需要使用其它端口,在server端IP地址后面指定端口号)

#PMM默认管理员admin@admin
[root@localhost ~]# pmm-admin config --server-insecure-tls --server-url=https://admin:admin@172.16.200.12
Checking local pmm-agent status...
pmm-agent is running.
Registering pmm-agent on PMM Server...
Registered.
Configuration file /usr/local/percona/pmm2/config/pmm-agent.yaml updated.
Reloading pmm-agent configuration...
Configuration reloaded.
Checking local pmm-agent status...
pmm-agent is running.

创建数据库用户,赋权

MariaDB [(none)]> CREATE USER 'pmm'@'localhost' IDENTIFIED BY 'pass' WITH MAX_USER_CONNECTIONS 10;
Query OK, 0 rows affected (0.016 sec)

MariaDB [(none)]> GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm'@'localhost';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.004 sec)

添加监控数据源performance schema

在这里插入图片描述

#修改配置文件,启用performance schema
[root@localhost ~]# vim /etc/my.cnf.d/mariadb-server.cnf
performance_schema=ON
[root@localhost ~]# systemctl restart mariadb.service 
[root@localhost ~]# mysql -uroot -ppassword
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 10.3.9-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW VARIABLES LIKE 'performance_schema';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| performance_schema | ON    |
+--------------------+-------+
1 row in set (0.001 sec)
#添加监控服务
[root@localhost ~]# pmm-admin add mysql --query-source=perfschema --username=pmm --password=pass --service-name=MYSQL_NODE --host=127.0.0.1 --port=3306
MySQL Service added.
Service ID  : /service_id/e74ada1c-44ed-4cf6-b3bf-ba0b37ca4f2d
Service name: MYSQL_NODE

Table statistics collection enabled (the limit is 1000, the actual table count is 307).

[root@localhost ~]# pmm-admin inventory list services
Services list.

Service type           Service name         Address and Port  Service ID
MySQL                  MYSQL_NODE           127.0.0.1:3306    /service_id/e74ada1c-44ed-4cf6-b3bf-ba0b37ca4f2d
PostgreSQL             pmm-server-postgresql 127.0.0.1:5432    /service_id/7b3fc98e-3e6e-4e46-865c-85fd207ab42e

在这里插入图片描述

组件间数据流

在这里插入图片描述

参考文献

https://www.percona.com/doc/percona-monitoring-and-management/2.x/index.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值