A method and tool for monitoring redis cluster using ansible framework

The Redis cluster was monitored through ANSIBLE framework, and the difficulty of monitoring the accuracy and high availability of monitoring data was solved by monitoring the Redis cluster of the cloud database Redis cluster monitoring, and the accuracy and high availability of monitoring data were achieved.

CN112035323BActive Publication Date: 2025-01-24SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010903685.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-01
Publication Date
2025-01-24
Estimated Expiration
2040-09-01

AI Technical Summary

Technical Problem

The monitoring cloud database Redis cluster has difficulties in detecting changes of master-slave nodes, obtaining instance information in real time, and ensuring high availability of monitoring.

Method used

Adopt Ansible framework monitoring the Redis cluster, to ensure the accuracy and high availability of monitoring data through initialization, monitoring nodes, obtaining instance data and monitoring indicators, and timely updating the mainstore node information.

Benefits of technology

The real -time update and monitoring indicators of Redis cluster node information have been realized, and the accuracy of monitoring data and high availability of monitoring data are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112035323B_ABST
    Figure CN112035323B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for monitoring a redis cluster using an ansible framework, relates to the field of OpenStack technology, and is implemented based on the ansible framework, including: initializing a redis cluster; monitoring each node of the redis cluster, and obtaining instance data and monitoring indicators of the redis cluster at set time intervals; obtaining information of each node of the redis cluster at the same set time intervals, and updating the master and slave nodes of the redis cluster to ensure that the node information of the acquired redis cluster is consistent with the real node information of the redis cluster. The present invention also discloses a tool for monitoring a redis cluster using an ansible framework, which implements the specific content of the aforementioned method based on a script execution module, a monitoring module, and a timed task module run by ansible. The method and tool of the present invention can improve the accuracy of monitoring data, realize real-time monitoring of redis clusters, and high availability of monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of OpenStack, and in particular to a method and a tool for monitoring a redis cluster by using an ansible framework. Background Art

[0002] As an in-memory database, Redis has the characteristics of high performance, simple structure, and complete related tools. It is increasingly used in various Internet projects and has become an essential component of major portals and mobile Internet apps. In recent years, with the rise of cloud computing, a large number of Redis databases have been migrated from local to cloud computing platforms and become cloud databases. However, due to the special technical architecture of cloud computing platforms, monitoring cloud database Redis clusters has the following technical difficulties:

[0003] How to know whether the master and slave nodes of the redis cluster have changed;

[0004] How to obtain instance information of redis cluster in real time;

[0005] How to ensure high availability of monitoring. Summary of the invention

[0006] Aiming at the technical difficulties in monitoring a cloud database Redis cluster, the present invention provides a method and a tool for monitoring a Redis cluster by using an Ansible framework.

[0007] First, the present invention provides a method for monitoring a redis cluster using ansible framework. The technical solution adopted to solve the above technical problems is as follows:

[0008] A method for monitoring a redis cluster using the ansible framework, based on the ansible framework, includes the following steps:

[0009] Initialize the redis cluster.

[0010] Monitor each node of the redis cluster and obtain instance data and monitoring indicators of the redis cluster at set time intervals.

[0011] The information of each node of the redis cluster is obtained at the same set time interval, and the master and slave nodes of the redis cluster are updated to ensure that the node information of the redis cluster obtained is consistent with the real node information of the redis cluster.

[0012] Optionally, the specific operations for initializing the redis cluster include:

[0013] The backend service application calls the script executor.

[0014] The script executor first executes the terraform script to create the redis cluster instance and the required resources.

[0015] The script executor then executes the initialization Ansible script to complete the initialization of the redis cluster. The initialization Ansible script contains a monitoring script. After the redis cluster is initialized, the monitoring script starts working.

[0016] Optionally, the monitoring indicators of the redis cluster obtained include: CPU usage, memory usage, memory usage, total number of keys in the redis cluster, current number of connections, instantaneous inbound traffic - Kbps, instantaneous outbound traffic - Kpbs, cache hit rate - percentage, maximum command delay, used memory RSS, memory fragmentation rate, number of expired key values, number of evicted key values, number of query hits, number of query misses, number of development operations per second, total network inbound traffic, total network outbound traffic, and total number of connections received.

[0017] Preferably, the redis cluster is multi-shard and multi-node, and each redis cluster shard contains a master node and at least one slave node. When displaying the instance data and monitoring indicators of the redis cluster, if no node is pre-selected, any master node of the redis cluster instance is selected by default for the first loading of the display page. If a node is pre-selected, the display page displays the monitoring indicators of the selected node.

[0018] Secondly, the present invention provides a tool for monitoring redis clusters using ansible framework, and the technical solutions adopted to solve the above technical problems are as follows:

[0019] A tool that uses the Ansible framework to monitor the Redis cluster. The tool is implemented based on the script execution module, monitoring module, and scheduled task module run by Ansible.

[0020] The script execution module initializes the redis cluster.

[0021] The monitoring module monitors each node of the redis cluster. After the redis cluster is initialized, the monitoring module starts and obtains the instance data and monitoring indicators of the redis cluster at set time intervals.

[0022] The scheduled task module obtains the information of each node of the redis cluster at set time intervals and updates the master and slave nodes of the redis cluster to ensure that the node information of the redis cluster obtained by the monitoring module is consistent with the real node information of the redis cluster.

[0023] Optionally, the specific operations of the script execution module involved in initializing the redis cluster include:

[0024] The backend service application calls the script execution module.

[0025] The script execution module first executes the terraform script to create a redis cluster instance and the required resources.

[0026] The script execution module then executes the initialization ansible script to complete the initialization of the redis cluster.

[0027] Optionally, the monitoring indicators of the redis cluster obtained by the monitoring module involved are: CPU usage, memory usage, memory usage, total number of keys in the redis cluster, current number of connections, instantaneous inbound traffic - Kbps, instantaneous outbound traffic - Kpbs, cache hit rate - percentage, maximum command delay, used memory RSS, memory fragmentation rate, number of expired key values, number of evicted key values, number of query hits, number of query misses, number of development operations per second, total network inbound traffic, total network outbound traffic, and total number of connections received.

[0028] Optionally, the redis cluster involved is multi-shard and multi-node, and each redis cluster shard contains a master node and at least one slave node. When the monitoring module displays the instance data and monitoring indicators of the redis cluster, if no node is pre-selected, any master node of the redis cluster instance is selected by default for the first loading of the monitoring module display page. If a node is pre-selected, the monitoring module displays the monitoring indicators of the selected node on the display page.

[0029] Further optionally, the monitoring module involved monitors each node of the redis cluster, and stores the monitoring indicator of each node as a key in the redis cluster;

[0030] The monitoring module obtains the key data in the redis cluster at set time intervals, and displays the time point and value of the corresponding monitoring indicator on the display page, and the points of the data of each monitoring indicator are connected by lines.

[0031] Preferably, the interval setting time period of the monitoring module involved is the same as the interval setting time period of the timing task module.

[0032] A method and tool for monitoring a redis cluster using ansible framework of the present invention has the following beneficial effects compared with the prior art:

[0033] 1) On the one hand, the present invention monitors each node of the redis cluster and obtains instance data and monitoring indicators of the redis cluster at set time intervals. On the other hand, it periodically obtains information of each node of the redis cluster and updates the master and slave nodes of the redis cluster to ensure that the node information of the acquired redis cluster is consistent with the real node information of the redis cluster, thereby improving the accuracy of the monitoring data;

[0034] 2) After the redis cluster of the present invention is initialized, each node of the redis cluster can be monitored, and instance data and monitoring indicators of the redis cluster can be obtained at set time intervals to achieve real-time monitoring and high availability of monitoring. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Attached Figure 1 This is the specific operation process of initializing the redis cluster in Embodiment 1 of the present invention;

[0036] Attached Figure 2 This is the specific process of monitoring the redis cluster in the first embodiment of the present invention;

[0037] Attached Figure 3 It is a flowchart of the second embodiment of the present invention.

[0038] The information of each reference number in the accompanying drawings indicates:

[0039] 1. Script execution module, 2. Monitoring module, 3. Scheduled task module;

[0040] A represents the Redis cluster, A1 represents the master node, and A2 represents the slave node. DETAILED DESCRIPTION

[0041] In order to make the technical solution, the technical problem solved and the technical effect of the present invention more clearly understood, the technical solution of the present invention is clearly and completely described below in conjunction with specific embodiments.

[0042] Embodiment 1:

[0043] This embodiment proposes a method for monitoring a redis cluster using the Ansible framework. Based on the Ansible framework, the implementation process includes:

[0044] Step S1: Initialize the redis cluster.

[0045] Combined with Figure 1 In this embodiment, three redis cluster shards are taken as an example, and each redis cluster shard includes a master node and two slave nodes. The specific operations for initializing the redis cluster include:

[0046] The backend service application calls the script executor.

[0047] The script executor first executes the terraform script to create the redis cluster instance and the required resources.

[0048] The script executor then executes the initialization Ansible script to complete the initialization of the redis cluster. The initialization Ansible script contains a monitoring script. After the redis cluster is initialized, the monitoring script starts working.

[0049] Combined with Figure 2 , step S2, monitor each node of the redis cluster, and obtain the instance data and monitoring indicators of the redis cluster at set time intervals, wherein the monitoring indicators of the redis cluster obtained include: cpu usage, memory usage, memory usage, total number of keys in the redis cluster, current number of connections, instantaneous inflow-Kbps, instantaneous outflow-Kpbs, cache hit rate-percentage, maximum command delay, used memory RSS, memory fragmentation rate, number of expired key values, number of evicted key values, number of query hits, number of query misses, number of development operations per second, total network inflow, total network outflow, and total number of connections received. In this embodiment, taking three redis cluster shards, each redis cluster shard containing one master node and two slave nodes as an example, when displaying the instance data and monitoring indicators of the redis cluster, if no node is pre-selected, any master node of the redis cluster instance is selected by default for the first load of the display page. If a node is pre-selected, the display page displays the monitoring indicators of the selected node.

[0050] Combined with Figure 2 , step S3, obtain the information of each node of the redis cluster at the same set time interval, and update the master and slave nodes of the redis cluster to ensure that the obtained node information of the redis cluster is consistent with the real node information of the redis cluster.

[0051] Embodiment 2:

[0052] Combined with Figure 3 This embodiment proposes a tool for monitoring a redis cluster using an ansible framework. The tool is implemented based on a script execution module 1, a monitoring module 2, and a scheduled task module 3 run by ansible.

[0053] Script execution module 1 initializes redis cluster A. The specific operations include:

[0054] The backend service application calls the script execution module 1,

[0055] Script execution module 1 first executes the terraform script to create an instance of redis cluster A and the required resources.

[0056] Script execution module 1 then executes the initialization ansible script to complete the initialization of redis cluster A.

[0057] Monitoring module 2 monitors each node of redis cluster A. After redis cluster A is initialized, monitoring module 2 is started and instance data and monitoring indicators of redis cluster A are obtained at set time intervals. The monitoring indicators of redis cluster A obtained include: CPU usage, memory usage, memory usage, total number of keys of redis cluster A, current number of connections, instantaneous inflow - Kbps, instantaneous outflow - Kpbs, cache hit rate - percentage, maximum command delay, used memory RSS, memory fragmentation rate, number of expired key values, number of evicted key values, number of query hits, number of query misses, number of development operations per second, total network inflow, total network outflow, and total number of connections received.

[0058] The timing task module 3 obtains the information of each node of the redis cluster A at the same set time interval, and updates the master node A1 and the slave node A2 of the redis cluster A to ensure that the node information of the redis cluster A obtained by the monitoring module 2 is consistent with the real node information of the redis cluster A.

[0059] The redis cluster A involved in this embodiment is multi-shard and multi-node. Taking each redis cluster A shard including a master node A1 and two slave nodes A2 as an example, when the monitoring module 2 displays the instance data and monitoring indicators of the redis cluster A, if no node is pre-selected, any master node A1 of the redis cluster A instance is selected by default for the first loading of the monitoring module 2 display page. If a node is pre-selected, the monitoring module 2 displays the monitoring indicators of the selected node on the display page.

[0060] The monitoring module 2 involved in this embodiment monitors each node of the redis cluster A, and stores the monitoring index of each node as a key in the redis cluster A. The monitoring module 2 obtains the key data in the redis cluster A at set time intervals, and displays the time point and value of the corresponding monitoring index on the display page, and the points of the data of each monitoring index are connected by lines.

[0061] In summary, the method and tool for monitoring redis clusters using ansible framework of the present invention monitor each node of redis cluster A on the one hand, and obtain instance data and monitoring indicators of redis cluster A at set time intervals; on the other hand, the information of each node of redis cluster A is obtained regularly, and the master node A1 and slave node A2 of redis cluster A are updated to ensure that the node information of redis cluster A obtained is consistent with the real node information of redis cluster A, thereby improving the accuracy of monitoring data.

[0062] The above specific examples are used to explain the principles and implementation methods of the present invention in detail. These examples are only used to help understand the core technical content of the present invention. Based on the above specific embodiments of the present invention, any improvements and modifications made by technicians in this technical field without departing from the principles of the present invention should fall within the scope of patent protection of the present invention.

Claims

1. A method for monitoring a redis cluster using ansible framework, characterized in that ,Based on the ansible framework, its implementation process includes: Initialize the redis cluster. The specific operations include: the backend service application calls the script executor, the script executor first executes the terraform script to create the redis cluster instance and the required resources, and then executes the initialization ansible script to complete the initialization of the redis cluster. The initialization ansible script contains a monitoring script. After the redis cluster is initialized, the monitoring script starts working; Monitor each node of the redis cluster, and obtain the instance data and monitoring indicators of the redis cluster at set time intervals; the redis cluster is multi-shard and multi-node, and each redis cluster shard contains a master node and at least one slave node. When displaying the instance data and monitoring indicators of the redis cluster, if no node is pre-selected, any master node of the redis cluster instance is selected by default for the first load of the display page. If a node is pre-selected, the display page displays the monitoring indicators of the selected node; The information of each node of the redis cluster is obtained at the same set time interval, and the master and slave nodes of the redis cluster are updated to ensure that the node information of the redis cluster obtained is consistent with the real node information of the redis cluster.

2. According to claim 1, a method for monitoring a redis cluster using ansible framework is characterized in that: The monitoring indicators of the redis cluster obtained are: CPU usage, memory usage, memory usage, total number of keys in the redis cluster, current number of connections, instantaneous inbound traffic - Kbps, instantaneous outbound traffic - Kpbs, cache hit rate - percentage, maximum command delay, used memory RSS, memory fragmentation rate, number of expired key values, number of evicted key values, number of query hits, number of query misses, number of development operations per second, total network inbound traffic, total network outbound traffic, and total number of connections received.

3. A tool for monitoring redis clusters using the ansible framework, characterized by ,The implementation of this tool is based on the script execution module, monitoring module, and scheduled task module run by ansible, among which, The script execution module initializes the redis cluster. The specific operations include: the backend service application calls the script execution module, the script execution module first executes the terraform script to create the redis cluster instance and the required resources, and then executes the initialization ansible script to complete the initialization of the redis cluster; The monitoring module monitors each node of the redis cluster. After the redis cluster is initialized, the monitoring module is started and obtains the instance data and monitoring indicators of the redis cluster at set intervals; the redis cluster is multi-shard and multi-node, and each redis cluster shard contains a master node and at least one slave node. When the monitoring module displays the instance data and monitoring indicators of the redis cluster, if no node is pre-selected, any master node of the redis cluster instance is selected by default for the first loading of the monitoring module display page. If a node is pre-selected, the monitoring module displays the monitoring indicators of the selected node on the display page; The scheduled task module obtains the information of each node of the redis cluster at set time intervals and updates the master and slave nodes of the redis cluster to ensure that the node information of the redis cluster obtained by the monitoring module is consistent with the real node information of the redis cluster.

4. A tool for monitoring a redis cluster using ansible framework according to claim 3, characterized in that: The monitoring indicators of the redis cluster obtained by the monitoring module include: CPU usage, memory usage, memory usage, total number of keys in the redis cluster, current number of connections, instantaneous inbound traffic-Kbps, instantaneous outbound traffic-Kpbs, cache hit rate-percentage, maximum command delay, used memory RSS, memory fragmentation rate, number of expired key values, number of evicted key values, number of query hits, number of query misses, number of development operations per second, total network inbound traffic, total network outbound traffic, and total number of connections received.

5. A tool for monitoring a redis cluster using ansible framework according to claim 3, characterized in that: The monitoring module monitors each node of the redis cluster and stores the monitoring index of each node as a key in the redis cluster; The monitoring module obtains the key data in the redis cluster at set time intervals, and displays the time point and value of the corresponding monitoring indicator on the display page, and the points of the data of each monitoring indicator are connected by lines.

6. A tool for monitoring a redis cluster using ansible framework according to claim 3, characterized in that: The interval setting time period of the monitoring module is the same as the interval setting time period of the timing task module.

Citation Information

Patent Citations

  • intelligent network SCP cloud service implementation system based on CAAS

    CN109756366A

  • Quality monitoring processing method and device

    CN111291990A