Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to diagnose redis slowlog with Elastic

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to use Elastic to diagnose redis slowlog, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

How to monitor the redis slow log through the custom beats, and finally visually display the redis slow log through Kibana.

The redis slow query log settings and query logs are explained here. The last 100 commands that have been executed for more than 20 milliseconds can be recorded through config set. You can fetch all slow query commands through the slowlog get command.

Beats is a lightweight data collector developed in golang language. Officially, FileBeat is used to collect log files, MetricBeat collects metrics information of nginx, apache and other applications, PacketBeat collects network packet data, and so on. In addition, users can quickly develop custom beat based on Beats to meet personalized needs, such as rsbeat-redis slowlog beat here.

Rsbeat is a beat used to collect redis slowlog information, which has been open source on github. You can check it at this address. Https://github.com/yourdream/rsbeat

When using rsbeat, you need to modify the configuration file rsbeat.yml. Here, you mainly customize the address of redis, the time of slow query, the address of es, and so on.

The above diagram illustrates the flow chart of rsbeat. First of all, rsbeat will regularly obtain slow query commands from redis, then store the slow query commands in elasticsearch, and finally query and visualize the data through kibana.

This shows how to convert redis's slow query commands into es's data model.

The stored redis slow query commands can be queried and displayed visually through Kibana. Examples such as bar chart and pie chart are shown here. Through these displays, we can quickly analyze the distribution of slow query commands, so as to locate the problems of business code, and then eliminate slow query commands.

Above a brief introduction to the source code of rsbeat, you can see that the code itself is very simple, mainly a go file.

In addition, rsbeat also provides the implementation of docker, which is convenient for everyone to use.

Finally, it summarizes some matters in the open source of rsbeat, and finally summarizes the application prospect of elastic stack in the field of data analysis.

After reading the above, have you mastered how to use Elastic to diagnose redis slowlog? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report