zoukankan      html  css  js  c++  java
  • 性能测试之数据库监控分析工具Grafana+Prometheus

    使用到 Grafana+Prometheus+Mysql_exportor

    使用Prometheus和Grafana,可以快速的构建我们性能测试的绝大多数的监控模型:数据库监控、服务器监控、Jvm监控、Tomcat监控、Mq监控、Redis监控、Consul监控、Haproxy监控、Nginx监控
    ....(明天见...)


    构建正确和全链路的监控模型,是性能测试工作中必须的工作,也是性能测试的基础。

    搭建性能测试Mysql监控模型

    效果图

    安装Mysqld_exporter

    在需要监控的数据库服务器安装

    #下载地址
    https://prometheus.io/download/
    
    #下载
    mysqld_exporter
    node_exporter
    
    #安装
    tar -xvf mysqld_exporter-0.12.1.linux-amd64.tar.gz
    tar -xvf node_exporter-1.0.0-rc.0.linux-amd64.tar.gz
    
    #创建配置文件
    cd mysqld_exporter-0.12.1.linux-amd64
    vi my.cnf
        [client]
        user=xxxxxx
        password=xxxx
        ip=xxxx
        port=xxx
        
    #启动
    nohup ./mysqld_exporter --config.my-cnf=my.cnf & > mysqld_exporter.log 2>&1 & 
    nohup ./node_exporter  > node_exporter.log 2>&1 & 
    

    安装Prometheus

    #下载地址
    https://prometheus.io/download/
    #下载
    prometheus
    #安装
    tar -xvf prometheus-2.18.1.linux-amd64.tar.gz 
    #修改配置文件
    vi prometheus.ym
      - job_name: 'mysql'
        static_configs:
        - targets: ['数据库ip:9104']
          labels:
            instance: 数据库ip
      - job_name: 'linux'
        static_configs:
        - targets: ['数据库ip:9100']
          labels:
            instance: db
    #启动
    nohup ./prometheus  > prometheus.log 2>&1 &
    
    

    安装Grafana

    #下载地址
    https://grafana.com/grafana/download
    #安装
    rpm -ivh grafana-6.7.3-1.x86_64.rpm
    #启动
    systemctl start grafana-server
    #访问
    ip:3000    账号admin/admin
    
    

    Grafana设置Data source


    Grafana设置Dashboards

    下载Mysql仪表盘

    https://grafana.com/grafana/dashboards/7362

    导入Mysql仪表盘

    完成。监控包含丰富的计数器,监控指标。




    扫一扫,关注我

  • 相关阅读:
    小程序中自定义组件
    rem是如何实现自适应布局的?
    基于vue前端状态管理模式
    vue项目使用keep-alive的作用
    JS移动元素的方法
    es6 promise then对异常处理的方法
    async/await 中await接收的promise的问题
    angularjs ngRoute demo
    angularjs $watch demo
    Html5 Geolocation demo
  • 原文地址:https://www.cnblogs.com/hally/p/12899447.html
Copyright © 2011-2022 走看看