Cloud database intelligent fault switching method and device for electricity utilization information acquisition system, computer equipment and storage medium
By constructing multi-dimensional data feature vectors and using trained models for fault identification and switching decisions, the problem of low accuracy in traditional cloud database fault switching is solved, and more accurate fault switching processing is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA SOUTHERN POWER GRID DIGITAL GRID GRP CO LTD
- Filing Date
- 2025-12-15
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional cloud database failover methods consider only one factor, resulting in low accuracy in failover.
By acquiring multi-dimensional data from the electricity information collection system, fault feature vectors and node status feature vectors are constructed, fused, and the trained fault detection model is used to accurately identify faults. The fault switching action prediction model is then input to generate personalized switching actions.
It improves the accuracy of cloud database failover, avoids false alarms and missed alarms caused by traditional rules or fixed thresholds, and ensures that failover decisions are aligned with fault type and node status, balancing load balancing and data consistency.
Smart Images

Figure CN121900873A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a cloud database intelligent fault switching method, apparatus, computer equipment, computer-readable storage medium, and computer program product for an electricity information collection system. Background Technology
[0002] Currently, in order to ensure the operational stability of cloud databases, it is crucial to accurately perform failover on cloud databases.
[0003] In traditional technologies, when switching cloud databases, a method that relies on a single-dimensional operating metric is generally used. However, this method considers only one factor and easily overlooks the collaborative relationship of multi-dimensional data in the database, resulting in low accuracy of cloud database switchover. Summary of the Invention
[0004] Based on this, it is necessary to provide a cloud database intelligent fault switching method, device, computer equipment, computer-readable storage medium, and computer program product for electricity information collection systems that can improve the accuracy of cloud database fault switching and address the aforementioned technical problems.
[0005] Firstly, this application provides a cloud database intelligent fault switching method for electricity consumption information collection systems, including:
[0006] Acquire the operational status data, historical fault data, business load data, and node status data of the cloud database to be analyzed from the electricity consumption information collection system;
[0007] Based on the operational status data, the historical fault data, and the business load data, a fault feature vector corresponding to the cloud database is constructed, and based on the node status data, a node status feature vector corresponding to the database node is constructed.
[0008] The fault feature vector and the node status feature vector corresponding to the database node are fused to obtain the fused feature vector corresponding to the cloud database.
[0009] The fused feature vector is input into the trained fault detection model to obtain the fault detection result corresponding to the cloud database;
[0010] Obtain the resource status data and data synchronization progress information corresponding to the cloud database, and input the fault detection result, the node status data, the resource status data and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database.
[0011] According to the fault switching action, the cloud database is subjected to corresponding fault switching processing.
[0012] In one embodiment, the step of fusing the fault feature vector and the node state feature vector corresponding to the database node to obtain the fused feature vector corresponding to the cloud database includes:
[0013] Based on the fault feature vector and the node status feature vector corresponding to the database node, a first associated feature vector corresponding to the cloud database is constructed; based on the fault feature vector and the business load data, a second associated feature vector corresponding to the cloud database is constructed.
[0014] The fault feature vector and the second associated feature vector are fused to obtain the first fused feature vector corresponding to the cloud database. The node status feature vector corresponding to the database node and the first associated feature vector are fused to obtain the second fused feature vector corresponding to the cloud database.
[0015] The first fused feature vector and the second fused feature vector are concatenated to obtain the fused feature vector corresponding to the cloud database.
[0016] In one embodiment, constructing the first associated feature vector corresponding to the cloud database based on the fault feature vector and the node state feature vector corresponding to the database node includes:
[0017] Based on the fault feature vector and the node state feature vector corresponding to the database node, the matching degree between the database node and the fault feature vector is determined;
[0018] Based on the matching degree, a preset number of database nodes are selected from each of the database nodes as target database nodes in the cloud database;
[0019] The average feature vector is obtained by averaging the node state feature vectors corresponding to the target database nodes.
[0020] The fault feature vector and the average feature vector are concatenated to obtain the first associated feature vector corresponding to the cloud database.
[0021] In one embodiment, the step of inputting the fault detection result, the node status data, the resource status data, and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database includes:
[0022] The fault detection results, node status data, resource status data, and data synchronization progress information are input into the trained fault switching action prediction model to obtain the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient corresponding to the cloud database.
[0023] Based on the fault switching node information, the fault switching mode information, the resource quota adjustment ratio, and the data synchronization priority adjustment coefficient, the fault switching action corresponding to the cloud database is obtained.
[0024] In one embodiment, the trained fault-change action prediction model is obtained by training it in the following manner:
[0025] Obtain sample operation status data, sample historical fault data, sample business load data, and sample node status data of the sample cloud database;
[0026] Based on the sample operation status data, the sample historical fault data, and the sample service load data, construct the sample fault feature vector corresponding to the sample cloud database, and construct the sample node status feature vector corresponding to the sample database node based on the sample node status data.
[0027] The sample fault feature vector and the sample node state feature vector corresponding to the sample database node are fused to obtain the sample fused feature vector corresponding to the sample cloud database.
[0028] The sample fusion feature vector is input into the trained fault detection model to obtain the sample fault detection results corresponding to the sample cloud database;
[0029] Obtain the sample resource status data and sample data synchronization progress information corresponding to the sample cloud database, and input the sample fault detection result, the sample node status data, the sample resource status data and the sample data synchronization progress information into the fault switching action prediction model to be trained to obtain the predicted fault switching action corresponding to the sample cloud database.
[0030] Based on the predicted fault switching action, the predicted fault switching node information, predicted fault switching mode information, predicted resource quota adjustment ratio, and predicted data synchronization priority adjustment coefficient corresponding to the sample cloud database are obtained.
[0031] Obtain the actual fault switching node information, actual fault switching mode information, actual resource quota adjustment ratio, and actual data synchronization priority adjustment coefficient corresponding to the sample cloud database;
[0032] Based on the differences between the predicted fault switching node information and the actual fault switching node information, and the differences between the predicted fault switching mode information and the actual fault switching mode information, the cross-entropy loss value is obtained. Based on the differences between the predicted resource quota adjustment ratio and the actual resource quota adjustment ratio, and the differences between the predicted data synchronization priority adjustment coefficient and the actual data synchronization priority adjustment coefficient, the mean square error loss value is obtained.
[0033] The cross-entropy loss value and the mean square error loss value are fused to obtain the target loss value;
[0034] Based on the target loss value, the fault switching action prediction model to be trained is iteratively trained to obtain the trained fault switching action prediction model.
[0035] In one embodiment, constructing a fault feature vector corresponding to the cloud database based on the operating status data, the historical fault data, and the business load data includes:
[0036] The running status data, the historical fault data, and the business load data are respectively processed by feature extraction to obtain the running status feature vector, the historical fault feature vector, and the business load feature vector corresponding to the cloud database.
[0037] The operating status feature vector, the historical fault feature vector, and the business load feature vector are concatenated to obtain the fault feature vector corresponding to the cloud database.
[0038] Secondly, this application also provides a cloud database intelligent fault switching device for an electricity consumption information collection system, comprising:
[0039] The data acquisition module is used to acquire the operating status data, historical fault data, business load data, and node status data of the cloud database to be analyzed in the electricity information collection system.
[0040] The vector construction module is used to construct a fault feature vector corresponding to the cloud database based on the running status data, the historical fault data, and the business load data, and to construct a node status feature vector corresponding to the database node based on the node status data.
[0041] The vector fusion module is used to fuse the fault feature vector and the node state feature vector corresponding to the database node to obtain the fused feature vector corresponding to the cloud database.
[0042] The fault detection module is used to input the fused feature vector into the trained fault detection model to obtain the fault detection result corresponding to the cloud database.
[0043] The action prediction module is used to obtain the resource status data and data synchronization progress information corresponding to the cloud database, and input the fault detection result, the node status data, the resource status data and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database.
[0044] The fault switching module is used to perform corresponding fault switching processing on the cloud database according to the fault switching action.
[0045] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0046] Acquire the operational status data, historical fault data, business load data, and node status data of the cloud database to be analyzed from the electricity consumption information collection system;
[0047] Based on the operational status data, the historical fault data, and the business load data, a fault feature vector corresponding to the cloud database is constructed, and based on the node status data, a node status feature vector corresponding to the database node is constructed.
[0048] The fault feature vector and the node status feature vector corresponding to the database node are fused to obtain the fused feature vector corresponding to the cloud database.
[0049] The fused feature vector is input into the trained fault detection model to obtain the fault detection result corresponding to the cloud database;
[0050] Obtain the resource status data and data synchronization progress information corresponding to the cloud database, and input the fault detection result, the node status data, the resource status data and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database.
[0051] According to the fault switching action, the cloud database is subjected to corresponding fault switching processing.
[0052] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0053] Acquire the operational status data, historical fault data, business load data, and node status data of the cloud database to be analyzed from the electricity consumption information collection system;
[0054] Based on the operational status data, the historical fault data, and the business load data, a fault feature vector corresponding to the cloud database is constructed, and based on the node status data, a node status feature vector corresponding to the database node is constructed.
[0055] The fault feature vector and the node status feature vector corresponding to the database node are fused to obtain the fused feature vector corresponding to the cloud database.
[0056] The fused feature vector is input into the trained fault detection model to obtain the fault detection result corresponding to the cloud database;
[0057] Obtain the resource status data and data synchronization progress information corresponding to the cloud database, and input the fault detection result, the node status data, the resource status data and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database.
[0058] According to the fault switching action, the cloud database is subjected to corresponding fault switching processing.
[0059] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0060] Acquire the operational status data, historical fault data, business load data, and node status data of the cloud database to be analyzed from the electricity consumption information collection system;
[0061] Based on the operational status data, the historical fault data, and the business load data, a fault feature vector corresponding to the cloud database is constructed, and based on the node status data, a node status feature vector corresponding to the database node is constructed.
[0062] The fault feature vector and the node status feature vector corresponding to the database node are fused to obtain the fused feature vector corresponding to the cloud database.
[0063] The fused feature vector is input into the trained fault detection model to obtain the fault detection result corresponding to the cloud database;
[0064] Obtain the resource status data and data synchronization progress information corresponding to the cloud database, and input the fault detection result, the node status data, the resource status data and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database.
[0065] According to the fault switching action, the cloud database is subjected to corresponding fault switching processing.
[0066] The aforementioned intelligent fault switching method, device, computer equipment, storage medium, and computer program product for cloud databases in electricity information collection systems first acquire the operational status data, historical fault data, business load data, and node status data of the cloud database to be analyzed in the electricity information collection system. Based on the operational status data, historical fault data, and business load data, a fault feature vector corresponding to the cloud database is constructed, and based on the node status data, a node status feature vector corresponding to the database node is constructed. Then, the fault feature vector and the node status feature vector corresponding to the database node are fused to obtain a fused feature vector corresponding to the cloud database. Next, the fused feature vector is input into a trained fault detection model to obtain the fault detection result corresponding to the cloud database. Then, the resource status data and data synchronization progress information corresponding to the cloud database are acquired. The fault detection result, node status data, resource status data, and data synchronization progress information are input into a trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database. Finally, the cloud database is subjected to corresponding fault switching processing according to the fault switching action. In this way, when performing failover on cloud databases, comprehensive multi-dimensional data such as operational status, historical faults, business load, and node status are acquired. Then, by constructing fault feature vectors and node status feature vectors separately and fusing them, the collaborative correlation of multi-dimensional data is explored. Subsequently, the trained fault detection model is used to accurately identify faults, avoiding false alarms and missed alarms caused by traditional rules or fixed thresholds. Finally, the fault detection results and dynamic data such as node status, resource status, and data synchronization progress are input into the failover action prediction model to generate personalized failover actions adapted to the current scenario, replacing the traditional static pre-configuration strategy. This ensures that the failover decision is both consistent with the fault type and the actual state of the node, and balances load balancing and data consistency. It breaks the limitations of traditional single indicators and helps improve the accuracy of cloud database failover. Attached Figure Description
[0067] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0068] Figure 1 This is a flowchart illustrating a cloud database intelligent fault switching method for an electricity consumption information collection system in one embodiment.
[0069] Figure 2 This is a flowchart illustrating a cloud database intelligent fault switching method for an electricity consumption information collection system in another embodiment.
[0070] Figure 3 This is a flowchart illustrating an intelligent fault switching and data consistency assurance method for a full-stack cloud database of a metering automation system in one embodiment.
[0071] Figure 4 This is a structural block diagram of a cloud database intelligent fault switching device for an electricity consumption information collection system in one embodiment.
[0072] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0073] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0074] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0075] In one exemplary embodiment, such as Figure 1As shown, a cloud database intelligent fault switching method for an electricity consumption information collection system is provided. This embodiment illustrates the method by applying it to a server. It is understood that this method can also be applied to terminals, and to systems including terminals and servers, and is implemented through interaction between the terminals and servers. The terminals can be, but are not limited to, various personal computers, laptops, smartphones, and tablets; the servers can be independent servers or server clusters composed of multiple servers. In this embodiment, the method includes the following steps:
[0076] Step S101: Obtain the operating status data, historical fault data, business load data, and node status data of the cloud database to be analyzed from the electricity information collection system.
[0077] Among them, the electricity information collection system refers to the automated information system in the power system used to comprehensively collect, transmit, store and process electricity consumption data of electricity users.
[0078] Cloud databases refer to database systems deployed in cloud environments (public, private, and hybrid clouds) that possess features such as distributed storage, elastic scaling, and multi-node backup. In practical scenarios, cloud databases are also known as full-stack cloud databases for metering automation systems, referring to cloud databases applied to metering automation systems (also known as metering systems).
[0079] Among them, the operational status data refers to the indicator data generated during the real-time operation of the cloud database, including hardware dimensions such as CPU (Central Processing Unit), memory, disk IO (Input / Output) utilization, node temperature, network dimensions such as cross-node latency, bandwidth usage, packet loss rate, and software dimensions such as transaction commit success rate, log write speed, etc.
[0080] Historical fault data refers to the recorded information of past faults in the cloud database, including fault type (hardware / software / network / data fault), fault impact range (master / slave / backup nodes), fault recovery difficulty, occurrence frequency, average recovery time, and other data.
[0081] Among them, business load data refers to the business request-related data carried by the cloud database, including data such as metering business type (such as data writing, cross-department query), data writing frequency, query concurrency, etc.
[0082] Among them, database nodes refer to independent units that make up a cloud database, which typically include master nodes (core business processing), slave nodes (read-write separation / backup), backup nodes (disaster recovery redundancy), and edge nodes (edge business processing nearby).
[0083] Among them, node status data refers to the real-time availability status data of database nodes, including node health, remaining resource capacity (CPU / memory remaining), network connectivity status, and other data.
[0084] For example, in response to a fault analysis command for the cloud database to be analyzed in the electricity consumption information collection system, the server pulls the cloud database's operating status data in real time from the cloud platform monitoring component built into the cloud database; retrieves historical fault data of the cloud database from the historical fault database of the cloud database; collects the cloud database's business load data through the cloud database's traffic statistics module; and obtains the node status data of the cloud database's database nodes through the status monitoring interface of the database nodes in the cloud database.
[0085] Step S102: Based on the running status data, historical fault data, and business load data, construct the fault feature vector corresponding to the cloud database, and based on the node status data, construct the node status feature vector corresponding to the database node.
[0086] Among them, the fault feature vector refers to the feature vector constructed based on operational status data, historical fault data, and business load data.
[0087] Among them, the state feature vector refers to the feature vector constructed based on the node state data.
[0088] For example, the server performs data cleaning on the running status data, historical fault data, business load data, and node status data to obtain cleaned running status data, cleaned historical fault data, cleaned business load data, and cleaned node status data. Then, based on the cleaned running status data, cleaned historical fault data, and cleaned business load data, a fault feature vector corresponding to the cloud database is constructed, and based on the cleaned node status data, a node status feature vector corresponding to the database node is constructed.
[0089] Step S103: The fault feature vector and the node state feature vector corresponding to the database node are fused to obtain the fused feature vector corresponding to the cloud database.
[0090] Among them, the fused feature vector refers to the feature vector obtained by fusing the fault feature vector and the node state feature vector corresponding to the database node.
[0091] For example, the server determines the concatenation order of the node state feature vectors corresponding to the database nodes based on the node identifiers of the database nodes, and concatenates the node state feature vectors corresponding to the database nodes according to the concatenation order to obtain the concatenated feature vector; then, the fault feature vector and the concatenated feature vector are concatenated again to obtain the fused feature vector corresponding to the cloud database.
[0092] Step S104: Input the fused feature vector into the trained fault detection model to obtain the fault detection result corresponding to the cloud database.
[0093] Among them, the fault detection model refers to the network model that can use fused feature vectors to obtain the fault detection results corresponding to the cloud database, such as the DNN (Deep Neural Network) model.
[0094] Among them, the fault detection result refers to the quantitative judgment output of the fault detection model on the current state of the cloud database.
[0095] For example, the server inputs the fused feature vector into the trained fault detection model, and then uses the CNN (Convolutional Neural Network) in the fault recognition channel of the model. The hybrid architecture of Convolutional Neural Network (CNN) and Transformer completes feature extraction and fault determination: First, the CNN layer is used to perform local feature mining on the fused feature vector to extract key local features strongly correlated with faults, such as sudden changes in CPU load and abnormal disk I / O, generating corresponding local feature vectors. Then, the local feature vector is input into a Transformer encoder with two attention heads. Through the self-attention mechanism, global feature dependencies are modeled to capture the non-linear correlation between fault features and database status and business load, outputting global fused features. Next, the global fused features are input into the model's Softmax activation function to obtain the probability of cloud database fault occurrence (binary classification: normal / fault). If the probability of fault occurrence is greater than a preset threshold (e.g., 0.7), the multi-dimensional predicted fault type (four-class classification: hardware / software / network / data fault) and corresponding predicted probability output by the Softmax activation function are obtained simultaneously, and the type with the highest predicted probability is selected as the target fault type. Finally, the "fault occurrence probability (including fault / normal determination result) + target fault type (including corresponding confidence level)" are integrated into the structured fault detection result of the cloud database.
[0096] It should be noted that the trained fault detection model is obtained through the following steps: First, a sample cloud database corresponding to the fault detection model to be trained is determined (this sample cloud database is different from the one used to train the fault switching action prediction model). Second, sample operational status data, historical fault data, service load data, and sample node status data of the sample cloud database are obtained. Third, based on the sample operational status data, historical fault data, and service load data, a sample fault feature vector corresponding to the sample cloud database is constructed, and based on the sample node status data, a sample node status feature vector corresponding to the sample database node is constructed. Fourth, the sample fault feature vector and the sample node status feature vector corresponding to the sample database node are fused to obtain a sample fused feature vector corresponding to the sample cloud database. Fifth, the sample fused feature vector is input into the fault detection model to be trained to obtain the predicted fault detection result corresponding to the sample cloud database. Sixth, the actual fault detection result corresponding to the sample cloud database is obtained, and based on the difference between the predicted and actual fault detection results, the cross-entropy loss value and F1 (F1) between the predicted and actual fault detection results are obtained. The cross-entropy loss value (F1 score) and the F1 score loss value are fused together according to the fusion coefficients corresponding to the cross-entropy loss value and the F1 score loss value to obtain the processed loss value. Based on the processed loss value, the fault detection model to be trained is iteratively trained to obtain the trained fault detection model.
[0097] For example, the processed loss value is calculated using the following formula:
[0098] Equation (1)
[0099] Where Lce is the cross-entropy loss value between the predicted fault detection result and the actual fault detection result (to optimize fault classification accuracy), L F1 To predict the F1 loss value between the fault detection results and the actual fault detection results (to balance the imbalance between positive and negative samples and reduce the false negative rate), α is a hyperparameter (default 0.2).
[0100] Step S105: Obtain the resource status data and data synchronization progress information corresponding to the cloud database. Input the fault detection results, node status data, resource status data and data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database.
[0101] Among them, resource status data refers to the real-time supply capacity and occupancy status data of each database node (master / slave / backup / edge node) and associated cloud resources in the cloud database, including node hardware resource data (including the number of remaining CPU cores, remaining memory capacity, remaining disk space, and remaining network bandwidth percentage of each node), cloud resource scheduling data (including the resource quota that can be elastically expanded on the cloud platform and resource scheduling latency), and resource load balancing data (including the current CPU / memory / IO load balancing degree and resource occupancy trend of each node).
[0102] Among them, data synchronization progress information refers to the data consistency synchronization status data between the cloud database master node and slave nodes and backup nodes, including synchronization completion rate (the percentage of data synchronized by slave nodes / backup nodes relative to the total data of the master node), synchronization delay duration (the time difference between the generation of the latest data from the master node and the completion of synchronization by slave nodes / backup nodes), and synchronization status identifier (health status of the synchronization link, amount of unsynchronized data, and synchronization mode).
[0103] Among them, the fault switching action prediction model refers to a network model, such as a DNN model, that can use fault detection results, node status data, resource status data, and data synchronization progress information to obtain the fault switching action corresponding to the cloud database.
[0104] Among them, fault switching actions refer to structured switching instructions that can be directly executed by the cloud database, including discrete actions and continuous actions.
[0105] Among them, discrete actions include the target node selected by the cloud database for switching (also known as fault switching node information, which has 4 types: master → slave / master → backup / master → edge / slave → backup) and the switching mode selected by the cloud database (also known as fault switching mode information, which has 2 types: fast switching / secure switching).
[0106] The continuous actions include adjusting the cloud database resource quota ratio (0.8-2 times, for CPU / memory / bandwidth, 3 consecutive values) and adjusting the data synchronization priority coefficient (0.5-1.5 times, 1 consecutive value).
[0107] For example, the server obtains the resource status data of the cloud database through the cloud platform resource monitoring interface corresponding to the cloud database, and obtains the data synchronization progress information of the cloud database through the database synchronization management module corresponding to the cloud database. Then, the fault detection results, node status data, resource status data and data synchronization progress information are input into the trained fault switching action prediction model to obtain the predicted probability of the cloud database under each preset fault switching action. Then, the preset fault switching action with the highest predicted probability is selected from each preset fault switching action as the fault switching action corresponding to the cloud database.
[0108] Step S106: Perform corresponding fault switching processing on the cloud database according to the fault switching action.
[0109] For example, the server performs an integrity check on the failover action and obtains the check result of the failover action; if the check result indicates that the failover action has passed the check, the cloud database is processed accordingly for the failover action.
[0110] In the aforementioned intelligent fault switching method for cloud databases in electricity information collection systems, when switching cloud databases, comprehensive multi-dimensional data such as operating status, historical faults, business load, and node status are acquired. Then, by constructing fault feature vectors and node status feature vectors separately and fusing them, the collaborative correlation of multi-dimensional data is explored. Subsequently, the trained fault detection model is used to accurately identify faults, avoiding false alarms and missed alarms caused by traditional rules or fixed thresholds. Finally, the fault detection results and dynamic data such as node status, resource status, and data synchronization progress are input into the fault switching action prediction model to generate personalized switching actions adapted to the current scenario, replacing the traditional static pre-configuration strategy. This ensures that the fault switching decision is both consistent with the fault type and the actual state of the node, and balances load balancing and data consistency. It breaks the limitations of traditional single indicators and is conducive to improving the accuracy of cloud database fault switching.
[0111] In an exemplary embodiment, step S103 above, which fuses the fault feature vector and the node state feature vector corresponding to the database node to obtain the fused feature vector corresponding to the cloud database, specifically includes the following: constructing a first associated feature vector corresponding to the cloud database based on the fault feature vector and the node state feature vector corresponding to the database node; constructing a second associated feature vector corresponding to the cloud database based on the fault feature vector and the business load data; fusing the fault feature vector and the second associated feature vector to obtain the first fused feature vector corresponding to the cloud database; fusing the node state feature vector corresponding to the database node and the first associated feature vector to obtain the second fused feature vector corresponding to the cloud database; and concatenating the first fused feature vector and the second fused feature vector to obtain the fused feature vector corresponding to the cloud database.
[0112] Here, the first correlation feature vector refers to the feature vector used to quantify the correlation between the fault feature vector and the node state feature vector corresponding to the database node. The second correlation feature vector refers to the feature vector used to quantify the correlation between the fault feature vector and the business load data. The first fused feature vector refers to the feature vector obtained by fusing the fault feature vector and the second correlation feature vector. The second fused feature vector refers to the feature vector obtained by fusing the node state feature vector corresponding to the database node and the first correlation feature vector.
[0113] For example, the server constructs a first associated feature vector for the cloud database based on the fault feature vector and the node state feature vector corresponding to the database node. Next, it extracts the peak business load of the cloud database from the business load data, extracts the business load time-series feature vector of the peak business load, and concatenates the fault feature vector and the business load time-series feature vector to obtain a second associated feature vector for the cloud database. Then, it inputs the fault feature vector and the second associated feature vector into an attention mechanism network to obtain their respective weights. Based on these weights, it fuses the fault feature vector and the second associated feature vector to obtain a first fused feature vector for the cloud database. Next, it concatenates the node state feature vector corresponding to the database node, and then concatenates the concatenated node state feature vector with the first associated feature vector to obtain a second fused feature vector for the cloud database. Finally, it concatenates the first fused feature vector and the second fused feature vector according to a preset concatenation order to obtain the final fused feature vector for the cloud database.
[0114] In this embodiment, by constructing associated feature vectors, the implicit correlations between fault features and node status, and between fault features and business load are mined, providing more comprehensive and accurate feature inputs for the fault detection model, effectively improving the scenario adaptability of fault type identification and the accuracy of fault node location.
[0115] In an exemplary embodiment, a first associated feature vector corresponding to the cloud database is constructed based on the fault feature vector and the node state feature vector corresponding to the database node. Specifically, this includes: determining the matching degree between the database node and the fault feature vector based on the fault feature vector and the node state feature vector corresponding to the database node; selecting a predetermined number of database nodes from among the database nodes based on the matching degree as target database nodes in the cloud database; averaging the node state feature vector corresponding to the target database node to obtain an average feature vector; and concatenating the fault feature vector and the average feature vector to obtain the first associated feature vector corresponding to the cloud database.
[0116] Here, the matching degree represents the strength of the association between a database node and a fault feature vector. The preset quantity refers to a pre-defined number of database nodes. The target database node represents the set of nodes selected from the cloud database nodes, sorted from highest to lowest based on the matching degree, and equal to the preset quantity. The average feature vector is the feature vector obtained by averaging the node state feature vectors corresponding to the target database node.
[0117] For example, the server inputs the fault feature vector and the node state feature vector corresponding to the database node into the cosine similarity prediction model to obtain the cosine similarity between the node state feature vector corresponding to the database node and the fault feature vector, which is used as the matching degree between the database node and the fault feature vector. Then, according to the matching degree from high to low, a preset number of database nodes are selected from each database node, and these database nodes are used as target database nodes in the cloud database. Then, the node state feature vector corresponding to the target database node is averaged to obtain the average feature vector. Then, the fault feature vector and the average feature vector are concatenated according to a preset concatenation order to obtain the first associated feature vector corresponding to the cloud database.
[0118] In this embodiment, the correlation strength between database nodes and fault features is accurately quantified by vector similarity calculation. Based on a preset number, the target database nodes with the highest correlation are selected to provide more accurate feature input for the subsequent fault detection model.
[0119] In an exemplary embodiment, step S105 above, which involves inputting the fault detection results, node status data, resource status data, and data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database, specifically includes the following: inputting the fault detection results, node status data, resource status data, and data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient corresponding to the cloud database; and obtaining the fault switching action corresponding to the cloud database based on the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient.
[0120] The failover node information represents the structured data (4 types: master → slave / master → backup / master → edge / slave → backup) of the database nodes associated with the failover of the cloud database (including the node before and after the failover). The failover mode information represents the failover method (2 types: fast failover / secure failover). The resource quota adjustment ratio is a quantitative adjustment coefficient based on the current resource quota of the node after the failover of the cloud database, used to dynamically match business load requirements. The data synchronization priority adjustment coefficient is the adjustment coefficient for the data synchronization priority of the node after the failover of the cloud database (value range [0,1], the closer the coefficient is to 1, the higher the synchronization priority).
[0121] For example, the server extracts the first feature vector of the fault detection result, the second feature vector of the node status data, the third feature vector of the resource status data, and the fourth feature vector of the data synchronization progress information. The first, second, third, and fourth feature vectors are concatenated to obtain a concatenated feature vector corresponding to the fault detection result, node status data, resource status data, and data synchronization progress information. This concatenated feature vector is then input into the trained fault switching action prediction model to obtain the predicted probability of the cloud database under each preset fault switching node information, the predicted probability under each preset fault switching mode information, the resource quota adjustment ratio, and the data synchronization priority adjustment coefficient. Next, the preset fault switching node information with the highest predicted probability is selected from the preset fault switching node information and used as the corresponding fault switching node information for the cloud database. Similarly, the preset fault switching mode information with the highest predicted probability is selected from the preset fault switching mode information and used as the corresponding fault switching mode information for the cloud database. Finally, the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient are all used as the corresponding fault switching action for the cloud database.
[0122] In this embodiment, the trained fault switching action prediction model accurately outputs fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient, ultimately comprehensively improving the intelligence level of cloud database fault switching.
[0123] In an exemplary embodiment, the cloud database intelligent fault switching method for an electricity information collection system provided in this application further includes a training process for a trained fault switching action prediction model, specifically including the following: acquiring sample operating status data, sample historical fault data, sample service load data, and sample node status data of the sample cloud database; constructing a sample fault feature vector corresponding to the sample cloud database based on the sample operating status data, sample historical fault data, and sample service load data, and constructing a sample node status feature vector corresponding to the sample database node based on the sample node status data; fusing the sample fault feature vector and the sample node status feature vector corresponding to the sample database node to obtain a sample fused feature vector corresponding to the sample cloud database; inputting the sample fused feature vector into the trained fault detection model to obtain the sample fault detection result corresponding to the sample cloud database; acquiring sample resource status data and sample data synchronization progress information corresponding to the sample cloud database, and combining the sample fault detection result, sample node status data, sample resource status data, and sample data synchronization progress information... The predicted fault handover action is input into the fault handover action prediction model to be trained, and the predicted fault handover action corresponding to the sample cloud database is obtained. Based on the predicted fault handover action, the predicted fault handover node information, predicted fault handover mode information, predicted resource quota adjustment ratio, and predicted data synchronization priority adjustment coefficient corresponding to the sample cloud database are obtained. The actual fault handover node information, actual fault handover mode information, actual resource quota adjustment ratio, and actual data synchronization priority adjustment coefficient corresponding to the sample cloud database are obtained. Based on the differences between the predicted fault handover node information and the actual fault handover node information, and the differences between the predicted fault handover mode information and the actual fault handover mode information, the cross-entropy loss value is obtained. Based on the differences between the predicted resource quota adjustment ratio and the actual resource quota adjustment ratio, and the differences between the predicted data synchronization priority adjustment coefficient and the actual data synchronization priority adjustment coefficient, the mean squared error loss value is obtained. The cross-entropy loss value and the mean squared error loss value are fused to obtain the target loss value. Based on the target loss value, the fault handover action prediction model to be trained is iteratively trained to obtain the trained fault handover action prediction model.
[0124] Here, "Sample Cloud Database" refers to the cloud database used to train the fault switching prediction model. "Sample Operation Status Data" refers to the operation status data of the sample cloud database. "Sample Historical Fault Data" refers to the historical fault data of the sample cloud database. "Sample Service Load Data" refers to the service load data of the sample cloud database. "Sample Database Node" refers to the database node of the sample cloud database. "Sample Node Status Data" refers to the node status data of the sample database node. "Sample Fault Feature Vector" refers to a feature vector constructed based on sample operation status data, sample historical fault data, and sample service load data. "Sample Node Status Feature Vector" refers to a feature vector constructed based on sample node status data. "Sample Fusion Feature Vector" refers to the feature vector obtained by fusing the sample fault feature vector and the corresponding sample node status feature vector of the sample database node. "Sample Fault Detection Result" refers to the fault detection result output by the trained fault detection model corresponding to the sample cloud database. "Sample Resource Status Data" refers to the resource status data corresponding to the sample cloud database. "Sample Data Synchronization Progress Information" refers to the data synchronization progress information corresponding to the sample cloud database. "Predicted Fault Switching Action" refers to the predicted value of the fault switching action corresponding to the sample cloud database. "Predicted Fault Switching Node Information" refers to the predicted value of the fault switching node information corresponding to the sample cloud database. Predicted failover mode information refers to the predicted value of the failover mode information corresponding to the sample cloud database. Predicted resource quota adjustment ratio refers to the predicted value of the resource quota adjustment ratio corresponding to the sample cloud database. Predicted data synchronization priority adjustment coefficient refers to the predicted value of the data synchronization priority adjustment coefficient corresponding to the sample cloud database. Actual failover node information refers to the actual value of the failover node information corresponding to the sample cloud database. Actual failover mode information refers to the actual value of the failover mode information corresponding to the sample cloud database. Actual resource quota adjustment ratio refers to the actual value of the resource quota adjustment ratio corresponding to the sample cloud database. Actual data synchronization priority adjustment coefficient refers to the actual value of the data synchronization priority adjustment coefficient corresponding to the sample cloud database. Cross-entropy loss value refers to the loss value calculated based on the differences between predicted failover node information and actual failover node information, and the differences between predicted failover mode information and actual failover mode information. Mean squared error loss value refers to the loss value calculated based on the differences between predicted resource quota adjustment ratio and actual resource quota adjustment ratio, and the differences between predicted data synchronization priority adjustment coefficient and actual data synchronization priority adjustment coefficient. The target loss value refers to the loss value obtained by fusing the cross-entropy loss value and the mean squared error loss value.
[0125] For example, the server determines the sample cloud database corresponding to the fault switching action prediction model to be trained; it acquires the sample operating status data, sample historical fault data, sample service load data, and sample node status data of the sample cloud database; based on the sample operating status data, sample historical fault data, and sample service load data, it constructs the sample fault feature vector corresponding to the sample cloud database, and based on the sample node status data, it constructs the sample node status feature vector corresponding to the sample database node; it fuses the sample fault feature vector and the sample node status feature vector corresponding to the sample database node to obtain the sample fused feature vector corresponding to the sample cloud database; and it then integrates the sample fused feature vector... Inputting the data into the trained fault detection model yields the sample fault detection results corresponding to the sample cloud database. Obtaining the sample resource status data and sample data synchronization progress information corresponding to the sample cloud database, the sample fault detection results, sample node status data, sample resource status data, and sample data synchronization progress information are then input into the fault handover action prediction model to be trained, yielding the predicted fault handover action corresponding to the sample cloud database. Based on the predicted fault handover action, the predicted fault handover node information, predicted fault handover mode information, predicted resource quota adjustment ratio, and predicted data synchronization priority adjustment coefficient corresponding to the sample cloud database are obtained. Finally, the actual fault handover node information and actual fault handover data corresponding to the sample cloud database are obtained. The system calculates the following: mode information, actual resource quota adjustment ratio, and actual data synchronization priority adjustment coefficient; based on the difference between predicted and actual fault switching node information, a first cross-entropy loss value is obtained; based on the difference between predicted and actual fault switching mode information, a second cross-entropy loss value is obtained; and the first and second cross-entropy loss values are summed to obtain the total cross-entropy loss value; based on the difference between predicted and actual resource quota adjustment ratios, a first mean squared error loss value is obtained; and based on the difference between predicted and actual data synchronization priority adjustment coefficients, a second mean squared error loss value is obtained; and the first mean squared error loss value is summed to obtain the total cross-entropy loss value. The difference loss value and the second mean squared error loss value are summed to obtain the mean squared error loss value. Based on the respective weight coefficients of the cross-entropy loss value and the mean squared error loss value, the cross-entropy loss value and the mean squared error loss value are summed to obtain the target loss value. Based on the target loss value, the model parameters of the fault switching action prediction model to be trained are adjusted to obtain the fault switching action prediction model with adjusted model parameters. The fault switching action prediction model with adjusted model parameters is then retrained until the target loss value obtained by the trained fault switching action prediction model is less than the loss value threshold. At this point, training is stopped, and the trained fault switching action prediction model is taken as the completed fault switching action prediction model.
[0126] For example, the target loss value can be calculated using the following formula:
[0127] Equation (2)
[0128] Among them, L ce_dis This refers to the cross-entropy loss value, L. mse_con β1=0.6 and β2=0.4 are the mean squared error loss values, and β1=0.6 and β2=0.4 are the weighting coefficients.
[0129] In this embodiment, by comprehensively collecting multi-dimensional sample data from the sample cloud database, the fault switching action prediction model is iteratively trained, thereby achieving comprehensive optimization of the model's prediction performance and providing reliable intelligent decision support for cloud database fault switching.
[0130] In an exemplary embodiment, step S102 above, which constructs a fault feature vector corresponding to the cloud database based on the operating status data, historical fault data, and business load data, specifically includes the following: performing feature extraction processing on the operating status data, historical fault data, and business load data respectively to obtain the operating status feature vector, historical fault feature vector, and business load feature vector corresponding to the cloud database; and concatenating the operating status feature vector, historical fault feature vector, and business load feature vector to obtain the fault feature vector corresponding to the cloud database.
[0131] Among them, the operational status feature vector refers to the feature vector corresponding to the operational status data. The historical fault feature vector refers to the feature vector corresponding to the historical fault data. The service load feature vector refers to the feature vector corresponding to the service load data.
[0132] For example, the server performs STL (Seasonal and Trend decomposition using Loess) temporal decomposition on the operational status data to obtain the trend component, periodic component, and abnormal fluctuation component in the operational status data. Then, it extracts features through a CNN-1d (1-dimensional Convolutional Neural Network) layer to obtain the operational status feature vector corresponding to the cloud database. Next, it extracts features from the historical fault feature vector through an Embedding layer to obtain the historical fault feature vector corresponding to the cloud database. Finally, it encodes and normalizes the business load data using One-Hot encoding to obtain the business load feature vector corresponding to the cloud database. Then, according to a preset concatenation order, it concatenates the operational status feature vector, the historical fault feature vector, and the business load feature vector to obtain the fault feature vector corresponding to the cloud database.
[0133] In this embodiment, by performing targeted feature extraction on the operating status data, historical fault data, and business load data respectively, the dynamic changes in the real-time operating status of the database, the regular characteristics of historical faults, and the fluctuation characteristics of business load are accurately captured, providing more comprehensive and accurate feature input for subsequent fault detection models.
[0134] In one exemplary embodiment, such as Figure 2 As shown, another intelligent fault switching method for cloud databases in electricity consumption information collection systems is provided. Taking the application of this method to a server as an example, the specific steps include:
[0135] Step S201: Obtain the operating status data, historical fault data, business load data, and node status data of the cloud database to be analyzed from the electricity information collection system.
[0136] Step S202 involves performing feature extraction processing on the running status data, historical fault data, and business load data respectively to obtain the running status feature vector, historical fault feature vector, and business load feature vector corresponding to the cloud database.
[0137] Step S203: The running status feature vector, historical fault feature vector, and business load feature vector are concatenated to obtain the fault feature vector corresponding to the cloud database.
[0138] Step S204: Based on the node status data, construct the node status feature vector corresponding to the database node.
[0139] Step S205: Determine the matching degree between the database node and the fault feature vector based on the fault feature vector and the node state feature vector corresponding to the database node; based on the matching degree, select a preset number of database nodes from each database node as target database nodes in the cloud database.
[0140] Step S206: Average the node state feature vectors corresponding to the target database nodes to obtain the average feature vector; concatenate the fault feature vector and the average feature vector to obtain the first associated feature vector corresponding to the cloud database.
[0141] Step S207: Based on the fault feature vector and business load data, construct the second associated feature vector corresponding to the cloud database.
[0142] Step S208: The fault feature vector and the second associated feature vector are fused to obtain the first fused feature vector corresponding to the cloud database. The node status feature vector and the first associated feature vector corresponding to the database node are fused to obtain the second fused feature vector corresponding to the cloud database.
[0143] Step S209: The first fused feature vector and the second fused feature vector are concatenated to obtain the fused feature vector corresponding to the cloud database.
[0144] Step S210: Input the fused feature vector into the trained fault detection model to obtain the fault detection result corresponding to the cloud database.
[0145] Step S211: Obtain the resource status data and data synchronization progress information corresponding to the cloud database.
[0146] Step S212: Input the fault detection results, node status data, resource status data, and data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient corresponding to the cloud database.
[0147] Step S213: Based on the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient, obtain the fault switching action corresponding to the cloud database.
[0148] Step S214: Perform corresponding fault switching processing on the cloud database according to the fault switching action.
[0149] In the aforementioned intelligent fault switching method for cloud databases in electricity information collection systems, when switching cloud databases, comprehensive multi-dimensional data such as operating status, historical faults, business load, and node status are acquired. Then, by constructing fault feature vectors and node status feature vectors separately and fusing them, the collaborative correlation of multi-dimensional data is explored. Subsequently, the trained fault detection model is used to accurately identify faults, avoiding false alarms and missed alarms caused by traditional rules or fixed thresholds. Finally, the fault detection results and dynamic data such as node status, resource status, and data synchronization progress are input into the fault switching action prediction model to generate personalized switching actions adapted to the current scenario, replacing the traditional static pre-configuration strategy. This ensures that the fault switching decision is both consistent with the fault type and the actual state of the node, and balances load balancing and data consistency. It breaks the limitations of traditional single indicators and is conducive to improving the accuracy of cloud database fault switching.
[0150] In an exemplary embodiment, to more clearly illustrate the cloud database intelligent fault switching method for an electricity consumption information collection system provided in this application, the following specific embodiment will be used to describe the cloud database intelligent fault switching method for an electricity consumption information collection system. In one embodiment, as follows... Figure 3 As shown, this application also provides an intelligent fault switching and data consistency assurance method for a full-stack cloud database in a metering automation system. Specifically, it includes the following:
[0151] 1. Multimodal Fault Feature Fusion Module: The core of this module is to integrate fault features, database status, and business requirements through multi-dimensional feature encoding, correlation modeling, and gating fusion, providing comprehensive feature support for fault detection.
[0152] (1) Multi-dimensional feature encoding: Fault feature encoding: Includes three core features, which are output as fixed-dimensional feature vectors after standardization and embedding. Operational status features: Real-time database operation indicators (hardware: CPU / memory / disk IO utilization, node temperature; network: cross-node latency, bandwidth usage, packet loss rate; software: transaction commit success rate, log write speed) are decomposed by STL, and trend components, periodic components, and abnormal fluctuation components are extracted. Local dependency features are extracted through CNN-1d layer, and a 64-dimensional embedding vector is output. Fault type features: Historical fault records (hardware / software / network / data faults), fault impact range, and fault recovery difficulty are encoded into a 32-dimensional vector through the Embedding layer. This vector is concatenated with the normalized features of fault occurrence frequency and average recovery time, and output as a 32-dimensional embedding vector through a fully connected layer. Business load features: The distribution characteristics of current metering business types, data write frequency, and query concurrency are statistically analyzed. After One-Hot encoding and normalization, a 32-dimensional embedding vector is output through a fully connected layer. Fault Feature Fusion: The three types of feature vectors mentioned above are concatenated into a 128-dimensional comprehensive feature vector. Database Status Feature Encoding: For full-stack cloud database nodes (master node / slave node / backup node / edge node), node health, remaining resource capacity, and network connectivity status are extracted. After standardization, time-dependent features are extracted through a GRU layer, outputting a 64-dimensional status feature vector.
[0153] 2. Correlation Feature Modeling: Fault-State Correlation Features: Calculate the matching degree between fault features and the states of each node, take the average state features of the top-3 related nodes, and concatenate them with the comprehensive fault features. Load-Fault Correlation Features: Analyze the temporal correlation between peak business load and the probability of fault occurrence, extract the correlation features between load mutations and fault precursors, and integrate them into the comprehensive feature vector.
[0154] 3. Gated Fusion Mechanism: A feature fusion network is constructed using two layers of gated recurrent units (GRUs) to dynamically adjust the contribution weights of features across different dimensions. The first layer GRU fuses fault comprehensive features and business requirement features, outputting 128-dimensional fault-requirement fused features. The second layer GRU fuses database state features and fault-state correlation features, outputting 64-dimensional state correlation features.
[0155] 2. Fault detection and localization based on deep neural networks: A dual-channel DNN architecture is adopted to achieve accurate fault identification and node localization.
[0156] (1) Fault Identification Channel (CNN-Transformer Hybrid Architecture): Input multimodal fusion feature vector, extract local key features through CNN layer, and model global feature dependency through Transformer encoder (2 attention heads) to capture the nonlinear correlation between fault features and database status and business load. The output layer adopts Softmax activation function to output the probability of fault occurrence (binary classification: normal / fault) and the probability distribution of fault type (four classification: hardware / software / network / data fault).
[0157] (2) Fault localization channel (attention-enhanced LSTM): Input the state feature vector of each node and the fault-state association feature. Model the temporal dependency between nodes through a bidirectional LSTM layer. Introduce a node attention mechanism to assign higher weights to the nodes with the greatest impact from the fault. Output the node fault probability distribution through a fully connected layer to locate the faulty node and its impact range.
[0158] (3) Model training optimization: The detection network is trained using a hybrid loss function.
[0159] Equation (1)
[0160] Where Lce is the cross-entropy loss (optimizing fault classification accuracy), L F1 F1 loss is used to balance the imbalance between positive and negative samples and reduce the false negative rate. α is a hyperparameter (default 0.2).
[0161] 3. Intelligent fault switching strategy based on multi-objective decision DNN: Based on fault detection results, a multi-objective optimization DNN model is constructed, and the optimal switching strategy is generated through offline training-online inference mode. The core components are completely implemented based on DNN, without the need for reinforcement learning framework.
[0162] (1) Switching decision feature input: Input feature vector: Integrate the fault type / location result (10-dimensional encoding vector), health of each node (8-dimensional), resource load status (6-dimensional), and data synchronization progress (4-dimensional) output by S2, and input the 28-dimensional switching decision input features into the DNN model after standardization.
[0163] (2) Multi-objective decision-making DNN model structure: Model architecture: The fully connected DNN structure of "feature extraction-multi-objective output" is adopted, with a total of 5 layers. Input layer: 28-dimensional decision features. Hidden layer 1: 256 neurons, activation function ReLU, dropout rate 0.2. Hidden layer 2: 128 neurons, activation function ReLU, LayerNorm normalization. Hidden layer 3: 64 neurons, activation function GELU, to enhance nonlinear fitting ability. Output layer: Two parallel outputs, covering discrete action and continuous action decision-making. Discrete action output branch: Softmax activation is adopted to output the probability distribution of two types of discrete actions, specifically the selection of switching target nodes (4 types: master → slave / master → backup / master → edge / slave → backup) and the selection of switching modes (2 types: fast switching / safe switching). Continuous action output branch: Activated by Linear, outputting two types of continuous action values, specifically the resource quota adjustment ratio (0.8-2 times, for CPU / memory / bandwidth, 3 consecutive values) and the data synchronization priority adjustment coefficient (0.5-1.5 times, 1 consecutive value).
[0164] (3) Model Training and Optimization: Construction of Training Sample Library: Collect triplet samples of "input features - optimal switching action - switching effect" under historical fault scenarios. The "optimal switching action" is determined by expert rules and offline simulation verification (e.g., "safe switching + master → backup node" is preferred in core business scenarios, and "fast switching + resource quota 1.5 times" is preferred in high load scenarios). A total of ≥100,000 labeled samples are constructed. Multi-objective loss function: A hybrid loss function is used to optimize the model and balance the classification accuracy of discrete actions with the regression accuracy of continuous actions.
[0165] Equation (2)
[0166] Where: L ce_dis For the cross-entropy loss of discrete actions, L mse_con The mean squared error loss for continuous motion is represented by β1=0.6 and β2=0.4, which are weighting coefficients.
[0167] Training optimization: The AdamW optimizer is used, and the learning rate is dynamically adjusted (initially 1e-3, decaying by 10% every 10 rounds). Overfitting is avoided through an early stopping mechanism (if the validation set loss does not decrease after 3 rounds).
[0168] (4) Switching Execution and Dynamic Adjustment: Online Inference: After a fault occurs, 28-dimensional decision features are collected in real time, input into a pre-trained multi-objective decision DNN, and output discrete action probability distribution and continuous action values. Action Selection: Discrete actions are selected based on the highest probability value, and continuous actions are directly selected based on the output values to generate the final switching instruction; after the switching is completed, three types of indicators are collected: switching delay, data synchronization integrity, and system throughput.
[0169] 4. DNN-driven dynamic data consistency guarantee mechanism: Based on deep neural network prediction and compensation, it ensures data consistency during the switchover process. Feature extraction is performed on the transaction logs of master and slave nodes before and after the switchover, and log consistency is calculated through cosine similarity; if inconsistent data exists, the incremental synchronization compensation module is triggered.
[0170] In the above embodiments, when performing failover on a cloud database, comprehensive multi-dimensional data such as operating status, historical faults, business load, and node status are acquired. Then, by constructing fault feature vectors and node status feature vectors separately and fusing them, the collaborative correlation of multi-dimensional data is explored. Subsequently, the trained fault detection model is used to accurately identify faults, avoiding false alarms and missed alarms caused by traditional rules or fixed thresholds. Finally, the fault detection results and dynamic data such as node status, resource status, and data synchronization progress are input into the failover action prediction model to generate personalized failover actions adapted to the current scenario, replacing the traditional static pre-configuration strategy. This ensures that the failover decision is both consistent with the fault type and the actual state of the node, and balances load balancing and data consistency. It breaks the limitations of traditional single indicators and helps improve the accuracy of cloud database failover.
[0171] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0172] Based on the same inventive concept, this application also provides a cloud database intelligent fault switching device for an electricity consumption information collection system, which implements the cloud database intelligent fault switching method for an electricity consumption information collection system described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the cloud database intelligent fault switching device for an electricity consumption information collection system provided below can be found in the limitations of the cloud database intelligent fault switching method for an electricity consumption information collection system described above, and will not be repeated here.
[0173] In one exemplary embodiment, such as Figure 4As shown, a cloud database intelligent fault switching device for an electricity information collection system is provided, comprising: a data acquisition module 401, a vector construction module 402, a vector fusion module 403, a fault detection module 404, an action prediction module 405, and a fault switching module 406, wherein:
[0174] The data acquisition module 401 is used to acquire the operating status data, historical fault data, business load data, and node status data of the cloud database to be analyzed in the electricity information collection system.
[0175] The vector construction module 402 is used to construct the fault feature vector corresponding to the cloud database based on the running status data, historical fault data, and business load data, and to construct the node status feature vector corresponding to the database node based on the node status data.
[0176] The vector fusion module 403 is used to fuse the fault feature vector and the node state feature vector corresponding to the database node to obtain the fused feature vector corresponding to the cloud database.
[0177] The fault detection module 404 is used to input the fused feature vector into the trained fault detection model to obtain the fault detection result corresponding to the cloud database.
[0178] The action prediction module 405 is used to obtain the resource status data and data synchronization progress information corresponding to the cloud database. It inputs the fault detection results, node status data, resource status data and data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database.
[0179] The fault switching module 406 is used to perform corresponding fault switching processing on the cloud database according to the fault switching action.
[0180] In an exemplary embodiment, the vector fusion module 403 is further configured to: construct a first associated feature vector corresponding to the cloud database based on the fault feature vector and the node state feature vector corresponding to the database node; construct a second associated feature vector corresponding to the cloud database based on the fault feature vector and the business load data; perform fusion processing on the fault feature vector and the second associated feature vector to obtain a first fused feature vector corresponding to the cloud database; perform fusion processing on the node state feature vector corresponding to the database node and the first associated feature vector to obtain a second fused feature vector corresponding to the cloud database; and perform concatenation processing on the first fused feature vector and the second fused feature vector to obtain a fused feature vector corresponding to the cloud database.
[0181] In an exemplary embodiment, the vector fusion module 403 is further configured to determine the matching degree between the database node and the fault feature vector based on the fault feature vector and the node state feature vector corresponding to the database node; based on the matching degree, select a preset number of database nodes from each database node as target database nodes in the cloud database; perform average processing on the node state feature vector corresponding to the target database node to obtain an average feature vector; and perform concatenation processing on the fault feature vector and the average feature vector to obtain the first associated feature vector corresponding to the cloud database.
[0182] In an exemplary embodiment, the action prediction module 405 is further configured to input the fault detection results, node status data, resource status data, and data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient corresponding to the cloud database; and to obtain the fault switching action corresponding to the cloud database based on the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient.
[0183] In an exemplary embodiment, the cloud database intelligent fault switching device for an electricity information collection system further includes a model training module, used to acquire sample operating status data, sample historical fault data, sample service load data, and sample node status data of the sample cloud database; construct sample fault feature vectors corresponding to the sample cloud database based on the sample operating status data, sample historical fault data, and sample service load data, and construct sample node status feature vectors corresponding to the sample database nodes based on the sample node status data; fuse the sample fault feature vectors and the sample node status feature vectors corresponding to the sample database nodes to obtain sample fused feature vectors corresponding to the sample cloud database; input the sample fused feature vectors into the trained fault detection model to obtain sample fault detection results corresponding to the sample cloud database; acquire sample resource status data and sample data synchronization progress information corresponding to the sample cloud database, and input the sample fault detection results, sample node status data, sample resource status data, and sample data synchronization progress information into the fault switching action to be trained. The prediction model obtains the predicted failover actions corresponding to the sample cloud database. Based on the predicted failover actions, it obtains the predicted failover node information, predicted failover mode information, predicted resource quota adjustment ratio, and predicted data synchronization priority adjustment coefficient corresponding to the sample cloud database. It then obtains the actual failover node information, actual failover mode information, actual resource quota adjustment ratio, and actual data synchronization priority adjustment coefficient corresponding to the sample cloud database. Based on the differences between the predicted and actual failover node information, and between the predicted and actual failover mode information, it obtains the cross-entropy loss value. Based on the differences between the predicted and actual resource quota adjustment ratios, and between the predicted and actual data synchronization priority adjustment coefficients, it obtains the mean squared error loss value. The cross-entropy loss value and the mean squared error loss value are fused to obtain the target loss value. Based on the target loss value, the failover action prediction model to be trained is iteratively trained to obtain the trained failover action prediction model.
[0184] In an exemplary embodiment, the vector construction module 402 is further configured to perform feature extraction processing on the running status data, historical fault data, and business load data respectively to obtain the running status feature vector, historical fault feature vector, and business load feature vector corresponding to the cloud database; and to concatenate the running status feature vector, historical fault feature vector, and business load feature vector to obtain the fault feature vector corresponding to the cloud database.
[0185] The modules in the cloud database intelligent fault switching device for the electricity information collection system described above can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0186] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs in the non-volatile storage media to run. The database stores operational status data, historical fault data, etc. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network. When the computer program is executed by the processor, it implements a cloud database intelligent fault switching method for an electricity information collection system.
[0187] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0188] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0189] In one exemplary embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above-described method embodiments.
[0190] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0191] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0192] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0193] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A cloud database intelligent fault switching method for electricity consumption information collection systems, characterized in that, The method includes: Acquire the operational status data, historical fault data, business load data, and node status data of the cloud database to be analyzed from the electricity information collection system; Based on the operational status data, the historical fault data, and the business load data, a fault feature vector corresponding to the cloud database is constructed, and based on the node status data, a node status feature vector corresponding to the database node is constructed. The fault feature vector and the node status feature vector corresponding to the database node are fused to obtain the fused feature vector corresponding to the cloud database. The fused feature vector is input into the trained fault detection model to obtain the fault detection result corresponding to the cloud database; Obtain the resource status data and data synchronization progress information corresponding to the cloud database, and input the fault detection result, the node status data, the resource status data and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database. According to the fault switching action, the cloud database is subjected to corresponding fault switching processing.
2. The method according to claim 1, characterized in that, The process of fusing the fault feature vector and the node state feature vector corresponding to the database node to obtain the fused feature vector corresponding to the cloud database includes: Based on the fault feature vector and the node status feature vector corresponding to the database node, a first associated feature vector corresponding to the cloud database is constructed; based on the fault feature vector and the business load data, a second associated feature vector corresponding to the cloud database is constructed. The fault feature vector and the second associated feature vector are fused to obtain the first fused feature vector corresponding to the cloud database. The node status feature vector corresponding to the database node and the first associated feature vector are fused to obtain the second fused feature vector corresponding to the cloud database. The first fused feature vector and the second fused feature vector are concatenated to obtain the fused feature vector corresponding to the cloud database.
3. The method according to claim 2, characterized in that, The step of constructing the first associated feature vector corresponding to the cloud database based on the fault feature vector and the node state feature vector corresponding to the database node includes: Based on the fault feature vector and the node state feature vector corresponding to the database node, the matching degree between the database node and the fault feature vector is determined; Based on the matching degree, a preset number of database nodes are selected from each of the database nodes as target database nodes in the cloud database; The average feature vector is obtained by averaging the node state feature vectors corresponding to the target database nodes. The fault feature vector and the average feature vector are concatenated to obtain the first associated feature vector corresponding to the cloud database.
4. The method according to claim 1, characterized in that, The step of inputting the fault detection result, the node status data, the resource status data, and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database includes: The fault detection results, node status data, resource status data, and data synchronization progress information are input into the trained fault switching action prediction model to obtain the fault switching node information, fault switching mode information, resource quota adjustment ratio, and data synchronization priority adjustment coefficient corresponding to the cloud database. Based on the fault switching node information, the fault switching mode information, the resource quota adjustment ratio, and the data synchronization priority adjustment coefficient, the fault switching action corresponding to the cloud database is obtained.
5. The method according to claim 1, characterized in that, The trained fault-change action prediction model was obtained through the following method: Obtain sample operation status data, sample historical fault data, sample business load data, and sample node status data of the sample cloud database; Based on the sample operation status data, the sample historical fault data, and the sample service load data, construct the sample fault feature vector corresponding to the sample cloud database, and construct the sample node status feature vector corresponding to the sample database node based on the sample node status data. The sample fault feature vector and the sample node state feature vector corresponding to the sample database node are fused to obtain the sample fused feature vector corresponding to the sample cloud database. The sample fusion feature vector is input into the trained fault detection model to obtain the sample fault detection results corresponding to the sample cloud database; Obtain the sample resource status data and sample data synchronization progress information corresponding to the sample cloud database, and input the sample fault detection result, the sample node status data, the sample resource status data and the sample data synchronization progress information into the fault switching action prediction model to be trained to obtain the predicted fault switching action corresponding to the sample cloud database. Based on the predicted fault switching action, the predicted fault switching node information, predicted fault switching mode information, predicted resource quota adjustment ratio, and predicted data synchronization priority adjustment coefficient corresponding to the sample cloud database are obtained. Obtain the actual fault switching node information, actual fault switching mode information, actual resource quota adjustment ratio, and actual data synchronization priority adjustment coefficient corresponding to the sample cloud database; Based on the differences between the predicted fault switching node information and the actual fault switching node information, and the differences between the predicted fault switching mode information and the actual fault switching mode information, the cross-entropy loss value is obtained. Based on the differences between the predicted resource quota adjustment ratio and the actual resource quota adjustment ratio, and the differences between the predicted data synchronization priority adjustment coefficient and the actual data synchronization priority adjustment coefficient, the mean square error loss value is obtained. The cross-entropy loss value and the mean square error loss value are fused to obtain the target loss value; Based on the target loss value, the fault switching action prediction model to be trained is iteratively trained to obtain the trained fault switching action prediction model.
6. The method according to any one of claims 1 to 5, characterized in that, The step of constructing a fault feature vector corresponding to the cloud database based on the operational status data, the historical fault data, and the business load data includes: The running status data, the historical fault data, and the business load data are respectively processed by feature extraction to obtain the running status feature vector, the historical fault feature vector, and the business load feature vector corresponding to the cloud database. The operating status feature vector, the historical fault feature vector, and the business load feature vector are concatenated to obtain the fault feature vector corresponding to the cloud database.
7. A cloud database intelligent fault switching device for an electricity consumption information collection system, characterized in that, The device includes: The data acquisition module is used to acquire the operating status data, historical fault data, business load data, and node status data of the cloud database to be analyzed in the electricity information collection system. The vector construction module is used to construct a fault feature vector corresponding to the cloud database based on the running status data, the historical fault data, and the business load data, and to construct a node status feature vector corresponding to the database node based on the node status data. The vector fusion module is used to fuse the fault feature vector and the node state feature vector corresponding to the database node to obtain the fused feature vector corresponding to the cloud database. The fault detection module is used to input the fused feature vector into the trained fault detection model to obtain the fault detection result corresponding to the cloud database. The action prediction module is used to obtain the resource status data and data synchronization progress information corresponding to the cloud database, and input the fault detection result, the node status data, the resource status data and the data synchronization progress information into the trained fault switching action prediction model to obtain the fault switching action corresponding to the cloud database. The fault switching module is used to perform corresponding fault switching processing on the cloud database according to the fault switching action.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.