In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "what are the easy-to-use Redis operation and maintenance tools", the content is simple and clear, and I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "what are the good Redis operation and maintenance tools".
When we apply Redis, we often face the operation and maintenance work, including Redis running status monitoring, data migration, master-slave cluster, slice cluster deployment and operation and maintenance. Next, I will introduce some tools to you from these three aspects. Let's first learn about the tools for monitoring the real-time running status of Redis, all of which use a monitoring command provided by Redis: INFO.
The most basic monitoring command: INFO command
The INFO command provided by Redis itself returns rich instance running monitoring information, which is the basis of the Redis monitoring tool.
When using the INFO command, you can take a parameter section, which has several values, and accordingly, the INFO command will return different types of monitoring information. I classify the returned information of the INFO command into five categories, some of which contain different monitoring contents, as shown in the following table:
The results returned by the INFO command are useful when monitoring the running status of Redis. If you want to know the detailed meaning of the returned results of all the parameters of the INFO command, you can check out the introduction on the official website of Redis. Here, I would like to give you a few parameters that you need to focus on during operation and maintenance, as well as their important return results.
First of all, whether you are running a single instance or a cluster, I suggest you focus on the returned results of the four parameters stat, commandstat, cpu and memory, which include the execution of the command (such as the number and time of execution of the command, the CPU resources used by the command), the use of memory resources (such as memory usage, memory fragmentation rate), CPU resource usage, etc. This can help us determine the running status and resource consumption of the instance.
In addition, when you enable the RDB or AOF function, you need to focus on the return result of the persistence parameter, through which you can view the execution of RDB or AOF.
If you are using a master-slave cluster, you should focus on the return result of the replication parameter, which includes the real-time status of master-slave synchronization.
However, the INFO command only provides the monitoring results in text form and is not visualized, so in practical application, we can also use some third-party open source tools to visualize the results returned by the INFO command. Next, I'm going to talk about Prometheus, where you can visualize the statistical results of Redis through plug-ins.
Redis-exporter Monitoring for Prometheus
Prometheus is an open source system monitoring and alarm framework. Its core function is to pull monitoring data from the monitored system, combined with Grafana tools for visual display. Moreover, the monitoring data can be saved to the time series database so that the operation and maintenance personnel can make historical queries. At the same time, Prometheus will check whether the monitoring index of the system exceeds the preset threshold, and once the threshold is exceeded, Prometheus will trigger an alarm.
For the daily operation and maintenance management of the system, these functions are very important. Prometheus has implemented a tool framework that uses these functions. As long as we can get the monitoring data from the monitored system, we can use Prometheus to achieve operation and maintenance monitoring.
Prometheus just provides the plug-in function to achieve the monitoring of a system, we call the plug-in exporter, each exporter is actually a component to collect monitoring data. The format of the data collected by exporter meets the requirements of Prometheus. After the data is obtained by Prometheus, it can be displayed and saved.
Redis-exporter is used to monitor Redis. It provides the running status and various statistical information monitored by INFO command to Prometheus for visual display and alarm setting. At present, Redis-exporter can support Redis version 2.0 to 6.0, which has a wide range of applications.
In addition to getting the running status of the Redis instance, Redis-exporter can also monitor the size of key-value pairs and the number of elements in the collection type data, which can be achieved using the command line option of check-keys when running Redis-exporter.
In addition, we can develop a Lua script to customize the data to be monitored. Then, we use the scripts command line option to have Redis-exporter run this specific script to meet the diverse monitoring needs of the business layer.
Finally, I'd like to share with you two more gadgets: redis-stat and Redis Live. Compared with Redis-exporter, both of these are lightweight monitoring tools. They are developed in Ruby and Python respectively, and they also visually display the instance running status information provided by the INFO command. Although these two tools have been rarely updated, they are both good references if you want to develop your own Redis monitoring tools.
In addition to monitoring the running status of Redis, another common operation and maintenance task is data migration. Next, let's learn about the tools for data migration.
Data Migration tool Redis-shake
Sometimes we need to migrate data between different instances. At present, one of the more commonly used data migration tools is Redis-shake, which is a tool for Redis data synchronization developed by Aliyun Redis and MongoDB team.
The basic operation principle of Redis-shake is to start the Redis-shake process first, which simulates an Redis instance. The Redis-shake process then performs full data synchronization with the source instance where the data is moved out.
This process is similar to the full synchronization of Redis master-slave instances.
The source instance is equivalent to the master library, and the Redis-shake is equivalent to the slave library. The source instance transfers the RDB file to Redis-shake,Redis-shake first and sends the RDB file to the destination instance. The source instance then sends incremental commands to Redis-shake,Redis-shake responsible for resynchronizing these incremental commands to the destination instance.
The following figure shows the process of data migration by Redis-shake:
One of the advantages of Redis-shake is that it supports many types of migration.
First of all, it supports both data migration between individual instances and data migration from cluster to cluster.
Second, some Redis slicing clusters (such as Codis) use proxy to receive request operations, and Redis-shake also supports data migration with proxy.
In addition, because Redis-shake is developed by the Aliyun team, in addition to supporting the open source Redis version, Redis-shake also supports the migration of Redis instances under the cloud and Redis instances on the cloud, which can help us achieve the goal of Redis services on the cloud.
After data migration, we usually need to compare whether the data in the source instance is consistent with that in the destination instance. If there is inconsistent data, we need to find it, remove it from the destination instance, or migrate the inconsistent data again.
Here, I would like to introduce you to another tool for data consistency comparison, which is Redis-full-check developed by Aliyun team.
The working principle of Redis-full-check is very simple, which is to complete the data verification by comparing the data in the source instance and the destination instance. However, in order to reduce the comparison overhead of data checking, Redis-full-check adopts the method of multi-round comparison.
In the first round of verification, Redis-full-check finds all the key on the source instance, and then looks up the corresponding values from the source instance and the destination instance for comparison. After the first comparison, redis-full-check records the data in the destination instance that is inconsistent with the source instance in the sqlite database.
Starting with the second round of validation, Redis-full-check only compares inconsistent data recorded in the database at the end of the previous round.
In order to avoid affecting the normal request processing of the instance, Redis-full-check pauses for a period of time after each comparison round. With the progress of Redis-shake incremental synchronization, the inconsistent data between the source instance and the destination instance will gradually decrease, so we don't need a lot of rounds to verify the comparison.
We can set the number of rounds for comparison by ourselves. The specific way is to set the value of the parameter comparetimes to the number of rounds we want to compare when running the redis-full-check command.
When all the rounds are compared, the data recorded in the database is the final difference between the source instance and the destination instance.
One thing to note here is that Redis-full-check provides three comparison modes, which we can set through the comparemode parameter. There are three values for comparemode parameter, which means as follows:
KeyOutline, only compare whether the key values are equal
ValueOutline, which only compares whether the length of the value value is equal
FullValue, compare whether the key value, value length and value value are equal.
When we apply Redis-full-check, we can choose the corresponding comparison mode according to the business requirements for data consistency. If consistency is required, set the comparemode parameter to FullValue.
OK, finally, I would like to introduce you to CacheCloud, a tool for Redis cluster operation and maintenance management.
Cluster management tool CacheCloud
CacheCloud is a cloud platform for Redis operation and maintenance management developed by Sohu. It implements the automatic deployment and management of master-slave cluster, sentry cluster and Redis Cluster. Users can operate directly on the management interface of the platform.
CacheCloud provides 5 operation and maintenance operations for common cluster operation and maintenance requirements.
Offline instance: close the instance and the monitoring tasks related to the instance.
Online instance: restart the offline instance and monitor it.
Add a slave node: add a slave node to the master node in the master-slave cluster.
Failover: manually complete the failover of the Redis Cluster master-slave node.
Configuration management: after the user submits the work order for configuration modification, the administrator will audit and complete the configuration modification.
Of course, as an operation and maintenance management platform, CacheCloud not only provides operation and maintenance operations, but also provides rich monitoring information.
CacheCloud not only collects and visually displays the real-time running status information of the instance provided by the INFO command, but also saves the running status information of the instance, such as memory usage, number of client connections, and data volume of key-value pairs. In this way, when there is a problem with the operation of Redis, the operation and maintenance staff can query the saved history and analyze it with the running status information at that time.
If you want a unified platform to centrally host tasks related to Redis instance management, CacheCloud is a good tool.
The above is all the contents of this article entitled "what are the useful Redis operation and maintenance tools?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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
© 2024 shulou.com SLNews company. All rights reserved.