pmm 部署监控mysql数据库


详细的部署信息请参考官方文档:https://www.percona.com/doc/percona-monitoring-and-management/deploy/server/docker.setting-up.html#pmm-server-docker-image-pulling一、server端部署:
1.监控机器安装docker:
ip:192.168.56.101
操作系统版本:
[root@my-mm ~]# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core)
安装:
yum install -y docker启动:
systemctl start docker
systemctl enable docker
2.拉取PMM服务器映像:
docker pull percona/pmm-server:latest[root@my-mm ~]# docker pull percona/pmm-server:latest
Trying to pull repository docker.io/percona/pmm-server …
latest: Pulling from docker.io/percona/pmm-server
aeb7866da422: Pull complete
904d1ed4e1e3: Pull complete
Digest: sha256:5eb0fe89d2e93198e7070e92f22cdd95fcef5db257f70a3e05071685f2503a56
Status: Downloaded newer image for docker.io/percona/pmm-server:latest
3.创建一个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[root@my-mm ~]# 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
8448b22b99f7d667f6bfa9dcc78a4e662aed57a4d36473061d2533afa6c3e515
4.创建和运行 PMM Server Container:
docker run -d -p 80:80 –volumes-from pmm-data –name pmm-server –restart always percona/pmm-server:latest[root@my-mm ~]# docker run -d -p 80:80 –volumes-from pmm-data –name pmm-server –restart always percona/pmm-server:latest
56372ece726b9e61f29d2f0dd1e72a5353237015997f2e7637a7164b05f38727
检查docker状态:
[root@my-mm ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
56372ece726b percona/pmm-server:latest “/opt/entrypoint.sh” 28 seconds ago Up 27 seconds 0.0.0.0:80->80/tcp, 443/tcp pmm-server5.登录:
http://192.168.56.101
默认登录信息如下,可以自行修改:
username:admin password:admin登录界面:二、客户端部署:
6.客户端部署软件,在需要被监控MySQL服务端安装pmm-client:
客户端信息(192.168.56.102)
添加yum源(或者下载安装包):
rpm -ivh https://www.percona.com/redir/downloads/percona-release/redhat/latest/percona-release-0.1-6.noarch.rpm
安装pmm-client:
yum install pmm-client –y卸载软件:
yum remove pmm-client -y6.添加监控:
客户端连接pmm server,配置监控服务器:
pmm-admin config –server 192.168.56.101添加操作系统监控:
[root@my2 ~]# pmm-admin add linux:metrics
OK, now monitoring this system.在需要监控的数据库上面创建用户:
GRANT ALL PRIVILEGES ON *.* TO ‘pmm-monitor’@’%’ IDENTIFIED BY ‘pmm-monitor’;
flush privileges;添加mysql监控:
pmm-admin add mysql –user pmm-monitor –password pmm-monitor –host 192.168.56.102 –port 3306[root@my2 ~]# pmm-admin add mysql –user pmm-monitor –password pmm-monitor –host 192.168.56.102 –port 3306
[linux:metrics] OK, already monitoring this system.
[mysql:metrics] OK, now monitoring MySQL metrics using DSN pmm-monitor:***@tcp(192.168.56.102:3306)
[mysql:queries] OK, now monitoring MySQL queries from slowlog using DSN pmm-monitor:***@tcp(192.168.56.102:3306)web页面查看添加的mysql监控信息:客户端查看监控信息:
[root@my2 ~]# pmm-admin list
pmm-admin 1.16.0PMM Server | 192.168.56.101
Client Name | my2.ml.com
Client Address | 192.168.56.102
Service Manager | linux-upstart————– ———– ———– ——– —————————————– ————————————————————————————–
SERVICE TYPE NAME LOCAL PORT RUNNING DATA SOURCE OPTIONS
————– ———– ———– ——– —————————————– ————————————————————————————–
mysql:queries my2.ml.com – YES pmm-monitor:***@tcp(192.168.56.102:3306) query_source=slowlog, query_examples=true, slow_log_rotation=true, retain_slow_logs=1
linux:metrics my2.ml.com 42000 YES –
mysql:metrics my2.ml.com 42002 YES pmm-monitor:***开发云主机域名@tcp(192.168.56.102:3306)
默认监控显示是以主机名字显示,如果机器上面部署多个mysql或者需要指定显示的主机名:pmm-admin config –server 192.168.56.101 client-name #client-name是指定监控显示名称client-name
例如:pmm-admin add mysql –user pmm-monitor –password ‘pmm-monitor’ –socket=/data/mysql_3317/data/mysql.sock mysql-3307清除监控数据:
pmm-admin purge 会提示帮助信息,示例如下:
pmm-admin purge linux:metrics my2.ml.com
pmm-admin purge mysql:metrics my2.ml.com删除添加的监控项:pmm-admin remove mysql:metrics my2.ml.com直接输入pmm-admin会显示所有的帮助信息:[root@my2 ~]# pmm-admin
Usage:
pmm-admin [flags]
pmm-admin [command]Available Commands:
config Configure PMM Client.
add Add service to monitoring.
annotate Annotate application events.
remove Remove service from monitoring.
list List monitoring services for this system.
info Display PMM Client information (works offline).
check-network Check network connectivity between client and server.
ping Check if PMM server is alive.
start Start monitoring service.
stop Stop monitoring service.
restart Restart monitoring service.
show-passwords Show PMM Client password information (works offline).
purge Purge metrics data on PMM server.
repair Repair installation.
uninstall Removes all monitoring services with the best effort.
summary Fetch system data for diagnostics.
help Help about any commandFlags:
-c, –config-file string PMM config file (default “/usr/local/percona/pmm-client/pmm.yml”)
-h, –help help for pmm-admin
–skip-root skip UID check (experimental)
–timeout duration timeout (default 5s)
–verbose verbose output
-v, –version show versionUse “pmm-admin [command] –help” for more information about a command.

相关推荐: 引锁,重建任务

当使用数据库管理功能下的维护计划,建立索引失败的情况下,使用代理执行作业的方式,比较实用的,代码如下:方法1:USE [msdb]GO/** Object: Job [索引重建] Script Date: 2018-2-8 16:29:40 **/BEGIN …

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

Like (0)
Donate 微信扫一扫 微信扫一扫
Previous 06/04 17:53
Next 06/04 17:53

相关推荐