Alarm method and device, server and readable storage medium
By obtaining the time synchronization information of the main server of the distributed storage cluster, determining the time synchronization status and generating alarm information, the performance and data migration problems caused by time inconsistency in the cluster are solved, and the high availability and business stability of the cluster are improved.
Patent Information
- Application Number
- CN202411562272.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-14
AI Technical Summary
Time inconsistency in distributed storage clusters may lead to performance monitoring abnormalities, data migration failures and logging analysis, and time synchronization abnormalities need to be discovered in a timely manner.
By obtaining the external and internal time synchronization information of the master server, the first time synchronization status of the master server is determined, and alarm information is generated based on the status of the master server and the second time synchronization status of the slave server to identify the time synchronization exception in the cluster.
It realizes timely and accurately discovers time synchronization abnormalities in distributed storage clusters, improves the high availability of the cluster and reduces the impact on business.
Smart Images

Figure CN119440967A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of distributed storage cluster time synchronization, and in particular to an alarm method, device, server and readable storage medium. Background Art
[0002] With the development of big data technology, more and more data need to be stored. In order to solve the performance bottleneck of the server when storing data in a centralized manner, distributed storage clusters have emerged, which can store data in a decentralized manner.
[0003] For distributed storage clusters, if the internal time of the cluster is inconsistent, there may be performance indicator monitoring anomalies. If the time synchronization with the external server fails, data migration between different clusters may fail. If there are frequent time jumps among cluster nodes, it will also affect log recording and analysis.
[0004] Therefore, it is necessary to promptly detect time synchronization anomalies in the distributed storage cluster. Summary of the invention
[0005] Based on this, it is necessary to provide an alarm method, device, server and readable storage medium that can timely discover time synchronization anomalies of a distributed storage cluster in response to the above technical problems.
[0006] In a first aspect, the present application provides an alarm method, comprising:
[0007] Obtaining time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0008] Determining a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information;
[0009] An alarm message is generated according to the first time synchronization state and the second time synchronization state of each slave server; the alarm message is used to indicate that a time synchronization anomaly exists in the distributed storage cluster.
[0010] In one of the embodiments, generating alarm information according to the first time synchronization state and the second time synchronization state of each slave server includes:
[0011] When the first time synchronization state is an abnormal state, generating the alarm information;
[0012] The alarm information is generated when the first time synchronization state is a normal state and any one of the second time synchronization states is an abnormal state.
[0013] In one embodiment, the method further comprises:
[0014] For each of the slave servers, obtaining the node information reported by the slave server and the time interval for reporting the node information;
[0015] A second time synchronization state of the slave server is determined according to the time interval and the node information.
[0016] In one of the embodiments, determining the second time synchronization state of the slave server according to the time interval and the node information includes:
[0017] When the time interval is greater than or equal to a preset time period, determining that the second time synchronization state is an abnormal state;
[0018] When the time interval is smaller than the preset time period, the second time synchronization state is determined according to the node information.
[0019] In one embodiment, determining the second time synchronization state according to the node information includes:
[0020] Acquire the execution result of the time synchronization of the slave server, the current time and the time jump information from the node information; the time jump information is used to indicate whether the number of time jumps occurring in the slave server within a preset time period is greater than a preset number threshold;
[0021] The second time synchronization state is determined according to the execution result, the current time and the time jump information.
[0022] In one of the embodiments, determining the second time synchronization state according to the execution result, the current time and the time jump information includes:
[0023] If any one of the following conditions is met, determining that the second time synchronization state is an abnormal state;
[0024] The conditions include:
[0025] The execution result is abnormal;
[0026] The time difference between the current time and the current time of the main server is greater than a preset time difference threshold;
[0027] The number of time jumps occurring from the server within the preset time period is greater than a preset number threshold.
[0028] In one of the embodiments, determining the first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information includes:
[0029] When both the external time synchronization information and the internal time synchronization information are normal, it is determined that the first time synchronization state is a normal state.
[0030] In a second aspect, the present application also provides an alarm device, including:
[0031] A first acquisition module is used to acquire time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0032] A first determining module, configured to determine a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information;
[0033] The alarm module is used to generate alarm information according to the first time synchronization state and the second time synchronization state of each slave server; the alarm information is used to indicate that there is a time synchronization anomaly in the distributed storage cluster.
[0034] In a third aspect, the present application further provides a server, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0035] Obtaining time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0036] Determining a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information;
[0037] An alarm message is generated according to the first time synchronization state and the second time synchronization state of each slave server; the alarm message is used to indicate that a time synchronization anomaly exists in the distributed storage cluster.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0039] Obtaining time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0040] Determining a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information;
[0041] An alarm message is generated according to the first time synchronization state and the second time synchronization state of each slave server; the alarm message is used to indicate that a time synchronization anomaly exists in the distributed storage cluster.
[0042] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0043] Obtaining time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0044] Determining a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information;
[0045] An alarm message is generated according to the first time synchronization state and the second time synchronization state of each slave server; the alarm message is used to indicate that a time synchronization anomaly exists in the distributed storage cluster.
[0046] The above-mentioned alarm method, device, server and readable storage medium, the main server in the distributed storage cluster obtains time synchronization information including external time synchronization information and internal time synchronization information of the main server, so that the main server can accurately determine the first time synchronization status of the main server itself according to the acquired external time synchronization information and internal time synchronization information, so that according to the first time synchronization status of the main server and the second time synchronization status of each slave server, an alarm information characterizing the existence of time synchronization anomaly in the distributed storage cluster can be generated. Since the alarm information is generated according to the first time synchronization status of the main server and the second time synchronization status of each slave server, both the time synchronization status of the main service itself and the time synchronization status of each slave server are taken into account, so that the main server can timely and accurately discover the time synchronization anomaly of the distributed storage cluster, improve the high availability of the distributed storage cluster, and reduce the impact on the business. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0048] FIG1 is a diagram of an application environment of an alarm method in one embodiment;
[0049] FIG2 is a schematic diagram of a flow chart of an alarm method in an embodiment;
[0050] FIG3 is a schematic diagram of a flow chart of an alarm method in another embodiment;
[0051] FIG4 is a schematic diagram of a flow chart of an alarm method in another embodiment;
[0052] FIG5 is a schematic diagram of a flow chart of an alarm method in another embodiment;
[0053] FIG6 is a schematic diagram of a flow chart of an alarm method in another embodiment;
[0054] FIG7 is a block diagram of a warning device according to an embodiment;
[0055] FIG8 is a block diagram of a warning device in another embodiment;
[0056] FIG9 is a block diagram of a warning device in another embodiment;
[0057] FIG10 is a block diagram of a warning device according to another embodiment;
[0058] FIG11 is a block diagram of a warning device according to another embodiment;
[0059] FIG. 12 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] The alarm method provided in the embodiment of the present application can be applied in the application environment shown in FIG1. Among them, the server 102 can be a master server in a distributed storage cluster, and the server 104 can be a slave server in the distributed storage cluster. The server 102 can be connected to the server 104 in communication. When the master server 102 receives a data file to be processed, the received data file can be stored in the master server 102 and the slave server 104 in a dispersed manner. When the master server 102 fails, a slave server will be selected from other slave servers 104 as the master server. The failure of the slave server will not affect other servers in the distributed storage cluster.
[0062] In an exemplary embodiment, as shown in FIG2 , an alarm method is provided, which is described by taking the method applied to the main server in FIG1 as an example, and includes the following steps:
[0063] S201, obtaining time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0064] The external time synchronization information of the master server refers to the time synchronization information between the master server and servers outside the distributed storage cluster, and the internal time synchronization information of the master server refers to the time synchronization information of the master server itself.
[0065] Optionally, in this embodiment, the main server can determine the external time synchronization information of the main server by running a script to check whether the time synchronization between the main server and the external server is normal. In addition, the main server can determine the internal time synchronization information of the main server by checking whether its own time synchronization service is normal.
[0066] S202: Determine a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information.
[0067] In this embodiment, the main server can determine the time synchronization status between the main server and the external server based on the above-mentioned external time synchronization information, and determine the time synchronization status of the main server based on the above-mentioned internal time synchronization information. If the time synchronization status between the main server and the external server is normal, and the time synchronization status of the main server itself is also normal, the main server can determine that the first time synchronization status of the main server is a normal state; if the time synchronization status between the main server and the external server is abnormal, or the time synchronization status of the main server itself is abnormal, the main server can determine that the first time synchronization status of the main server is an abnormal state.
[0068] S203, generating alarm information according to the first time synchronization state and the second time synchronization state of each slave server; the alarm information is used to indicate whether there is a time synchronization anomaly in the distributed storage cluster.
[0069] In this embodiment, the master server can determine the second time synchronization status of each slave server based on the information sent by each slave server, and then determine whether there is a time synchronization anomaly in the distributed storage cluster based on the first time synchronization status of the master server and the second time synchronization status of each slave server. When it is determined that there is a time synchronization anomaly in the distributed storage cluster, an alarm message is generated. The alarm message prompts that there is a time synchronization anomaly in the distributed cluster, and the maintenance personnel are notified in time to handle the time synchronization anomaly in the distributed storage cluster.
[0070] In the above alarm method, the master server in the distributed storage cluster obtains time synchronization information including external time synchronization information and internal time synchronization information of the master server, so that the master server can accurately determine the first time synchronization status of the master server itself according to the acquired external time synchronization information and internal time synchronization information, so that according to the first time synchronization status of the master server and the second time synchronization status of each slave server, an alarm information characterizing the existence of time synchronization anomalies in the distributed storage cluster can be generated. Since the alarm information is generated according to the first time synchronization status of the master server and the second time synchronization status of each slave server, both the time synchronization status of the master service itself and the time synchronization status of each slave server are taken into account, so that the master server can timely and accurately discover the time synchronization anomalies of the distributed storage cluster, improve the high availability of the distributed storage cluster, and reduce the impact on the business.
[0071] In this embodiment, the detailed process of generating alarm information by the master server according to its own first time synchronization state and the second time synchronization state of each slave server is explained. In an exemplary embodiment, as shown in FIG3 , the above S203 includes:
[0072] S301, generating alarm information when the first time synchronization state is an abnormal state.
[0073] In this embodiment, when the master server determines that the first time synchronization state is an abnormal state, it indicates that the external time synchronization information between the master server and the external server is abnormal, or the time synchronization information inside the master server is abnormal, and the master server can generate an alarm message to prompt the operation and maintenance personnel that there is a time synchronization abnormality in the distributed storage cluster. It can be understood that when the master server determines that the first time synchronization state is a normal state, it indicates that the external time synchronization information between the master server and the external server is normal, and the time synchronization information inside the master server is normal, and there is no time synchronization abnormality in the distributed storage cluster.
[0074] S302: Generate alarm information when the first time synchronization state is a normal state and any second time synchronization state is an abnormal state.
[0075] In this embodiment, when the first time synchronization status of the master server is normal, the master server can determine whether the second time synchronization status of each slave server is abnormal. If the second time synchronization status of any slave server is abnormal, it means that there is a slave server with time synchronization abnormality in the distributed storage cluster. The master server can generate an alarm message to prompt the operation and maintenance personnel that there is a time synchronization abnormality in the distributed storage cluster, so that the operation and maintenance personnel can further determine the server with time synchronization abnormality in the distributed storage cluster.
[0076] Furthermore, as an optional implementation, the master server may also display the slave server nodes whose time synchronization status is determined to be abnormal. On this basis, as another optional implementation, if the number of slave servers whose time synchronization status is determined to be abnormal by the master server exceeds a preset number threshold, the master server may display the slave server nodes before the number threshold. For example, if the master server determines that the number of slave servers whose time synchronization status is abnormal exceeds 10, the master server may display the first 10 slave server nodes determined.
[0077] In this embodiment, the master server generates an alarm message when its own first time synchronization state is an abnormal state, and generates an alarm message when its own first time synchronization state is a normal state and the second time synchronization state of any slave server is an abnormal state. This can fully consider the time synchronization function of each server in the distributed storage cluster, ensure timely and accurate detection of whether there is a time synchronization anomaly in the distributed cluster, improve the high availability of the distributed storage cluster, and reduce the impact on the business.
[0078] In this embodiment, the process of determining the second time synchronization state of the slave server is explained. In an exemplary embodiment, as shown in FIG4 , the method further includes:
[0079] S401, for each slave server, obtaining node information reported by the slave server and a time interval for reporting the node information.
[0080] First, it should be noted that, for each slave server, the method for determining the second time synchronization state of the slave server is the same, and this embodiment will be explained by taking a slave server as an example. In this embodiment, for each slave server, the master server can determine the time interval for reporting the node information from the slave server by the time when the slave server reports the node information, and obtain the node information reported by the slave server and the time interval for reporting the node information. Exemplarily, the time interval in this embodiment can be one minute, or two minutes, etc., and this embodiment does not limit the specific value of the time interval.
[0081] S402: Determine a second time synchronization state of the slave server according to the time interval and the node information.
[0082] Optionally, in this embodiment, the master server may determine the second time synchronization state of the slave server based on whether the time interval for reporting node information from the slave server is greater than a preset time interval, and the content of the node information reported by the slave server. Further, as an optional implementation, the master server may determine the second time synchronization state of the slave server based on the time interval for reporting node information from the slave server or any one of the node information reported by the slave server. For example, if the master server determines that the time interval for reporting node information from the slave server is greater than a preset time interval, the master server may determine that the second time synchronization state of the slave server is an abnormal state; or, if the master server determines that there is a time synchronization anomaly in the slave server based on the node information reported by the slave server, the master server may also determine that the second time synchronization state of the slave server is an abnormal state.
[0083] In this embodiment, the master server can accurately determine the second time synchronization status of each slave server by obtaining the node information reported by the slave server and the time interval for reporting the node information, based on the time interval for reporting the node information from the slave server and the reported node information, thereby ensuring the accuracy of determining the second time synchronization status of the slave server, thereby enabling the master server to accurately determine whether there is a time synchronization anomaly in the distributed storage cluster.
[0084] In this embodiment, the detailed process of determining the second time synchronization state of the slave server according to the time interval of reporting the node information from the slave server and the node information reported from the slave server is explained. In an exemplary embodiment, as shown in FIG5 , the above S402 includes:
[0085] S501: When the time interval is greater than or equal to a preset time period, determine that the second time synchronization state is an abnormal state.
[0086] In this embodiment, when the master server determines that the time interval for reporting node information from the slave server is greater than or equal to a preset time period, it can be considered that not only is there an abnormality in time synchronization on the slave server, but there may be an abnormality in the entire slave server. At this time, the master server can determine the second time synchronization state of the slave server as an abnormal state.
[0087] S502: When the time interval is less than a preset time period, determine a second time synchronization state according to the node information.
[0088] In this embodiment, when the master server determines that the time interval for reporting node information from the slave server is less than a preset time period, the master server can determine that the slave server can report the node information on time, and further, the master server can determine the second time synchronization state of the slave server based on the node information reported by the slave server. Optionally, as an optional implementation, the master server can parse the node information reported by the slave server, parse out the time synchronization information of the slave server from the reported node information, and determine the second time synchronization state of the slave server based on the parsed time synchronization information.
[0089] In this embodiment, when the time interval for the slave server to report node information is greater than or equal to the preset time period, the master server can promptly determine the second time synchronization status of the slave server as an abnormal state. When the time interval for the slave server to report node information is less than the preset time period, the master server can further accurately determine the second time synchronization status of the slave server based on the node information reported by the slave server, thereby ensuring the accuracy of the determined second time synchronization status of the slave server, so that the master server can promptly determine whether to generate an alarm message based on the second time synchronization status of each slave server, thereby enabling the operation and maintenance personnel to promptly discover whether there is a time synchronization abnormality in the distributed storage cluster.
[0090] In this embodiment, the process of determining the second time synchronization state of the slave server according to the node information reported by the slave server by the master server is described in detail. In an exemplary embodiment, as shown in FIG6 , the above S502 includes:
[0091] S601, obtaining the execution result of the slave server time synchronization, the current time and the time jump information from the node information; the time jump information is used to indicate whether the number of time jumps occurring from the slave server within a preset time period is greater than a preset number threshold.
[0092] In this embodiment, the master server can parse the node information reported by the slave server, and parse the execution result of the slave server time synchronization, the current time of the slave service, and the time jump information of the slave server from the above node information. Among them, the time jump information of the slave server is used to indicate whether the number of time jumps occurring in the slave server within a preset time period is greater than a preset number threshold.
[0093] It is understandable that if the number of time jumps occurring from the server within a preset time period is greater than a preset number of times threshold, it can be determined that frequent time jumps have occurred from the server within the preset time period. In the present embodiment, whether a time jump occurs from the server within a preset time period can be determined by the server itself. For example, if more than 5 time jumps occur from the server within 10 minutes (the time changes are: A1->B1->A2->B2->A3), and the interval between each time jump is greater than or equal to 10S, then the server can determine that frequent time jumps exist within these 10 minutes.
[0094] S602: Determine a second time synchronization state according to the execution result, the current time and the time jump information.
[0095] In this embodiment, the main server parses the node information reported by the slave server, obtains the execution result of the time synchronization of the slave server, the current time of the slave server, and the time jump information of the slave server, and can determine the second time synchronization status of the slave server based on any one of the information including the execution result of the time synchronization of the slave server, the current time of the slave server, and the time jump information of the slave server.
[0096] As an optional implementation, if the execution result of the time synchronization of the slave server, the current time of the slave server, and the time jump information of the slave server meet any one of the following conditions, the master server can determine that the second time synchronization state of the slave server is an abnormal state, wherein the above conditions may include: the execution result of the time synchronization of the slave server is abnormal, the time difference between the current time of the slave server and the current time of the master server is greater than a preset time difference threshold, and the number of time jumps occurring in the slave server within a preset time period is greater than a preset number threshold.
[0097] In the present embodiment, since the master server obtains the execution result of the time synchronization of the slave server, the current time of the slave server and the time jump information of the slave server from the node information reported by the slave server, the obtained information is all related to the time synchronization information of the slave server. Therefore, the master server can accurately determine the second time synchronization state of the slave server based on the execution result of the time synchronization of the slave server, the current time of the slave server and the time jump information of the slave server, thereby ensuring the accuracy of the master server in determining the second time synchronization state of the slave server.
[0098] In this embodiment, the detailed process of determining the first time synchronization state of the master server according to the external time synchronization information of the master server and the internal time synchronization information of the master server is explained. In an exemplary embodiment, the above S202 includes:
[0099] Step A: When both the external time synchronization information and the internal time synchronization information are normal, determining that the first time synchronization state is a normal state.
[0100] In this embodiment, as described in the above embodiments, the external time synchronization information of the main server refers to the time synchronization information between the main server and servers outside the distributed storage cluster, and the internal time synchronization information of the main server refers to the time synchronization information of the main server itself. If the main server determines that the external time synchronization information and internal time synchronization information obtained are normal, it means that the time synchronization between the main server and servers outside the distributed storage cluster is normal, and the time synchronization information of the main server itself is also normal. In this scenario, the main server can determine that its first time synchronization status is normal.
[0101] In the present embodiment, since the main server determines that the first time synchronization state of the main server is a normal state when it determines that the external time synchronization information between the main server and the servers outside the distributed storage cluster is normal and the internal time synchronization information of the main server itself is also normal, both the time synchronization information between the main server and the servers outside the distributed storage cluster and the time synchronization information of the main server itself are taken into consideration, so that the main server can accurately determine the first time synchronization state of the main server; in addition, the process of the main server determining the first time synchronization state of the main server itself based on the external time synchronization information between the main server and the servers outside the distributed storage cluster and the internal time synchronization information of the main server itself is relatively simple, thereby improving the efficiency of the main server in determining its own first time synchronization state, so that the main server can promptly generate an alarm message indicating that there is a time synchronization anomaly in the distributed storage cluster.
[0102] To facilitate understanding by those skilled in the art, the alarm method provided by the present application is described in detail below. The method may include:
[0103] S1, obtaining time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server.
[0104] S2, when both the external time synchronization information and the internal time synchronization information are normal, determine that the first time synchronization state of the main server is a normal state; when one of the external time synchronization information and the internal time synchronization information is abnormal, determine that the first time synchronization state of the main server is an abnormal state.
[0105] S3: When the first time synchronization state of the primary server is abnormal, generate an alarm message.
[0106] S4, when the first time synchronization state of the master server is normal, for each slave server in the distributed storage cluster, obtain the node information reported by the slave server and the time interval for reporting the node information.
[0107] S5: When the time interval is greater than or equal to the preset time period, determine that the second time synchronization state of the slave server is an abnormal state.
[0108] S6, when the time interval is less than the preset time period, obtain the execution result of the time synchronization from the server, the current time and the time jump information from the node information; the time jump information is used to indicate whether the number of time jumps occurring from the server within the preset time period is greater than the preset number threshold.
[0109] S7, if any one of the following conditions is met, the second time synchronization state of the slave server is determined to be an abnormal state; the above conditions include: the execution result is abnormal; the time difference between the current time and the current time of the master server is greater than the preset time difference threshold; the number of time jumps occurring in the slave server within the preset time period is greater than the preset number threshold.
[0110] S8, if it is determined that the second time synchronization state of any slave server is an abnormal state, an alarm message is generated and the slave server nodes in the abnormal state are displayed. When the displayed slave server nodes in the abnormal state exceed the preset number, the slave server nodes before the preset number are displayed.
[0111] It should be noted that for the descriptions in the above S1-S8, reference may be made to the relevant descriptions in the above embodiments, and the effects are similar, so this embodiment will not be repeated here.
[0112] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0113] Based on the same inventive concept, the embodiment of the present application also provides an alarm device for implementing the alarm method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more alarm device embodiments provided below can refer to the limitations on the alarm method above, and will not be repeated here.
[0114] In an exemplary embodiment, as shown in FIG7 , an alarm device is provided, comprising: a first acquisition module 10, a first determination module 11 and an alarm module 12, wherein:
[0115] The first acquisition module 10 is used to acquire time synchronization information of the master server in the distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server.
[0116] The first determining module 11 is used to determine a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information.
[0117] The alarm module 12 is used to generate alarm information according to the first time synchronization state and the second time synchronization state of each slave server; the alarm information is used to indicate that there is a time synchronization anomaly in the distributed storage cluster.
[0118] The alarm device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0119] In one embodiment, as shown in FIG8 , the alarm module 12 includes: a first generating unit 121 and a second generating unit 122 , wherein:
[0120] The first generating unit 121 is configured to generate alarm information when the first time synchronization state is an abnormal state.
[0121] The second generating unit 122 is configured to generate alarm information when the first time synchronization state is a normal state and any second time synchronization state is an abnormal state.
[0122] The alarm device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0123] In one embodiment, as shown in FIG9 , the apparatus further includes: a second acquisition module 13 and a second determination module 14, wherein:
[0124] The second acquisition module 13 is used to acquire, for each slave server, the node information reported by the slave server and the time interval for reporting the node information.
[0125] The second determining module 14 is used to determine a second time synchronization state of the slave server according to the time interval and the node information.
[0126] The alarm device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0127] In one embodiment, as shown in FIG. 10 , the second determination module 14 includes: a first determination unit 141 and a second determination unit 142; wherein:
[0128] The first determining unit 141 is configured to determine that the second time synchronization state is an abnormal state when the time interval is greater than or equal to a preset time period.
[0129] The second determining unit 142 is configured to determine a second time synchronization state according to the node information when the time interval is less than a preset time period.
[0130] The alarm device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0131] In one embodiment, please continue to refer to FIG. 10 , the second determination unit 142 is used to obtain the execution result, current time and time jump information of the time synchronization from the server from the node information; determine the second time synchronization state according to the execution result, current time and time jump information; the time jump information is used to indicate whether the number of time jumps occurring from the server within a preset time period is greater than a preset number threshold;
[0132] The alarm device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0133] In one embodiment, please continue to refer to Figure 10. The above-mentioned second determination unit 142 is used to determine that the second time synchronization state is an abnormal state if any one of the following conditions is met; the conditions include: the execution result is abnormal; the time difference between the current time and the current time of the main server is greater than the preset time difference threshold; the number of time jumps from the server within the preset time period is greater than the preset number threshold.
[0134] The alarm device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0135] In one embodiment, as shown in FIG. 11 , the first determining module 11 includes: a third determining unit 111 , wherein:
[0136] The third determining unit 111 is configured to determine that the first time synchronization state is a normal state when both the external time synchronization information and the internal time synchronization information are normal.
[0137] The alarm device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0138] Each module in the above alarm device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0139] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG12. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store time synchronization information. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an alarm method is implemented.
[0140] Those skilled in the art will understand that the structure shown in FIG. 12 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0141] In an exemplary embodiment, a server is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0142] Obtaining time synchronization information of the master server in the distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0143] Determine the first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information;
[0144] An alarm message is generated according to the first time synchronization state and the second time synchronization state of each slave server; the alarm message is used to indicate that a time synchronization anomaly exists in the distributed storage cluster.
[0145] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0146] When the first time synchronization state is in an abnormal state, an alarm message is generated;
[0147] When the first time synchronization state is a normal state and any second time synchronization state is an abnormal state, an alarm message is generated.
[0148] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0149] For each slave server, obtain the node information reported by the slave server and the time interval for reporting the node information;
[0150] The second time synchronization state of the slave server is determined according to the time interval and the node information.
[0151] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0152] When the time interval is greater than or equal to the preset time period, determining that the second time synchronization state is an abnormal state;
[0153] When the time interval is less than the preset time period, a second time synchronization state is determined according to the node information.
[0154] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0155] Obtain the execution result of the time synchronization from the server, the current time and the time jump information from the node information; the time jump information is used to indicate whether the number of time jumps from the server within a preset time period is greater than a preset number threshold;
[0156] A second time synchronization state is determined according to the execution result, the current time and the time jump information.
[0157] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0158] If any one of the following conditions is met, the second time synchronization state is determined to be an abnormal state;
[0159] The conditions include:
[0160] The execution result is abnormal;
[0161] The time difference between the current time and the current time of the primary server is greater than the preset time difference threshold;
[0162] The number of time jumps from the server within a preset time period is greater than a preset number threshold.
[0163] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0164] When both the external time synchronization information and the internal time synchronization information are normal, it is determined that the first time synchronization state is a normal state.
[0165] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0166] Obtaining time synchronization information of the master server in the distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0167] Determine the first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information;
[0168] An alarm message is generated according to the first time synchronization state and the second time synchronization state of each slave server; the alarm message is used to indicate that a time synchronization anomaly exists in the distributed storage cluster.
[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0170] When the first time synchronization state is in an abnormal state, an alarm message is generated;
[0171] When the first time synchronization state is a normal state and any second time synchronization state is an abnormal state, an alarm message is generated.
[0172] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0173] For each slave server, obtain the node information reported by the slave server and the time interval for reporting the node information;
[0174] The second time synchronization state of the slave server is determined according to the time interval and the node information.
[0175] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0176] When the time interval is greater than or equal to the preset time period, determining that the second time synchronization state is an abnormal state;
[0177] When the time interval is less than the preset time period, a second time synchronization state is determined according to the node information.
[0178] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0179] Obtain the execution result of the time synchronization from the server, the current time and the time jump information from the node information; the time jump information is used to indicate whether the number of time jumps from the server within a preset time period is greater than a preset number threshold;
[0180] A second time synchronization state is determined according to the execution result, the current time and the time jump information.
[0181] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0182] If any one of the following conditions is met, the second time synchronization state is determined to be an abnormal state;
[0183] The conditions include:
[0184] The execution result is abnormal;
[0185] The time difference between the current time and the current time of the primary server is greater than the preset time difference threshold;
[0186] The number of time jumps from the server within a preset time period is greater than a preset number threshold.
[0187] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0188] When both the external time synchronization information and the internal time synchronization information are normal, it is determined that the first time synchronization state is a normal state.
[0189] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0190] Obtaining time synchronization information of the master server in the distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server;
[0191] Determine the first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information;
[0192] An alarm message is generated according to the first time synchronization state and the second time synchronization state of each slave server; the alarm message is used to indicate that a time synchronization anomaly exists in the distributed storage cluster.
[0193] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0194] When the first time synchronization state is in an abnormal state, an alarm message is generated;
[0195] When the first time synchronization state is a normal state and any second time synchronization state is an abnormal state, an alarm message is generated.
[0196] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0197] For each slave server, obtain the node information reported by the slave server and the time interval for reporting the node information;
[0198] The second time synchronization state of the slave server is determined according to the time interval and the node information.
[0199] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0200] When the time interval is greater than or equal to the preset time period, determining that the second time synchronization state is an abnormal state;
[0201] When the time interval is less than the preset time period, a second time synchronization state is determined according to the node information.
[0202] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0203] Obtain the execution result of the time synchronization from the server, the current time and the time jump information from the node information; the time jump information is used to indicate whether the number of time jumps from the server within a preset time period is greater than a preset number threshold;
[0204] A second time synchronization state is determined according to the execution result, the current time and the time jump information.
[0205] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0206] If any one of the following conditions is met, the second time synchronization state is determined to be an abnormal state;
[0207] The conditions include:
[0208] The execution result is abnormal;
[0209] The time difference between the current time and the current time of the primary server is greater than the preset time difference threshold;
[0210] The number of time jumps from the server within a preset time period is greater than a preset number threshold.
[0211] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0212] When both the external time synchronization information and the internal time synchronization information are normal, it is determined that the first time synchronization state is a normal state.
[0213] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0214] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0215] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An alarm method, characterized in that: The method comprises: Obtaining time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server; Determining a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information; An alarm message is generated according to the first time synchronization state and the second time synchronization state of each slave server; the alarm message is used to indicate that a time synchronization anomaly exists in the distributed storage cluster.
2. The method according to claim 1, characterized in that The generating alarm information according to the first time synchronization state and the second time synchronization state of each slave server includes: When the first time synchronization state is an abnormal state, generating the alarm information; The alarm information is generated when the first time synchronization state is a normal state and any one of the second time synchronization states is an abnormal state.
3. The method according to claim 2, characterized in that The method further comprises: For each of the slave servers, obtaining the node information reported by the slave server and the time interval for reporting the node information; A second time synchronization state of the slave server is determined according to the time interval and the node information.
4. The method according to claim 3, characterized in that The determining, according to the time interval and the node information, a second time synchronization state of the slave server includes: When the time interval is greater than or equal to a preset time period, determining that the second time synchronization state is an abnormal state; When the time interval is smaller than the preset time period, the second time synchronization state is determined according to the node information.
5. The method according to claim 4, characterized in that The determining the second time synchronization state according to the node information includes: Acquire the execution result of the time synchronization of the slave server, the current time and the time jump information from the node information; the time jump information is used to indicate whether the number of time jumps occurring in the slave server within a preset time period is greater than a preset number threshold; The second time synchronization state is determined according to the execution result, the current time and the time jump information.
6. The method according to claim 5, characterized in that The determining the second time synchronization state according to the execution result, the current time and the time jump information includes: If any one of the following conditions is met, determining that the second time synchronization state is an abnormal state; The conditions include: The execution result is abnormal; The time difference between the current time and the current time of the main server is greater than a preset time difference threshold; The number of time jumps occurring from the server within the preset time period is greater than a preset number threshold.
7. The method according to any one of claims 1 to 6, characterized in that: The determining, according to the external time synchronization information and the internal time synchronization information, a first time synchronization state of the master server includes: When both the external time synchronization information and the internal time synchronization information are normal, it is determined that the first time synchronization state is a normal state.
8. An alarm device, characterized in that: The device comprises: A first acquisition module is used to acquire time synchronization information of a master server in a distributed storage cluster; the time synchronization information includes external time synchronization information and internal time synchronization information of the master server; A first determining module, configured to determine a first time synchronization state of the master server according to the external time synchronization information and the internal time synchronization information; The alarm module is used to generate alarm information according to the first time synchronization state and the second time synchronization state of each slave server; the alarm information is used to indicate that there is a time synchronization anomaly in the distributed storage cluster.
9. A server, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.