Rapid recovery method and system for database cluster fault and storage medium
Through prediction and optimization algorithms, the database cluster services are quickly restored, which solves the data loss and inaccessibility problems caused by database cluster failure, and achieves the dual goals of data security and service recovery.
Patent Information
- Application Number
- CN202411834318.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-04
AI Technical Summary
When a database cluster encounters a failure, it is difficult to quickly restore services, resulting in data loss or inaccessibility.
The failure recovery time is predicted by a random forest regression prediction algorithm based on gray wolf optimization, combined with the construction of a fault recovery model based on refraction reverse learning mechanism, the fault recovery is characterized, and the fault recovery data is optimized by the Gardener Bird optimization algorithm based on sine cosine factor.
It realizes the recovery of database cluster services in a short time while ensuring data security, and ensures the normal recovery of subsequent data services, avoiding the problems of data loss and inaccessibility.
Smart Images

Figure CN119759625A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database cluster recovery, and in particular to a method, system and storage medium for rapid recovery of database cluster failure. Background Art
[0002] With the continuous development and changes of today's application development companies, the implementation and deployment of projects have gradually become diversified. In order to meet different customer needs and different product architectures, it is necessary to adjust the deployment method of services according to actual needs to cope with data warehouses under different environments and different concurrent requirements.
[0003] In today's Internet age, data is regarded as one of the most valuable resources. For most enterprises and organizations, databases are the core systems for storing and managing data. However, due to various reasons, databases may encounter various failures, resulting in data loss or inaccessibility. Summary of the invention
[0004] In view of the above problems, the present invention provides a method, system and storage medium for rapid recovery of database cluster failures. When the database encounters an emergency state and is unable to provide services, it can not only perform emergency processing and restore services in a short time while ensuring data security, but also ensure subsequent data services and normal recovery of data.
[0005] In order to achieve the above-mentioned purpose and other related purposes, the technical solution provided by the present invention is as follows:
[0006] A method for quickly recovering from a database cluster failure, the method comprising:
[0007] K1. Obtain data information about database cluster failures, data information about the network topology of the database cluster, and data information about the configuration files of the database cluster;
[0008] K2. Based on the data information of the database cluster failure, the data information of the network topology of the database cluster and the data information of the configuration file of the database cluster, the random forest regression prediction algorithm based on gray wolf optimization is used to predict the failure recovery time of the database cluster to obtain data information of the failure recovery time of the database cluster;
[0009] K3. Based on the data information of the database cluster failure recovery time, a database cluster failure recovery model based on a refraction reverse learning mechanism is constructed to characterize the failure recovery of the database cluster and obtain the data information of the failure recovery of the database cluster;
[0010] K4. Based on the data information of the fault recovery of the database cluster, the data of the fault recovery is optimized by using a bowerbird optimization algorithm based on sine-cosine factors to obtain optimized data information of the fault recovery.
[0011] Furthermore, in step K2, the predicting of the failure recovery time of the database cluster by using the random forest regression prediction algorithm based on gray wolf optimization includes:
[0012] K21. Based on the data information of the database cluster failure, the data information of the network topology of the database cluster and the data information of the configuration file of the database cluster, a feature extraction function Q of the database cluster failure is established.
[0013]
[0014] Among them, x1 is the data information of the database cluster failure, x2 is the data information of the network topology structure of the database cluster, x3 is the data information of the configuration file of the database cluster, α1, α2 and α3 are the feature extraction factors of the database cluster failure, and the feature matrix of the database cluster failure is extracted to obtain the data information of the feature matrix of the database cluster failure;
[0015] K22. Input the data information of the feature matrix of the database cluster failure into the random forest regression prediction model for training and learning, initialize the hyperparameters of the model, and obtain the data information of the hyperparameters of the model;
[0016] K23. Based on the data information of the hyperparameters of the model, the gray wolf population is initialized, the population parameters and the maximum number of iterations are determined, and the data information of the initialized gray wolf population is obtained;
[0017] K24. Based on the data information of the initialized gray wolf population, establish the fitness function W of the population individuals,
[0018]
[0019] Among them, y is the data information of the gray wolf population after initialization, β1, β2 and β3 are the fitness determining factors of the population individuals, and the fitness values of the population individuals are calculated to obtain the data information of the fitness values of the population individuals;
[0020] K25. Based on the data information of the fitness values of the individuals in the population, establish a target optimization function R,
[0021]
[0022] Among them, z is the data information of the fitness value of the population individual, δ1, δ2 and δ3 are the optimization factors of the target, and the hyperparameters of the model are optimized to obtain the optimized random forest regression prediction model.
[0023] Furthermore, it also includes:
[0024] K26. Based on the optimized random forest regression prediction model, the data information of the database cluster failure, the data information of the network topology structure of the database cluster and the data information of the configuration file of the database cluster are input to predict the failure recovery time of the database cluster and obtain the data information of the failure recovery time of the database cluster.
[0025] Furthermore, the constraint conditions of the feature extraction factors α1, α2 and α3 of the database cluster failure are:
[0026]
[0027] Furthermore, the optimization factors δ1, δ2 and δ3 of the objective are:
[0028]
[0029] Among them, z is the data information of the fitness value of the individual in the population.
[0030] Furthermore, in step K3, the construction of a fault recovery model of a database cluster based on a refraction reverse learning mechanism and characterization of a fault recovery solution of the database cluster include:
[0031] K31. Constructing a database cluster failure recovery time data set based on the database cluster failure recovery time data information;
[0032] K32. The database cluster failure recovery time data set is input into the database cluster failure recovery model based on the refraction reverse learning mechanism for training and learning, and the database cluster failure recovery function U is determined.
[0033]
[0034] Among them, h is the data set of the fault recovery time of the database cluster, γ1, γ2 and γ3 are the parameters of the refraction reverse learning mechanism for the fault recovery of the database cluster, and the trained fault recovery model of the database cluster based on the refraction reverse learning mechanism is obtained;
[0035] K33. Based on the trained database cluster fault recovery model based on the refraction reverse learning mechanism, input the data information of the database cluster fault recovery time, characterize the database cluster fault recovery, and obtain the database cluster fault recovery data information.
[0036] Furthermore, the refractive reverse learning mechanism parameters γ1, γ2 and γ3 for failure recovery of the database cluster are:
[0037]
[0038] Where h is the data set of the failure recovery time of the database cluster.
[0039] Further, in step K4, the optimization of the fault recovery data using the bowerbird optimization algorithm based on sine-cosine factors includes:
[0040] K41. Based on the data information of the database cluster failure recovery, the gardener bird population is initialized, the population parameters are determined, and the data information of the initialized gardener bird population is obtained;
[0041] K42. Based on the data information of the initialized gardener bird population, a fitness function G of the gardener bird population is established.
[0042]
[0043] Among them, r is the data information of the initialized bowerbird population, η1, η2 and η3 are the weight factors of the bowerbird population, and the fitness values of the individuals in the bowerbird population are calculated to obtain the data information of the fitness values of the individuals in the bowerbird population;
[0044] K43. Based on the data information of the fitness values of the individual gardener bird population, an optimization function H of the population is established.
[0045]
[0046] Among them, g is the data information of the fitness value of the individual of the bowerbird population, λ1, λ2 and λ3 are the sine and cosine factors of the bowerbird population, and the fault recovery data is optimized to obtain the optimized fault recovery data information.
[0047] In order to achieve the above-mentioned object and other related objects, the present invention also provides a rapid recovery system for database cluster failure, including a computer device, which is programmed or configured to execute the steps of any one of the rapid recovery methods for database cluster failure.
[0048] In order to achieve the above-mentioned object and other related objects, the present invention also provides a computer-readable storage medium, on which is stored a computer program programmed or configured to execute any one of the methods for rapid recovery of database cluster failures.
[0049] The present invention has the following positive effects:
[0050] 1. The present invention predicts the fault recovery time of a database cluster by adopting a random forest regression prediction algorithm based on gray wolf optimization, and combines the construction of a fault recovery model of a database cluster based on a refraction reverse learning mechanism to characterize the fault recovery of the database cluster. When the database encounters an emergency state and cannot provide services, it can not only handle it urgently and restore services in a short time while ensuring data security, but also ensure subsequent data services and normal recovery of data.
[0051] 2. The present invention optimizes the data for fault recovery by adopting the bowerbird optimization algorithm based on sine-cosine factors, which not only solves the problem that the database may encounter various faults, thereby causing data loss or inaccessibility, but also has multiple copies of data, without the need to create additional off-site backups, and real-time backups. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a schematic diagram of the method flow of the present invention;
[0053] Figure 2 It is a schematic diagram of the process of the random forest regression prediction algorithm based on gray wolf optimization of the present invention;
[0054] Figure 3 A schematic diagram of a process for constructing a fault recovery model for a database cluster based on a refraction reverse learning mechanism according to the present invention;
[0055] Figure 4 The figure is a flow chart of the bowerbird optimization algorithm based on sine-cosine factors of the present invention. DETAILED DESCRIPTION
[0056] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0057] Example 1: Figure 1 As shown, a method for quickly recovering a database cluster failure comprises:
[0058] K1. Obtain data information about database cluster failures, data information about the network topology of the database cluster, and data information about the configuration files of the database cluster;
[0059] K2. Based on the data information of the database cluster failure, the data information of the network topology of the database cluster and the data information of the configuration file of the database cluster, the random forest regression prediction algorithm based on gray wolf optimization is used to predict the failure recovery time of the database cluster to obtain data information of the failure recovery time of the database cluster;
[0060] K3. Based on the data information of the database cluster failure recovery time, a database cluster failure recovery model based on a refraction reverse learning mechanism is constructed to characterize the failure recovery of the database cluster and obtain the data information of the failure recovery of the database cluster;
[0061] K4. Based on the data information of the fault recovery of the database cluster, the data of the fault recovery is optimized by using a bowerbird optimization algorithm based on sine-cosine factors to obtain optimized data information of the fault recovery.
[0062] In this embodiment, if Figure 2 As shown, in step K2, the prediction of the failure recovery time of the database cluster using the random forest regression prediction algorithm based on gray wolf optimization includes:
[0063] K21. Based on the data information of the database cluster failure, the data information of the network topology of the database cluster and the data information of the configuration file of the database cluster, a feature extraction function Q of the database cluster failure is established.
[0064]
[0065] Among them, x1 is the data information of the database cluster failure, x2 is the data information of the network topology structure of the database cluster, x3 is the data information of the configuration file of the database cluster, α1, α2 and α3 are the feature extraction factors of the database cluster failure, and the feature matrix of the database cluster failure is extracted to obtain the data information of the feature matrix of the database cluster failure;
[0066] K22. Input the data information of the feature matrix of the database cluster failure into the random forest regression prediction model for training and learning, initialize the hyperparameters of the model, and obtain the data information of the hyperparameters of the model;
[0067] K23. Based on the data information of the hyperparameters of the model, the gray wolf population is initialized, the population parameters and the maximum number of iterations are determined, and the data information of the initialized gray wolf population is obtained;
[0068] K24. Based on the data information of the initialized gray wolf population, establish the fitness function W of the population individuals,
[0069]
[0070] Among them, y is the data information of the gray wolf population after initialization, β1, β2 and β3 are the fitness determining factors of the population individuals, and the fitness values of the population individuals are calculated to obtain the data information of the fitness values of the population individuals;
[0071] K25. Based on the data information of the fitness values of the individuals in the population, establish a target optimization function R,
[0072]
[0073] Among them, z is the data information of the fitness value of the population individual, δ1, δ2 and δ3 are the optimization factors of the target, and the hyperparameters of the model are optimized to obtain the optimized random forest regression prediction model.
[0074] In this embodiment, it also includes:
[0075] K26. Based on the optimized random forest regression prediction model, the data information of the database cluster failure, the data information of the network topology structure of the database cluster and the data information of the configuration file of the database cluster are input to predict the failure recovery time of the database cluster and obtain the data information of the failure recovery time of the database cluster.
[0076] In this embodiment, the constraint conditions of the feature extraction factors α1, α2 and α3 of the database cluster failure are:
[0077]
[0078] In this embodiment, the optimization factors δ1, δ2 and δ3 of the objective are,
[0079]
[0080] Among them, z is the data information of the fitness value of the individual in the population.
[0081] In this embodiment, if Figure 3 As shown, in step K3, the construction of a fault recovery model of a database cluster based on a refraction reverse learning mechanism and the characterization of a fault recovery solution for the database cluster include:
[0082] K31. Constructing a database cluster failure recovery time data set based on the database cluster failure recovery time data information;
[0083] K32. The database cluster failure recovery time data set is input into the database cluster failure recovery model based on the refraction reverse learning mechanism for training and learning, and the database cluster failure recovery function U is determined.
[0084]
[0085] Among them, h is the data set of the fault recovery time of the database cluster, γ1, γ2 and γ3 are the parameters of the refraction reverse learning mechanism for the fault recovery of the database cluster, and the trained fault recovery model of the database cluster based on the refraction reverse learning mechanism is obtained;
[0086] K33. Based on the trained database cluster fault recovery model based on the refraction reverse learning mechanism, input the data information of the database cluster fault recovery time, characterize the database cluster fault recovery, and obtain the database cluster fault recovery data information.
[0087] In this embodiment, the refractive reverse learning mechanism parameters γ1, γ2 and γ3 for failure recovery of the database cluster are:
[0088]
[0089] Where h is the data set of the failure recovery time of the database cluster.
[0090] Embodiment 2: Based on the rapid recovery method for a database cluster failure in Embodiment 1, the present invention is further illustrated and described below.
[0091] like Figure 1 As shown, a method for quickly recovering a database cluster failure comprises:
[0092] K1. Obtain data information about database cluster failures, data information about the network topology of the database cluster, and data information about the configuration files of the database cluster;
[0093] K2. Based on the data information of the database cluster failure, the data information of the network topology of the database cluster and the data information of the configuration file of the database cluster, the random forest regression prediction algorithm based on gray wolf optimization is used to predict the failure recovery time of the database cluster to obtain data information of the failure recovery time of the database cluster;
[0094] K3. Based on the data information of the database cluster failure recovery time, a database cluster failure recovery model based on a refraction reverse learning mechanism is constructed to characterize the failure recovery of the database cluster and obtain the data information of the failure recovery of the database cluster;
[0095] K4. Based on the data information of the fault recovery of the database cluster, the data of the fault recovery is optimized by using a bowerbird optimization algorithm based on sine-cosine factors to obtain optimized data information of the fault recovery.
[0096] In this embodiment, if Figure 4 As shown, in step K4, the optimization of the fault recovery data using the bowerbird optimization algorithm based on sine-cosine factors includes:
[0097] K41. Based on the data information of the database cluster failure recovery, the gardener bird population is initialized, the population parameters are determined, and the data information of the initialized gardener bird population is obtained;
[0098] K42. Based on the data information of the initialized gardener bird population, a fitness function G of the gardener bird population is established.
[0099]
[0100] Among them, r is the data information of the initialized bowerbird population, η1, η2 and η3 are the weight factors of the bowerbird population, and the fitness values of the individuals in the bowerbird population are calculated to obtain the data information of the fitness values of the individuals in the bowerbird population;
[0101] K43. Based on the data information of the fitness values of the individual gardener bird population, an optimization function H of the population is established.
[0102]
[0103] Among them, g is the data information of the fitness value of the individual of the bowerbird population, λ1, λ2 and λ3 are the sine and cosine factors of the bowerbird population, and the fault recovery data is optimized to obtain the optimized fault recovery data information.
[0104] In this embodiment, the present invention provides a rapid recovery system for a database cluster failure, including a computer device, wherein the computer device is programmed or configured to execute the steps of any one of the rapid recovery methods for a database cluster failure.
[0105] In this embodiment, the present invention provides a computer-readable storage medium, on which is stored a computer program programmed or configured to execute any one of the methods for rapid recovery of a database cluster failure.
[0106] Any reference to memory, storage, database or other media used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM) and memory bus dynamic RAM (RDRAM).
[0107] In summary, the present invention not only performs emergency processing when the database encounters an emergency state and cannot provide services, and restores services in a short time while ensuring data security, but also ensures subsequent data services and normal recovery of data.
[0108] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for rapid recovery of a database cluster failure, characterized in that: The method comprises: K1. Obtain data information about database cluster failures, data information about the network topology of the database cluster, and data information about the configuration files of the database cluster; K2. Based on the data information of the database cluster failure, the data information of the network topology of the database cluster and the data information of the configuration file of the database cluster, the random forest regression prediction algorithm based on gray wolf optimization is used to predict the failure recovery time of the database cluster to obtain data information of the failure recovery time of the database cluster; K3. Based on the data information of the database cluster failure recovery time, a database cluster failure recovery model based on a refraction reverse learning mechanism is constructed to characterize the failure recovery of the database cluster and obtain the data information of the failure recovery of the database cluster; K4. Based on the data information of the fault recovery of the database cluster, the data of the fault recovery is optimized by using a bowerbird optimization algorithm based on sine-cosine factors to obtain optimized data information of the fault recovery.
2. The rapid recovery method for database cluster failure according to claim 1, characterized in that: In step K2, the prediction of the failure recovery time of the database cluster using the random forest regression prediction algorithm based on gray wolf optimization includes: K21. Based on the data information of the database cluster failure, the data information of the network topology of the database cluster and the data information of the configuration file of the database cluster, a feature extraction function Q of the database cluster failure is established. Among them, x1 is the data information of the database cluster failure, x2 is the data information of the network topology structure of the database cluster, x3 is the data information of the configuration file of the database cluster, α1, α2 and α3 are the feature extraction factors of the database cluster failure, and the feature matrix of the database cluster failure is extracted to obtain the data information of the feature matrix of the database cluster failure; K22. Input the data information of the feature matrix of the database cluster failure into the random forest regression prediction model for training and learning, initialize the hyperparameters of the model, and obtain the data information of the hyperparameters of the model; K23. Based on the data information of the hyperparameters of the model, the gray wolf population is initialized, the population parameters and the maximum number of iterations are determined, and the data information of the initialized gray wolf population is obtained; K24. Based on the data information of the initialized gray wolf population, establish the fitness function W of the population individuals, Among them, y is the data information of the gray wolf population after initialization, β1, β2 and β3 are the fitness determining factors of the population individuals, and the fitness values of the population individuals are calculated to obtain the data information of the fitness values of the population individuals; K25. Based on the data information of the fitness values of the individuals in the population, establish a target optimization function R, Among them, z is the data information of the fitness value of the population individual, δ1, δ2 and δ3 are the optimization factors of the target, and the hyperparameters of the model are optimized to obtain the optimized random forest regression prediction model.
3. The rapid recovery method for database cluster failure according to claim 2, characterized in that: Also includes: K26. Based on the optimized random forest regression prediction model, the data information of the database cluster failure, the data information of the network topology structure of the database cluster and the data information of the configuration file of the database cluster are input to predict the failure recovery time of the database cluster and obtain the data information of the failure recovery time of the database cluster.
4. The rapid recovery method for database cluster failure according to claim 2, characterized in that: The constraint conditions of the feature extraction factors α1, α2 and α3 of the database cluster failure are:
5. The rapid recovery method for database cluster failure according to claim 2, characterized in that: The optimization factors δ1, δ2 and δ3 of the objective are, Among them, z is the data information of the fitness value of the individual in the population.
6. The rapid recovery method for database cluster failure according to claim 1, characterized in that: In step K3, the construction of a fault recovery model of a database cluster based on a refraction reverse learning mechanism and characterization of a fault recovery solution of the database cluster include: K31. Constructing a database cluster failure recovery time data set based on the database cluster failure recovery time data information; K32. The database cluster failure recovery time data set is input into the database cluster failure recovery model based on the refraction reverse learning mechanism for training and learning, and the database cluster failure recovery function U is determined. Among them, h is the data set of the fault recovery time of the database cluster, γ1, γ2 and γ3 are the parameters of the refraction reverse learning mechanism for the fault recovery of the database cluster, and the trained fault recovery model of the database cluster based on the refraction reverse learning mechanism is obtained; K33. Based on the trained database cluster fault recovery model based on the refraction reverse learning mechanism, input the data information of the database cluster fault recovery time, characterize the database cluster fault recovery, and obtain the database cluster fault recovery data information.
7. The rapid recovery method for database cluster failure according to claim 6, characterized in that: The parameters γ1, γ2 and γ3 of the refractive reverse learning mechanism for failure recovery of the database cluster are: Where h is the data set of the failure recovery time of the database cluster.
8. The rapid recovery method for database cluster failure according to claim 1, characterized in that: In step K4, the optimization of the fault recovery data using the bowerbird optimization algorithm based on sine-cosine factors includes: K41. Based on the data information of the database cluster failure recovery, the gardener bird population is initialized, the population parameters are determined, and the data information of the initialized gardener bird population is obtained; K42. Based on the data information of the initialized gardener bird population, a fitness function G of the gardener bird population is established. Among them, r is the data information of the initialized bowerbird population, η1, η2 and η3 are the weight factors of the bowerbird population, and the fitness values of the individuals in the bowerbird population are calculated to obtain the data information of the fitness values of the individuals in the bowerbird population; K43. Based on the data information of the fitness values of the individual gardener bird population, an optimization function H of the population is established. Among them, g is the data information of the fitness value of the individual of the bowerbird population, λ1, λ2 and λ3 are the sine and cosine factors of the bowerbird population, and the fault recovery data is optimized to obtain the optimized fault recovery data information.
9. A rapid recovery system for database cluster failure, comprising a computer device, characterized in that: The computer device is programmed or configured to execute the steps of the method for rapid recovery of database cluster failure as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program programmed or configured to execute the method for rapid recovery of a database cluster failure as claimed in any one of claims 1 to 8.