In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Prometheus (also known as Prometheus) official website: https://prometheus.io/docs/introduction/overview/
Grafana official website: https://grafana.com/enterprise
Features
The main features of Prometheus are:
A multidimensional data model with time series data identified by measurement names and key / value pairs A flexible query language to take advantage of this dimension independent of distributed storage; a single server node is an autonomous collection of time series generated by pull models on HTTP push time series through intermediate gateways support discovery of targets through service discovery or static configuration multiple graphics and dashboard support patterns
module
The Prometheus ecosystem consists of several components, many of which are optional:
The main Prometheus server, a client library for storing time series data for detecting application code, a special-purpose exporter for short-term work, a push gateway, HAProxy,StatsD,Graphite, etc., an alertmanager processing alarm, various support tools
Most Prometheus components are written in Go, so it's easy to build and deploy as static binaries.
Today, this article focuses on how to use Grafana+Prometheus to monitor mysql performance in detail.
# cmd / usr/local
Today, let's talk about how to monitor the performance of the mysql database in the server.
I. Database operation
1.mysql start
# service mysqld start # start database # service mysqld stop # shut down database # service mysqld restart # restart database
2. Enter mysql
Mysql-u root-p
3. Add a monitoring mysql account
# use mysql#GRANT ALL PRIVILEGES ON *. * TO 'account' @ 'localhost' identified by' password'
# flush privileges; # Refresh
2. Prometheus building
Here we will provide you with a clean compression package of Prometheus database. Just decompress it.
Put the compressed package on the server
# cmd / usr/local
Decompression
# tar-zxvf prometheus-xxxxx
Now modify Prometheus's configuration file to have a prometheus.yml file in his installation directory. Add
-job_name: 'linux' static_configs:-targets: [' localhost:9100']-job_name: 'mysql' static_configs:-targets: [' localhost:9104']
Here, we should pay attention to one place, strictly follow the format of Prometheus, do not add spaces and indents at will, or you will make mistakes.
The significance of adding this step is to open two ports to Prometheus for Grafana monitoring.
Set file permissions: # chmod 777 prometheus.yml starts from the configuration file
#. / prometheus-config.file=prometheus.yml &
Set the linux system port
Firewall-cmd-- list-ports # # list open ports firewall-cmd-- add-port=9090/tcp-- permanent # # permanently add 9090 port firewall-cmd-- add-port=9100/tcp-- permanent # # permanently add 9100 port firewall-cmd-- add-port=9104/tcp-- permanent # # permanently add 9104 port firewall-cmd-- list-ports # # list open ports systemctl stop firewalld # # turn off firewall systemctl start firewalld # # turn on firewall Systemctl status firewalld # # check the firewall status systemctl restart firewalld # # restart the firewall systemctl disable firewalld # # turn on and turn off the firewall That is, permanently shut down.
Windows access: http://192.168.xx.xx:9090 statue-targets checks the port status as up as successful
3. Building mysqld_exporter
A compressed package will also be provided here.
1. Upload mysqld_exporter to local 2, extract tar-zxvf mysqld_exporter-xxxxxx 3, create a .my.cnf configuration file under / usr/local/mysql_exporter, and write down the user name and password you created.
[client] user=xxxx password=xxxx
4. Start the service
Start. / mysqld_exporter-- config.my-cnf=my.cnf under / usr/local/mysql_exporter
5. Install lsof
# yum install lsof
6. Check the occupancy of port 9104
Lsof-iRU 9104
7 、
Close process # kill-9 process number
8. Restart Prometheus
4. Node_exporter monitors linux
Here will provide you with a compressed package.
1. Upload to / usr/local/ 2, extract tar-zxvf node_exporter-xxxxx 3, launch. / node_exporter & 4 in the / usr/local/node_exporter directory, and access the http:// server ip:9100/metrics through the browser to see the monitored data.
At this time, check that the task items are in the UP state so that our monitoring platform has been set up. As for how Gafana connects to Prometheus database without explanation, please read a few articles if you need it.
Linux effect drawing is attached
Finally, the compressed package required for this article and the monitoring template of Grafana based on Prometheus database are attached.
Link: https://pan.baidu.com/s/124sJ0cv3zghK02n4W-rSZw extraction code: w987
Link: https://pan.baidu.com/s/1l3pvorWAv3_VfwhL6G9PHg extraction code: m7nw
Summary
This is the end of this article on using Grafana+Prometheus to monitor mysql performance. For more information about mysql performance monitoring, please search for previous articles or continue to browse the relevant articles below. I hope you will support it in the future!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Shili gongneng, yige sql server jiushi 1ge shili.gongneng xuanzezhuyao shi gongxiang gongneng de xu
© 2024 shulou.com SLNews company. All rights reserved.