A blockchain node failure recovery method, device and medium
By collecting and analyzing CPU occupancy and status information on blockchain nodes, identifying and recovering abnormal nodes, the problem of targeted fault recovery in the existing technology is solved, and the efficiency and accuracy of fault processing are improved.
Patent Information
- Application Number
- CN202411807407.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-04
AI Technical Summary
The existing technology cannot carry out targeted failure recovery for blockchain nodes, resulting in waste of resources.
By collecting the CPU occupancy rate and node status information of blockchain nodes, conducting initial screening and abnormal analysis, identifying memory abnormal nodes, synchronous abnormal nodes and comprehensive abnormal nodes, and performing targeted recovery operations.
It realizes targeted recovery of blockchain node failures, improves the efficiency and accuracy of fault handling, and reduces the waste of human resources.
Smart Images

Figure CN119766631A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain node failure recovery method, device and medium. Background Art
[0002] Blockchain is a distributed database technology originally designed for cryptocurrencies such as Bitcoin. It is a data structure composed of a series of data blocks (blocks) linked (chain), each of which contains a certain amount of transaction information and metadata related to it. These data blocks are connected together in chronological order to form an immutable, transparent, decentralized ledger. A blockchain node refers to a device or computer that is connected to a blockchain network and participates in the consensus algorithm. Each node plays an important role in the blockchain network and is responsible for maintaining the security, consistency, and availability of the entire blockchain. Nodes communicate with each other through a peer-to-peer network and jointly maintain the data integrity of the blockchain.
[0003] However, at present, when judging the failure of blockchain nodes, detailed analysis of blockchain nodes is not carried out, and the abnormal type of the corresponding faulty node is not identified, and the faulty node is not restored in a targeted manner according to the abnormal type. Instead, the abnormal type is judged uniformly by the user, resulting in a waste of human resources;
[0004] To this end, the present invention proposes a blockchain node failure recovery method, device and medium. Summary of the invention
[0005] The purpose of the present invention is to propose a blockchain node fault recovery method, device and medium to solve the problem of being unable to perform targeted fault recovery on blockchain nodes proposed in the above background technology.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] A blockchain node failure recovery method, the method comprising:
[0008] Step S1, collecting the CPU occupancy rates of multiple blockchain nodes in the target blockchain, and then performing a preliminary screening of abnormalities on the blockchain nodes;
[0009] Step S2, collecting node status information of multiple preliminarily screened normal nodes in the target blockchain;
[0010] Step S3, analyzing the node status information corresponding to the initially screened normal nodes in the target blockchain to determine the abnormal conditions corresponding to the initially screened normal nodes;
[0011] Step S4, performing node abnormality recovery on memory abnormal nodes, synchronization abnormal nodes and comprehensive abnormal nodes in the target blockchain;
[0012] Step S5, the user terminal receives the recovery completion signal, comprehensive abnormality signal, synchronization abnormality signal or memory abnormality signal corresponding to the target blockchain, and the user obtains the status of the corresponding blockchain node based on the recovery completion signal, and dispatches professionals to restore the corresponding blockchain node based on the comprehensive abnormality signal, synchronization abnormality signal or memory abnormality signal.
[0013] Furthermore, the step S1 includes the following sub-steps:
[0014] Step S101, obtaining the CPU occupancy rate of multiple blockchain nodes in the target blockchain;
[0015] Step S102, comparing the CPU occupancy rates of multiple blockchain nodes with a CPU occupancy rate threshold;
[0016] Step S103: for any blockchain node, if the CPU occupancy rate corresponding to the blockchain node is greater than or equal to the CPU occupancy rate threshold, the corresponding blockchain node is recorded as a memory abnormality node;
[0017] Step S104: if the CPU occupancy rate corresponding to the blockchain node is less than the CPU occupancy rate threshold, the corresponding blockchain is recorded as a preliminarily screened normal node;
[0018] Step S105: After all blockchain nodes have completed the initial screening, proceed to the subsequent steps.
[0019] Furthermore, the node status information specifically includes the block height, node response time, node write speed, node read speed and node packet loss rate corresponding to the initially screened normal nodes.
[0020] Furthermore, the step S3 includes the following sub-steps:
[0021] Step S301, obtaining the block heights QGDi of multiple pre-screened normal nodes in the target blockchain, where i is the number corresponding to the pre-screened normal node, i=1, 2, ..., z, and z is a positive integer;
[0022] Step S302, add and average the block heights of multiple pre-screened normal nodes to obtain the mean block height QGJ corresponding to the multiple pre-screened normal nodes, and then calculate the standard deviation QGB of the block heights corresponding to the multiple pre-screened normal nodes by the formula:
[0023]
[0024] Step S303, taking the block height mean minus the block height standard deviation as the first node judgment value, and taking the block height mean plus the block height standard deviation as the second node judgment value; taking the first node judgment value as the left endpoint, and taking the second node judgment value as the right endpoint to obtain the node judgment interval of the target blockchain.
[0025] Furthermore, the step S3 further includes:
[0026] Step S304, comparing the block heights of multiple initially screened normal nodes with the node determination interval, if the block height is outside the node determination interval, the corresponding initially screened normal node is recorded as a synchronous abnormal node;
[0027] Step S305: if the block height of the initially screened normal node is within the node determination interval, then subsequent steps are performed on the initially screened normal node;
[0028] Step S306, obtaining the node response time JXYi, node write speed JXRi, node read speed JDQi and node packet loss rate JDBi corresponding to the initially screened normal nodes;
[0029] Step S307, calculate the node comprehensive abnormal value JZHi corresponding to the normal node in the initial screening by the formula, the specific formula is:
[0030] JZHi=JXYi×A1+(|JXRi-BXR|+|JDQi-BDQ|)×A2+JDBi×A3; wherein BXR is the standard write speed, BDQ is the standard read speed, A1, A2 and A3 are fixed value proportional coefficients, A1, A2 and A3 are all greater than 0 and A1+A2+A3=1.
[0031] Furthermore, the step S3 also includes the following sub-steps:
[0032] Step S308, comparing the node comprehensive abnormal value with the node abnormal threshold; if the node comprehensive abnormal value is less than or equal to the first node abnormal threshold, the corresponding initially screened normal node is identified as a comprehensive normal node;
[0033] Step S309: if the node comprehensive abnormal value is greater than the first node abnormal threshold, and the node comprehensive abnormal value is less than or equal to the second node abnormal threshold, the corresponding initial normal node is identified as the first comprehensive abnormal node;
[0034] Step S310: if the node comprehensive abnormal value is greater than the second node abnormal threshold, the corresponding initial normal node is identified as the second comprehensive abnormal node;
[0035] The first node abnormality threshold is smaller than the second node abnormality threshold, and the fault degree of the second comprehensive abnormal node is higher than the fault degree of the first comprehensive abnormal node.
[0036] Furthermore, the step S4 includes the following sub-steps:
[0037] Step S401, obtaining a memory abnormal node, reading a log file corresponding to the memory abnormal node, logging into the node server, and identifying the process with the highest CPU usage in the log file through a system monitoring tool. If the corresponding process is not a core process, then shutting down the corresponding process;
[0038] Step S402: if the corresponding process is a core process, skip the corresponding core process, select the next process with the second highest CPU usage, and determine whether the process is a core process; and so on, until all processes in the corresponding memory abnormality node are traversed;
[0039] Among them, a process is a running activity of a program in a computer on a certain data set; a core process is a more important process in a blockchain node and is set by the user;
[0040] Step S403, reading the CPU occupancy rate corresponding to the abnormal memory node after the process is closed, and comparing it with the CPU occupancy rate threshold. If the CPU occupancy rate corresponding to the abnormal memory node after the process is closed is less than or equal to the CPU occupancy rate threshold, it is determined that the corresponding abnormal memory node is successfully recovered, and a recovery completion signal is generated;
[0041] Step S404: If the CPU occupancy rate corresponding to the abnormal memory node is still greater than the CPU occupancy rate threshold after the process is closed, it is determined that the abnormal memory node has failed to recover, and a memory abnormality signal is generated.
[0042] Furthermore, the step S4 further includes the following sub-steps:
[0043] Step S405, obtaining the synchronization abnormal node, and then obtaining all adjacent blockchain nodes corresponding to the synchronization abnormal node;
[0044] Step S406, traverse the adjacent blockchain nodes, if the adjacent blockchain node is an abnormal node, disconnect the connection between the synchronous abnormal node and the corresponding abnormal node; if the adjacent blockchain node is a normal node, do not perform any operation;
[0045] Step S407, restart the corresponding synchronization abnormal node, obtain the real-time block height of the corresponding synchronization abnormal node; and compare the real-time block height with the node determination interval. When the real-time block height of the corresponding synchronization abnormal node is within the node determination interval, it is determined that the synchronization abnormal node has been recovered and a recovery completion signal is generated; when the real-time block height of the synchronization abnormal node is outside the node determination interval, it is determined that the corresponding synchronization abnormal node has failed to recover and a synchronization abnormal signal is generated;
[0046] Step S408, obtaining a first comprehensive abnormal node, reconfiguring a network connection corresponding to the first comprehensive abnormal node, and calculating a node comprehensive abnormal value corresponding to the first comprehensive abnormal node again;
[0047] Step S409: if the node comprehensive abnormality value is less than or equal to the first node abnormality threshold, it is determined that the corresponding first comprehensive abnormal node has been recovered and a recovery completion signal is generated; if the node comprehensive abnormality value is greater than the first node abnormality threshold, it is determined that the corresponding first comprehensive abnormal node has failed to recover and a comprehensive abnormality signal is generated;
[0048] Step S410: directly generate a comprehensive abnormal signal for the second comprehensive abnormal node.
[0049] A computer device, comprising:
[0050] A memory storing a computer program;
[0051] A processor is communicatively connected to the memory, and when the computer program is executed by the processor, the above method is implemented.
[0052] A computer-readable storage medium stores a computer program, wherein the program implements the above method when executed by a processor.
[0053] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0054] The present invention first collects the CPU occupancy rates of multiple blockchain nodes in the target blockchain, and then performs a preliminary screening of abnormal determinations on the blockchain nodes; then collects the node status information of multiple pre-screened normal nodes in the target blockchain; at the same time, analyzes the node status information corresponding to the pre-screened normal nodes in the target blockchain, and determines the abnormal conditions corresponding to the pre-screened normal nodes; further, performs node abnormality recovery on memory abnormal nodes, synchronization abnormal nodes, and comprehensive abnormal nodes in the target blockchain according to the above operations; finally, a recovery completion signal, a comprehensive abnormal signal, a synchronization abnormal signal, or a memory abnormal signal corresponding to the target blockchain is received by a user terminal, and the user obtains the status of the corresponding blockchain node according to the recovery completion signal, and dispatches professionals to recover the corresponding blockchain node according to the comprehensive abnormal signal, the synchronization abnormal signal, or the memory abnormal signal; the present invention realizes targeted recovery according to the fault type of the blockchain node; BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.
[0056] Figure 1 is a flow chart of the method of the present invention;
[0057] Figure 2 This is a schematic diagram of the connection of blockchain nodes in the present invention;
[0058] Figure 3 It is a schematic diagram of the structure of the computer device in the present invention. DETAILED DESCRIPTION
[0059] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] Embodiment 1:
[0061] See also Figure 1-Figure 2 As shown, the technical solution provided by the present invention is: a blockchain node failure recovery method, the method is as follows:
[0062] Step S1, collecting the CPU occupancy rates of multiple blockchain nodes in the target blockchain, and then performing a preliminary screening of abnormalities on the blockchain nodes;
[0063] In this embodiment, step S1 includes the following sub-steps:
[0064] Step S101, obtaining the CPU occupancy rate of multiple blockchain nodes in the target blockchain;
[0065] Step S102, comparing the CPU occupancy rates of multiple blockchain nodes with a CPU occupancy rate threshold;
[0066] Step S103: for any blockchain node, if the CPU occupancy rate corresponding to the blockchain node is greater than or equal to the CPU occupancy rate threshold, the corresponding blockchain node is recorded as a memory abnormality node;
[0067] Step S104: if the CPU occupancy rate corresponding to the blockchain node is less than the CPU occupancy rate threshold, the corresponding blockchain is recorded as a preliminarily screened normal node;
[0068] Step S105: After all blockchain nodes have completed the initial screening, proceed to the subsequent steps.
[0069] Step S2, collecting node status information of multiple preliminarily screened normal nodes in the target blockchain; the node status information specifically includes the block height, node response time, node write speed, node read speed and node packet loss rate corresponding to the preliminarily screened normal nodes;
[0070] Among them, the block height refers to the sequence number (or number) of the latest block in the blockchain recorded by the node; in the blockchain network, each block is added to the chain in chronological order, and each block contains a reference to its previous block (ie, hash value), thus forming a continuous and tamper-proof chain structure.
[0071] Step S3, analyzing the node status information corresponding to the initially screened normal nodes in the target blockchain to determine the abnormal conditions corresponding to the initially screened normal nodes;
[0072] In this embodiment, step S3 includes the following sub-steps:
[0073] Step S301, obtaining the block heights QGDi of multiple pre-screened normal nodes in the target blockchain, where i is the number corresponding to the pre-screened normal node, i=1, 2, ..., z, and z is a positive integer;
[0074] Step S302, add and average the block heights of multiple pre-screened normal nodes to obtain the mean block height QGJ corresponding to the multiple pre-screened normal nodes, and then calculate the standard deviation QGB of the block heights corresponding to the multiple pre-screened normal nodes by the formula:
[0075]
[0076] Step S303: subtract the block height standard deviation from the block height mean as the first node determination value, and add the block height standard deviation to the block height mean as the second node determination value; the first node determination value is used as the left endpoint, and the second node determination value is used as the right endpoint to obtain the node determination interval of the target blockchain;
[0077] Step S304, comparing the block heights of multiple initially screened normal nodes with the node determination interval, if the block height is outside the node determination interval, the corresponding initially screened normal node is recorded as a synchronous abnormal node;
[0078] Step S305: if the block height of the initially screened normal node is within the node determination interval, then subsequent steps are performed on the initially screened normal node;
[0079] Step S306, obtaining the node response time JXYi, node write speed JXRi, node read speed JDQi and node packet loss rate JDBi corresponding to the initially screened normal nodes;
[0080] Step S307, calculate the node comprehensive abnormal value JZHi corresponding to the normal node in the initial screening by the formula, the specific formula is:
[0081] JZHi=JXYi×A1+(|JXRi-BXR|+|JDQi-BDQ|)×A2+JDBi×A3; where BXR is the standard write speed, BDQ is the standard read speed, A1, A2 and A3 are fixed value proportional coefficients, A1, A2 and A3 are all greater than 0 and A1+A2+A3=1;
[0082] Step S308, comparing the node comprehensive abnormal value with the node abnormal threshold; if the node comprehensive abnormal value is less than or equal to the first node abnormal threshold, the corresponding initially screened normal node is identified as a comprehensive normal node;
[0083] Step S309: if the node comprehensive abnormal value is greater than the first node abnormal threshold, and the node comprehensive abnormal value is less than or equal to the second node abnormal threshold, the corresponding initial normal node is identified as the first comprehensive abnormal node;
[0084] Step S310: if the node comprehensive abnormal value is greater than the second node abnormal threshold, the corresponding initial normal node is identified as the second comprehensive abnormal node;
[0085] The first node abnormality threshold is smaller than the second node abnormality threshold, and the fault degree of the second comprehensive abnormal node is higher than the fault degree of the first comprehensive abnormal node.
[0086] Step S4, performing node abnormality recovery on memory abnormal nodes, synchronization abnormal nodes and comprehensive abnormal nodes in the target blockchain;
[0087] In this embodiment, step S4 includes the following sub-steps:
[0088] Step S401, obtaining a memory abnormal node, reading a log file corresponding to the memory abnormal node, logging into the node server, and identifying the process with the highest CPU usage in the log file through a system monitoring tool. If the corresponding process is not a core process, then shutting down the corresponding process;
[0089] Step S402: if the corresponding process is a core process, skip the corresponding core process, select the next process with the second highest CPU usage, and determine whether the process is a core process; and so on, until all processes in the corresponding memory abnormality node are traversed;
[0090] Among them, a process is a running activity of a program in a computer on a certain data set; a core process is a more important process in a blockchain node and is set by the user;
[0091] Step S403, reading the CPU occupancy rate corresponding to the abnormal memory node after the process is closed, and comparing it with the CPU occupancy rate threshold. If the CPU occupancy rate corresponding to the abnormal memory node after the process is closed is less than or equal to the CPU occupancy rate threshold, it is determined that the corresponding abnormal memory node is successfully recovered, and a recovery completion signal is generated;
[0092] Step S404: if the CPU occupancy rate corresponding to the abnormal memory node is still greater than the CPU occupancy rate threshold after the process is closed, it is determined that the abnormal memory node has failed to recover, and a memory abnormality signal is generated;
[0093] Step S405, obtaining the synchronization abnormal node, and then obtaining all adjacent blockchain nodes corresponding to the synchronization abnormal node;
[0094] Among them, the adjacent blockchain node is specifically a blockchain node connected to the synchronization abnormal node;
[0095] Step S406, traverse the adjacent blockchain nodes. If the adjacent blockchain node is an abnormal node (memory abnormal node, synchronization abnormal node or comprehensive abnormal node), disconnect the synchronization abnormal node from the corresponding abnormal node; if the adjacent blockchain node is a normal node, do not perform any operation;
[0096] Step S407, restart the corresponding synchronization abnormal node, obtain the real-time block height of the corresponding synchronization abnormal node; and compare the real-time block height with the node determination interval. When the real-time block height of the corresponding synchronization abnormal node is within the node determination interval, it is determined that the synchronization abnormal node has been recovered and a recovery completion signal is generated; when the real-time block height of the synchronization abnormal node is outside the node determination interval, it is determined that the corresponding synchronization abnormal node has failed to recover and a synchronization abnormal signal is generated;
[0097] Step S408, obtaining a first comprehensive abnormal node, and reconfiguring a network connection corresponding to the first comprehensive abnormal node. In the specific operation, a VPN or a proxy server may be used to optimize the network connection, and the node comprehensive abnormal value corresponding to the first comprehensive abnormal node is calculated again;
[0098] Step S409: if the node comprehensive abnormality value is less than or equal to the first node abnormality threshold, it is determined that the corresponding first comprehensive abnormal node has been recovered and a recovery completion signal is generated; if the node comprehensive abnormality value is greater than the first node abnormality threshold, it is determined that the corresponding first comprehensive abnormal node has failed to recover and a comprehensive abnormality signal is generated;
[0099] Step S410: directly generate a comprehensive abnormal signal for the second comprehensive abnormal node.
[0100] Step S5, the user terminal receives the recovery completion signal, comprehensive abnormality signal, synchronization abnormality signal or memory abnormality signal corresponding to the target blockchain, and the user obtains the status of the corresponding blockchain node based on the recovery completion signal, and dispatches professionals to restore the corresponding blockchain node based on the comprehensive abnormality signal, synchronization abnormality signal or memory abnormality signal.
[0101] In this application, if corresponding calculation formulas appear, the above calculation formulas are all dimensionless and take their numerical calculations. The weight coefficients, proportional coefficients and other coefficients in the formulas are set to a result value obtained by quantifying each parameter. The size of the weight coefficient and the proportional coefficient can be determined as long as it does not affect the proportional relationship between the parameter and the result value.
[0102] Embodiment 2:
[0103] Figure 3 The structural diagram of a computer device is illustrated, and the computer device may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus. The processor may call the logic instructions in the memory to execute a blockchain node fault recovery method, which includes: collecting the CPU occupancy rate of multiple blockchain nodes in the target blockchain, and then performing a preliminary screening abnormality judgment on the blockchain node; collecting the node status information of multiple preliminary screening normal nodes in the target blockchain; analyzing the node status information corresponding to the preliminary screening normal nodes in the target blockchain, and judging the abnormal situation corresponding to the preliminary screening normal nodes; performing node abnormality recovery on the memory abnormal nodes, synchronization abnormal nodes, and comprehensive abnormal nodes in the target blockchain; the user terminal receives the recovery completion signal, comprehensive abnormal signal, synchronization abnormal signal, or memory abnormal signal corresponding to the target blockchain, and the user learns the status of the corresponding blockchain node according to the recovery completion signal, and dispatches professionals to recover the corresponding blockchain node according to the comprehensive abnormal signal, synchronization abnormal signal, or memory abnormal signal.
[0104] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0105] On the other hand, the present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a blockchain node fault recovery method provided by the above methods, the method including: collecting the CPU occupancy rate of multiple blockchain nodes in the target blockchain, and then performing an initial screening of abnormalities on the blockchain nodes; collecting node status information of multiple initially screened normal nodes in the target blockchain; analyzing the node status information corresponding to the initially screened normal nodes in the target blockchain, and judging the abnormal conditions corresponding to the initially screened normal nodes; performing node abnormality recovery on memory abnormal nodes, synchronization abnormal nodes and comprehensive abnormal nodes in the target blockchain; the user terminal receives the recovery completion signal, comprehensive abnormal signal, synchronization abnormal signal or memory abnormal signal corresponding to the target blockchain, the user obtains the status of the corresponding blockchain node based on the recovery completion signal, and dispatches professionals to recover the corresponding blockchain nodes based on the comprehensive abnormal signal, synchronization abnormal signal or memory abnormal signal.
[0106] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, which is implemented when the processor executes a blockchain node fault recovery method provided above, the method comprising: collecting the CPU occupancy rates of multiple blockchain nodes in the target blockchain, and then performing an initial screening of abnormalities on the blockchain nodes; collecting node status information of multiple initially screened normal nodes in the target blockchain; analyzing the node status information corresponding to the initially screened normal nodes in the target blockchain, and judging the abnormal conditions corresponding to the initially screened normal nodes; performing node abnormality recovery on memory abnormal nodes, synchronization abnormal nodes, and comprehensive abnormal nodes in the target blockchain; a user terminal receives a recovery completion signal, a comprehensive abnormality signal, a synchronization abnormality signal, or a memory abnormality signal corresponding to the target blockchain, and the user obtains the status of the corresponding blockchain node based on the recovery completion signal, and dispatches professionals to recover the corresponding blockchain nodes based on the comprehensive abnormality signal, the synchronization abnormality signal, or the memory abnormality signal.
[0107] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A blockchain node failure recovery method, characterized in that: Methods include: Step S1, collecting the CPU occupancy rates of multiple blockchain nodes in the target blockchain, and then performing a preliminary screening of abnormalities on the blockchain nodes; Step S2, collecting node status information of multiple preliminarily screened normal nodes in the target blockchain; Step S3, analyzing the node status information corresponding to the initially screened normal nodes in the target blockchain to determine the abnormal conditions corresponding to the initially screened normal nodes; Step S4, performing node abnormality recovery on memory abnormal nodes, synchronization abnormal nodes and comprehensive abnormal nodes in the target blockchain; Step S5, the user terminal receives the recovery completion signal, comprehensive abnormality signal, synchronization abnormality signal or memory abnormality signal corresponding to the target blockchain, and the user obtains the status of the corresponding blockchain node based on the recovery completion signal, and dispatches professionals to restore the corresponding blockchain node based on the comprehensive abnormality signal, synchronization abnormality signal or memory abnormality signal.
2. A blockchain node failure recovery method according to claim 1, characterized in that: The step S1 includes the following sub-steps: Step S101, obtaining the CPU occupancy rate of multiple blockchain nodes in the target blockchain; Step S102, comparing the CPU occupancy rates of multiple blockchain nodes with a CPU occupancy rate threshold; Step S103: for any blockchain node, if the CPU occupancy rate corresponding to the blockchain node is greater than or equal to the CPU occupancy rate threshold, the corresponding blockchain node is recorded as a memory abnormality node; Step S104: if the CPU occupancy rate corresponding to the blockchain node is less than the CPU occupancy rate threshold, the corresponding blockchain is recorded as a preliminarily screened normal node; Step S105: After all blockchain nodes have completed the initial screening, proceed to the subsequent steps.
3. A blockchain node failure recovery method according to claim 1, characterized in that: The node status information specifically includes the block height corresponding to the initially screened normal nodes, the node response time, the node write speed, the node read speed and the node packet loss rate.
4. A blockchain node failure recovery method according to claim 1, characterized in that: The step S3 includes the following sub-steps: Step S301, obtaining the block heights QGDi of multiple pre-screened normal nodes in the target blockchain, where i is the number corresponding to the pre-screened normal node, i=1, 2, ..., z, and z is a positive integer; Step S302, add and average the block heights of multiple pre-screened normal nodes to obtain the mean block height QGJ corresponding to the multiple pre-screened normal nodes, and then calculate the standard deviation QGB of the block heights corresponding to the multiple pre-screened normal nodes by the formula: Step S303, taking the block height mean minus the block height standard deviation as the first node judgment value, and taking the block height mean plus the block height standard deviation as the second node judgment value; taking the first node judgment value as the left endpoint, and taking the second node judgment value as the right endpoint to obtain the node judgment interval of the target blockchain.
5. A blockchain node failure recovery method according to claim 4, characterized in that: The step S3 further comprises: Step S304, comparing the block heights of multiple initially screened normal nodes with the node determination interval, if the block height is outside the node determination interval, the corresponding initially screened normal node is recorded as a synchronous abnormal node; Step S305: if the block height of the initially screened normal node is within the node determination interval, then subsequent steps are performed on the initially screened normal node; Step S306, obtaining the node response time JXYi, node write speed JXRi, node read speed JDQi and node packet loss rate JDBi corresponding to the initially screened normal nodes; Step S307, calculate the node comprehensive abnormal value JZHi corresponding to the normal node in the initial screening by the formula, the specific formula is: JZHi=JXYi×A1+(|JXRi-BXR|+|JDQi-BDQ|)×A2+JDBi×A3; wherein BXR is the standard write speed, BDQ is the standard read speed, A1, A2 and A3 are fixed value proportional coefficients, A1, A2 and A3 are all greater than 0 and A1+A2+A3=1.
6. A blockchain node failure recovery method according to claim 5, characterized in that: The step S3 further comprises the following sub-steps: Step S308, comparing the node comprehensive abnormal value with the node abnormal threshold; if the node comprehensive abnormal value is less than or equal to the first node abnormal threshold, the corresponding initially screened normal node is identified as a comprehensive normal node; Step S309: if the node comprehensive abnormal value is greater than the first node abnormal threshold, and the node comprehensive abnormal value is less than or equal to the second node abnormal threshold, the corresponding initial normal node is identified as the first comprehensive abnormal node; Step S310: if the node comprehensive abnormal value is greater than the second node abnormal threshold, the corresponding initial normal node is identified as the second comprehensive abnormal node; The first node abnormality threshold is smaller than the second node abnormality threshold, and the fault degree of the second comprehensive abnormal node is higher than the fault degree of the first comprehensive abnormal node.
7. A blockchain node failure recovery method according to claim 1, characterized in that: The step S4 includes the following sub-steps: Step S401, obtaining a memory abnormal node, reading a log file corresponding to the memory abnormal node, logging into the node server, and identifying the process with the highest CPU usage in the log file through a system monitoring tool. If the corresponding process is not a core process, then shutting down the corresponding process; Step S402: if the corresponding process is a core process, skip the corresponding core process, select the next process with the second highest CPU usage, and determine whether the process is a core process; and so on, until all processes in the corresponding memory abnormality node are traversed; Among them, a process is a running activity of a program in a computer on a certain data set; a core process is a more important process in a blockchain node and is set by the user; Step S403, reading the CPU occupancy rate corresponding to the abnormal memory node after the process is closed, and comparing it with the CPU occupancy rate threshold. If the CPU occupancy rate corresponding to the abnormal memory node after the process is closed is less than or equal to the CPU occupancy rate threshold, it is determined that the corresponding abnormal memory node is successfully recovered, and a recovery completion signal is generated; Step S404: If the CPU occupancy rate corresponding to the abnormal memory node is still greater than the CPU occupancy rate threshold after the process is closed, it is determined that the abnormal memory node has failed to recover, and a memory abnormality signal is generated.
8. A blockchain node failure recovery method according to claim 1, characterized in that: The step S4 also includes the following sub-steps: Step S405, obtaining the synchronization abnormal node, and then obtaining all adjacent blockchain nodes corresponding to the synchronization abnormal node; Step S406, traverse the adjacent blockchain nodes, if the adjacent blockchain node is an abnormal node, disconnect the connection between the synchronous abnormal node and the corresponding abnormal node; if the adjacent blockchain node is a normal node, do not perform any operation; Step S407, restart the corresponding synchronization abnormal node, and obtain the real-time block height of the corresponding synchronization abnormal node; The real-time block height is compared with the node determination interval. When the real-time block height of the corresponding synchronization abnormal node is within the node determination interval, it is determined that the synchronization abnormal node has been recovered and a recovery completion signal is generated; when the real-time block height of the synchronization abnormal node is outside the node determination interval, it is determined that the corresponding synchronization abnormal node has failed to recover and a synchronization abnormal signal is generated; Step S408, obtaining a first comprehensive abnormal node, reconfiguring a network connection corresponding to the first comprehensive abnormal node, and calculating a node comprehensive abnormal value corresponding to the first comprehensive abnormal node again; Step S409: if the node comprehensive abnormality value is less than or equal to the first node abnormality threshold, it is determined that the corresponding first comprehensive abnormal node has been recovered and a recovery completion signal is generated; if the node comprehensive abnormality value is greater than the first node abnormality threshold, it is determined that the corresponding first comprehensive abnormal node has failed to recover and a comprehensive abnormality signal is generated; Step S410: directly generate a comprehensive abnormal signal for the second comprehensive abnormal node.
9. A computer device, characterized in that: The computer device comprises: A memory storing a computer program; A processor is communicatively connected to the memory, and when the computer program is executed by the processor, the method described in any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.