Log backhaul routing method and apparatus, and storage medium
By independently selecting healthy paths for log return by edge nodes and access servers, the problem of single point failure of a single dispatching center and slow recovery from multiple dispatch center failures is solved, and the timeliness and reliability of log return are improved.
Patent Information
- Application Number
- PCT/CN2023/139957
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-07
- Filing Date
- 2023-12-19
- Publication Date
- 2024-09-12
AI Technical Summary
In the existing log backhaul system, there is a single point of failure in a single dispatch center, and the fault recovery time of multiple dispatch centers is long, resulting in poor log backhaul timeliness.
Use edge nodes and access servers to independently select healthy paths for log return, avoid single points of failure through polling and health query mechanisms, and ensure that there is at least one available path for log return.
It effectively improves the timeliness of log return, avoids the single point of failure problem and the decision-making consistency problem of multiple dispatch centers, and ensures the data integrity and arrival rate of log return.
Smart Images

Figure CN2023139957_12092024_PF_FP_ABST
Abstract
Description
A log return routing method, device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to a Chinese patent application filed with the Patent Office of China on March 7, 2023, with application number 202310208655.7 and entitled “A Routing Method, Device and Storage Medium for Log Return,” the entire contents of which are incorporated herein by reference. Technical Field
[0003] The embodiments of the present application relate to the technical field of data processing, and more specifically, to a method, device, and storage medium for selecting a path for log backhaul. Background Art
[0004] Logs are data that records response behaviors and request information when a computer system responds to specific inputs. They can be used in areas such as statistical analysis, anomaly location, and billing. The generation, collection, and retrieval of logs are traditional requirements in the computer system field.
[0005] Currently, there are many common solutions for log generation, collection, and retrieval. For example, a collection system is built based on a combination of three widely used open source projects: Elasticsearch, Logstash, and Kibana. Among them, Logstash is used to collect logs, Elasticsearch is used to store and retrieve logs, and Kibana is used to visualize the results of statistical analysis.
[0006] In addition, in some sub-sectors with higher performance requirements, since log collection is based on diverse network conditions, access routing or application acceleration services are required. Routing is usually performed by a dispatch center. That is, the dispatch center performs quality inspections on servers and scores and selects available servers, thereby issuing call links to clients, which can avoid single points of failure of servers and network links.
[0007] However, when a single dispatch center is used for route selection, there is a hidden danger of single-point failure in the center. To avoid the hidden danger of single-point failure in the center, multiple dispatch centers are usually introduced and the results of multiple dispatch centers are made consistent through a distributed consensus algorithm. Therefore, if a dispatch center fails, multiple dispatch centers need to negotiate, resulting in a long recovery time and poor timeliness of log return.
[0008] Summary of the Invention
[0009] The embodiments of the present application provide a log return routing method, device, and storage medium, aiming to improve the timeliness of log return.
[0010] In a first aspect, an embodiment of the present application provides a method for selecting a route for log transmission, the method comprising:
[0011] The edge node sends a log return request to any access server with a health mark that it is connected to. The access server with a health mark is in a normal state and is connected to at least one access server in the central cluster with a health mark. The log return request contains log data.
[0012] When the access server that receives the log return request is currently in a normal state, it forwards the log return request to any central cluster with a health mark to which it is connected;
[0013] When the central cluster that receives the log return request is currently in a normal state, the log data in the log return request is parsed to form a log return path.
[0014] In some embodiments of the present application, the method further includes:
[0015] If the central cluster that receives the log return request is currently in an abnormal state, it will not parse the log return request and will return an unhealthy status code to the access server that forwarded the log return request.
[0016] The access server that receives the unhealthy status code marks the central cluster as unhealthy and returns the log return request to the edge node.
[0017] In some embodiments of the present application, after the edge node sends a log return request to any access server with a health mark connected to it, the method further includes:
[0018] When the access server that receives the log return request is in an abnormal state, it returns a status code indicating unhealthy behavior to the edge node;
[0019] When an edge node receives a status code indicating unhealthy conditions, it marks the access server as unhealthy and sends log return requests to other healthy access servers in a round-robin manner.
[0020] In some embodiments of the present application, the method further includes:
[0021] For any access server with an unhealthy mark, the edge node sends a first health query request to the access server after a first preset interval from the marking moment;
[0022] The access server that receives the first health query request determines whether it is in a normal state and determines the health status of all central clusters to which it is connected;
[0023] When the access server that receives the first health query request is in a normal state and is connected to at least one central cluster with a health mark, the access server sends a health-indicating status code to the edge node; after the edge node receives the health-indicating status code, it adds a health mark to the access server.
[0024] In some embodiments of the present application, the method further includes:
[0025] For any central cluster with an unhealthy mark, the access server sends a second health query request to the central cluster after a second preset interval from the marking time;
[0026] The central cluster receiving the second health query request determines whether it is in a normal state;
[0027] When the central cluster receiving the second health query request is in a normal state, the central cluster sends a health status code to the access server;
[0028] After receiving the health status code, the access server adds a health mark to the central cluster.
[0029] In some embodiments of the present application, the access server that receives the first health query request determines whether it is in a normal state, including:
[0030] When the number of log message instances currently processed by the access server that receives the first health query request is greater than 0, the access server itself is in a normal state.
[0031] In some embodiments of the present application, the central cluster receiving the second health query request determines whether it is in a normal state, including:
[0032] When the number of log message instances currently processed by the central cluster that receives the second health query request is greater than 0, and the backlog of log message instances is less than the backlog threshold, the central cluster itself is in a normal state.
[0033] In a second aspect, an embodiment of the present application provides a log return routing device, the device including an edge node, an access server, and a central cluster, wherein:
[0034] The edge node is configured to send a log return request to any access server with a health mark connected to it, wherein the access server with a health mark is in a normal state and is connected to at least one access server of the central cluster with a health mark, and the log return request includes log data;
[0035] The access server is used to forward the log return request to any central cluster with a health mark when receiving the log return request and is in a normal state;
[0036] The central cluster is used to parse the log data in the log return request to form a log return path when receiving the log return request and is currently in a normal state.
[0037] In some embodiments of the present application, the apparatus further comprises:
[0038] A first abnormal state module is configured to, when the central cluster receiving the log return request is currently in an abnormal state, not parse the log return request and return a status code indicating an unhealthy state to the access server that forwarded the log return request;
[0039] The first updating module is configured to mark the central cluster as unhealthy and return the log return request to the edge node when the access server receives a status code indicating unhealthy status.
[0040] In some embodiments of the present application, the apparatus further comprises:
[0041] The second abnormal state module is used to return a status code indicating unhealthy state to the edge node when the access server that receives the log return request is currently in an abnormal state;
[0042] The second updating module is configured to mark the access server as unhealthy when the edge node receives a status code indicating unhealthy status, and to send a log return request to other healthy access servers in a polling manner.
[0043] In some embodiments of the present application, the edge node includes a first health query module, which is configured to send a first health query request to any access server with an unhealthy mark after a first preset interval from the marking time;
[0044] The access server includes a first health determination module, which is configured to determine whether the access server that receives the first health query request is in a normal state and to determine the health status of all central clusters to which it is connected; and when the access server that receives the first health query request is in a normal state and is connected to at least one central cluster with a health mark, the access server sends a health status code to the edge node;
[0045] The edge node further includes a first health marking module, which is configured to add a health mark to the access server after receiving a health status code.
[0046] In some embodiments of the present application, the access server includes a second health query module, which is configured to send a second health query request to any central cluster with an unhealthy mark after a second preset interval from the marking time;
[0047] The central cluster includes a second health determination module, which is used to determine whether the central cluster itself is in a normal state after receiving the second health query request; and when the central cluster itself is in a normal state after receiving the second health query request, the central cluster sends a status code indicating health to the access server; the access server includes a second health marking module, which is used to add a health mark to the central cluster after receiving the status code indicating health.
[0048] In some embodiments of the present application, the first health determination module includes:
[0049] The first health determination unit is configured to determine that the access server itself is in a normal state when the number of log message instances currently processed by the access server that has received the first health query request is greater than 0.
[0050] In some embodiments of the present application, the second health determination module includes:
[0051] The second health determination unit is configured to determine that the central cluster itself is in a normal state when the number of log message instances currently processed by the central cluster that receives the second health query request is greater than 0 and the backlog of log message instances is less than the backlog threshold.
[0052] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the routing method for log transmission according to the first aspect of the embodiment is implemented. Beneficial effects:
[0053] In this method, when log return is required, the edge node itself selects an access server to send a log return request, and the access server selects a central cluster to forward the log return request. The access server selected by the edge node is an access server with a health mark, and the access server with a health mark is connected to at least one central cluster with a health mark. Therefore, there is at least one path between the edge node, the access server with a health mark and the central cluster, which can enable the log return request to reach the central cluster. If the central cluster that receives the log return request is still in a normal state, the log data contained in the log return request can be parsed, thereby forming a log return path.
[0054] By independently selecting the objects to which messages are sent at both the edge node and access server levels, the significant overhead of the existing method using a dispatch center can be effectively avoided. In addition, compared with the single point of failure problem of a single dispatch center and the difficulty in ensuring the consistency of dispatch results from multiple dispatch centers, the edge node in this method has a grasp of the global health status and can avoid faulty access servers or central clusters. There is no single point of failure problem, and there will be no situation where multiple centers issue different decisions at the same time, as may occur with multiple dispatch centers.
[0055] At the same time, the recovery process of the fault location does not affect other normal edge nodes, access servers and central clusters to form other log return paths, which can effectively improve the timeliness of log return. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0057] FIG1 is a flowchart of a method for selecting a path for log transmission according to an embodiment of the present application;
[0058] FIG2 is a flowchart of steps for health query of an access server proposed in one embodiment of the present application;
[0059] FIG3 is a flowchart of steps for health query of a central cluster provided by an embodiment of the present application;
[0060] FIG4 is a schematic diagram of the structure of a routing device for log return provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0062] In some niche areas with higher performance requirements, general log collection solutions do not meet performance requirements. For example, in the field of large-scale billing logs, billing logs not only come from a wider range of sources, but also cannot tolerate a large number of retransmissions and missed transmissions due to billing, and high real-time performance is required. Therefore, access routing is required. Current routing relies on traditional dispatching systems, including single dispatching centers and multiple dispatching centers.
[0063] Among them, a single dispatching center is prone to single point failure risks. In order to avoid single point failure risks, multiple dispatching centers are introduced, and multiple dispatching centers determine the unique result through a distributed consensus algorithm. However, in the multiple dispatching center mode, if one dispatching center fails, the other dispatching centers need to negotiate during the failure recovery, resulting in a long failure recovery time and a higher failure rate, which leads to poor timeliness of log return.
[0064] To solve this problem, an embodiment of the present application provides a log return routing method that does not rely on central scheduling and decision-making, implements decentralized routing decisions, and can effectively improve the timeliness of log return.
[0065] 1 , a flowchart of a method for selecting a route for log transmission in accordance with an embodiment of the present application is shown. The device architecture used in the method includes edge nodes, access servers, and a central cluster. The edge nodes are service nodes distributed around the world, and need to transmit service-generated data back to the central cluster for processing. The access servers are distributed across hub nodes nationwide, providing cross-network and cross-operator access services and authentication. They can forward requests sent by edge nodes to the central cluster, which is responsible for data processing. The method may specifically include the following steps:
[0066] S101: The edge node sends a log return request to any connected access server with a health flag. Any edge node can connect to multiple access servers. The connections between edge nodes and access servers can be pre-configured or continuously updated. For example, an edge node can connect to only a few fixed access servers by parsing a fixed list, or it can periodically parse a new access server list to connect to newly added access servers.
[0067] When there is a need for log return, the edge node will select an access server with a healthy mark to send the log return request. The access server with a healthy mark is in a normal state and is connected to at least one access server of a central cluster with a healthy mark. That is, through the access server with a healthy mark, there is at least one path that can successfully send the log return request to a central cluster with a healthy mark.
[0068] In the actual implementation process, in the initial stage, each access server can monitor the health status of each central cluster it is connected to and add an initial health mark for each central cluster. Then the edge node monitors the health status of each access server it is connected to and the health mark of the connected central cluster, and adds an initial health mark for each access server.
[0069] Afterwards, the edge server can also monitor the health status of each access server regularly, because the health status of the access server not only involves whether it is in a normal state, but also involves the health status of all central clusters to which it is connected. Therefore, each access server also needs to monitor the health status of the central cluster regularly.
[0070] S102: When the access server receiving the log return request is currently in a normal state, the log return request is forwarded to any central cluster with a health mark to which the access server is connected.
[0071] Although the access server that receives the log return request is marked as healthy, it is possible that when the log return request of the edge node is sent to the access server, the access server may suddenly fail. Therefore, it is necessary to determine the current status of the access server that receives the log return request.
[0072] When the access server that receives the log return request is currently in a normal state, the log return request can be processed further. Since the access server with a healthy mark has successfully connected to at least one central cluster with a healthy mark, the log return request can be forwarded to any healthy central cluster it is connected to. When the access server that receives the log return request is currently in an abnormal state, the log return request cannot be forwarded. The access server can return a status code indicating unhealthy conditions to the edge node. The response body of the status code indicating unhealthy conditions can also include the specific reason for the return. When the edge node receives the status code indicating unhealthy conditions, it marks the access server as unhealthy and uses a polling method to send log return requests to other healthy access servers.
[0073] S103: When the central cluster that receives the log return request is currently in a normal state, the log data in the log return request is parsed to form a log return path.
[0074] If the access server is in a normal state, the access server can independently select any central cluster with a health mark to which it is connected to forward the log return request. After receiving the log return request forwarded by the access server, any central cluster with a health mark also needs to determine whether it is currently in a normal state.
[0075] If the central cluster is in a normal state, the log return request can be processed normally, and the log data contained in the request body of the log return request can be parsed, thereby completing the return of the log data and forming a complete log return path.
[0076] If the central cluster is in an abnormal state after receiving the log return request forwarded by the access server, the central cluster cannot parse the log return request and returns a status code indicating unhealthy conditions to the access server that forwarded the log return request. The response body of the status code indicating unhealthy conditions may include specific reasons. The access server that receives the status code indicating unhealthy conditions returned by the central cluster marks the central cluster as unhealthy and returns the log return request to the edge node. The edge node may poll other access servers with health marks to send log return requests.
[0077] When the edge node polls other access servers with health marks, it may adopt a method of randomly traversing all other healthy access servers, or a method of traversing all other healthy access servers in a list order, which is not limited in this embodiment.
[0078] Through the above process, it can be found that during the transmission of each log return request, if the access servers and central clusters involved are in an abnormal state, they will return a status code indicating unhealthy conditions, that is, notify the upper level of their own health status. Therefore, in this embodiment, in order to save data transmission resources when the edge node monitors the health status of all access servers connected to it, and the access server monitors the health status of all central clusters connected to it, the health status of the access servers and central clusters involved in the current log return request can be obtained separately during the transmission of each log return request, and there is no need to monitor the health status of each access server and each central cluster in real time, which can save a lot of data resources.
[0079] For example, when the access server that receives the log return request is currently in a normal state and successfully forwards the log return request, and the central cluster that receives the log return request successfully parses the log data in the log return request, the central cluster can return a status code indicating health to the access server in the current log return path, and can even return a status code indicating health to all access servers connected to the central cluster, so that the access server or all access servers in the current log return path know that the central cluster is in a normal state and maintain the health mark of the central cluster.
[0080] After the access server in the current log return path receives the health status code returned by the central cluster, the access server meets the conditions that it is in a normal state and is connected to at least one central cluster with a health mark. Therefore, the access server can also return the health status code to the edge node in the current log return path, or even to all edge nodes connected to it, so that the edge node or all edge nodes in the current log return path maintain the health mark of the access server.
[0081] For access servers or central clusters that are in an abnormal state during the transmission of log return requests, an unhealthy mark is added because they each return a status code indicating unhealthy conditions to the upper level. For example, the access server itself is in an abnormal state and does not meet the conditions for adding a healthy mark. Therefore, when the edge node of the upper level receives a status code indicating unhealthy conditions, an unhealthy mark is added to the access server; because the central cluster itself is in an abnormal state, when the access server of the upper level receives a status code indicating unhealthy conditions, an unhealthy mark is added to the central cluster.
[0082] Similarly, in the actual implementation process, the access server or central cluster can return a status code indicating unhealthy conditions only to the upper level involved in the current log return request transmission process, or it can return a status code indicating unhealthy conditions to all upper levels to which it is connected.
[0083] For example, the edge nodes include A1, A2, and A3, the access servers include B1 and B2, and the central cluster includes B1 and C3. The potential log return paths of edge node-access server-central cluster may include: A1-B1-C1, A1-B1-C2, A1-B2-C1, A1-B2-C2, A2-B1-C1, A2-B1-C2, A2-B2-C1, A2-B2-C2, A3-B1-C1, A3-B1-C2, A3-B2-C1, and A3-B2-C2.
[0084] If, during the transmission of the current log return request, edge node A1 autonomously selects access server B1 to send the log return request, and access server B1 is in an abnormal state, access server B1 can return a status code indicating an unhealthy state only to edge node A1, or it can simultaneously return a status code indicating an unhealthy state to all edge nodes A1, A2, and A3 connected to it at the previous level; the same applies to the central cluster.
[0085] If a log return path is successfully formed during the transmission of the current log return request, that is, a central cluster successfully parses the log data in the log return request, assuming that the log return path is A2-B2-C2, then the central cluster C2 can return a health status code only to the access server B2, or it can return a health status code to all the access servers B1 and B2 connected to it at the same time; since the access server B2 in the current log return path can successfully forward the log return request, the access server B2 itself is in a normal state and is connected to at least one central cluster C2 with a health mark, so the access server B2 can return a health status code only to the edge node A2 in the current log return path, or it can return a health status code to all the edge nodes A1, A2 and A3 connected to it at the same time.
[0086] By updating the health mark of the access server or central cluster during the transmission process of each log return request, a large amount of data resources can be saved. However, for the access server or central cluster that has been marked as unhealthy, its health status needs to be queried to know whether it has recovered to a healthy state, so as to update the unhealthy mark.
[0087] 2 , a flowchart of steps for health query of an access server provided by an embodiment of the present application is shown. As shown in FIG2 , in a feasible implementation manner, the health query of an edge node for an access server with an unhealthy mark includes the following steps:
[0088] A1: For any access server with an unhealthy mark, the edge node sends a first health query request to the access server after a first preset interval from the marking time.
[0089] When an edge node adds an unhealthy mark to an access server, it records the timestamp of the current unhealthy mark and sends a first health query request to the access server after a first preset interval to query whether the access server has recovered.
[0090] A2: The access server that receives the first health query request determines whether it is in a normal state, and determines the health status of all central clusters to which it is connected.
[0091] The health check rule of the access server itself may be: when the number of log message instances currently processed is greater than 0, the access server itself is in a normal state; the access server may perform health checks on itself or through a third party.
[0092] At the same time, the access server queries the health status of all central clusters it is connected to, obtains the number of central clusters with healthy marks, and can also perform health queries on central clusters with unhealthy marks.
[0093] A3: The access server that receives the first health query request determines the returned status code.
[0094] When the access server that receives the first health query request is in a normal state and is connected to at least one central cluster with a health mark, the access server sends a status code indicating health to the edge node; when the access server that receives the first health query request is in an abnormal state and / or is not connected to at least one central cluster with a health mark, the access server sends a status code indicating unhealthiness to the edge node.
[0095] A4: The edge node updates the health flag of the access server based on the received status code.
[0096] Among them, when the edge node receives a status code indicating health, it adds a health mark to the access server; when the edge node receives a status code indicating unhealth, it maintains the unhealthy mark of the access server and updates the timestamp of the current unhealthy mark. After a first preset interval, it sends a first health query request to the access server again to inquire whether the access server has recovered to health.
[0097] 3 , a flowchart of steps for health query of a central cluster provided by an embodiment of the present application is shown. As shown in FIG3 , in a feasible implementation manner, the access server's health query for a central cluster with an unhealthy mark includes the following steps:
[0098] B1: For any central cluster with an unhealthy mark, the access server sends a second health query request to the central cluster after a second preset interval from the marking time.
[0099] When an access server adds an unhealthy mark to a central cluster, it records the timestamp of the current unhealthy mark. After a second preset interval, the access server sends a second health query request to the central cluster to check whether the central cluster has returned to normal.
[0100] B2: The central cluster receives the second health query request and determines whether it is in a normal state.
[0101] The health check rule of the central cluster can be: when the number of log message instances currently being processed is greater than 0 and the backlog of log message instances is less than the backlog threshold, the central cluster itself is in a normal state; the central cluster can perform health checks on itself or through a third party.
[0102] B3: The central cluster receives the second health query request and determines the returned status code.
[0103] When the central cluster receiving the second health query request is in a normal state, the central cluster sends a health status code to the access server; when the central cluster receiving the second health query request is still in an abnormal state, it sends an unhealthy status code to the access server.
[0104] B4: The access server updates the health mark of the central cluster according to the received status code.
[0105] Among them, when the access server receives a status code indicating health, it adds a health mark to the central cluster; when the access server receives a status code indicating unhealth, it maintains the unhealthy mark of the central cluster and updates the timestamp of the current unhealthy mark. After a second preset interval, it sends a second health query request to the central cluster again to inquire whether the center has recovered its health.
[0106] During the process of performing a health query on the access server or central cluster, if no status code or any response is received within the calibrated time, the access server or central cluster connection may fail. The upper layer can add an unhealthy mark to the access server or central cluster. The status code representing health in this embodiment can be HTTP status code 200, and the status code representing unhealthiness can be HTTP status code 500, 502, or 503.
[0107] For example, the access server can use the following logic to monitor the health of the central cluster:
[0108] The access server records the health mark and unhealthy mark of each connected central cluster, for example, maintaining a Map, where the key is the central cluster and the value is the health mark of the central cluster. If the central cluster is marked as healthy, the value is 0; when the central cluster returns a status code indicating unhealthy conditions, or no status code is received due to failure of the underlying TCP connection, the central cluster is considered to be unhealthy, and the value is set to the current Unix timestamp; and the backend thread periodically checks the Map. If a central cluster with a value other than 0 is found, and the current Unix timestamp is greater than the value by a preset threshold, a health query is performed again; if the central cluster returns a status code indicating health, the central cluster is considered to have recovered and available, and the value is set to 0; if a status code indicating unhealthy conditions is returned or no status code is received, the central cluster is considered to still be abnormal, and the value is updated to the current Unix timestamp.
[0109] If an access server is marked as unhealthy by multiple edge nodes of the previous level at the same time, any edge node of the previous level can perform a health query, and then the queried access server can synchronize the status code of this query to all edge nodes of the previous level; similarly, if a central cluster is marked as unhealthy by multiple access servers of the previous level at the same time, any access server of the previous level can perform a health query, and then the queried central cluster can synchronize the status code of this query to all access servers of the previous level, further saving data transmission resources during the health query process.
[0110] The health check rules for the central cluster and access servers provided in this embodiment can effectively cover the following fault scenarios:
[0111] 1) Single-center cluster failure: Due to a server failure or an internal Internet failure within the center cluster, the center cluster's processing capacity decreases. The number of log message instances processed by the center cluster is 0, or the backlog of log message instances is greater than or equal to the backlog threshold. Therefore, the center cluster is unhealthy and returns a status code indicating unhealthy conditions to the access server. The access server then does not send log return requests to the center cluster.
[0112] 2) Single-center cluster network access failure: Affected by the central cluster campus firewall or public network cutover operation, the single-center cluster network access may be interrupted or packet loss occurs. At this time, the access server cannot access the central cluster, that is, the central cluster cannot receive the second health query request. If the access server does not receive any status code within the calibration time, it considers the central cluster unhealthy, adds an unhealthy mark to it, and does not send log return requests to the central cluster.
[0113] 3) Single access server network failure. Since access servers are distributed in different areas and use networks of different operators, single access server network failure is prone to occur when the operator in the computer room or a certain area implements cutover. At this time, the network connection between the edge node and the access server is interrupted or timed out. The edge node cannot receive any status code returned by the access server and considers the access server unhealthy. It adds an unhealthy mark to it and does not send log return requests to the access server.
[0114] 4) Single access server failure: When a server fails due to some hardware or software reasons, its own instance cannot be started or the health check fails. At this time, the edge node receives the status code indicating unhealthy status returned by the access server, adds an unhealthy mark to it, and does not send a log return request to the access server.
[0115] 5) Single access server network failure: Due to the influence of regional operator firewalls, a single access server is often unable to access all central clusters. In this case, the access server fails the health check of all central clusters, that is, there is no connection to at least one central cluster with a healthy mark. Therefore, the access server does not meet the conditions for adding a healthy mark, and the edge node does not send a log return request to the access server.
[0116] Compared with the log return routing method involving the dispatch center, this method achieves decentralization. The routing selection right of the log return process is at the upper level. That is, by independently selecting the object to which the message is sent at the edge node and the access server, the significant overhead of the existing method using the dispatch center can be effectively avoided.
[0117] The availability of access servers and central clusters can be notified to edge nodes step by step. After the edge nodes understand the global health status, they can decide which access server to send the log return request to. The edge nodes will make independent decisions on the route. Compared with the routing method of using multiple dispatch centers, faulty access servers or central clusters can be avoided in a timely manner. There is no single point of failure problem, which ensures the integrity and arrival rate of data during the log return process. There will also be no situation where multiple centers issue different decisions at the same time, as may happen with multiple dispatch centers.
[0118] Moreover, in this method, when restoring the fault location, it does not affect other normal edge nodes, access servers and central clusters to form other log return paths, which can effectively improve the timeliness of log return.
[0119] 4 , a schematic diagram illustrating the structure of a routing device for log backhaul according to an embodiment of the present application is shown. The device includes an edge node, an access server, and a central cluster, wherein:
[0120] The edge node is configured to send a log return request to any access server with a health mark connected to it, wherein the access server with a health mark is in a normal state and is connected to at least one access server of the central cluster with a health mark, and the log return request includes log data;
[0121] The access server is used to forward the log return request to any central cluster with a health mark when receiving the log return request and is in a normal state;
[0122] The central cluster is used to parse the log data in the log return request to form a log return path when receiving the log return request and is currently in a normal state.
[0123] In some embodiments of the present application, the apparatus further comprises:
[0124] A first abnormal state module is configured to, when the central cluster receiving the log return request is currently in an abnormal state, not parse the log return request and return a status code indicating an unhealthy state to the access server that forwarded the log return request;
[0125] The first updating module is configured to mark the central cluster as unhealthy and return the log return request to the edge node when the access server receives a status code indicating unhealthy status.
[0126] In some embodiments of the present application, the apparatus further comprises:
[0127] The second abnormal state module is used to return a status code indicating unhealthy state to the edge node when the access server that receives the log return request is currently in an abnormal state;
[0128] A second update module is configured to mark an access server as unhealthy when the edge node receives a status code indicating unhealthy status, and to send a log return request to other healthy access servers in a round-robin manner. In some embodiments of the present application, the edge node includes a first health query module, which is configured to send a first health query request to any access server marked unhealthy after a first preset interval from the time of marking.
[0129] The access server includes a first health determination module, which is configured to determine whether the access server that receives the first health query request is in a normal state and to determine the health status of all central clusters to which it is connected; and when the access server that receives the first health query request is in a normal state and is connected to at least one central cluster with a health mark, the access server sends a health status code to the edge node;
[0130] The edge node further includes a first health marking module, which is configured to add a health mark to the access server after receiving a health status code.
[0131] In some embodiments of the present application, the access server includes a second health query module, which is configured to send a second health query request to any central cluster with an unhealthy mark after a second preset interval from the marking time;
[0132] The central cluster includes a second health determination module, which is used to determine whether the central cluster itself is in a normal state after receiving the second health query request; and when the central cluster itself is in a normal state after receiving the second health query request, the central cluster sends a status code indicating health to the access server; the access server includes a second health marking module, which is used to add a health mark to the central cluster after receiving the status code indicating health.
[0133] In some embodiments of the present application, the first health determination module includes:
[0134] The first health determination unit is configured to determine that the access server itself is in a normal state when the number of log message instances currently processed by the access server that has received the first health query request is greater than 0.
[0135] In some embodiments of the present application, the second health determination module includes:
[0136] The second health determination unit is configured to determine that the central cluster itself is in a normal state when the number of log message instances currently processed by the central cluster that receives the second health query request is greater than 0 and the backlog of log message instances is less than the backlog threshold.
[0137] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the routing method for log transmission as described in the embodiment is implemented.
[0138] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0139] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0140] The present application embodiment is described with reference to the flow chart and / or block diagram of the method, terminal device (system), and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flow chart and / or block diagram and the combination of the process and / or box in the flow chart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for realizing the function specified in one process or multiple processes and / or one box or multiple boxes of the flow chart.
[0141] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0142] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0143] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0144] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0145] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A method for selecting a path for log transmission, characterized in that: The method comprises: The edge node sends a log return request to any access server with a health mark connected to it, wherein the access server with a health mark is in a normal state and is connected to at least one access server of the central cluster with a health mark, and the log return request contains log data; When the access server receiving the log return request is currently in a normal state, forwarding the log return request to any central cluster with a health mark connected to it; When the central cluster receiving the log return request is currently in a normal state, the log data in the log return request is parsed to form a log return path.
2. The method according to claim 1, characterized in that The method further comprises: When the central cluster receiving the log return request is currently in an abnormal state, the log return request is not parsed, and a status code indicating unhealthy state is returned to the access server forwarding the log return request; The access server that receives the status code indicating unhealthiness marks the central cluster as unhealthy and returns the log return request to the edge node.
3. The method according to claim 1, characterized in that After the edge node sends a log return request to any access server connected to it and having a health mark, the method further includes: When the access server receiving the log return request is currently in an abnormal state, returning a status code indicating unhealthy state to the edge node; When receiving the status code indicating unhealthiness, the edge node marks the access server as unhealthy, and sends the log return request to other healthy access servers in a polling manner.
4. The method according to claim 1, characterized in that: The method further comprises: For any access server with an unhealthy mark, the edge node sends a first health query request to the access server after a first preset interval from the marking time; The access server receiving the first health query request determines whether it is in a normal state, and determines the health status of all central clusters to which it is connected; When the access server receiving the first health query request is in a normal state and is connected to at least one central cluster with a health mark, the access server sends a health status code to the edge node; After receiving the status code indicating health, the edge node adds a health mark to the access server.
5. The method according to claim 1, characterized in that The method further comprises: For any central cluster with an unhealthy mark, the access server sends a second health query request to the central cluster after a second preset interval from the marking time; The central cluster receiving the second health query request determines whether it is in a normal state; When the central cluster receiving the second health query request is in a normal state, the central cluster sends a health status code to the access server; After receiving the status code indicating health, the access server adds a health mark to the central cluster.
6. The method according to claim 4, characterized in that The access server receiving the first health query request determines whether it is in a normal state, including: When the number of log message instances currently processed by the access server that receives the first health query request is greater than 0, the access server itself is in a normal state.
7. The method according to claim 5, characterized in that The central cluster receiving the second health query request determines whether it is in a normal state, including: When the number of log message instances currently processed by the central cluster receiving the second health query request is greater than 0, and the backlog of the log message instances is less than the backlog threshold, the central cluster itself is in a normal state. Normal state.
8. A log return routing device, characterized in that: The device includes an edge node, an access server and a central cluster, wherein: The edge node is used to send a log return request to any access server with a health mark connected to it, wherein the access server with a health mark is in a normal state and is connected to at least one access server of a central cluster with a health mark, and the log return request includes log data; The access server is used for forwarding the log return request to any central cluster with a health mark connected to it when receiving the log return request and being in a normal state; The central cluster is used to parse the log data in the log return request to form a log return path when receiving the log return request and is currently in a normal state.
9. The device according to claim 8, characterized in that The device also includes: A first abnormal state module, configured to, when the central cluster receiving the log return request is currently in an abnormal state, not parse the log return request, and return a status code indicating an unhealthy state to the access server forwarding the log return request; The first updating module is used to mark the central cluster as unhealthy and return the log return request to the edge node when the access server receives the status code indicating unhealthy.
10. The device according to claim 8, characterized in that The device also includes: A second abnormal state module is used to return a status code indicating unhealthy state to the edge node when the access server receiving the log return request is currently in an abnormal state; The second updating module is used to mark the access server as unhealthy when the edge node receives the status code indicating unhealthy state, and send the log return request to other healthy access servers in a polling manner.
11. The device according to claim 8, characterized in that The edge node comprises a first health query module, the first health query module being used to send a first health query request to any access server with an unhealthy mark after a first preset interval from the marking time; The access server includes a first health determination module, which is used to determine whether the access server receiving the first health query request is in a normal state, and determine the health status of all central clusters connected to it; and when the access server receiving the first health query request is in a normal state and is connected to at least one central cluster with a health mark, the access server sends a health status code to the edge node; The edge node further includes a first health marking module, and the first health marking module is used to add a health mark to the access server after receiving the status code representing health.
12. The device according to claim 8, characterized in that The access server includes a second health query module, and the second health query module is used to send a second health query request to any central cluster with an unhealthy mark after a second preset interval from the marking time; The central cluster includes a second health determination module, and the second health determination module is used to determine whether the central cluster itself that receives the second health query request is in a normal state; When the central cluster receiving the second health query request is in a normal state, the central cluster sends a health status code to the access server; The access server includes a second health mark module, and the second health mark module is used to add a health mark to the central cluster after receiving the status code representing health.
13. The device according to claim 11, characterized in that The first health determination module includes: The first health determination unit is configured to determine that the access server itself is in a normal state when the number of log message instances currently processed by the access server that receives the first health query request is greater than 0.
14. The device according to claim 12, characterized in that The second health determination module includes: The second health determination unit is configured to determine that the central cluster itself is in a normal state when the number of log message instances currently processed by the central cluster that receives the second health query request is greater than 0 and the backlog of the log message instances is less than a backlog threshold.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the log routing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data Storage System Based on Redis Cluster
CN109407980A
Server cluster system supporting high concurrency, control method and control device
CN111198762A
Micro-service request processing method and device, equipment and medium
CN114866617A
Method and device for returning CDN (Content Delivery Network) log with high reliability
CN115643166A
Log return routing method and device and storage medium
CN116095180A
