Grafana+Prometheus监控mysql性能
#cmd /usr/local
今天讲一下如何监控服务器中的mysql数据库的性能
一、数据库操作
1.mysql启动
#service mysqld start #启动数据库
#service mysqld stop #关闭数据库
#service mysqld restart #重启数据库
2、进入 mysql
mysql -u root -p
#use mysql
#GRANT ALL PRIVILEGES ON *.* TO '帐号'@'localhost' identified by '密码';
#flush privileges; #刷新
二、Prometheus 搭建
这里会给大家提供一个干净的普罗米修斯数据库的压缩包,大家解压就好
将压缩包放到服务器中
#cmd /usr/local
解压
#tar -zxvf prometheus-xxxxx
现在修改一下普罗米修斯的配置文件,在他的安装目录中有一个prometheus.yml文件,添加
- job_name: 'linux'
static_configs:
- targets: ['localhost:9100']
这里大家注意一个地方,要严格按照普罗米修斯的格式,不要随意添加空格和缩进,不然会出错
增加这一步的意义是给普罗米修斯开放两个端口,用于Grafana监控
设置文件权限:#chmod 777 prometheus.yml
从配置文件中启动
#./prometheus --config.file=prometheus.yml &
设置linux系统端口
firewall-cmd --list-ports ##列出开放的端口
firewall-cmd --add-port=9090/tcp --permanent ##永久添加 9090 端口
firewall-cmd --add-port=9100/tcp --permanent ##永久添加 9100 端口
firewall-cmd --add-port=9104/tcp --permanent ##永久添加 9104 端口
firewall-cmd --list-ports ##列出开放的端口
systemctl stop firewalld ##关闭防火墙
systemctl start firewalld ##开启防火墙
systemctl status firewalld ##查看防火墙状态
systemctl restart firewalld ##重启防火墙
systemctl disable firewalld ##开机关闭防火墙,即永久关闭
三、mysqld_exporter 搭建
这里也会提供一个压缩包给大家
[client]
user=xxxx
password=xxxx
4、启动服务
在/usr/local/mysql_exporter 下启动./mysqld_exporter --config.my-cnf=my.cnf
5、安装lsof
#yum install lsof
6、查看 9104 端口占用情况
lsof -i:9104
7、
关闭进程 #kill -9 进程号
8、重启 Prometheus

四、Node_exporter 监控 linux
这里会给大家提供一个压缩包
./node_exporter &
附linux效果图
链接:https://pan.baidu.com/s/1eDjFx0gUqltz3jLD63ymMQ
提取码:lnh7
链接:https://pan.baidu.com/s/1YI0hmB0Bd1RLxgmSiJX0Hw
提取码:9psm
链接:https://pan.baidu.com/s/1B6hCwbGG1HGCJo-sho7t6w
提取码:nseh
Grafana+Prometheus监控mysql性能的更多相关文章
- Grafana+Prometheus 监控 MySQL
转自:Grafana+Prometheus 监控 MySQL 架构图 环境 IP 环境 需装软件 192.168.0.237 mysql-5.7.20 node_exporter-0.15.2.lin ...
- 使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库
一.背景 在平时开发过程当中需要针对 MySQL 数据库进行监控,这里我们可以使用 Grafana 和 Prometheus 来实现监控功能.Grafana 是一款功能强大的仪表盘面板,支持多种数据源 ...
- Prometheus 监控Mysql服务器及Grafana可视化
Prometheus 监控Mysql服务器及Grafana可视化. mysql_exporter:用于收集MySQL性能信息. 使用版本 mysqld_exporter 0.11.0 官方地址 使用文 ...
- 分布式数据存储 - Zabbix监控MySQL性能
Zabbix如何监控mysql性能,我们可以使用mysql自带的模板,可以监控如下内容:OPS(增删改查).mysql请求流量带宽,mysql响应流量带宽,最后会附上相应的监控图! 编写check_m ...
- zabbix监控mysql性能
使用zabbix监控mysql的三种方式 1.只是安装agent 2.启用模板监控 3.启用自定义脚本的模板监控 zabbix中默认有mysql的监控模板.默认已经在zabbix2.2及以上的版本中. ...
- mytop安装,使用mytop监控MySQL性能
本文主要描述mytop安装,安装过程中可能出现的报错,以及使用mytop监控MySQL性能. 欢迎转载,请注明作者.出处. 作者:张正 blog:http://space.itpub.net/2635 ...
- spotlight监控mysql性能
spotlight可以监控mysql性能,同监控linux一样配置 目录 1.安装spotlight 2.参数认识 1.安装spotlight spotlight不仅仅只是监控mysql,还可以完成数 ...
- Grafan+Prometheus 监控 MySQL
架构图 环境 IP 环境 需装软件 192.168.0.237 mysql-5.7.20 node_exporter-0.15.2.linux-amd64.tar.gz mysqld_exporter ...
- 采用prometheus 监控mysql
1. prometheus 是什么 开源的系统监控和报警工具,监控项目的流量.内存量.负载量等实时数据. 它通过直接或短时jobs中介收集监控数据,在本地存储所有收集到的数据,并且通过定义好的rule ...
随机推荐
- LeetCode No.157,158,159
No.157 Read 用 Read4 读取 N 个字符 题目 给你一个文件,并且该文件只能通过给定的 read4 方法来读取,请实现一个方法使其能够读取 n 个字符. read4 方法: API r ...
- LeetCode No.148,149,150
No.148 SortList 排序链表 题目 在 O(n log n) 时间复杂度和常数级空间复杂度下,对链表进行排序. 示例 输入: 4->2->1->3 输出: 1->2 ...
- 流程控制 if-while-for -语句
if 语句是用来判断条件的真假,是否成立,如果为ture就执行,为flase则跳过 1.python用缩进表示代码的归属 2.同一缩进的代码,称之为代码块,默认缩进4个 if 语句结构 ...
- 2019 年百度之星·程序设计大赛 - 初赛一 1005 Seq(数学规律)
http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=861&pid=1005 Sample Input Sampl ...
- 4412开发板QtE系统下MT6620-wifi的测试
基于iTOP4412系统烧写并启动之后,使用如下命令.wpa_passphrase XXX "YYY " >> /etc/wpa_supplicant.conf其中 X ...
- 文件流下载时 axios blob文件大小不正确?
文件流下载时 js blob文件大小不正确? res.data的字节长度 length blob.size匹配不上.. axio请求里必须修改 responseType: 'blob' 参数, 默认是 ...
- certutil
计算摘要 certutil -hashfile inst.ini MD2 certutil -hashfile inst.ini MD5 certutil -hashfile inst.ini SHA ...
- Git ubuntu 升级
外文文档 This team will distribute the most current stable package of Git for Ubuntu. Stable releases: h ...
- mean|mode|median|sample的表达方式
Measures of Center measures of central tendency:the center or most typical value:average Mean:its ar ...
- Relative-Frequency|frequency|pie chart |bar chart
2.2Organizing Qualitative Data The number of times a particular distinct value occurs is called its ...