Data backup and recovery method and device, storage medium and computer equipment

Through real-time monitoring and pre-equipment replication mechanisms, data recovery problems in Redis cluster failures are solved, and recovery strategies are formulated according to the activity level, which achieves rapid response and high-reliability data recovery, improving the stability and user of the Internet e-commerce activity system Experience.

CN119105913AActive Publication Date: 2024-12-10MIYUAN (GUANGZHOU) NEW MEDIA TECH CO LTD

Patent Information

Application Number
CN202411332896.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-10
Estimated Expiration
2044-09-24

AI Technical Summary

Technical Problem

In the prior art, the data recovery method in the case of failure of Redis clusters is time-consuming and complex, and cannot meet the needs of fast response, affecting the stability and user experience of the Internet e-commerce activity system.

Method used

During the target event held by e-commerce platforms, the health status of the Redis cluster is monitored in real time. When an abnormality is detected, data backup is performed through preset backup and snapshot mechanisms, and the data recovery strategy is determined based on the activity level. This strategy is used to restore the Redis cluster. activity data.

Benefits of technology

Effectively reduce the risk of data loss, improve the availability and data security of Redis clusters, significantly improve the reliability and stability of Internet e-commerce activity systems, reduce business interruption time, and improve user experience and enterprise operation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119105913A_ABST
    Figure CN119105913A_ABST
Patent Text Reader

Abstract

According to the data backup and recovery method and device, the storage medium and the computer equipment provided by the invention, the health state of the Redis cluster associated with the target activity can be monitored in real time when the e-commerce platform holds the target activity; when the Redis cluster service is detected to be abnormal, data backup and snapshot can be performed on the Redis cluster through a preset backup and snapshot mechanism, so that the risk of data loss can be effectively reduced, and the availability and data security of the Redis cluster can be improved; then, a target data recovery strategy corresponding to the activity magnitude of the target activity can be determined, and the activity data stored in the Redis cluster is recovered by using the target data recovery strategy, so that the reliability and the stability of the Internet e-commerce activity system are remarkably improved, the service interruption time caused by the Redis cluster fault is shortened, and the user experience is improved. Therefore, the user experience and the enterprise operation efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data backup and recovery method, device, storage medium and computer equipment. Background Art

[0002] In the high-traffic Internet e-commerce environment, the stability and response speed of the activity system are crucial to the user experience. Since the activity system is highly dependent on Redis cache, once the Redis cluster fails or has data consistency issues, it will cause business interruption, which will seriously affect service quality and user engagement.

[0003] Currently, when a Redis cluster fails, data is mainly restored manually. This data recovery method is time-consuming and complex, and cannot meet the needs of rapid response. Summary of the invention

[0004] The purpose of the present application is to solve at least one of the above-mentioned technical defects, especially the technical defect that the data recovery method in the prior art is time-consuming and complicated and cannot meet the demand for rapid response.

[0005] The present application provides a data backup and recovery method, the method comprising:

[0006] During the time when the e-commerce platform holds a target activity, monitor the health status of the Redis cluster associated with the target activity in real time;

[0007] When an abnormality is detected in the Redis cluster service, data backup and snapshot of the Redis cluster are performed through a preset backup and snapshot mechanism;

[0008] A target data recovery strategy corresponding to the activity level of the target activity is determined, and the activity data stored in the Redis cluster is recovered using the target data recovery strategy.

[0009] Optionally, during the period when the target activity is held on the e-commerce platform, real-time monitoring of the health status of the Redis cluster associated with the target activity includes:

[0010] When creating a target activity on an e-commerce platform, a corresponding Redis cluster is allocated to the target activity according to the activity level of the target activity, and the association relationship between the activity ID of the target activity and the Redis cluster is recorded;

[0011] During the period when the target activity is held on the e-commerce platform, the Redis cluster associated with the target activity is determined according to the association relationship between the activity ID and the Redis cluster, and the health status of the Redis cluster is monitored in real time.

[0012] Optionally, allocating a corresponding Redis cluster to the target activity according to the activity level of the target activity includes:

[0013] determining an activity magnitude of the target activity;

[0014] Obtaining an activity cluster association record table, wherein the activity cluster association record table records the association relationship between all activities in the e-commerce platform whose end time does not exceed a preset time threshold and the assigned Redis cluster;

[0015] According to the activity cluster association record table and the activity quantity conversion relationship between different activity levels, the number of activities associated with each Redis cluster is counted;

[0016] According to the number of activities associated with each Redis cluster and the activity level of the target activity, a corresponding Redis cluster is allocated to the target activity, wherein when the activity level of the target activity is a big promotion activity, the Redis cluster allocated to the target activity includes a primary cluster and a secondary cluster.

[0017] Optionally, determining the activity level of the target activity includes:

[0018] Determine user engagement levels and channel order types for the target campaign;

[0019] The activity magnitude of the target activity is determined according to the user participation level and the channel order type.

[0020] Optionally, the real-time monitoring of the health status of the Redis cluster associated with the target activity includes:

[0021] Using a preset cluster anomaly detection method, real-time monitoring of the health status of the Redis cluster associated with the target activity;

[0022] Alternatively, a preconfigured health monitoring model is used to monitor the health status of the Redis cluster associated with the target activity in real time.

[0023] Optionally, determining a target data recovery strategy corresponding to the activity level of the target activity, and using the target data recovery strategy to recover the activity data stored in the Redis cluster includes:

[0024] When the activity level of the target activity is a big promotion activity, the access priority between the primary cluster and the secondary cluster associated with the target activity is modified to switch the primary cluster with the secondary cluster.

[0025] Optionally, determining a target data recovery strategy corresponding to the activity level of the target activity, and using the target data recovery strategy to recover the activity data stored in the Redis cluster includes:

[0026] When the activity level of the target activity is a non-promotional activity, a replacement activity with the same activity rules as the target activity is recreated, and after the corresponding Redis cluster is reallocated for the replacement activity, the activity registration record of the target activity and all order MQ messages during the activity are synchronized to the reallocated Redis cluster.

[0027] The present application also provides a data backup and recovery device, comprising:

[0028] A real-time monitoring module, used to monitor the health status of the Redis cluster associated with the target activity in real time during the target activity held on the e-commerce platform;

[0029] A backup and snapshot module, used to perform data backup and snapshot of the Redis cluster through a preset backup and snapshot mechanism when an abnormality of the Redis cluster service is detected;

[0030] The data recovery module is used to determine a target data recovery strategy corresponding to the activity level of the target activity, and use the target data recovery strategy to recover the activity data stored in the Redis cluster.

[0031] The present application also provides a computer-readable storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the data backup and recovery method described in any of the above embodiments.

[0032] The present application also provides a computer device, comprising: one or more processors, and a memory;

[0033] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the data backup and recovery method described in any one of the above embodiments are performed.

[0034] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0035] The data backup and recovery method, device, storage medium and computer equipment provided by the present application can monitor the health status of the Redis cluster associated with the target activity in real time during the target activity held on the e-commerce platform; when a Redis cluster service abnormality is detected, the Redis cluster can be backed up and snapshotted through a preset backup and snapshot mechanism, which can not only effectively reduce the risk of data loss, but also improve the availability and data security of the Redis cluster; then, the present application can also determine a target data recovery strategy corresponding to the activity level of the target activity, and use the target data recovery strategy to restore the activity data stored in the Redis cluster, thereby significantly improving the reliability and stability of the Internet e-commerce activity system, reducing the business interruption time caused by Redis cluster failures, and thus improving user experience and enterprise operation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0037] Figure 1 A flowchart of a data backup and recovery method provided in an embodiment of the present application;

[0038] Figure 2 A schematic diagram of the Redis cache-A policy recovery process provided in an embodiment of the present application;

[0039] Figure 3 A schematic diagram of the Redis cache-B strategy recovery process provided in an embodiment of the present application;

[0040] Figure 4 An active Redis cluster business architecture diagram provided for an embodiment of the present application;

[0041] Figure 5 A schematic diagram of the structure of a data backup and recovery device provided in an embodiment of the present application;

[0042] Figure 6 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0044] In one embodiment, Figure 1 As shown, Figure 1 A flowchart of a data backup and recovery method provided in an embodiment of the present application; the present application provides a data backup and recovery method, which may include:

[0045] S110: During the period when the target activity is held on the e-commerce platform, the health status of the Redis cluster associated with the target activity is monitored in real time.

[0046] In this step, since the activity system is highly dependent on Redis cache, once the Redis cluster fails or has data consistency issues, it will cause business interruption, which will seriously affect service quality and user engagement. Based on this, when creating a target activity, this application can allocate a corresponding Redis cluster for it. This allocation process can dynamically adjust resource allocation according to activity traffic, thereby avoiding system overload during the recovery process.

[0047] After allocating a specific Redis cluster to the target activity to store activity data, this application can also associate the target activity with the Redis cluster. In this way, during the target activity held on the e-commerce platform, the health status of the Redis cluster associated with the target activity can be monitored in real time, so that timely intervention can be made when its health status is poor, thereby quickly restoring the activity data.

[0048] Among them, when monitoring the health status of the Redis cluster associated with the target activity, the present application can determine the common fault types of the Redis cluster and perform fault detection according to the fault type. For example, common fault types of Redis clusters may include node failure: detecting whether a single Redis node fails; cluster failure: detecting whether the entire Redis cluster fails; network failure: detecting whether there is a problem with the network connection; performance bottleneck: detecting whether there is a performance bottleneck in the Redis cluster, such as excessive CPU and memory usage. The present application can use a variety of detection methods for the above-mentioned fault types, such as heartbeat monitoring: detecting the online status of the Redis node through the heartbeat packet; command response: regularly sending simple commands (such as PING) to Redis to check the response time and command execution; performance indicators: monitoring Redis performance indicators, such as CPU usage, memory usage, etc.; log analysis: analyzing Redis log files to identify potential signs of failure. The present application can select one or more detection methods for detection according to actual conditions, and there is no restriction here.

[0049] S120: When a Redis cluster service anomaly is detected, data backup and snapshot of the Redis cluster are performed through a preset backup and snapshot mechanism.

[0050] In this step, after real-time monitoring of the health status of the Redis cluster associated with the target activity during the target activity held on the e-commerce platform through S110, if a Redis cluster service abnormality is detected, data backup and snapshot of the Redis cluster can be performed through the preset backup and snapshot mechanism, thereby reducing the risk of data loss.

[0051] Specifically, when monitoring the health status of the Redis cluster associated with the target activity, the present application can use an automatic trigger mechanism to detect whether the health status of the current Redis cluster meets the trigger conditions for triggering the backup and snapshot mechanism, and when the condition is met, trigger the backup and snapshot mechanism to perform data backup and snapshots on the Redis cluster.

[0052] Among them, the triggering condition of the present application can be a fault threshold: define the threshold for fault triggering, such as the response time exceeds the preset value, the CPU usage rate exceeds 80%, etc.; it can also be the number of consecutive failures: define the number of consecutive failures as a triggering condition, such as three consecutive heartbeat detection failures are considered to be a fault; it can also be other triggering conditions, which can be set according to the actual situation. After the present application sets the triggering conditions, it can determine whether to trigger the backup and snapshot mechanism according to the corresponding trigger logic. For example, when the monitored indicators of the present application exceed the preset threshold, the backup and snapshot mechanism is triggered, and the number of consecutive failures can also be recorded. When the recorded number reaches the preset number, the backup and snapshot mechanism is triggered.

[0053] Furthermore, the backup and snapshot mechanism of the present application includes but is not limited to Redis configuration, backup scripts and backup storage. Among them, Redis configuration refers to enabling AOF persistence and periodic snapshot generation in the Redis configuration file; backup scripts refer to writing scripts or using existing backup tools (such as redis-backup) to achieve backup and snapshot automation; backup storage refers to storing backup files in persistent storage media, such as NAS, cloud storage services, etc. The specific backup and snapshot mechanism can be set according to the actual situation and is not limited here.

[0054] In addition, the present application can not only start the backup and snapshot mechanism when the Redis cluster service is abnormal, but also regularly start the backup and snapshot mechanism under normal circumstances to regularly back up the active data stored in the Redis cluster.

[0055] For example, the backup mechanism of the present application may include full backup and incremental backup. Specifically, the present application may perform full backup regularly to save all data of the Redis cluster, or perform incremental backup after the full backup to save only the data changes since the last backup. The snapshot mechanism of the present application may include snapshot files, AOF logs, etc. Since Redis itself supports the generation of snapshot files (.rdb), the present application may generate snapshots regularly or when a failure occurs, and the present application may also use the Append Only File (AOF) persistence method to record all write commands executed by Redis, and then replay these commands during failure recovery.

[0056] Furthermore, when this application detects that a Redis cluster failure has occurred, real-time fault detection can be performed through the operation and maintenance platform to trigger an alarm. Business abnormalities in the MQ consumer service process can also trigger SLS log alarms. Data abnormalities in the redis cluster can also be accessed through the front-end interface to trigger DingTalk / Feishu alarms. The specific alarm method can be set according to the actual situation and is not restricted here.

[0057] S130: Determine a target data recovery strategy corresponding to the activity level of the target activity, and use the target data recovery strategy to recover the activity data stored in the Redis cluster.

[0058] In this step, when a Redis cluster service anomaly is detected through S120, data backup and snapshot of the Redis cluster can be performed through a preset backup and snapshot mechanism. A target data recovery strategy corresponding to the activity level of the target activity can also be determined, and the target data recovery strategy can be used to recover the activity data stored in the Redis cluster, thereby improving the availability and data security of the Redis cluster.

[0059] It is understandable that, since the e-commerce platform of this application needs to access different CPS channel orders when holding activities, and implement corresponding activities through CPS channel orders, the CPS channel orders here refer to the orders of major e-commerce platforms on the Internet, such as JD.com, Taobao, Vipshop, etc. When creating different activities, this application can set different user groups for user participation and statistical rules for activities. Through the above rules, the user participation level and order level of this activity can be preliminarily evaluated based on the number of users of this platform, and then the activity level of this activity can be determined.

[0060] Next, the present application can formulate different data recovery strategies for different activity levels, so that the preset data recovery strategy can be used, combined with incremental synchronization technology, to quickly restore the affected Redis instance. For example, when the activity level of the present application is a big promotion activity, since the user participation level and order level of this type of activity are the highest, therefore, for this type of activity, the present application can pre-formulate a corresponding data recovery strategy; and when the activity level of the present application is a non-big promotion activity, since the user participation level and order level of this type of activity are relatively low, therefore, for this type of activity, the present application can also pre-formulate a corresponding data recovery strategy. In this way, after determining the activity level of the target activity, the corresponding target data recovery strategy can be determined, and the activity data stored in the Redis cluster can be restored according to the target data recovery strategy, which can significantly improve the reliability and stability of the activity system.

[0061] In the above embodiment, during the period when the e-commerce platform holds a target activity, the health status of the Redis cluster associated with the target activity can be monitored in real time; when a Redis cluster service abnormality is detected, the Redis cluster can be backed up and snapshotted through a preset backup and snapshot mechanism, which can not only effectively reduce the risk of data loss, but also improve the availability and data security of the Redis cluster; then, the present application can also determine a target data recovery strategy corresponding to the activity level of the target activity, and use the target data recovery strategy to restore the activity data stored in the Redis cluster, thereby significantly improving the reliability and stability of the Internet e-commerce activity system, reducing business interruption time caused by Redis cluster failures, and thus improving user experience and enterprise operation efficiency.

[0062] In one embodiment, during the period when the target activity is held on the e-commerce platform, real-time monitoring of the health status of the Redis cluster associated with the target activity in S110 may include:

[0063] S111: When creating a target activity on an e-commerce platform, a corresponding Redis cluster is allocated to the target activity according to the activity level of the target activity, and an association relationship between the activity ID of the target activity and the Reids cluster is recorded.

[0064] S112: During the period when the target activity is held on the e-commerce platform, a Redis cluster associated with the target activity is determined according to the association relationship between the activity ID and the Reids cluster, and a health status of the Redis cluster is monitored in real time.

[0065] In this embodiment, before monitoring the health status of the Redis cluster associated with the target activity, the target activity can be created first, and a corresponding Redis cluster can be assigned to the target activity according to the activity level of the target activity, and the association between the activity ID of the target activity and the Redis cluster can be recorded. In this way, during the target activity held on the e-commerce platform, the Redis cluster associated with the target activity can be determined according to the association between the activity ID of the target activity and the Redis cluster, and the health status of the Redis cluster can be monitored in real time, so that data backup and snapshots can be performed in time when the health status is not good, and data recovery can be performed.

[0066] In one embodiment, allocating a corresponding Redis cluster to the target activity according to the activity level of the target activity in S111 may include:

[0067] S1111: Determine the activity level of the target activity.

[0068] S1112: Obtain an activity cluster association record table, in which the activity cluster association record table records the association relationship between all activities in the e-commerce platform whose end time does not exceed a preset time threshold and the assigned Redis cluster.

[0069] S1113: According to the activity cluster association record table and the activity quantity conversion relationship between different activity levels, count the number of activities associated with each Redis cluster.

[0070] S1114: Allocate a corresponding Redis cluster to the target activity according to the number of activities associated with each Redis cluster and the activity level of the target activity, wherein when the activity level of the target activity is a big promotion activity, the Redis cluster allocated to the target activity includes a primary cluster and a secondary cluster.

[0071] In this embodiment, when allocating a corresponding Redis cluster to a target activity, the activity level of the target activity can be determined first, and an activity cluster association record table can be obtained, which records the association relationship between all activities in the e-commerce platform whose end time does not exceed a preset time threshold and the assigned Redis cluster. In this way, the activity level corresponding to the activity associated with each Redis cluster can be queried according to the activity cluster association record table, and then the number of activities associated with each Redis cluster can be counted according to the activity number conversion relationship between different activity levels. In this way, the current activity load of each Redis cluster can be quickly evaluated according to the number of activities associated with each Redis cluster, and then the target activity can be allocated to the corresponding Redis cluster according to the activity load of each Redis cluster.

[0072] In a specific implementation, the capacity of each Redis cluster in this application is fixed, and each cluster is currently associated with several activities, which can be queried through the activity cluster association record table. In addition, since the front-end list only displays activity information for the last three months, and the system sets the cache time of each active Redis cluster to be up to 4 months after the end of the activity. Therefore, this application can query all activities whose end time does not exceed 4 months based on the above information, and group and count the number of activities associated with each cluster, as well as the number of activities of different activity levels under each cluster.

[0073] For example, the present application may divide the activity levels into S, A, B, and C, and stipulate that one S-level activity is equivalent to 10 C-level activities, one A-level activity is equivalent to 5 C-level activities, and one B-level activity is equivalent to 3 C-level activities. In this way, the number of activities in each Redis cluster can be normalized to obtain the number of activities at the same activity level. Then, the present application may sort the number of activities in each cluster to determine the cluster with the least number of activities, and use it as the cluster with the least load. After allocating the target activity to the cluster, system overload during the recovery process can be avoided.

[0074] In addition, the present application can allocate different numbers of Redis clusters to activities of different magnitudes. For example, when the target activity of the present application is a big promotion activity, the present application can allocate two Redis clusters for it, one as the primary cluster and the other as the secondary cluster; and when the target activity of the present application is a non-big promotion activity, it can be allocated one Redis cluster, which can dynamically adjust resources and quickly recover data.

[0075] In one embodiment, determining the activity level of the target activity in S1111 may include:

[0076] S11111: Determine the user participation level and channel order type of the target activity.

[0077] S11112: Determine the activity level of the target activity according to the user participation level and the channel order type.

[0078] In this embodiment, when determining the activity level of the target activity, the user participation level and the channel order type of the target activity may be determined first, so that the activity level of the target activity may be determined based on the user participation level and the channel order type.

[0079] Specifically, the degree of user participation in the target activity in the present application can be determined by the user group in which the users participate. For example, the user group in which the users participate in the present application includes but is not limited to all users, designated whitelist users, designated user tag users, and newly registered users; and the channel order type of the target user in the present application can be determined by the statistical rules of the activity. For example, the present application can divide the channel order types into all CPS channel orders, designated channel orders, designated channel category orders, designated channel brands, designated channel stores, and designated product IDs. The specific settings can be made according to the actual situation and are not restricted here.

[0080] After the application determines the user participation level and channel order type of the target activity, the application can preliminarily evaluate the user participation level and order level of the activity based on the number of users of the platform, and divide the specific activity level according to the user participation level and order level, which can be divided into the following levels:

[0081] S level: all CPS channel order activities participated by all users

[0082] Level A: All users participate in the specified statistical rule activities

[0083] Level B: All channel order activities in which the specified user participates

[0084] Level C: Activities with specified statistical rules and participation of specified users

[0085] Of course, the present application may also divide activity levels by other division methods, and the types of divided activity levels may also be different from the above types, which may be set according to actual conditions and are not limited here.

[0086] In one embodiment, real-time monitoring of the health status of the Redis cluster associated with the target activity in S110 may include:

[0087] S210: Using a preset cluster anomaly detection method, monitor the health status of the Redis cluster associated with the target activity in real time.

[0088] S211: Alternatively, a pre-configured operation status monitoring model is used to monitor the health status of the Redis cluster associated with the target activity in real time.

[0089] In this embodiment, when monitoring the health status of the Redis cluster associated with the target activity, it can be monitored by a preset cluster anomaly detection method, or a pre-configured health monitoring model can be used for real-time monitoring. The specific selection can be made according to the actual situation and is not limited here.

[0090] When this application uses a preset cluster anomaly detection method to detect the health status of a Redis cluster, it can first determine the common fault types of the Redis cluster, and perform fault detection based on the fault type. For example, common Redis cluster fault types may include node failure: detecting whether a single Redis node fails; cluster failure: detecting whether the entire Redis cluster fails; network failure: detecting whether there is a problem with the network connection; performance bottleneck: detecting whether there is a performance bottleneck in the Redis cluster, such as excessive CPU and memory usage. This application can use a variety of detection methods for the above-mentioned fault types, such as heartbeat monitoring: detecting the online status of the Redis node through a heartbeat packet; command response: regularly sending simple commands (such as PING) to Redis to check the response time and command execution; performance indicators: monitoring Redis performance indicators, such as CPU usage, memory usage, etc.; log analysis: analyzing Redis log files to identify potential signs of failure. This application can select one or more detection methods for detection based on actual conditions, and there is no restriction here.

[0091] When this application uses a pre-configured health monitoring model to monitor the health status of a Redis cluster, the health monitoring model can be configured in the following manner and used to monitor the health status, including the following:

[0092] 1. Data Collection

[0093] First, you need to collect performance indicators about the Redis cluster. These indicators include but are not limited to CPU usage, memory usage, network latency, request processing time, number of requests per second (QPS), error rate, etc. These data can be collected through Redis's own monitoring tools or third-party monitoring systems such as Prometheus and Grafana.

[0094] 2. Feature Engineering

[0095] Extract useful features from the collected data. This may involve cleaning, transforming, and aggregating the raw data. For example, statistics such as the average, peak, and standard deviation over a period of time can be calculated as features.

[0096] 3. Model selection and training

[0097] Choose a suitable machine learning algorithm to train the model. For time series forecasting, consider using models such as ARIMA, LSTM (Long Short-Term Memory Network), or Prophet. For classification tasks, use random forests, support vector machines (SVM), or neural networks. When training the model, divide the historical data into training and test sets, and adjust the model parameters based on the test results to optimize performance.

[0098] 4. Anomaly Detection

[0099] Once the model is trained, it can be deployed to the production environment to monitor the status of the Redis cluster in real time. If the actual observed indicators deviate from the results predicted by the model, it is considered that there may be anomalies. In order to detect anomalies more accurately, this application can also use statistical methods (such as Z-Score) or density-based methods (such as Isolation Forest) for further confirmation.

[0100] 5. Early warning mechanism

[0101] When an abnormal pattern is detected, the system can trigger an early warning notification to the operation and maintenance personnel or developers. The early warning notification can be sent via email, SMS or messaging platform.

[0102] 6. Data recovery strategy

[0103] Different data recovery strategies can be used for different abnormal modes to reduce the probability of sudden failure points.

[0104] In one embodiment, determining a target data recovery strategy corresponding to the activity level of the target activity in S130, and using the target data recovery strategy to recover the activity data stored in the Redis cluster may include:

[0105] S131: When the activity level of the target activity is a big promotion activity, modify the access priority between the primary cluster and the secondary cluster associated with the target activity to switch the primary cluster with the secondary cluster.

[0106] In this embodiment, when determining the target data recovery strategy corresponding to the target activity, the activity level of the target activity can be determined first, and the target data recovery strategy can be determined based on the activity level. For example, when the activity level of the target activity of the present application is a big promotion activity, since the present application allocates a main cluster and a sub-cluster to it when creating this type of activity, and performs double-write records during the activity, each cluster corresponds to a different consumer service, and registers the processing version number of each order MQ message. Therefore, when the Redis cluster service associated with this type of activity is abnormal, the access priority between the main cluster and the sub-cluster associated with the target activity can be modified to switch the main cluster and the sub-cluster, thereby achieving data recovery.

[0107] Indicatively, if Figure 2 As shown, Figure 2 A schematic diagram of the Redis cache-A strategy recovery process provided in the embodiment of the present application, comprising Figure 2 It can be seen that each activity in this application will perform double record writing when listening to the consumption order MQ. At the same time, the processing version number size of the same user activity message in the two clusters will be compared. When the system determines that the cluster needs to be switched, such as the version number of the primary cluster is smaller than the version number of the secondary cluster, or other service abnormalities occur, the access priority of the cluster record associated with the activity will be modified. The higher the priority field value, the higher the primary cluster. Therefore, as long as the priority of the secondary cluster is adjusted to be greater than the priority field value of the primary cluster, switching can be achieved in seconds.

[0108] In this application, the active Redis cluster resource configuration association table is as follows:

[0109]

[0110] Table 1 Redis cluster resource configuration association table

[0111] As can be seen from Table 1, when allocating a Redis cluster to a target activity, the present application can set a corresponding priority for the Redis cluster, so that when switching between the primary and secondary clusters, the secondary cluster's priority field value can be adjusted to be greater than the primary cluster's priority field value to achieve second-level switching.

[0112] In one embodiment, determining a target data recovery strategy corresponding to the activity level of the target activity in S130, and using the target data recovery strategy to recover the activity data stored in the Redis cluster may include:

[0113] S132: When the activity level of the target activity is a non-promotional activity, a replacement activity with the same activity rules as the target activity is recreated, and after reallocating the corresponding Redis cluster for the replacement activity, the activity registration record of the target activity and all order MQ messages during the activity are synchronized to the reallocated Redis cluster.

[0114] In this embodiment, when determining the target data recovery strategy corresponding to the target activity, the activity level of the target activity can be determined first, and the target data recovery strategy can be determined based on the activity level. For example, when the activity level of the target activity of this application is a non-big promotion activity, since the system only allocates one cluster when creating an activity, when a cluster service anomaly is detected, an alarm will be triggered, and the activity system can copy an activity with the same rules and specify a new Redis cluster, automatically synchronize the activity registration records and resend all order MQ messages during the activity for fast consumption. Since the amount of daily activity data for this type of activity is small, the recovery speed is fast, and fast recovery can be achieved within 10 minutes.

[0115] Indicatively, if Figure 3 , 4 As shown, Figure 3 A schematic diagram of the Redis cache-B strategy recovery process provided in an embodiment of the present application, Figure 4 An active Redis cluster business architecture diagram provided for an embodiment of the present application; in the present application, when the system detects a cluster abnormality, the system service will automatically send a cluster service abnormal MQ message to monitor the cluster service abnormal MQ message and reconfirm whether the cluster service is abnormal. Abnormal situations include: cluster access failure, non-existence of activity progress data, and other pre-determined abnormal judgment logic. After confirming the cluster abnormality, determine again whether there is a cluster record associated with the newly added activity. If there is a second unopened cluster record, it means that the activity is already being restored, but the data has not been restored, so it is not turned on. When it is confirmed that recovery is required, the configuration information and registered records associated with the activity are obtained, and a new activity is created, and a new Redis cluster is allocated, and the registered records are re-registered under the name of the new activity.

[0116] Next, this application can obtain all the original order messages within this time period according to the start and end time of the activity, and resend the order MQ messages in batches according to the order creation time sequence, re-consume the activity statistics logic, and automatically count the activity progress. When all order MQ messages are resent, a new cluster record is opened, and the status of the old cluster is closed, completing the final Redis cluster replacement and realizing the recovery of activity data.

[0117] The data backup and recovery device provided in the embodiment of the present application is described below. The data backup and recovery device described below and the data backup and recovery method described above can be referenced to each other.

[0118] In one embodiment, Figure 5 As shown, Figure 5 A schematic diagram of the structure of a data backup and recovery device provided in an embodiment of the present application; the present application also provides a data backup and recovery device, which may include:

[0119] The real-time monitoring module 210 is used to monitor the health status of the Redis cluster associated with the target activity in real time during the target activity held on the e-commerce platform.

[0120] The backup and snapshot module 220 is used to perform data backup and snapshot of the Redis cluster through a preset backup and snapshot mechanism when an abnormality of the Redis cluster service is detected.

[0121] The data recovery module 230 is used to determine a target data recovery strategy corresponding to the activity level of the target activity, and use the target data recovery strategy to recover the activity data stored in the Redis cluster.

[0122] In the above embodiment, during the period when the e-commerce platform holds a target activity, the health status of the Redis cluster associated with the target activity can be monitored in real time; when a Redis cluster service abnormality is detected, the Redis cluster can be backed up and snapshotted through a preset backup and snapshot mechanism, which can not only effectively reduce the risk of data loss, but also improve the availability and data security of the Redis cluster; then, the present application can also determine a target data recovery strategy corresponding to the activity level of the target activity, and use the target data recovery strategy to restore the activity data stored in the Redis cluster, thereby significantly improving the reliability and stability of the Internet e-commerce activity system, reducing business interruption time caused by Redis cluster failures, and thus improving user experience and enterprise operation efficiency.

[0123] In one embodiment, the present application also provides a computer-readable storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the data backup and recovery method described in any of the above embodiments.

[0124] In one embodiment, the present application also provides a computer device, including: one or more processors, and a memory.

[0125] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the data backup and recovery method described in any one of the above embodiments are performed.

[0126] Indicatively, Figure 6 As shown, Figure 6 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 may be provided as a server. Figure 6 , the computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by a memory 301, for storing instructions executable by the processing component 302, such as an application. The application stored in the memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute instructions to perform the data backup and recovery method of any of the above embodiments.

[0127] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.

[0128] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0129] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0130] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.

[0131] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data backup and recovery method, characterized in that: The method comprises: During the time when the e-commerce platform holds a target activity, monitor the health status of the Redis cluster associated with the target activity in real time; When an abnormality is detected in the Redis cluster service, data backup and snapshot of the Redis cluster are performed through a preset backup and snapshot mechanism; A target data recovery strategy corresponding to the activity level of the target activity is determined, and the activity data stored in the Redis cluster is recovered using the target data recovery strategy.

2. The data backup and recovery method according to claim 1, characterized in that: During the period when the target activity is held on the e-commerce platform, real-time monitoring of the health status of the Redis cluster associated with the target activity includes: When creating a target activity on an e-commerce platform, a corresponding Redis cluster is allocated to the target activity according to the activity level of the target activity, and the association relationship between the activity ID of the target activity and the Redis cluster is recorded; During the period when the target activity is held on the e-commerce platform, the Redis cluster associated with the target activity is determined according to the association relationship between the activity ID and the Redis cluster, and the health status of the Redis cluster is monitored in real time.

3. The data backup and recovery method according to claim 2, characterized in that: The allocating a corresponding Redis cluster to the target activity according to the activity level of the target activity includes: determining an activity magnitude of the target activity; Obtaining an activity cluster association record table, wherein the activity cluster association record table records the association relationship between all activities in the e-commerce platform whose end time does not exceed a preset time threshold and the assigned Redis cluster; According to the activity cluster association record table and the activity quantity conversion relationship between different activity levels, the number of activities associated with each Redis cluster is counted; According to the number of activities associated with each Redis cluster and the activity level of the target activity, a corresponding Redis cluster is allocated to the target activity, wherein when the activity level of the target activity is a big promotion activity, the Redis cluster allocated to the target activity includes a primary cluster and a secondary cluster.

4. The data backup and recovery method according to claim 3, characterized in that: Determining the activity magnitude of the target activity includes: Determine user engagement levels and channel order types for the target campaign; The activity magnitude of the target activity is determined according to the user participation level and the channel order type.

5. The data backup and recovery method according to any one of claims 1 to 4, characterized in that: The real-time monitoring of the health status of the Redis cluster associated with the target activity includes: Using a preset cluster anomaly detection method, real-time monitoring of the health status of the Redis cluster associated with the target activity; Alternatively, a preconfigured health monitoring model is used to monitor the health status of the Redis cluster associated with the target activity in real time.

6. The data backup and recovery method according to any one of claims 1 to 4, characterized in that: The determining of a target data recovery strategy corresponding to the activity level of the target activity, and using the target data recovery strategy to recover the activity data stored in the Redis cluster, includes: When the activity level of the target activity is a big promotion activity, the access priority between the primary cluster and the secondary cluster associated with the target activity is modified to switch the primary cluster with the secondary cluster.

7. The data backup and recovery method according to any one of claims 1 to 4, characterized in that: The determining of a target data recovery strategy corresponding to the activity level of the target activity, and using the target data recovery strategy to recover the activity data stored in the Redis cluster, includes: When the activity level of the target activity is a non-promotional activity, a replacement activity with the same activity rules as the target activity is recreated, and after the corresponding Redis cluster is reallocated for the replacement activity, the activity registration record of the target activity and all order MQ messages during the activity are synchronized to the reallocated Redis cluster.

8. A data backup and recovery device, characterized in that: include: A real-time monitoring module, used to monitor the health status of the Redis cluster associated with the target activity in real time during the target activity held on the e-commerce platform; A backup and snapshot module, used to perform data backup and snapshot of the Redis cluster through a preset backup and snapshot mechanism when an abnormality of the Redis cluster service is detected; The data recovery module is used to determine a target data recovery strategy corresponding to the activity level of the target activity, and use the target data recovery strategy to recover the activity data stored in the Redis cluster.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the data backup and recovery method as described in any one of claims 1 to 7.

10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the data backup and recovery method according to any one of claims 1 to 7 are performed.

Citation Information

Patent Citations

  • Fault switching method and system of wireless controller, electronic equipment and storage medium

    CN111405599A

  • Inventory item management method and system suitable for multiple scenes, terminal and storage medium

    CN112069253A

  • Cluster service calling method and device, electronic equipment, storage medium and product

    CN113111123A

  • Data processing method and device

    CN114138732A

  • Method and device for detecting security risk of Internet of Things card and storage medium

    CN114372295A

Cited By

  • Data backup recovery method

    CN120448190A

  • Data backup and recovery method

    CN120448190B