Method and system for switching multiple Redis clusters in alarm processing

By deploying multiple Redis clusters in the alarm processing system and adding switching services, the problem of insufficient reliability of a single Redis cluster is solved, automatic switching and data consistency in the event of failure are achieved, and business continuity and user experience are ensured.

CN119324858AActive Publication Date: 2025-01-17CHINA UNITED NETWORK COMM GRP CO LTD

Patent Information

Application Number
CN202411471929.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-01-17
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

In the prior art, the reliability of a single Redis cluster is insufficient, resulting in hardware failure or version upgrades that require offline Redis clusters for maintenance, resulting in an interruption of alarm processing.

Method used

Deploy multiple Redis clusters in the alarm processing system, and add Redis switching services and alarm Redis synchronization services. Synchronize resource data through resource loading services, monitor the status of the Redis cluster, and automatically switch to the backup cluster when a failure occurs, ensuring data consistency and Business continuity.

Benefits of technology

Automatic switching in the event of Redis cluster failure is realized, ensuring smooth business conversion, avoiding data loss and out of order, improving system reliability, and ensuring unaware service continuity of users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119324858A_ABST
    Figure CN119324858A_ABST
Patent Text Reader

Abstract

The invention provides a multi-Redis cluster switching method and system in alarm processing, electronic equipment and a storage medium, and aims to solve the problems that the reliability of alarm processing is insufficient and offline maintenance is needed. The method comprises the following steps: deploying a plurality of Redis clusters in an alarm processing system; redis switching and alarm Redis synchronization services are added; synchronizing resource data to each set of Redis cluster through a resource loading service; when the alarm processing service outputs data to a certain Topic, data is obtained from the Topic, and alarm data is written into a standby Redis cluster; the Redis switching service monitors the state of the Redis cluster, when the formal Redis cluster fails, after waiting for a preset time window, Redis switching is initiated, and meanwhile, the alarm Redis synchronization service is made to replace standby Redis configuration. According to the method and the device, the Redis cluster can be automatically switched, the switching process is smooth, and service processing is not influenced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of information technology, and in particular to a method for switching multiple Redis clusters in alarm processing, a system for switching multiple Redis clusters in alarm processing, an electronic device, and a computer-readable storage medium. Background Art

[0002] In the traditional mode, after receiving the alarm from Kafka (a high-throughput distributed publish-subscribe messaging system), the original alarm information needs to be processed with various complex logics, including filling in resource fields, standardizing information, engineering information, proprietary business information, etc., and then the processed data is output to Kafka. The contents of the data fields that various business logics rely on are usually stored in the database. It is too time-consuming to query and obtain relevant information from the database, so the relevant data is usually loaded into Redis (Remote Dictionary Server), and then the alarm processing is queried from Redis, thereby improving the overall business execution efficiency. At the same time, during the alarm processing process, some alarm data also needs to be cached in Redis to facilitate the execution of functions such as clearing alarms and backfilling. In summary, the Redis cluster is one of the core components of alarm processing. To ensure the reliability of Redis, Redis is usually deployed in cluster mode. Traditional alarm processing such as Figure 1 shown.

[0003] The existing solution uses a single-node Redis or a single Redis cluster in the alarm processing process. This solution still has some problems. First, due to various abnormal situations, such as hardware failures and Redis bugs, a single Redis cluster is still unable to provide services, and there is room for improvement in reliability. Secondly, from the system maintenance level, such as Redis version upgrades, cluster data cleanup and maintenance, etc., the Redis cluster needs to be taken offline for maintenance, which will interrupt the entire alarm processing business. Summary of the invention

[0004] In order to at least solve the problem of insufficient reliability of a single Redis cluster in the prior art, a single-node Redis or a single Redis cluster needs to be offline for maintenance, which will interrupt the entire alarm processing business. The present invention provides a method for switching multiple Redis clusters in alarm processing, a system for switching multiple Redis clusters in alarm processing, an electronic device, and a computer-readable storage medium, which can automatically switch to the currently active standby Redis cluster when a Redis cluster fails, and ensure smoothness during the switching process without affecting business processing.

[0005] In a first aspect, the present disclosure provides a method for switching multiple Redis clusters in alarm processing, the method comprising:

[0006] Deploy multiple Redis clusters in the alarm processing system;

[0007] Added Redis switching service and alarm Redis synchronization service;

[0008] Synchronize resource data to each Redis cluster through resource loading service;

[0009] When the alarm processing service outputs data to a Topic, the alarm Redis synchronization service obtains data from the Topic and writes the alarm data to the standby Redis cluster;

[0010] The Redis switching service monitors the Redis cluster status. When a failure is found in the official Redis cluster, a switch is initiated after waiting for a preset time window, so that the alarm processing replaces the official Redis and the alarm Redis synchronization service replaces the backup Redis configuration.

[0011] Furthermore, the method further comprises:

[0012] Through the alarm Redis synchronization service, the corresponding active alarms in each Redis are deleted after receiving the clear alarm.

[0013] Furthermore, the sending method also includes:

[0014] Assign a consumer group to each standby Redis cluster by alerting the Redis synchronization service to facilitate data insertion and avoid simultaneous blocking.

[0015] Furthermore, the method further comprises:

[0016] Add an external interface to trigger the switching service to facilitate operation and maintenance personnel to manually trigger the switch to the official Redis, and implement forced switching by adding additional force parameters.

[0017] Furthermore, when it is found that the formal Redis cluster fails, after waiting for a preset time window, a switch is initiated to replace the formal Redis for alarm processing, including:

[0018] When the official Redis cluster fails and the failure duration exceeds the failure time window, switch is performed;

[0019] Make the alarm processing service stop data processing and wait for the switching service to be triggered;

[0020] The Redis switching service monitors and alerts whether the Redis synchronization service has completed data synchronization. After data synchronization is completed, the alarm processing is triggered to restart the service and start processing alarms, and insert alarms into the new official Redis.

[0021] If the alarm processing is restarted during the switching process, data processing is performed according to the committed offset of Kafka.

[0022] Furthermore, the method further comprises:

[0023] The resource loading service is used to implement the scheduling of failed Redis cluster synchronization failures, including:

[0024] When an exception occurs in a synchronization task, the job is temporarily stopped and placed in the synchronization failure processing queue;

[0025] The processing thread of the failed task sends ACK (Acknowledge character) to MySQL and Redis. If both are OK, the job that failed to synchronize is pulled and the task is resumed.

[0026] In a second aspect, the present disclosure provides a system for switching multiple Redis clusters in alarm processing, the system comprising:

[0027] A deployment module, which is configured to deploy multiple Redis clusters in the alarm processing system;

[0028] The service management module is configured to add a Redis switching service and an alarm Redis synchronization service;

[0029] Resource synchronization module, which is configured to synchronize resource data to each Redis cluster through resource loading service;

[0030] An alarm writing module is configured to obtain data from a Topic through an alarm Redis synchronization service when the alarm processing service outputs data to the Topic, and write the alarm data to a standby Redis cluster;

[0031] The switching module is configured to monitor the Redis cluster status through the Redis switching service. When a failure occurs in the formal Redis cluster, a switch is initiated after waiting for a preset time window, so that the alarm processing replaces the formal Redis and the alarm Redis synchronization service replaces the standby Redis configuration.

[0032] Furthermore, the switching module is specifically configured as follows:

[0033] When the official Redis cluster fails and the failure duration exceeds the failure time window, switch is performed;

[0034] Make the alarm processing service stop data processing and wait for the switching service to be triggered;

[0035] The Redis switching service monitors and alerts whether the Redis synchronization service has completed data synchronization. After data synchronization is completed, the alarm processing is triggered to restart the service and start processing alarms, and insert alarms into the new official Redis.

[0036] If the alarm processing is restarted during the switching process, data processing is performed according to the committed offset of Kafka.

[0037] In a third aspect, the present disclosure provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program stored in the memory, the processor executes the method for switching multiple Redis clusters in alarm processing as described in any one of the first aspects.

[0038] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for switching multiple Redis clusters in alarm processing described in any one of the first aspects above is implemented.

[0039] Beneficial effects:

[0040] The method for switching multiple Redis clusters in alarm processing, the system, electronic device and storage medium for switching multiple Redis clusters in alarm processing provided by the present disclosure deploy multiple sets of Redis clusters, each cluster is completely equal, and one set of clusters serves as the main Redis cluster to provide services. When the main Redis cluster fails, it automatically switches to the currently active backup Redis cluster, and the switching process is guaranteed to be smooth, without affecting business processing, and the user is unaware; and data consistency can be guaranteed during the switching process, and the relevant alarm data in Redis is guaranteed to be completely consistent, and the alarm data will not be lost; on the basis of improving system reliability, it is also guaranteed that the business processing process is not affected during the service switching process, and no data loss or disorder is caused. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a schematic diagram of the existing alarm processing system;

[0042] Figure 2 A flowchart of a method for switching multiple Redis clusters in alarm processing provided in the first embodiment of the present disclosure;

[0043] Figure 3A basic design logic diagram of multiple Redis cluster switching in alarm processing provided by an embodiment of the present disclosure;

[0044] Figure 4 A schematic diagram of adding a scheduling function for processing failed Redis cluster synchronization to a resource loading service provided by an embodiment of the present disclosure;

[0045] Figure 5 An architecture diagram of a system for switching multiple Redis clusters in alarm processing provided in Embodiment 2 of the present disclosure;

[0046] Figure 6 This is an architecture diagram of an electronic device provided in Embodiment 4 of the present disclosure. DETAILED DESCRIPTION

[0047] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the present disclosure is further described in detail below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments and drawings described herein are only used to explain the present invention, rather than to limit the present invention.

[0048] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence; and, in the absence of conflict, the embodiments in the present disclosure and the features in the embodiments can be arbitrarily combined with each other.

[0049] The terms used in the embodiments of the present disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure. The singular forms of "a", "said" and "the" used in the embodiments of the present disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings.

[0050] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present disclosure, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.

[0051] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned problems existing in the prior art are described in detail below with specific embodiments. It is understandable that in the embodiments of the present application, the execution subject can perform some or all of the steps in the embodiments of the present application, and these steps or operations are only examples. The embodiments of the present application can also perform other operations or deformations of various operations. In addition, each step can be performed in a different order presented in the embodiments of the present application, and it is possible not to perform all the operations in the embodiments of the present application. And, the following several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0052] Figure 2 A flowchart of a method for switching multiple Redis clusters in alarm processing provided in the first embodiment of the present disclosure is shown as follows: Figure 2 As shown, the method includes:

[0053] Step S101: deploy multiple Redis clusters in the alarm processing system;

[0054] Step S102: Add Redis switching service and alarm Redis synchronization service;

[0055] Step S103: Synchronize resource data to each Redis cluster through the resource loading service;

[0056] Step S104: when the alarm processing service outputs data to a certain Topic, the alarm Redis synchronization service obtains data from the Topic and writes the alarm data to the standby Redis cluster;

[0057] Step S105: monitor the Redis cluster status through the Redis switching service. When a failure occurs in the formal Redis cluster, a switch is initiated after waiting for a preset time window, so that the alarm processing replaces the formal Redis, and the alarm Redis synchronization service replaces the standby Redis configuration.

[0058] The purpose of the disclosed embodiment is to deploy multiple sets of Redis clusters, and the Redis clusters are in a hot standby relationship, so that the overall service design can ensure that the service switching process does not affect the business processing process and does not cause data loss or disorder while improving the system reliability.

[0059] The basic design logic of this disclosure is as follows Figure 3 As shown in the figure, by deploying multiple sets of Redis clusters, there are formal Redis clusters and standby Redis clusters in the Redis cluster. Both include several Redis nodes;

[0060] Compared with the traditional solution, two services are added: Redis switching service and alarm Redis synchronization service. Redis switching service is responsible for monitoring the Redis status and executing the switch when a Redis failure is detected. Alarm Redis synchronization service realizes the consistency of alarm data of Redis cluster;

[0061] The resource loading service synchronizes resource data to each Redis cluster at the same time;

[0062] Alarm processing is based on the official Redis to process alarms, and active alarms are cached in the official Redis;

[0063] The alarm processing service outputs data to a topic (assuming the name is DATA); the alarm Redis synchronization service obtains data from DATA and then writes the alarm data to the standby Redis cluster;

[0064] The Redis switching service monitors the status of the Redis cluster. When a failure occurs in the formal cluster, it waits for a time window (which can be set according to actual conditions) and then initiates a switch. It notifies the Redis synchronization service to replace the standby Redis configuration.

[0065] The disclosed embodiment deploys multiple sets of Redis clusters in a hot standby mode of multiple Redis clusters. Each cluster is completely equal, and one of the clusters is used as the main Redis cluster to provide services. When the main Redis cluster fails, it automatically switches to the currently active backup Redis cluster. The switching process is smooth and does not affect business processing, and the user is not aware of it. In addition, data consistency can be guaranteed during the switching process, and the relevant alarm data in Redis is guaranteed to be completely consistent, without causing alarm data loss. On the basis of improving system reliability, it is also guaranteed that the service switching process does not affect the business processing process, and does not cause data loss or disorder.

[0066] Furthermore, the method further comprises:

[0067] Through the alarm Redis synchronization service, the corresponding active alarms in each Redis are deleted after receiving the clear alarm.

[0068] The alarm Redis synchronization service deletes the corresponding active alarm in Redis when receiving the clear alarm. This makes the alarm data in the standby Redis cluster consistent with the official Redis cluster. When switching, the Redis cluster can be immediately available. The switching process is smooth, does not affect business processing, and users are unaware.

[0069] Furthermore, the sending method also includes:

[0070] Assign a consumer group to each standby Redis cluster by alerting the Redis synchronization service to facilitate data insertion and avoid simultaneous blocking.

[0071] In Kafka, consumer groups allow data from a topic to be distributed to multiple consumer instances for consumption, thereby increasing consumption speed and system throughput. The main purpose of consumer groups is to distribute partitions of topics to consumers within a consumer group so that they can process data in parallel. By assigning a consumer group to each standby Redis cluster, it is convenient to synchronize data on Redis nodes within the cluster, thereby achieving fast data insertion and processing, avoiding simultaneous blocking, effectively distributing and processing data, and improving the system's data processing capabilities and efficiency.

[0072] Furthermore, the method further comprises:

[0073] Add an external interface to trigger the switching service to facilitate operation and maintenance personnel to manually trigger the switch to the official Redis, and implement forced switching by adding additional force parameters.

[0074] The switching service supports external interface triggering switching, which is convenient for operation and maintenance personnel to manually trigger switching. Manually triggered switching supports forced switching, that is, a certain Redis may have unsynchronized resources, allowing additional force parameters to be added to achieve forced switching. The force parameter is a parameter used to force certain operations in specific situations. By adding the corresponding force parameter to achieve forced switching, it is convenient to maintain the Redis cluster.

[0075] Furthermore, when it is found that the formal Redis cluster fails, after waiting for a preset time window, a switch is initiated to replace the formal Redis for alarm processing, including:

[0076] When the official Redis cluster fails and the failure duration exceeds the failure time window, switch is performed;

[0077] Make the alarm processing service stop data processing and wait for the switching service to be triggered;

[0078] The Redis switching service monitors and alerts whether the Redis synchronization service has completed data synchronization. After data synchronization is completed, the alarm processing is triggered to restart the service and start processing alarms, and insert alarms into the new official Redis.

[0079] If the alarm processing is restarted during the switching process, data processing is performed according to the committed offset of Kafka.

[0080] In order to ensure the consistency of alarm data, the alarm processing will only commit the data that has been processed, so all data will be written to Redis and sent to Kafka before it is committed. Switching will be performed after the fault duration exceeds the fault time window to ensure that the data of the standby Redis is ready and data consistency can be guaranteed during the switching process; and the alarm Redis synchronization service will be checked to see if data synchronization has been completed (LAG is 0). After it is 0, the alarm processing will be triggered to restart the processing. If the alarm processing is restarted during the switching process, data processing will be performed according to the submitted offset of Kafka, and the relevant alarm data will not be lost.

[0081] The consistency of alarm data is achieved through the replication of processed data and the data revisiting capability of Kafka. The relevant alarm data in each Redis is guaranteed to be completely consistent, and the alarm data will not be lost.

[0082] Furthermore, the method further comprises:

[0083] The resource loading service is used to implement the scheduling of failed Redis cluster synchronization failures, including:

[0084] When an exception occurs in a synchronization task, the job is temporarily stopped and placed in the synchronization failure processing queue;

[0085] The processing thread of the failed task sends ACK to MySQL and Redis. If both are OK, the job that failed to synchronize is pulled and the task is resumed.

[0086] The resource loading service calls and executes related resource loading tasks according to the registered periodic tasks. The resource loading task synchronizes data from the resource library and writes it to the Redis cluster after processing.

[0087] To support multiple Redis clusters, the resource loading service supports multiple Redis clusters to synchronize data. At the same time, the resource loading service adds a scheduling function for handling failed Redis cluster synchronization. Figure 3 As shown,

[0088] The processing logic for synchronization failure (misfire scheduler) is as follows:

[0089] 1. When an exception occurs in a synchronization task, the job is temporarily stopped and placed in the synchronization failure processing queue.

[0090] 2. The processing thread of the failed task sends ACK to MySQL and Redis. If both are OK, it pulls the job that failed to synchronize and resumes the task. Since the resource loading task is a periodic task, the same task needs to execute the merging logic. The Misfire scheduler will merge and redo all tasks starting from the first erroneous task according to the set misfire strategy when the job is resumed until the next task whose trigger time is greater than the current time, thus completing the recovery of the failed resource loading task.

[0091] In actual development, resource data asynchrony is not used as a basis for switching by default. It can be enabled through settings, but it is disabled by default. This is because data processing is more important than whether resources are synchronized, and the impact of resource asynchrony is not particularly large. In particular, when there are situations such as MySQL downtime and table locks, the frequency of resource asynchrony far exceeds that of Redis unavailability. Therefore, switching is performed only when Redis is unavailable, and when switching, try to choose Redis with consistent resource data.

[0092] The disclosed embodiment automatically switches to the currently active standby Redis cluster through a hot standby mode of multiple Redis clusters. The switching process is smooth and does not affect business processing. The user is not aware of it, which provides the system with higher system reliability. The data consistency of the alarm data is achieved by copying the processed data and the data revisiting capability of Kafka. The relevant alarm data in each Redis is guaranteed to be completely consistent, and the alarm data will not be lost. The consistency of non-alarm data is guaranteed during the switching process by recovering the failed resource loading tasks, ensuring that the alarm data processing process is accurate, and the field assignment is correct without data errors.

[0093] The second embodiment of the present disclosure also provides a system for switching multiple Redis clusters in alarm processing, such as Figure 5 As shown, the system comprises:

[0094] A deployment module 11, which is configured to deploy multiple Redis clusters in the alarm processing system;

[0095] A service management module 12, which is configured to add a Redis switching service and an alarm Redis synchronization service;

[0096] A resource synchronization module 13, which is configured to synchronize resource data to each Redis cluster through a resource loading service;

[0097] An alarm writing module 14 is configured to obtain data from a Topic through an alarm Redis synchronization service when the alarm processing service outputs data to the Topic, and write the alarm data to a standby Redis cluster;

[0098] The switching module 15 is configured to monitor the Redis cluster status through the Redis switching service. When a failure occurs in the formal Redis cluster, a switch is initiated after waiting for a preset time window, so that the alarm processing replaces the formal Redis, and the alarm Redis synchronization service replaces the standby Redis configuration.

[0099] Furthermore, the alarm writing module 14 is also configured to:

[0100] Through the alarm Redis synchronization service, the corresponding active alarms in each Redis are deleted after receiving the clear alarm.

[0101] Furthermore, the sent alarm writing module 14 is also configured as follows:

[0102] Assign a consumer group to each standby Redis cluster by alerting the Redis synchronization service to facilitate data insertion and avoid simultaneous blocking.

[0103] Furthermore, the switching module 15 is also configured to:

[0104] Add an external interface to trigger the switching service to facilitate operation and maintenance personnel to manually trigger the switch to the official Redis, and implement forced switching by adding additional force parameters.

[0105] Furthermore, the switching module 15 is specifically configured as follows:

[0106] When the official Redis cluster fails and the failure duration exceeds the failure time window, switch is performed;

[0107] Make the alarm processing service stop data processing and wait for the switching service to be triggered;

[0108] The Redis switching service monitors and alerts whether the Redis synchronization service has completed data synchronization. After data synchronization is completed, the alarm processing is triggered to restart the service and start processing alarms, and insert alarms into the new official Redis.

[0109] If the alarm processing is restarted during the switching process, data processing is performed according to the committed offset of Kafka.

[0110] Furthermore, the resource synchronization module 13 is also configured to:

[0111] The resource loading service is used to implement the scheduling of failed Redis cluster synchronization failures, including:

[0112] When an exception occurs in a synchronization task, the job is temporarily stopped and placed in the synchronization failure processing queue;

[0113] The processing thread of the failed task sends ACK to MySQL and Redis. If both are OK, the job that failed to synchronize is pulled and the task is resumed.

[0114] The system for switching multiple Redis clusters in alarm processing in the embodiment of the present disclosure is used to implement the method for switching multiple Redis clusters in alarm processing in method embodiment 1, so the description is relatively simple. For details, please refer to the relevant description in the previous method embodiment, which will not be repeated here.

[0115] In addition, if Figure 6 As shown, the third embodiment of the present disclosure further provides an electronic device, including a memory 100 and a processor 200, wherein the memory 100 stores a computer program, and when the processor 200 runs the computer program stored in the memory 100, the processor 200 executes the above-mentioned various possible methods.

[0116] The memory 100 is connected to the processor 200. The memory 100 may be a flash memory, a read-only memory or other memory, and the processor 200 may be a central processing unit or a single-chip microcomputer.

[0117] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to perform the above-mentioned various possible methods.

[0118] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), Digital Video Disc (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.

[0119] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present disclosure, but the present disclosure is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and substance of the present disclosure, and these modifications and improvements are also considered to be within the scope of protection of the present disclosure.

Claims

1. A method for switching multiple Redis clusters in alarm processing, characterized in that: The method comprises: Deploy multiple remote dictionary service Redis clusters in the alarm processing system; Added Redis switching service and alarm Redis synchronization service; Synchronize resource data to each Redis cluster through resource loading service; When the alarm processing service outputs data to a topic, the alarm Redis synchronization service obtains data from the topic and writes the alarm data to the standby Redis cluster; The Redis switching service monitors the Redis cluster status. When a failure is found in the official Redis cluster, a switch is initiated after waiting for a preset time window, so that the alarm processing replaces the official Redis and the alarm Redis synchronization service replaces the backup Redis configuration.

2. The method according to claim 1, characterized in that The method further comprises: Through the alarm Redis synchronization service, the corresponding active alarms in each Redis are deleted after receiving the clear alarm.

3. The method according to claim 1, characterized in that The delivery methods also include: Assign a consumer group to each standby Redis cluster by alerting the Redis synchronization service to facilitate data insertion and avoid simultaneous blocking.

4. The method according to claim 1, characterized in that: The method further comprises: Add an external interface to trigger the switching service to facilitate operation and maintenance personnel to manually trigger the switch to the official Redis, and implement forced switching by adding additional force parameters.

5. The method according to claim 1, characterized in that When a fault occurs in the official Redis cluster, a switch is initiated after waiting for a preset time window, so that the alarm processing replaces the official Redis, including: When the official Redis cluster fails and the failure duration exceeds the failure time window, switch is performed; Make the alarm processing service stop data processing and wait for the switching service to be triggered; The Redis switching service monitors and alerts whether the Redis synchronization service has completed data synchronization. After data synchronization is completed, the alarm processing is triggered to restart the service and start processing alarms, and insert alarms into the new official Redis. If the alarm processing is restarted during the switching process, data processing is performed according to the committed offset of Kafka.

6. The method according to claim 1, characterized in that The method further comprises: The resource loading service is used to implement the scheduling of failed Redis cluster synchronization failures, including: When an exception occurs in a synchronization task, the job is temporarily stopped and put into the synchronization failure processing queue; The processing thread of the failed task sends a confirmation character ACK to MySQL and Redis. If both are OK, pull the job that failed to synchronize and resume this task.

7. A system for switching multiple Redis clusters in alarm processing, characterized in that: The system comprises: A deployment module, which is configured to deploy multiple Redis clusters in the alarm processing system; The service management module is configured to add a Redis switching service and an alarm Redis synchronization service; Resource synchronization module, which is configured to synchronize resource data to each Redis cluster through resource loading service; An alarm writing module is configured to obtain data from a Topic through an alarm Redis synchronization service when the alarm processing service outputs data to the Topic, and write the alarm data to a standby Redis cluster; The switching module is configured to monitor the Redis cluster status through the Redis switching service. When a failure occurs in the formal Redis cluster, a switch is initiated after waiting for a preset time window, so that the alarm processing replaces the formal Redis and the alarm Redis synchronization service replaces the standby Redis configuration.

8. The system according to claim 7, characterized in that The switching module is specifically configured as follows: When the official Redis cluster fails and the failure duration exceeds the failure time window, switch is performed; Make the alarm processing service stop data processing and wait for the switching service to be triggered; The Redis switching service monitors and alerts whether the Redis synchronization service has completed data synchronization. After data synchronization is completed, the alarm processing is triggered to restart the service and start processing alarms, and insert alarms into the new official Redis. If the alarm processing is restarted during the switching process, data processing is performed according to the committed offset of Kafka.

9. An electronic device, characterized in that: It comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor runs the computer program stored in the memory, the processor executes the method for switching multiple Redis clusters in alarm processing according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the method for switching multiple Redis clusters in alarm processing according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data processing method and device, computer device and storage medium

    CN110555041A

  • Cluster switching method, device and equipment

    CN113051110A

  • Main and standby redis cluster switching method, device and system and medium

    CN116723086A

  • Main and standby cluster switching method and device, electronic equipment and readable storage medium

    CN116827760A

  • Redis cluster switching method and device, electronic equipment and storage medium

    CN117687778A

Cited By

  • Fault processing method and device for Redis cluster

    CN119966802A

  • Fault handling method and device for redis cluster

    CN119966802B

  • Redis cluster switching method and device

    CN122372406A