Distributed system, fault test method and device thereof and medium

By dividing the client and server in a distributed system and executing fault testing strategies, the accuracy of traditional fault testing in the case of failure superposition is solved, efficient fault detection and testing of distributed systems is realized, and the system is improved Performance and reliability.

CN118890359AActive Publication Date: 2024-11-01JINAN INSPUR DATA TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411123871.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-11-01
Estimated Expiration
2044-08-15

AI Technical Summary

Technical Problem

In distributed systems, traditional fault testing solutions are difficult to accurately analyze the cause of failures, especially when faults are superimposed, resulting in inaccurate test results, affecting system performance and reliability.

Method used

By dividing the client and the server in a distributed system, the fault testing strategy is adopted, including fault injection commands, fault recovery commands and status monitoring commands. The client sends these commands to the server to perform fault testing and determines the configuration information based on the result determination Fault test results to realize independent fault detection for each node.

Benefits of technology

It improves the accuracy and efficiency of fault testing, goes deep into each node to determine the cause of the fault, avoids the difficult judgment problems caused by the superposition of faults, improves the software quality of distributed systems and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890359A_ABST
    Figure CN118890359A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed system, a fault testing method and device thereof and a medium, relates to the technical field of distributed systems, is used for realizing fault testing of the distributed system, and provides the fault testing method of the distributed system aiming at the fault superposition problem which is difficult to solve by a traditional fault testing scheme. According to the invention, independent fault testing of each node can be realized, and fault reasons and whether fault processing accords with expectations are deepened to each node, so that the problem that faults among multiple nodes are difficult to judge due to superposition is effectively avoided. On the basis, the fault test of the distributed system is carried out through the method, so that the test efficiency and accuracy can be improved, the software quality of the distributed system is improved, the maintenance cost is reduced, and the extra analysis workload of development is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed systems, and in particular to a distributed system, and a fault testing method, device and medium thereof. Background Art

[0002] A distributed system is a system composed of multiple computers and communication networks. Unlike a centralized system, it has no central control node, and each node can handle tasks independently. This architecture has more efficient performance for the storage, processing, and query operations of large-scale data. As a product, a distributed system generally requires multiple tests to ensure its performance and reliability.

[0003] At present, fault testing of distributed systems still basically needs to rely on manual implementation, and targeted fault testing of various functions of distributed systems is performed through black box testing. However, when performing fault testing through the above scheme, the problem that testers cannot accurately analyze the cause of the fault due to fault superposition often occurs. In a distributed system, since each node can run independently and there is a certain degree of coupling between nodes, when different faults occur in several nodes, the external manifestation is a composite fault caused by the superposition of multiple faults. Therefore, it is difficult for testers to determine whether the fault handling meets expectations, and development intervention is required. Alternatively, there may be a problem that the performance of the fault handling meets expectations, but the actual logic operation of the software is not correct. The above problems all lead to the inability to accurately implement fault testing of distributed systems, thereby affecting the performance and reliability of distributed systems.

[0004] Therefore, technicians in this field are in urgent need of a distributed system fault testing method to solve the problem that traditional fault testing solutions are difficult to ensure test accuracy in scenarios such as distributed systems where fault superposition problems are prone to occur. Summary of the invention

[0005] The purpose of the present invention is to provide a distributed system, and a fault testing method, device and medium thereof, so as to solve the problem that traditional fault testing schemes are difficult to ensure test accuracy in scenarios such as distributed systems where fault superposition problems are prone to occur.

[0006] In order to solve the above technical problems, the present invention provides a distributed system fault testing method, which is applied to a distributed system; the distributed system comprises: a plurality of nodes, wherein one node is used as a client and the other nodes are used as servers;

[0007] The method is applied to the client, comprising:

[0008] Obtaining a fault test strategy; wherein a set of fault test strategies includes: an Internet Protocol address of a node, a fault injection command, a fault recovery command, a status monitoring command, and result determination configuration information;

[0009] According to the Internet Protocol address, the fault injection command, the fault recovery command and the state monitoring command in the same group of the fault testing strategy are sent to the corresponding server, so that the server: executes the fault injection command to perform fault injection and obtains the fault injection result; executes the fault recovery command to perform fault recovery; executes the state monitoring command to monitor the change of the specified state after fault injection and fault recovery, and obtains the state monitoring result; returns the fault injection result and the state monitoring result to the client;

[0010] Receiving the fault injection result and the status monitoring result returned by the server;

[0011] The configuration information is determined based on the result, and the fault test result is determined according to the corresponding fault injection result and the status monitoring result.

[0012] In a possible embodiment, determining the configuration information based on the result, and determining the fault test result according to the corresponding fault injection result and the state monitoring result includes:

[0013] According to the fault injection result, determining whether the fault injection of the server is successful;

[0014] If the fault injection is successful, the configuration information and the status monitoring result are determined according to the result to determine whether the change of the specified status meets expectations;

[0015] If it is met, the fault test result is determined to be a test success;

[0016] If not, the fault test result is determined to be a test failure;

[0017] If the fault injection fails, resending the fault injection command to the corresponding server so that the server performs the fault injection again;

[0018] The method further comprises:

[0019] Counting the number of repetitions of sending the same fault injection command;

[0020] If the number of repetitions exceeds the preset repetition threshold, an alarm is issued and the corresponding prompt information is returned;

[0021] Wherein, the prompt information includes: the fault injection command and the corresponding Internet Protocol address.

[0022] In a possible embodiment, if multiple groups of the fault testing strategies are obtained;

[0023] Then, according to the Internet Protocol address, sending the fault injection command, the fault recovery command and the status monitoring command in the same group of the fault testing strategy to the corresponding server includes:

[0024] Classifying each group of the fault testing strategies according to the Internet Protocol address;

[0025] Each group of the fault injection command, the fault recovery command and the status monitoring command corresponding to a certain server is packaged and sent to the corresponding server.

[0026] In a possible embodiment, before sending the fault injection command, the fault recovery command, and the status monitoring command in the same group of the fault testing strategies to the corresponding server according to the Internet Protocol address, the method further includes:

[0027] Get node configuration information;

[0028] A communication connection establishment request is sent to each of the server ends according to the node configuration information, so as to establish a communication connection with each of the server ends.

[0029] To solve the above technical problems, the present invention also provides a distributed system fault testing method, which is applied to a distributed system; the distributed system comprises: a plurality of nodes, wherein one node is used as a client and the other nodes are used as servers;

[0030] This method is applied to the server, and includes:

[0031] Receiving a fault injection command, a fault recovery command, and a status monitoring command sent by the client;

[0032] Performing fault injection according to the fault injection command and obtaining the fault injection result;

[0033] After the fault is injected, performing fault recovery according to the fault recovery command;

[0034] Monitor changes in a specified state after fault injection and fault recovery according to the state monitoring command, and obtain a state monitoring result;

[0035] The fault injection result and the status monitoring result are returned to the client so that the client can: determine the configuration information based on the result of the fault testing strategy belonging to the same group as the fault injection command, the fault recovery command and the status monitoring command, and determine the fault testing result according to the corresponding fault injection result and the status monitoring result.

[0036] In a possible embodiment, it further includes:

[0037] Create a first process and a second process;

[0038] The first process is used to: execute the fault injection command and return the fault injection result to the client; and execute the fault recovery command after executing the fault injection command;

[0039] The second process is used to: execute the status monitoring command and return the status monitoring result to the client;

[0040] The first process and the second process are two processes running in parallel.

[0041] In a possible embodiment, returning the fault injection result and the status monitoring result to the client includes:

[0042] Parsing the fault injection result and the state monitoring result to obtain a plurality of result items including timing characteristics;

[0043] Rearrange the result items according to the time sequence and merge them into a result data packet;

[0044] The result data packet is sent to the client.

[0045] In a possible embodiment, before receiving the fault injection command, the fault recovery command and the status monitoring command sent by the client, the method further includes:

[0046] Opening a socket connection and waiting for a communication connection establishment request sent by the client;

[0047] After receiving the communication connection establishment request sent by the client, respond to the communication connection establishment request to establish a communication connection with the client.

[0048] In order to solve the above technical problems, the present invention also provides a distributed system fault testing device, characterized in that it is applied to a distributed system; the distributed system comprises: a plurality of nodes, wherein one node is used as a client and the other nodes are used as servers;

[0049] The device is applied to the client, and includes:

[0050] A strategy acquisition module is used to acquire a fault test strategy; wherein a set of fault test strategies includes: an Internet Protocol address of a node, a fault injection command, a fault recovery command, a status monitoring command, and result determination configuration information;

[0051] A policy distribution module, for sending the fault injection command, the fault recovery command and the state monitoring command in the same group of the fault test policy to the corresponding server according to the Internet Protocol address, so that the server: executes the fault injection command to perform fault injection and obtains the fault injection result; executes the fault recovery command to perform fault recovery; executes the state monitoring command to monitor the change of the specified state after fault injection and fault recovery, and obtains the state monitoring result; returns the fault injection result and the state monitoring result to the client;

[0052] A result receiving module, used for receiving the fault injection result and the status monitoring result returned by the server;

[0053] A fault determination module is used to determine the configuration information based on the result, and determine the fault test result according to the corresponding fault injection result and the state monitoring result.

[0054] In order to solve the above technical problems, the present invention also provides a distributed system fault testing device, which is applied to a distributed system; the distributed system comprises: a plurality of nodes, wherein one node is used as a client and the other nodes are used as servers;

[0055] The device is applied to the server, and includes:

[0056] A command receiving module, used for receiving a fault injection command, a fault recovery command and a status monitoring command sent by the client;

[0057] A fault injection module, used to perform fault injection according to the fault injection command and obtain a fault injection result;

[0058] A fault recovery module, used for performing fault recovery according to the fault recovery command after the fault is injected;

[0059] A state monitoring module, used to monitor the changes of a specified state after fault injection and fault recovery according to the state monitoring command, and obtain state monitoring results;

[0060] A result returning module is used to return the fault injection result and the status monitoring result to the client, so that the client can: determine the configuration information based on the result of the fault testing strategy belonging to the same group as the fault injection command, the fault recovery command and the status monitoring command, and determine the fault testing result according to the corresponding fault injection result and the status monitoring result.

[0061] A distributed system applied to the client side, including: multiple nodes; one node acts as a client and the other nodes act as servers;

[0062] in:

[0063] The client is used to implement the steps of the distributed system fault testing method applied to the client side as described above;

[0064] The server is used to implement the steps of the distributed system fault testing method applied to the server side as described above.

[0065] In order to solve the above technical problem, the present invention also provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the distributed system fault testing method as described above are implemented.

[0066] The present invention provides a distributed system fault testing method, which utilizes existing nodes in the distributed system to divide them into a client (Client) and a server (Server), and respectively executes different fault testing logics. Specifically, after the client obtains the fault testing strategy for the actual fault testing, it sends the corresponding fault injection command, fault recovery command, and status monitoring command to the corresponding server, that is, the corresponding node, according to the Internet Protocol (IP) address of the node therein; then, the server receives the above commands and executes them to complete the corresponding fault testing process, and returns the corresponding results (that is, fault injection results and status monitoring results) to the client; after the client receives the test results returned by the server, it can determine the configuration information according to the results in the fault testing strategy, process the test results, determine the fault test results of the server, and complete a fault test case for the node.

[0067] In summary, this method adopts the client / server (C / S) architecture. The client can implement independent fault testing of each server in the distributed system, and realize fault detection deep into the node level in the distributed system, thereby effectively solving the problem of fault superposition between nodes. The fault test implemented based on this method can realize independent fault testing of each node, and the cause of the fault and whether the fault handling meets expectations are deeply rooted in each node, thereby effectively avoiding the problem that the faults between multiple nodes are difficult to judge due to superposition. Based on this, the fault testing of distributed systems through this method can improve the test efficiency and accuracy, which is conducive to improving the software quality of distributed systems, reducing maintenance costs, and reducing the additional analysis workload of development.

[0068] The distributed system, fault testing device, and non-volatile storage medium provided by the present invention correspond to the above method and have the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0070] FIG1 is a structural diagram of a distributed system provided by the present invention;

[0071] FIG2 is a flow chart of a distributed system fault testing method applied to a client side provided by the present invention;

[0072] FIG3 is a flow chart of a distributed system fault testing method applied to a server side provided by the present invention;

[0073] FIG4 is a structural diagram of a distributed system fault testing device applied to a client side provided by the present invention;

[0074] FIG5 is a structural diagram of a distributed system fault testing device applied to a server side provided by the present invention. DETAILED DESCRIPTION

[0075] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not 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.

[0076] The core of the present invention is to provide a distributed system, and a fault testing method, device and medium thereof.

[0077] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0078] For devices and systems with high data processing capabilities, such as computers, testing the software in them is also an important means to ensure the performance of the devices and systems. One of the most common test scenarios at present is the fault test scenario. As a system composed of multiple computers and communication networks, the distributed system also has the need for fault testing. The current mainstream fault testing solution is to conduct targeted tests on the functions of the distributed system through manual black box testing to determine whether a fault occurs.

[0079] However, due to the special structure of distributed systems, which contain multiple nodes that can run independently and have certain coupling between each other, a service may be implemented by multiple nodes in collaboration. Based on this, when performing fault testing, fault superposition may occur, that is, multiple nodes have faults, and these faults affect each other, which reflects a more complex superposition fault performance to the outside world.

[0080] Due to the existence of this fault superposition problem, there are too many combinations of node status after the failure and the performance of the software's fault handling function. Testers who are proficient in fault handling functions and developers of distributed systems need to personally intervene in the analysis to conduct fault testing, and it is also difficult to ensure the accuracy of fault testing.

[0081] Therefore, in order to solve the above-mentioned fault testing problem in the fault superposition scenario that is easy to occur in the distributed system, the present invention provides a distributed system fault testing method. The method is applied to a distributed system, as shown in Figure 1, the distributed system includes: multiple nodes. Among them, one node is used as a client, and the other nodes are used as servers.

[0082] It should be noted that this method is implemented on both the client and server sides in the above-mentioned distributed system. The following embodiments will explain this method in detail from the client and server sides respectively:

[0083] First, applied to the client, as shown in FIG2 , the method includes:

[0084] S11: Obtain a fault testing strategy.

[0085] A set of fault testing strategies includes: Internet protocol addresses of nodes, fault injection commands, fault recovery commands, status monitoring commands and result determination configuration information.

[0086] S12: Sending the fault injection command, fault recovery command and status monitoring command in the same group of fault testing strategies to the corresponding server according to the Internet Protocol address.

[0087] For the convenience of the server: execute the fault injection command to perform fault injection and obtain the fault injection result; execute the fault recovery command to perform fault recovery; execute the status monitoring command to monitor the changes of the specified status after fault injection and fault recovery, and obtain the status monitoring result; return the fault injection result and status monitoring result to the client.

[0088] S13: Receive the fault injection result and status monitoring result returned by the server.

[0089] S14: Determine the fault test result based on the result judgment configuration information and the corresponding fault injection result and status monitoring result.

[0090] As for step S11, it is easy to understand that a distributed system generally includes one client and multiple servers. A fault test performed on a server is implemented through a set of fault test strategies. Accordingly, if multiple nodes (servers) are fault tested by this method in actual applications, or a node is subjected to multiple different fault tests, the fault test strategies obtained in step S11 may include multiple groups.

[0091] Each set of fault test strategies corresponds to a fault test case of a node. As mentioned above, a set of fault test strategies includes but is not limited to: the Internet Protocol (IP) address of the node, fault injection command, fault recovery command, status monitoring command and result judgment configuration information. Among them:

[0092] 1. The IP address of the node, which represents the node (server) corresponding to this fault test strategy. The client can determine the server applicable to this fault test strategy through the IP address of the node.

[0093] 2. Fault injection command, that is, a command used to simulate fault scenarios. When executed by the corresponding node, this command can be used to inject specific faults to simulate the corresponding node into the corresponding fault environment and implement fault testing.

[0094] That is, the fault injection command is a command that simulates a specific fault environment, which may be a single command or a set of multiple commands. For example, if the fault test item is a sub-healthy network fault of the test node, a possible fault injection command includes:

[0095] Commands for initializing the network sub-health environment, modifying network sub-health configuration parameters, and injecting network delay.

[0096] Since the above commands are all common commands in the actual operation of the distributed storage system, the specific command format, ie, implementation, will not be described in detail in this embodiment.

[0097] In addition, this embodiment provides another example. If the fault test item is a slow disk access fault of the test node, a possible fault injection command includes:

[0098] Commands for initializing a slow disk access failure environment and for injecting a slow disk failure into a disk.

[0099] It can be seen from the above examples that this method supports any single node fault test case. In the fault injection command link, it can be obtained by simulating the instruction set of the corresponding fault environment.

[0100] 3. Fault recovery command, that is, a command to implement a recovery method for a corresponding fault, used to recover the fault problem simulated by the fault injection command.

[0101] Similar to the fault injection command mentioned above, the fault recovery command can also be a command or a set of multiple commands, which needs to be determined according to the specific fault type. When the fault test strategy is an existing fault test case and the fault type is known, the corresponding fault handling method is also known, and its specific fault handling instruction is the fault recovery command mentioned above.

[0102] 4. Status monitoring commands, that is, instructions for monitoring specific status changes that require attention during fault injection and fault repair.

[0103] It is easy to know that for different fault types, the state changes that need to be paid attention to are also different. For example, in the network sub-health fault test in the above example, the point of concern is the change of the node network port status (the change between the two states of the network port up and down). Similarly, for the slow disk access fault in another example, the point of concern is the process status of osd and the storage service status of ceph.

[0104] Ceph is an open source distributed storage service, and osd is the process by which ceph accesses disks. It is important to note that if the status of osd changes to down, the status of ceph will change from ok to warning.

[0105] 5. Result judgment configuration information, that is, the basis for judging the test results for specific faults.

[0106] It is easy to understand that, because different fault types focus on different state changes, the corresponding result judgment basis is also different.

[0107] For example, for the network sub-health fault test case in the above example, a possible result judgment configuration information thereof includes: the network port status changes to down within a first time range after the fault is injected; and the network port status changes back to up within a second time range after the fault is injected. In practical applications, the first time range can be 20 to 50 seconds, and the second time range can be 100 to 150 seconds.

[0108] In addition, for the disk access slow fault test case in the above example, a possible result judgment configuration information corresponding thereto includes: osd becomes down within the third time range after the fault is injected; and the ceph status changes back to warning within the fourth time range after the fault is injected. In practical applications, the third time range can be 20~50s, and the fourth time range can be 20~60s.

[0109] It can be seen that, based on the existing test cases of the types of failures that may occur to the nodes, they can be encapsulated in the form of fault test strategies based on the form of the above instructions. In practical applications, the fault test strategy can be encapsulated as a fault test interface, and the corresponding fault test cases can be implemented by directly calling. In addition, the present method also supports the expansion of fault test cases, as long as the form of the fault test strategy given in the above embodiment is used, the IP address of the node to be tested is specified, the fault simulation process, the fault recovery process, and the monitoring process of the concerned state are converted into the form of instructions that can be executed by the node to be tested, and the corresponding fault result judgment basis is encapsulated, the expansion of the fault test strategy can be realized, and the implementation of any type of fault test case can be realized.

[0110] Based on this, for step S12, the node IP address in the fault testing strategy is mainly used by the client to determine the corresponding server and does not need to be sent to the server; the fault injection command, fault recovery command and status monitoring command are executed in the server, and the client needs to send them to the specified server according to the IP address after obtaining the fault testing strategy to complete the fault test of the specified node; the result judgment configuration information does not need to be sent to the server, and is the basis for the client to determine the final fault test result based on the results returned by the server (fault injection results and status monitoring results), and does not need to be sent to the server.

[0111] That is, in step S12, for the implementation of any fault test case, after the client obtains the complete fault test strategy, the fault injection command, fault recovery command and status monitoring command in the fault test strategy are selectively sent to the corresponding server, and the rest does not need to be sent to the server.

[0112] Correspondingly, after receiving the above command, the server needs to return the corresponding result to the client to complete the execution of a command. Specifically, the fault injection results corresponding to the fault injection command include two types: fault injection success and fault injection failure. The state monitoring results are relatively complex, and it is necessary to record the changes in specific states according to the actual focus points. It should also be noted that the determination of the above results should also include timing characteristics, that is, if the result of fault injection success / failure is obtained at a certain moment, or if a certain change occurs in the state of concern at a certain moment.

[0113] After that, for step S13, the fault injection result and status monitoring result returned by the corresponding server are obtained. It is easy to know that based on the node IP address returned to the server, a corresponding relationship between the server return result and the result judgment configuration information can be established. So that step S14 can process and judge the fault injection result and status monitoring result through the result judgment configuration information, obtain the final fault test result, judge whether this fault test is successful or failed, and complete a fault test.

[0114] As can be seen from the above, the present invention provides a distributed system fault testing method, which divides each node in the distributed system into two types: client and server, that is, constructs a client / server (Client / Server, C / S) architecture. Among them, the client can implement independent fault testing of each server in the distributed system, and realizes fault detection deep into the node level in the distributed system, thereby effectively solving the problem of fault superposition between nodes. The fault test implemented based on this method can realize independent fault testing of each node, and the cause of the fault and whether the fault handling meets expectations are deeply rooted in each node, thereby effectively avoiding the problem that the faults between multiple nodes are difficult to judge due to superposition. Based on this, the fault testing of the distributed system by this method can improve the test efficiency and accuracy, which is conducive to improving the software quality of the distributed system, reducing maintenance costs, and reducing the additional analysis workload of development.

[0115] Furthermore, based on the distributed system fault testing method provided on the client side, this embodiment further provides a possible implementation scheme for determining the fault test result. The above step S14 specifically includes:

[0116] S141: According to the fault injection result, determine whether the server has successfully injected the fault; if the fault injection is successful, go to step S142; if the fault injection fails, go to step S145.

[0117] S142: Determine the configuration information and status monitoring results based on the results to determine whether the change in the specified status meets expectations; if so, go to step S143; if not, go to step S144.

[0118] S143: Determine that the fault test result is a test success.

[0119] S144: Determine that the fault test result is a test failure.

[0120] S145: resend the fault injection command to the corresponding server, so that the server performs fault injection again.

[0121] It should be noted that step S145 of this embodiment can be implemented by re-executing step S12, or by re-sending the fault injection command alone, which is not limited in this embodiment.

[0122] Accordingly, the method further comprises:

[0123] S151: Count the number of times the same fault injection command is sent repeatedly.

[0124] S152: If the number of repetitions exceeds a preset repetition threshold, an alarm is issued and corresponding prompt information is returned.

[0125] The prompt information includes: a fault injection command and a corresponding Internet Protocol address.

[0126] That is, in this embodiment, the judgment of any fault test result is based on the premise that the fault scenario is simulated normally, that is, only after the fault is injected normally can the result of this fault test be judged according to the status monitoring result; if the fault injection fails, the fault test is invalid; if the fault injection is successful, the fault test is valid, and the status monitoring result can be judged based on the result judgment configuration information to determine whether it meets the expectations; if it does, the result of this fault test is a successful test, otherwise it is a test failure.

[0127] Furthermore, for the scenario where the above-mentioned fault test is invalid, this embodiment provides a possible solution, which attempts to solve the problem of invalid fault test through a repeated writing mechanism. This solution has a better solution effect on occasional problems such as sudden network failures and connection abnormalities, and can solve part of the problem of invalid fault test, thereby improving the reliability of this method.

[0128] In addition, if the fault injection command is written repeatedly for many times and the fault scenario cannot be simulated normally, it means that a persistent anomaly may have occurred in the distributed system. At this time, this embodiment notifies the operation and maintenance personnel of the anomaly by issuing an alarm and returning corresponding prompt information, and locates the node where the anomaly occurs, so that the operation and maintenance personnel can promptly check the anomaly and resume subsequent fault testing.

[0129] Furthermore, based on the above-mentioned distributed system fault testing method provided on the client side, this embodiment also provides a possible implementation scheme for distributing fault injection commands, fault recovery commands and status monitoring commands:

[0130] If multiple groups of fault test strategies are obtained at one time in the above step S11, then step S12 specifically includes:

[0131] S121: Classifying each group of fault test strategies according to the Internet Protocol address;

[0132] S122: Packing and sending each group of fault injection commands, fault recovery commands and status monitoring commands corresponding to a certain server to the corresponding server.

[0133] It is easy to know that there are usually more than two nodes in a distributed system, that is, it generally includes multiple service terminals. And from the above embodiments, it can be seen that when executing the fault test case, this method can be performed separately on each node. Furthermore, when performing a fault test, a plurality of different nodes can be simultaneously tested for faults at one time to improve the efficiency of the fault test. In addition, different fault tests can also be performed for the same node. Based on this, that is, in step S11, multiple groups of fault test strategies will be obtained, and these fault test strategies may correspond to different service terminals, or may correspond to the same service terminal, depending on the actual fault test requirements.

[0134] Furthermore, after the client obtains multiple groups of fault test strategies, the command distribution of step S12 can be implemented in the same distribution method. That is, as shown in the above scheme of this embodiment, all fault test strategies are classified according to the IP address of the node, and the corresponding fault injection commands, fault recovery commands and status monitoring commands are packaged and sent to the corresponding server, and the distribution of multiple groups of fault test strategies to a certain server is completed. Similarly, by distributing the grouped instructions to the corresponding server, all instructions can be distributed, thereby improving the efficiency of fault testing in the preparation stage before fault testing.

[0135] Furthermore, based on the above-mentioned distributed system fault testing method provided on the client side, this embodiment also provides a possible implementation scheme. Before step S12, the above-mentioned method further includes:

[0136] S161: Obtain node configuration information;

[0137] S162: Send a communication connection establishment request to each server according to the node configuration information to establish a communication connection with each server.

[0138] It is easy to know that the distributed system contains multiple nodes, which are divided into clients and servers based on the needs of this method. However, in a fault test process, not all nodes in the distributed system need to be fault tested. Among the nodes that do not need to be fault tested, any node can be selected as the above-mentioned client node, and other nodes that need to be fault tested can be used as the above-mentioned server nodes. For other nodes that do not need to be fault tested, they can not participate in this fault test process.

[0139] It should also be noted that this embodiment does not limit the specific data contained in the node configuration information, which can be determined according to the communication needs between nodes in the actual distributed system. For example, in a possible implementation, the node configuration information includes: the IP address and port number of the node.

[0140] Based on the above, it can be known that during each fault test process, the client and the server are not static, but can change at any time according to actual needs. Furthermore, in order to avoid the fault test affecting irrelevant nodes (i.e., nodes that do not need to be fault tested), this embodiment provides a targeted communication connection method. That is, by pre-entering the node configuration information into a certain node, on the one hand, the determination of the client is realized (i.e., the node whose node configuration information is entered is the client); on the other hand, the determination of the server is realized (i.e., the node configuration information contains the node information of the server); and then the communication connection between the client and the server is realized, and communication preparations are made for the above-mentioned fault test.

[0141] On the other hand, this embodiment also provides a distributed system fault testing method applied to the server side, as shown in FIG3 , including:

[0142] S21: receiving a fault injection command, a fault recovery command, and a status monitoring command sent by the client.

[0143] S22: Perform fault injection according to the fault injection command and obtain the fault injection result.

[0144] S23: After the fault is injected, perform fault recovery according to the fault recovery command.

[0145] S24: Monitor the change of the specified state after the fault injection and the fault recovery according to the state monitoring command, and obtain the state monitoring result.

[0146] S25: Return the fault injection result and status monitoring result to the client.

[0147] To facilitate the client: determine the configuration information based on the results of the fault test strategy belonging to the same group as the fault injection command, the fault recovery command and the status monitoring command, and determine the fault test result according to the corresponding fault injection result and the status monitoring result.

[0148] It is easy to know that the method applied to the server side provided in this embodiment has the same or corresponding parts as the method applied to the client side in the above embodiment. The partial embodiments of the server side method can be obtained by combining the embodiments of the above client side method, which will not be repeated in this embodiment.

[0149] However, it should be noted that the above steps S22, S23 and step S24 can be executed in parallel, as shown in FIG3, to ensure that the state monitoring can detect the complete state change.

[0150] In particular, the following embodiments mainly describe some implementation schemes that are only applied to the server side or are not described in the above client side method embodiments.

[0151] For example, this embodiment provides a possible implementation scheme on the server side, and the method further includes:

[0152] S201: Create a first process and a second process;

[0153] Among them, the first process is used to: execute the fault injection command and return the fault injection result to the client; and after executing the fault injection command, execute the fault recovery command; the second process is used to: execute the status monitoring command and return the status monitoring result to the client; the first process and the second process are two processes running in parallel.

[0154] That is, in this embodiment, the server implements fault injection, fault recovery, and status monitoring through two pre-created parallel processes.

[0155] It can be seen from the above embodiments that fault recovery occurs after fault injection, but state monitoring is performed concurrently with fault injection and recovery. State monitoring requires monitoring the entire process of fault injection and recovery to obtain changes in the state of interest. Therefore, on the server side, this embodiment creates two parallel processes to implement fault injection and recovery, as well as state monitoring, to meet the requirements of fault testing while avoiding the occurrence of missed monitoring and missed detection, so as to ensure the accuracy of fault testing.

[0156] Furthermore, this embodiment also provides a possible implementation scheme for returning the fault injection result and the status monitoring result to the client side on the server side. The above step S25 specifically includes:

[0157] S251: Analyze the fault injection results and the status monitoring results to obtain multiple result items containing timing characteristics.

[0158] S252: Rearrange the result items according to the time sequence and merge them into a result data packet.

[0159] S253: Send the result data packet to the client.

[0160] The fault injection result is the server's response to the fault injection command. In actual applications, the response with the time when the response occurs is a common solution and does not require additional settings. Similarly, the purpose of the status monitoring command is to record the changes in the state of interest, which can be achieved through a monitor. When recording the state change, recording the time of the state change is also a common implementation plan and does not require additional settings.

[0161] That is, this embodiment utilizes the timing characteristics attached to the above-mentioned instruction response to rearrange the various result items in the fault injection results and the state monitoring results based on the timing characteristics, merge them into a result data packet, and send it to the client. On the one hand, the fault injection results and the state monitoring results of the same fault test case are directly connected at the physical level, and on the other hand, each result item is rearranged according to the timing characteristics, which is beneficial to the subsequent fault result judgment processing of the client and reduces the load on the client. In addition, considering that there is a one-to-many relationship between the client and the server, the solution of transferring part of the load tasks from the client to the server in this embodiment is conducive to improving the overall efficiency and avoiding the client from becoming a performance bottleneck that affects the efficiency of fault testing.

[0162] Furthermore, this embodiment also provides a possible implementation scheme for establishing a communication connection between the server and the client on the server side. Before the above step S21, the method further includes:

[0163] S202: Open the socket connection and wait for the communication connection establishment request sent by the client;

[0164] S203: After receiving the communication connection establishment request sent by the client, respond to the communication connection establishment request to establish a communication connection with the client.

[0165] That is, in this embodiment, a communication connection is established between the client and the server through a socket. Before the fault test officially starts, the server opens a socket connection for the client to communicate with. When the client connects, the current server becomes the node under test in this fault test. It is easy to know that this embodiment provides only one possible communication connection scheme between the server and the client, which is suitable for the communication connection scheme provided in the above-mentioned client-side embodiment to meet the fault test requirements of this method.

[0166] In the above embodiment, a distributed system fault testing method is described in detail, and the present invention also provides a corresponding embodiment of a distributed system fault testing device. It should be noted that the distributed system fault testing device provided by the present invention is also applied to the above-mentioned distributed system, which includes multiple nodes, one of which is a client and the other nodes are servers.

[0167] Furthermore, this embodiment also describes the embodiment of the device part from two sides, one is a device applied to the client side, and the other is a device applied to the server side.

[0168] Applied to the client side, as shown in FIG4 , this embodiment provides a distributed system fault testing device, including:

[0169] A strategy acquisition module 11 is used to acquire a fault test strategy; wherein a set of fault test strategies includes: an Internet Protocol address of a node, a fault injection command, a fault recovery command, a status monitoring command and result determination configuration information;

[0170] The policy distribution module 12 is used to send the fault injection command, fault recovery command and state monitoring command in the same group of fault test policies to the corresponding server according to the Internet Protocol address, so that the server: executes the fault injection command to perform fault injection and obtains the fault injection result; executes the fault recovery command to perform fault recovery; executes the state monitoring command to monitor the change of the specified state after fault injection and fault recovery, and obtains the state monitoring result; returns the fault injection result and the state monitoring result to the client;

[0171] A result receiving module 13 is used to receive the fault injection result and status monitoring result returned by the server;

[0172] The fault determination module 14 is used to determine the fault test result based on the result determination configuration information and the corresponding fault injection result and status monitoring result.

[0173] On the other hand, applied to the server side, as shown in FIG5 , this embodiment provides a distributed system fault testing device, including:

[0174] The command receiving module 21 is used to receive the fault injection command, fault recovery command and status monitoring command sent by the client;

[0175] The fault injection module 22 is used to perform fault injection according to the fault injection command and obtain the fault injection result;

[0176] A fault recovery module 23, used to perform fault recovery according to a fault recovery command after fault injection;

[0177] The state monitoring module 24 is used to monitor the changes of the specified state after the fault injection and the fault recovery according to the state monitoring command, and obtain the state monitoring result;

[0178] The result return module 25 is used to return the fault injection results and status monitoring results to the client, so that the client can: determine the configuration information based on the results of the fault test strategy belonging to the same group as the fault injection command, fault recovery command and status monitoring command, and determine the fault test results according to the corresponding fault injection results and status monitoring results.

[0179] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0180] FIG1 is a structural diagram of a distributed system provided by another embodiment of the present invention. As shown in FIG1 , a distributed system includes: a plurality of nodes; one node serves as a client, and the other nodes serve as servers.

[0181] Wherein, the client is used to implement the steps of the distributed system fault testing method applied to the client side as described above;

[0182] The server is used to implement the steps of the distributed system fault testing method applied to the server side as described above.

[0183] Similarly, since the embodiments of the system part correspond to the embodiments of the method part, the embodiments of the system part also refer to the description of the embodiments of the method part, which will not be repeated here.

[0184] In addition to the embodiments of a distributed system fault testing method, device, and a distributed system provided in the above embodiments, the present invention also provides an embodiment corresponding to a computer program product. A computer program product includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the distributed system fault testing method described in any of the above embodiments can be implemented.

[0185] Since the embodiments of the computer program product part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the computer program product part, which will not be repeated here.

[0186] Finally, the present invention also provides an embodiment corresponding to a non-volatile storage medium. A computer program is stored on the non-volatile storage medium, and when the computer program is executed by a processor, the steps recorded in the above method embodiment (which may be a method corresponding to the client side, a method corresponding to the server side, or a method corresponding to both the client side and the server side) are implemented.

[0187] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0188] The above is a detailed introduction to a distributed system, a fault testing method, a device and a medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.

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

Claims

1. A distributed system fault testing method, characterized in that: Application in distributed systems; The distributed system includes: a plurality of nodes, wherein one node serves as a client and the other nodes serve as servers; The method is applied to the client, comprising: Obtaining a fault test strategy; wherein a set of fault test strategies includes: an Internet Protocol address of a node, a fault injection command, a fault recovery command, a status monitoring command, and result determination configuration information; According to the Internet Protocol address, the fault injection command, the fault recovery command and the state monitoring command in the same group of the fault testing strategy are sent to the corresponding server, so that the server: executes the fault injection command to perform fault injection and obtains the fault injection result; executes the fault recovery command to perform fault recovery; executes the state monitoring command to monitor the change of the specified state after fault injection and fault recovery, and obtains the state monitoring result; returns the fault injection result and the state monitoring result to the client; Receiving the fault injection result and the status monitoring result returned by the server; The configuration information is determined based on the result, and the fault test result is determined according to the corresponding fault injection result and the status monitoring result.

2. The distributed system fault testing method according to claim 1, characterized in that: Determining the fault test result based on the result-determining configuration information and according to the corresponding fault injection result and the state monitoring result includes: According to the fault injection result, determining whether the fault injection of the server is successful; If the fault injection is successful, the configuration information and the status monitoring result are determined according to the result to determine whether the change of the specified status meets expectations; If it is met, the fault test result is determined to be a test success; If not, the fault test result is determined to be a test failure; If the fault injection fails, resending the fault injection command to the corresponding server so that the server performs the fault injection again; The method further comprises: Counting the number of repetitions of sending the same fault injection command; If the number of repetitions exceeds the preset repetition threshold, an alarm is issued and the corresponding prompt information is returned; Wherein, the prompt information includes: the fault injection command and the corresponding Internet Protocol address.

3. The distributed system fault testing method according to claim 1, characterized in that: If multiple groups of the fault testing strategies are obtained; Then, according to the Internet Protocol address, sending the fault injection command, the fault recovery command and the status monitoring command in the same group of the fault testing strategy to the corresponding server includes: Classifying each group of the fault testing strategies according to the Internet Protocol address; Each group of the fault injection command, the fault recovery command and the status monitoring command corresponding to a certain server is packaged and sent to the corresponding server.

4. The distributed system fault testing method according to any one of claims 1 to 3, characterized in that: Before sending the fault injection command, the fault recovery command and the status monitoring command in the same group of the fault testing strategy to the corresponding server according to the Internet Protocol address, the method further includes: Get node configuration information; A communication connection establishment request is sent to each of the server ends according to the node configuration information, so as to establish a communication connection with each of the server ends.

5. A distributed system fault testing method, characterized in that: Application in distributed systems; The distributed system includes: a plurality of nodes, wherein one node serves as a client and the other nodes serve as servers; This method is applied to the server, and includes: Receiving a fault injection command, a fault recovery command, and a status monitoring command sent by the client; Performing fault injection according to the fault injection command and obtaining the fault injection result; After the fault is injected, performing fault recovery according to the fault recovery command; Monitor changes in a specified state after fault injection and fault recovery according to the state monitoring command, and obtain a state monitoring result; The fault injection result and the status monitoring result are returned to the client so that the client can: determine the configuration information based on the result of the fault testing strategy belonging to the same group as the fault injection command, the fault recovery command and the status monitoring command, and determine the fault testing result according to the corresponding fault injection result and the status monitoring result.

6. The distributed system fault testing method according to claim 5, characterized in that: Also includes: Create a first process and a second process; The first process is used to: execute the fault injection command and return the fault injection result to the client; and execute the fault recovery command after executing the fault injection command; The second process is used to: execute the status monitoring command and return the status monitoring result to the client; The first process and the second process are two processes running in parallel.

7. The distributed system fault testing method according to claim 5, characterized in that: Returning the fault injection result and the status monitoring result to the client comprises: Parsing the fault injection result and the state monitoring result to obtain a plurality of result items including timing characteristics; Rearrange the result items according to the time sequence and merge them into a result data packet; The result data packet is sent to the client.

8. The distributed system fault testing method according to any one of claims 5 to 7, characterized in that: Before receiving the fault injection command, the fault recovery command and the status monitoring command sent by the client, the method further includes: Opening a socket connection and waiting for a communication connection establishment request sent by the client; After receiving the communication connection establishment request sent by the client, respond to the communication connection establishment request to establish a communication connection with the client.

9. A distributed system fault testing device, characterized in that: Application in distributed systems; The distributed system includes: a plurality of nodes, wherein one node serves as a client and the other nodes serve as servers; The device is applied to the client, and includes: A strategy acquisition module is used to acquire a fault test strategy; wherein a set of fault test strategies includes: an Internet Protocol address of a node, a fault injection command, a fault recovery command, a status monitoring command, and result determination configuration information; A policy distribution module, for sending the fault injection command, the fault recovery command and the state monitoring command in the same group of the fault test policy to the corresponding server according to the Internet Protocol address, so that the server: executes the fault injection command to perform fault injection and obtains the fault injection result; executes the fault recovery command to perform fault recovery; executes the state monitoring command to monitor the change of the specified state after fault injection and fault recovery, and obtains the state monitoring result; returns the fault injection result and the state monitoring result to the client; A result receiving module, used for receiving the fault injection result and the status monitoring result returned by the server; A fault determination module is used to determine the configuration information based on the result, and determine the fault test result according to the corresponding fault injection result and the state monitoring result.

10. A distributed system fault testing device, characterized in that: Application in distributed systems; The distributed system includes: a plurality of nodes, wherein one node serves as a client and the other nodes serve as servers; The device is applied to the server, and includes: A command receiving module, used for receiving a fault injection command, a fault recovery command and a status monitoring command sent by the client; A fault injection module, used to perform fault injection according to the fault injection command and obtain a fault injection result; A fault recovery module, used for performing fault recovery according to the fault recovery command after the fault is injected; A state monitoring module, used to monitor the changes of a specified state after fault injection and fault recovery according to the state monitoring command, and obtain state monitoring results; A result returning module is used to return the fault injection result and the status monitoring result to the client, so that the client can: determine the configuration information based on the result of the fault testing strategy belonging to the same group as the fault injection command, the fault recovery command and the status monitoring command, and determine the fault testing result according to the corresponding fault injection result and the status monitoring result.

11. A distributed system comprising: Multiple nodes; characterized in that one node acts as a client and the other nodes act as servers; in: The client is used to implement the steps of the distributed system fault testing method according to any one of claims 1 to 4; The server is used to implement the steps of the distributed system fault testing method as described in any one of claims 5 to 8.

12. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the distributed system fault testing method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Software testing automation framework (STAF)-based fault injection automation testing platform and method for high-end fault-tolerant computer

    CN102354298A

  • Storage fault injection method and system

    CN107301101A

  • PaaS cloud platform fault test method and device

    CN113157577A

  • Apparatus and method for injecting fault into distributed system

    CN116097226A

  • Fault testing method and device, electronic equipment and computer readable storage medium

    CN116974935A