Request processing method and device and computer equipment
By obtaining the processable state of the task request in the backup node of the distributed cluster and forwarding it to the original master node for processing, the problem of poor performance of the distributed cluster in the process of processing task requests is solved, and a higher processing speed is achieved , efficiency and reliability.
Patent Information
- Application Number
- CN202411495365.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-21
AI Technical Summary
The problem of poor performance of distributed clusters in processing task requests.
In the backup node of the distributed cluster, in response to the task request sent by the upstream, obtain the processing status of the task request, and when the backup node cannot process the task request, the task request is sent to the original master node to instruct the original master node to instruct the original master node. Process task requests.
It improves the speed and efficiency of task request processing by distributed clusters, reduces request processing errors, ensures the normal processing of the entire set of services, and improves the performance and reliability of distributed clusters.
Smart Images

Figure CN119493647A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of task processing, and in particular to a request processing method, device and computer equipment. Background Art
[0002] With the development of computer clustering and the increase in data size, distributed clusters are becoming more and more popular. Distributed clusters include multiple clusters and control centers that provide the same services. Each cluster includes multiple nodes, and the relationship between the logical services provided by different nodes is used to provide a complete set of services to process task requests.
[0003] In actual applications, after the service cluster (any cluster) receives the task request sent by the control center, the master node in the service cluster starts to respond to the task request. If any node in the service cluster cannot provide the corresponding service, a new service cluster is selected from other clusters, and the control center resends the task request to the newly selected service cluster, instructing the master node in the service cluster to start processing the task request.
[0004] However, the distributed cluster in the related art may have the problem of poor performance when processing task requests. Summary of the invention
[0005] Based on this, it is necessary to provide a request processing method, apparatus and computer equipment to address the above technical problems, which can improve the performance of the distributed cluster in the process of processing task requests.
[0006] In a first aspect, an embodiment of the present application provides a request processing method, which is applied to a standby node in a first cluster, where the first cluster is any cluster in a distributed cluster; the method includes:
[0007] In response to the task request sent by the upstream end, obtain the processable status of the task request;
[0008] When the processable state indicates that the standby node cannot process the task request, the task request is sent to the original master node to instruct the original master node to process the task request;
[0009] The original master node and the backup node are used to process the same type of requests, and the original master node is any node in any cluster other than the first cluster in the distributed cluster.
[0010] The technical solution in the embodiment of the present application responds to the task request sent by the upstream end, obtains the processable status of the task request, and when the processable status is that the standby node cannot process the task request, sends the task request to the original master node, instructing the original master node to process the task request. Among them, the original master node and the standby node are used to process the same type of requests, and the original master node is any node in any other cluster except the first cluster in the distributed cluster; in the above method, when the standby node responds to the task request sent by the upstream end, the standby node can first obtain the processable state of whether it can process the task request. When it cannot directly process the task request, it can directly interact with the original master node with the same logical service and forward the task request to the original master node for processing. This process does not need to indirectly pass through the control center in the distributed cluster to resend the task request to the original master node, thereby improving the speed and efficiency of the distributed cluster in processing the task request, thereby improving the performance of the distributed cluster; at the same time, the above method does not require human participation, can reduce request processing errors, thereby improving the accuracy of task request processing, and can greatly improve the speed and efficiency of task request processing; in addition, in the above method, when the distributed cluster provides a full set of services, it can ensure that the logical service corresponding to the standby node is provided normally, avoiding affecting the running status of other logical services provided by downstream nodes related to the standby node, so that it will not affect the normal processing of the complete service, thereby improving the success rate of the whole set of service processing.
[0011] In one embodiment, obtaining the processable status of the task request includes:
[0012] Obtain the consumed resources required to process the task request and the remaining resources of the standby node;
[0013] If the consumed resources are less than or equal to the remaining resources, the processable state is determined as the standby node can process the task request;
[0014] Otherwise, the processable state is determined to be that the standby node cannot process the task request.
[0015] The technical solution in the embodiment of the present application obtains the consumed resources required for processing the task request and the remaining resources of the standby node. If the consumed resources are less than or equal to the remaining resources, the processable state is determined to be that the standby node can process the task request; otherwise, the processable state is determined to be that the standby node cannot process the task request. In the above method, the standby node can determine its own processable state for the task request through the relationship between the consumed resources required for the task request and its own remaining resources, so as to ensure that the speed and efficiency of task processing can be improved on the basis of successful processing of the task request, and the processing process does not require the participation of complex algorithms, thereby reducing the complexity of determining the processable state of the task request and improving the speed and efficiency of determining the processable state of the task request.
[0016] In one embodiment, the method further comprises:
[0017] When the processable state indicates that the standby node can process the task request, the task request is processed to obtain a request processing result;
[0018] The request processing result is sent to the original master node, instructing the original master node to store the request processing result in the persistence system.
[0019] The technical solution in the embodiment of the present application, when the processable state is that the standby node can process the task request, processes the task request to obtain the request processing result, and sends the request processing result to the original master node, instructing the original master node to store the request processing result in the persistence system; the above method can, when the processable state of the task request is that the standby node can process the task request, the standby node processes the task request, which can share the processing pressure of the original master node, and improve the performance of the distributed cluster, the response speed to the task request and the reliability.
[0020] In one embodiment, before sending the task request to the original master node, the method further includes:
[0021] When a stop service message is received from the original master node, the task request is sent to the re-selected current master node, instructing the current master node to process the task request;
[0022] The stop service message is sent by the current master node after responding to the standby downgrade instruction sent by the control center in the distributed cluster; the current master node and the standby node process the same request type.
[0023] The technical solution in the embodiment of the present application, when a stop service message sent by the original master node is obtained, sends the task request to the re-selected current master node, instructing the current master node to process the task request; in the above method, after the standby node receives the stop service message sent by the original master node, it can manage the task request so that the task request is sent to the re-selected current master node for processing, thereby improving the success rate of the task request, and enabling the standby node to manage the task request in a timely manner, and can also improve the speed and efficiency of task request processing, thereby improving the performance of the distributed cluster.
[0024] In one embodiment, the method further comprises:
[0025] In the event of a failure of the original master node, in response to a master upgrade instruction sent by the control center in the distributed cluster, persistent information stored in the persistence system in the original master node is obtained to complete the master upgrade operation.
[0026] The technical solution in the embodiment of the present application, in the event of a failure of the original master node, responds to the upgrade command sent by the control center in the distributed cluster, obtains the persistence information stored in the persistence system of the original master node to complete the upgrade operation; after the standby node in the above method responds to the upgrade command, it can obtain the persistence information to achieve recovery, so as to be able to successfully provide logical services to the outside world, ensure the normal response of the distributed cluster, and improve the success rate of the distributed cluster in processing task requests; at the same time, the standby node in the above method can be upgraded to the master node to ensure that the corresponding logical services can be provided normally, so that the failure of the logical services provided by the interdependent nodes will not be spread due to the downgrade of the standby node after the failure of the original master node, and the impact of the failure can be reduced to a minimum, so that the corresponding entire set of services can be guaranteed to be provided normally by the distributed cluster, thereby improving the performance of the distributed cluster.
[0027] In a second aspect, an embodiment of the present application provides a request processing method, which is applied to an original master node in a second cluster, where the second cluster is any cluster in a distributed cluster; the method includes:
[0028] In response to a task request sent by a standby node in the first cluster, processing the task request;
[0029] Among them, the task request is a response by the standby node to the task request sent by the upstream end, obtaining the processable status of the task request, and sending it when the processable status is that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the original master node and the standby node are used to process the same type of requests.
[0030] The technical solution in the embodiment of the present application processes the task request in response to the task request sent by the standby node in the first cluster, wherein the task request is a response by the standby node to the task request sent by the upstream end, obtains the processable status of the task request, and is sent when the processable status is that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the original master node and the standby node are used to process the same type of requests; the above method can receive the task request forwarded by the standby node to process the task request when the standby node cannot process the task request, thereby improving the success rate of task request processing, thereby making the distributed cluster have higher performance and higher reliability.
[0031] In one embodiment, processing a task request includes:
[0032] Process the task request to obtain the request processing result, and store the request processing result in the persistence system.
[0033] According to the technical solution in the embodiment of the present application, the original master node can process the task request to obtain the request processing result, and store the request processing result in a persistence system to ensure that the request processing result can be persistently stored, so as to avoid the failure of the original master node. Other backup nodes can restore the persistent information to replace the original master node to continue to provide the same logical service, thereby improving the speed and efficiency of the corresponding task request processing.
[0034] In one embodiment, the method further comprises:
[0035] In the process of processing a task request, in response to a standby downgrade instruction sent by the control center in the distributed cluster, a stop service message is sent to the standby node, instructing the standby node to send the task request to the re-selected current master node; the current master node and the standby node process the same request type;
[0036] The control information of the persistent information stored in the persistent system is destroyed to complete the downgrade operation; wherein the persistent information at least includes the request processing result generated before the current moment.
[0037] The technical solution in the embodiment of the present application, in the process of processing task requests, responds to the downgrade instruction sent by the control center in the distributed cluster, sends a stop service message to the standby node, and destroys the control information of the persistent information stored in the persistence system to complete the downgrade operation; the original master node in the above method can send a stop service message to the standby node during the downgrade process to notify the standby node that the logical service provided by itself has been stopped, so that the standby node can manage the task request in time, improve the speed, efficiency and success rate of task request processing, and the original master node can destroy the control information of the persistent information to completely downgrade, avoid the problem of abnormal task request processing caused by confusion of the master node during task request processing, so that the task request can be processed normally, thereby improving the performance of the distributed cluster.
[0038] In a third aspect, an embodiment of the present application provides a request processing device, the device comprising:
[0039] An acquisition module, used for responding to a task request sent by an upstream end and acquiring a processable status of the task request;
[0040] A first sending module is used to send the task request to the original master node when the processable state is that the standby node cannot process the task request, and instruct the original master node to process the task request;
[0041] The original master node and the backup node are used to process the same type of requests, and the original master node is any node in any cluster other than the first cluster in the distributed cluster.
[0042] In a fourth aspect, an embodiment of the present application provides a request processing device, the device comprising:
[0043] A request processing module, configured to respond to a task request sent by a standby node in the first cluster and process the task request;
[0044] Among them, the task request is a task request sent by the standby node in response to the upstream end, obtaining the processable status of the task request, and sending it when the processable status is that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the original master node and the standby node are used to process the same type of requests. In the fifth aspect, an embodiment of the present application also provides a computer device, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method of any embodiment of the first aspect and the second aspect when executing the computer program.
[0045] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method of any embodiment of the first aspect and the second aspect above are implemented.
[0046] In a seventh aspect, an embodiment of the present application further provides a computer program product, the computer program product comprising a computer program, which, when executed by a processor, implements the steps of the method of any one of the embodiments of the first and second aspects above.
[0047] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] FIG1 is a schematic diagram of the distribution relationship between backup nodes and master nodes in different clusters in one embodiment;
[0049] FIG2 is a structural diagram of association relationships between different nodes in a cluster in one embodiment;
[0050] FIG3 is an application environment diagram of a request processing method in one embodiment;
[0051] FIG4 is a schematic diagram of a process flow of a request processing method in one embodiment;
[0052] FIG5 is a schematic diagram of a flow chart of a request processing method in another embodiment;
[0053] FIG6 is a schematic diagram of a flow chart of a request processing method in another embodiment;
[0054] FIG7 is a schematic diagram showing the difference between an original master node and a backup node in one embodiment;
[0055] FIG8 is a schematic diagram of a flow chart of a request processing method in another embodiment;
[0056] FIG9 is a block diagram of a request processing device in one embodiment;
[0057] FIG10 is a structural block diagram of a request processing device in another embodiment;
[0058] FIG. 11 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0059] 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.
[0060] In the field of task processing, in order to improve the efficiency and reliability of task request processing, multiple concurrent task requests are mainly processed through a cluster including a master node and multiple slave nodes, and the master node in the cluster distributes batch task requests to multiple slave nodes in the cluster to disperse its own processing pressure. After the master node fails, the master node can be re-selected from all healthy backup nodes according to the master election algorithm to continue processing task requests.
[0061] In practical applications, there are often some complex tasks. When processing such tasks, nodes that can provide multiple different logical services need to work together to achieve them. Therefore, distributed clusters with high reliability and high availability including multiple clusters are widely used to handle such tasks. Among them, the distributed cluster includes multiple clusters and a control center that provide the same service. Each cluster includes multiple nodes, and the relationship between the logical services provided by different nodes in each cluster is used to provide a complete set of services to process task requests. Among the multiple nodes in different clusters that provide the same logical service, one is the main node, and the other nodes are all standby nodes. Among them, Figure 1 shows a structural diagram of two clusters (cluster 1 and cluster 2) that provide the same service in a distributed cluster. In the figure, cluster 1 provides a complete set of services through nodes 11, 12 and 13, and cluster 2 provides nodes 21, 22 and 23 to provide a complete set of the same services, and nodes 11 and 21 are used to provide logical service 1, nodes 12 and 22 are used to provide logical service 3, and nodes 13 and 23 are used to provide logical service 1.
[0062] In actual applications, any cluster can provide multiple complete sets of services for processing multiple types of task requests. For example, as shown in Figure 2, when any cluster A processes request 1, request 2, and request 3, the control center can send request 1, request 2, and request 3 to node 1 that provides logical service 1 to start processing, and then transmit them to the downstream nodes in the corresponding service chain where node 1 is located in turn to complete the processing of the corresponding request. In Figure 2, node 2 provides logical service 2, node 3 provides logical service 3, and node 4 provides logical service 4, and the corresponding service chain where node 1 in cluster A is located includes 3, namely: node 1->node 2->node 3->node 4, node 1->node 4, node 1->node 3->node 4.
[0063] In the related art, after the service cluster (any cluster) receives the task request sent by the control center, the master node in the service cluster starts to respond to the task request. In the case that any node in the service cluster cannot provide the corresponding service, the service cluster is reselected from other clusters, and the control center resends the task request to the reselected service cluster, instructing the master node in the service cluster to start processing the task request. However, different clusters within the distributed cluster in the related art are independent of each other. Therefore, there will be a problem of poor performance of the distributed cluster in the process of processing task requests. Based on this, an embodiment of the present application provides a request processing method that can improve the performance of the distributed cluster in the process of processing task requests.
[0064] The request processing method provided in the embodiment of the present application can be applied to the distributed cluster shown in Figure 3. The distributed cluster includes multiple clusters and a control center, and at least two clusters in the multiple clusters can provide a complete set of services of the same type. Among them, each cluster includes multiple nodes, and each node is deployed with a corresponding logical service instance, which can provide a corresponding logical service; wherein, the logical service instance is the same and the logical service that can be provided is the same. Optionally, the control center and each node can be connected by communication, and different nodes can also be connected by communication, and the communication method can be Wi-Fi, mobile network or Bluetooth connection, etc. Optionally, the control center and each node can be, but not limited to, an independent server or a computer device, and this embodiment does not limit the specific form of the control center and each node. Among them, the above-mentioned computer device can be a personal computer, a desktop computer, a laptop computer, an iPad, a smart phone, a smart watch, and other electronic devices with data processing functions. Among them, Figure 3 takes the control center and each node as a personal computer, and the distributed cluster includes two first clusters and one second cluster, the first cluster includes a standby node, and the second cluster includes a master node as an example.
[0065] It should be noted here that for multiple clusters in a distributed cluster that can provide a complete set of services of the same type, each cluster includes multiple nodes, and different nodes in each cluster can provide different logical services, and different logical services are closely associated with each other. When any cluster responds to a corresponding task request, the operation of processing the task request can only be completed after all the multiple nodes in each cluster have executed the corresponding logical services. For the logical service provided by any node in any cluster of this type of cluster, there will also be a node in each other cluster that can provide the same logical service, and the nodes that provide the same logical service in each cluster include a master node and other backup nodes. The following describes the specific process of the request processing method by taking the backup node in the first cluster in the distributed cluster and the original master node in the second cluster as the execution subject of the request processing method.
[0066] As shown in FIG. 4 , it is a flow chart of a request processing method provided in an embodiment of the present application. The method is applied to a standby node in a first cluster, where the first cluster is any cluster in a distributed cluster. The method can be implemented by the following steps:
[0067] S101. In response to a task request sent by an upstream end, obtain a processable status of the task request.
[0068] In practical applications, the upstream end can be understood as the upstream node of the standby node. Exemplarily, processing the target service (a complete set of services) requires executing logical service 1, logical service 2, logical service 3 and logical service 4 in sequence before it can be completed. If the client sends a target request to the control center in the distributed cluster, the control center in the distributed cluster can send the target request to at least one Class A cluster in the distributed cluster that can provide the target service for processing. Each Class A cluster includes at least four nodes (including node 1, node 2, node 3 and node 4), which are used to provide logical service 1, logical service 2, logical service 3 and logical service 4 respectively. After node 4 executes logical service 4, it is determined that the processing of the target request is completed.
[0069] In actual applications, node 1 can receive a target request sent by the control center, node 2 can receive a sub-request 1 sent by node 1, node 3 can receive a sub-request 2 sent by node 2, and node 4 can receive a sub-request 3 sent by node 3. In an embodiment of the present application, any one of the above-mentioned nodes 1, 2, 3, and 4 can be a standby node. If the standby node is node 1, the upstream node of the standby node can be the control center; if the standby node is node 2, the upstream node of the standby node can be node 1; if the standby node is node 3, the upstream node of the standby node can be node 2; if the standby node is node 4, the upstream node of the standby node can be node 3. At the same time, the above-mentioned task request can be a target request, a sub-request 1, a sub-request 2, or a sub-request 3.
[0070] In addition, in an embodiment of the present application, node 1 can be called a downstream node of the control center, node 2 can be called a downstream node of node 1, node 3 can be called a downstream node of node 2, and node 4 can be called a downstream node of node 3.
[0071] Specifically, the standby node can receive the task request sent by the upstream end, respond to the task request, and obtain the processable status of the task request. It should be noted that the processable status of the task request can indicate whether the standby node itself can process the task request.
[0072] In one embodiment, the processable status of the task request may be obtained by analyzing and comparing the information carried in the task request to determine the processable status of the task request.
[0073] In another embodiment, the processable status of the task request may be obtained by pre-training an algorithm model, and then inputting the information carried in the task request into the algorithm model, and the algorithm model outputs the processable status of the task request.
[0074] S102: When the processable state is that the standby node cannot process the task request, send the task request to the original master node, instructing the original master node to process the task request. The original master node and the standby node are used to process the same type of request, and the original master node is any node in any other cluster in the distributed cluster except the first cluster.
[0075] Based on the processable status of the task request obtained in the previous step, when it is determined that the processable status is that the standby node cannot process the task request, the standby node can forward the task request to the original master node to instruct the original master node to process the task request.
[0076] In the embodiment of the present application, the original master node and the standby node are used to process the same type of request, which means that the original master node and the standby node provide the same logical service; wherein, the difference between the original master node and the standby node is that the original master node is configured with a persistent storage system (with persistence capability, and the data or information stored after the original master node fails or loses power is not easy to be lost), and the standby node is not configured with a persistent storage system. Optionally, the first cluster to which the standby node belongs can be any one of the clusters to which multiple standby nodes that can provide the logical service possessed by the original master node belong.
[0077] The technical solution in the embodiment of the present application responds to the task request sent by the upstream end, obtains the processable status of the task request, and when the processable status is that the standby node cannot process the task request, sends the task request to the original master node, instructing the original master node to process the task request. Among them, the original master node and the standby node are used to process the same type of requests, and the original master node is any node in any other cluster except the first cluster in the distributed cluster; in the above method, when the standby node responds to the task request sent by the upstream end, the standby node can first obtain the processable state of whether it can process the task request. When it cannot directly process the task request, it can directly interact with the original master node with the same logical service and forward the task request to the original master node for processing. This process does not need to indirectly pass through the control center in the distributed cluster to resend the task request to the original master node, thereby improving the speed and efficiency of the distributed cluster in processing the task request, thereby improving the performance of the distributed cluster; at the same time, the above method does not require human participation, can reduce request processing errors, thereby improving the accuracy of task request processing, and can greatly improve the speed and efficiency of task request processing; in addition, in the above method, when the distributed cluster provides a full set of services, it can ensure that the logical service corresponding to the standby node is provided normally, avoiding affecting the running status of other logical services provided by downstream nodes related to the standby node, so that it will not affect the normal processing of the complete service, thereby improving the success rate of the whole set of service processing.
[0078] In one embodiment, as shown in FIG. 5 , the step of obtaining the processable status of the task request in S100 may include the following steps:
[0079] S110: Obtain the consumed resources required to process the task request and the remaining resources of the standby node.
[0080] Specifically, the standby node can obtain its own remaining resources and the consumed resources required to process the task request. Optionally, the remaining resources and the consumed resources may include the number of central processing units, the number of graphics processing units, the size of the memory, the number of storage devices, etc. In the embodiment of the present application, the remaining resources and the consumed resources include the same resource types.
[0081] In one embodiment, the standby node may first obtain its own used resource amount, and then obtain its own remaining resource amount by subtracting the used resource amount from its own total resource amount. The used resource amount and the remaining resource amount include the same resource type. In another embodiment, the standby node may also call a specific instruction or tool to read its own remaining resource amount.
[0082] At the same time, the standby node can use a keyword extraction algorithm to perform keyword extraction processing on the information carried in the task request to obtain the amount of consumed resources required by the task request. Alternatively, the standby node can also obtain the task type of the task request, and then find the task type of the task request in the mapping relationship between different task types and different resource amounts, and determine the amount of resources matching the task type of the task request as the amount of consumed resources required by the task request.
[0083] S120: If the consumed resource amount is less than or equal to the remaining resource amount, determine that the processable state is that the standby node can process the task request; otherwise, determine that the processable state is that the standby node cannot process the task request.
[0084] Furthermore, the standby node can determine whether the amount of consumed resources required for the task request is less than or equal to its own remaining resources. If the amount of consumed resources is less than or equal to the remaining resources, the processable status of the task request is determined as the standby node can process the task request; otherwise, the processable status of the task request is determined as the standby node cannot process the task request.
[0085] The technical solution in the embodiment of the present application obtains the consumed resources required for processing the task request and the remaining resources of the standby node. If the consumed resources are less than or equal to the remaining resources, the processable state is determined to be that the standby node can process the task request; otherwise, the processable state is determined to be that the standby node cannot process the task request. In the above method, the standby node can determine its own processable state for the task request through the relationship between the consumed resources required for the task request and its own remaining resources, so as to ensure that the speed and efficiency of task processing can be improved on the basis of successful processing of the task request, and the processing process does not require the participation of complex algorithms, thereby reducing the complexity of determining the processable state of the task request and improving the speed and efficiency of determining the processable state of the task request.
[0086] In one embodiment, after executing the step in S101 above, as shown in FIG6 , the method may further include:
[0087] S103: When the processable state indicates that the standby node can process the task request, the task request is processed to obtain a request processing result.
[0088] In practical applications, when it is determined that the processable state is that the standby node can process the task request, the standby node can continue to process the task request to obtain a request processing result.
[0089] S104: Send the request processing result to the original master node, and instruct the original master node to store the request processing result in a persistence system.
[0090] Furthermore, the request processing result of the task request can be sent to the original master node, instructing the original master node to store the request processing result in a persistence system so that in the event of a sudden failure or power outage in the backup node, the request processing result of the task request can be read from the persistence system of the original master node for use when the downstream node processes related requests.
[0091] Exemplarily, there is a service chain of node 1->node 2->node 3. If the standby node is the first node in the service chain (i.e., node 1), the task request received by the standby node may be the target request sent by the control center; if the standby node is the downstream node of node 1 (node 2), the task request received by the standby node may be generated by node 1 based on the information carried in the target request and the corresponding request processing result generated by itself; if the standby node is the downstream node of node 2 (node 3), the task request received by the standby node may be generated by node 2 based on the information carried in the task request received by itself and the corresponding request processing result generated.
[0092] Optionally, the information carried in the above-mentioned target request may include relevant identification information of the logical services provided by nodes 1, 2 and 3 or corresponding request types, timestamps and other information; the information carried in the task request received by node 2 may include relevant identification information of the logical services provided by nodes 2 and 3 or corresponding request types, timestamps and other information.
[0093] Specifically, when the standby node is node 2, the task request received by the standby node may be generated by node 1 according to the relevant identification information of the logical services provided by nodes 2 and 3 carried in the target request or the corresponding request type, timestamp and other information, and the corresponding request processing result generated by itself; when the standby node is node 3, the task request received by the standby node may be generated by node 2 according to the relevant identification information of the logical services provided by node 3 carried in the task request received by itself or the corresponding request type, timestamp and other information, and the corresponding request processing result generated by itself.
[0094] The technical solution in the embodiment of the present application, when the processable state is that the standby node can process the task request, processes the task request to obtain the request processing result, and sends the request processing result to the original master node, instructing the original master node to store the request processing result in the persistence system; the above method can, when the processable state of the task request is that the standby node can process the task request, the standby node processes the task request, which can share the processing pressure of the original master node, and improve the performance of the distributed cluster, the response speed to the task request and the reliability.
[0095] In some scenarios, when the original master node fails, it is necessary to downgrade the original master node to a standby node, and re-select the master node to continue to be responsible for the logical services provided by the original master node. During the downgrade of the original master node, in order to improve the success rate of task request processing, the original master node can notify the standby node to manage the task request in a timely manner. The process of timely management of task requests is explained below.
[0096] In one embodiment, before sending the task request to the original master node, the method may further include: upon obtaining a stop service message sent by the original master node, sending the task request to the re-selected current master node, instructing the current master node to process the task request. The stop service message is sent by the current master node in response to a downgrade instruction sent by a control center in the distributed cluster; the current master node and the standby node process the same request type.
[0097] In actual applications, the failure of the process or cluster to which the original master node belongs or the restart of the cluster to which it belongs can be called the failure of the original master node. In the case of a failure of the original master node, the original master node needs to be downgraded to a standby node. At this time, other normal standby nodes that provide the same logical service as the original master node use the master election algorithm to re-select the master node. In the process of downgrading the original master node, the original master node cannot provide logical services to the upstream end, that is, the logical service is in a suspended state. In order to enable the upstream end and the standby node that provides the same logical service to manage the task request in a timely manner, the original master node can actively send a stop service message to the upstream end and the standby node to remind the upstream end and the standby node itself to stop providing logical services.
[0098] In addition, when the original master node receives the corresponding request sent by the upstream end or the standby node, it may send a stop service message to the upstream end or the standby node to remind the upstream end and the standby node itself to stop providing logical services.
[0099] Furthermore, in the case of obtaining a stop service message sent by the original master node, the standby node may send a task request to the re-selected current master node, instructing the current master node to process the task request.
[0100] It should be noted here that among the master node and each standby node that provide the same logical service in a distributed cluster, the master node and the standby node can communicate and interact with each other, but the standby nodes cannot communicate and interact with each other.
[0101] Among them, when the standby node receives the stop service message sent by the original master node, the current master node may have been determined. In this case, after receiving the stop service message sent by the original master node, the standby node can immediately send the task request to the re-selected current master node.
[0102] In addition, the current master node is determined after a period of time after the standby node receives the stop service message sent by the original master node. In this case, after the standby node receives the stop service message sent by the original master node, it can wait for a period of time to receive the current master node information sent by the current master node or the control center, and then send the task request to the re-selected current master node. Alternatively, after the standby node receives the stop service message sent by the original master node, it can send the task request in real time to other normal standby nodes that provide the same logical service to wait for processing.
[0103] Among them, in the process of the standby node sending task requests to other normal standby nodes, if the other standby nodes are not selected as the current master node, the other standby nodes can feedback error processing and other related messages to the standby node to remind the standby node that it is not the current master node. At the same time, after processing the task request, the current master node or the original master node can feedback successful processing and other related messages to the standby node to remind the standby node that the task request has been successfully processed.
[0104] In the embodiment of the present application, the request types processed by the current master node and the standby node are the same, that is, the logical services provided by the current master node and the standby node are the same.
[0105] The technical solution in the embodiment of the present application, when a stop service message sent by the original master node is obtained, sends the task request to the re-selected current master node, instructing the current master node to process the task request; in the above method, after the standby node receives the stop service message sent by the original master node, it can manage the task request so that the task request is sent to the re-selected current master node for processing, thereby improving the success rate of the task request, and enabling the standby node to manage the task request in a timely manner, and can also improve the speed and efficiency of task request processing, thereby improving the performance of the distributed cluster.
[0106] In some scenarios, when the original master node fails, it is necessary to re-select the master node from other normal standby nodes that provide the same logical service. At this time, the standby node can participate in the re-election operation. The following is an explanation of the process of the standby node participating in the re-election operation. In one embodiment, the above method may also include: in the case of the failure of the original master node, in response to the master upgrade instruction sent by the control center in the distributed cluster, obtaining the persistence information stored in the persistence system of the original master node to complete the master upgrade operation.
[0107] In the embodiment of the present application, the control center in the distributed cluster can monitor each node in the distributed cluster in real time to obtain the operating status of each node, that is, the normal status or the fault status. Correspondingly, when the original master node fails, the control center can find it in time and send a master upgrade instruction to other normal standby nodes that provide the same logical service as the original master node to re-select the master node.
[0108] Among them, the standby node can respond to the promotion command sent by the control center in the distributed cluster, and cooperate with other normal standby nodes to re-select the master node. When determining itself as the re-selected current master node, it can obtain persistence information from the persistence system of the original master node to quickly restore the persistence information on the original master node. After restoring the persistence information, the current master node can normally provide the corresponding logical services to complete the promotion operation.
[0109] It should be noted here that the persistence system in the above-mentioned original master node may include a storage unit and a log module, wherein the storage unit is used to store the configuration information required for starting the logical service provided by the original master node and the location information of the log module, and the log module is used to store the corresponding request processing results. At the same time, the persistence system can also store identification information, which indicates the task request type corresponding to the logical service, that is, the request type that the original master node can process. At the same time, the standby node can only store the identification information corresponding to the logical service provided by itself, and when it cannot process the task request itself, it can determine the original master node according to the identification information to send the task request to the original master node for processing. The above description is also the essence of the difference between the original master node and the standby node (that is, the standby node cannot store the information stored in the storage unit and the log module), wherein Figure 7 can intuitively clarify the difference between the two.
[0110] The technical solution in the embodiment of the present application, in the event of a failure of the original master node, responds to the upgrade command sent by the control center in the distributed cluster, obtains the persistence information stored in the persistence system of the original master node to complete the upgrade operation; after the standby node in the above method responds to the upgrade command, it can obtain the persistence information to achieve recovery, so as to be able to successfully provide logical services to the outside world, ensure the normal response of the distributed cluster, and improve the success rate of the distributed cluster in processing task requests; at the same time, the standby node in the above method can be upgraded to the master node to ensure that the corresponding logical services can be provided normally, so that the failure of the logical services provided by the interdependent nodes will not be spread due to the downgrade of the standby node after the failure of the original master node, and the impact of the failure can be reduced to a minimum, so that the corresponding entire set of services can be guaranteed to be provided normally by the distributed cluster, thereby improving the performance of the distributed cluster.
[0111] In one embodiment, the embodiment of the present application further provides a request processing method, which is applied to a standby node in a first cluster, where the first cluster is any cluster in a distributed cluster; the method includes the following process:
[0112] (1) Responding to the task request sent by the upstream end, obtaining the consumed resources required to process the task request and the remaining resources of the standby node;
[0113] (2) If the consumed resources are less than or equal to the remaining resources, the processable state is determined to be that the standby node can process the task request; otherwise, the processable state is determined to be that the standby node cannot process the task request;
[0114] (3) When the processable state indicates that the standby node cannot process the task request, the task request is sent to the original master node, instructing the original master node to process the task request; wherein the original master node and the standby node are used to process the same type of requests, and the original master node is any node in any cluster other than the first cluster in the distributed cluster;
[0115] (4) When the processable state indicates that the standby node can process the task request, the task request is processed to obtain the request processing result;
[0116] (5) Send the request processing result to the original master node, instructing the original master node to store the request processing result in the persistence system;
[0117] (6) When receiving the stop service message sent by the original master node, the task request is sent to the re-selected current master node, instructing the current master node to process the task request; wherein the stop service message is sent by the current master node in response to the standby downgrade instruction sent by the control center in the distributed cluster; the request types processed by the current master node and the standby node are the same;
[0118] (7) In the event of a failure of the original master node, in response to the master upgrade instruction sent by the control center in the distributed cluster, the persistent information stored in the persistence system of the original master node is obtained to complete the master upgrade operation.
[0119] The execution process of the above (1) to (7) can be specifically referred to the description of the above embodiment. The implementation principle and technical effect are similar and will not be repeated here.
[0120] The embodiment of the present application also provides a request processing method, which is applied to the original master node in the second cluster, where the second cluster is any cluster in the distributed cluster; the method can be implemented by the following steps:
[0121] In response to a task request sent by a standby node in the first cluster, the task request is processed. The task request is sent by the standby node in response to the task request sent by the upstream end, obtaining the processable status of the task request, and when the processable status is that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the original master node and the standby node are used to process the same type of request.
[0122] In actual applications, when the original master node is normal, the original master node can receive the task request sent by the upstream end and process the task request. Optionally, the upstream end can be an upstream node of the original master node, and the logical service provided by the upstream node is associated with and different from the logical service provided by the original master node.
[0123] In an embodiment of the present application, when the original master node is normal, the original master node can receive the task request sent by the standby node and process the task request. The logical service provided by the standby node is the same as the logical service provided by the original master node. It should be noted here that the original master node can only receive the task request sent by the standby node when the standby node cannot process the task request.
[0124] The technical solution in the embodiment of the present application processes the task request in response to the task request sent by the standby node in the first cluster, wherein the task request is a response by the standby node to the task request sent by the upstream end, obtains the processable status of the task request, and is sent when the processable status is that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the original master node and the standby node are used to process the same type of requests; the above method can receive the task request forwarded by the standby node to process the task request when the standby node cannot process the task request, thereby improving the success rate of task request processing, thereby making the distributed cluster have higher performance and higher reliability.
[0125] In one embodiment, the above step of processing the task request may specifically include: processing the task request to obtain a request processing result, and storing the request processing result in a persistence system.
[0126] In actual applications, the original master node can process the task request, obtain the request processing result, and store the request processing result in its own persistence system to ensure that the request processing result can be persistently stored.
[0127] According to the technical solution in the embodiment of the present application, the original master node can process the task request to obtain the request processing result, and store the request processing result in a persistence system to ensure that the request processing result can be persistently stored, so as to avoid the failure of the original master node. Other backup nodes can restore the persistent information to replace the original master node to continue to provide the same logical service, thereby improving the speed and efficiency of the corresponding task request processing.
[0128] In some scenarios, when the master node selected before the original master node fails and recovers, it is necessary to downgrade the original master node to a standby node, and at the same time, restore the master node selected before the original master node to be the current master node. The operation of downgrading the original master node to a standby node is described below. In one embodiment, as shown in FIG8 , the above method may further include the following steps:
[0129] S201. In the process of processing a task request, in response to a downgrade instruction sent by a control center in a distributed cluster, a stop service message is sent to the standby node, instructing the standby node to send the task request to the re-selected current master node; the current master node and the standby node process the same request type.
[0130] During the process of processing the task request by the original master node, the control center monitors that the master node previously selected by the original master node has recovered from the failure. At this time, the control center can send a promotion command to the master node previously selected by the original master node, and send a demotion command to the original master node.
[0131] Correspondingly, the original master node can send a stop service message to the standby node in response to the downgrade instruction sent by the control center in the distributed cluster, instructing the standby node to send the task request to the re-selected current master node; the current master node and the standby node process the same request type.
[0132] It should be noted here that the original master node sends a stop service message to the standby node, so that the standby node can manage the task request in time. Among them, the current master node and the standby node process the same request type, that is, the current master node and the standby node provide the same logical service.
[0133] S202: Destroy the control information of the persistent information stored in the persistent system to complete the downgrade operation, wherein the persistent information at least includes the request processing results generated before the current moment.
[0134] In practical applications, the control information of the persistent information stored in the persistence system can be stored in the memory of the original master node. During the downgrade process, the original master node can destroy or delete the control information of the persistent information stored in the persistence system to completely complete the downgrade operation. The persistent information can at least include all request processing results generated before the current moment.
[0135] Optionally, the control information may include information such as the storage location of the persistent information and the size of the data.
[0136] In an embodiment of the present application, the original master node can first send a stop service message to other nodes, and then destroy the control information of the persistent information stored in the persistence system to complete the downgrade operation, that is, complete the downgrade in the second stage, so that other nodes can manage the corresponding task requests in a timely manner, thereby minimizing the impact of the downgrade of the original master node.
[0137] The technical solution in the embodiment of the present application, in the process of processing task requests, responds to the downgrade instruction sent by the control center in the distributed cluster, sends a stop service message to the standby node, and destroys the control information of the persistent information stored in the persistence system to complete the downgrade operation; the original master node in the above method can send a stop service message to the standby node during the downgrade process to notify the standby node that the logical service provided by itself has been stopped, so that the standby node can manage the task request in time, improve the speed, efficiency and success rate of task request processing, and the original master node can destroy the control information of the persistent information to completely downgrade, avoid the problem of abnormal task request processing caused by confusion of the master node during task request processing, so that the task request can be processed normally, thereby improving the performance of the distributed cluster.
[0138] In one embodiment, the embodiment of the present application further provides a request processing method, which is applied to an original master node in a second cluster, where the second cluster is any cluster in a distributed cluster; the method includes the following process:
[0139] (1) In response to a task request sent by a standby node in the first cluster, the task request is processed to obtain a request processing result, and the request processing result is stored in a persistence system; wherein the task request is a task request sent by the standby node in response to the task request sent by the upstream end, the standby node obtains the processable status of the task request, and sends it when the processable status indicates that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the original master node and the standby node are used to process the same type of requests;
[0140] (2) In the process of processing task requests, in response to the standby downgrade instruction sent by the control center in the distributed cluster, a stop service message is sent to the standby node, instructing the standby node to send the task request to the re-selected current master node; the current master node and the standby node process the same request type;
[0141] (3) Destroying the control information of the persistent information stored in the persistent system to complete the downgrade operation; wherein the persistent information at least includes the request processing results generated before the current moment.
[0142] The execution process of the above (1) to (3) can be specifically referred to the description of the above embodiment. The implementation principle and technical effect are similar and will not be repeated here.
[0143] 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.
[0144] Based on the same inventive concept, the embodiment of the present application also provides a request processing device for implementing the request processing 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 request processing device embodiments provided below can refer to the limitations on the request processing method above, and will not be repeated here.
[0145] In one embodiment, FIG9 is a schematic diagram of the structure of a request processing device in an embodiment of the present application. The request processing device provided in the embodiment of the present application can be applied to a standby node in a first cluster, and the first cluster is any cluster in a distributed cluster. As shown in FIG9, the request processing device in the embodiment of the present application may include: an acquisition module 11 and a first sending module 12, wherein:
[0146] The acquisition module 11 is used to respond to the task request sent by the upstream end and acquire the processable status of the task request;
[0147] A first sending module 12 is used to send the task request to the original master node when the processable state is that the standby node cannot process the task request, and instruct the original master node to process the task request;
[0148] The original master node and the backup node are used to process the same type of requests, and the original master node is any node in any cluster other than the first cluster in the distributed cluster.
[0149] The request processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned request processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0150] In one embodiment, the acquisition module 11 includes: a resource quantity acquisition unit, a first determination unit, and a second determination unit, wherein:
[0151] A resource acquisition unit is used to acquire the consumed resources required to process the task request and the remaining resources of the standby node;
[0152] A first determining unit, configured to determine that the processable state is that the standby node can process the task request when the consumed resource amount is less than or equal to the remaining resource amount;
[0153] The second determining unit is configured to determine that the processable state is that the standby node cannot process the task request when the consumed resource amount is greater than the remaining resource amount.
[0154] The request processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned request processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0155] In one embodiment, the request processing device further includes: a request processing module and a result sending module, wherein:
[0156] A request processing module, used for processing the task request to obtain a request processing result when the processable state is that the standby node can process the task request;
[0157] The result sending module is used to send the request processing result to the original master node, and instruct the original master node to store the request processing result in the persistence system.
[0158] The request processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned request processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0159] In one embodiment, the request processing device further includes: a second sending module:
[0160] The second sending module is used to send the task request to the re-selected current master node when the service stop message sent by the original master node is obtained, and instruct the current master node to process the task request;
[0161] The stop service message is sent by the current master node after responding to the standby downgrade instruction sent by the control center in the distributed cluster; the current master node and the standby node process the same request type.
[0162] The request processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned request processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0163] In one embodiment, the request processing device includes:
[0164] The instruction response module is used to respond to the master upgrade instruction sent by the control center in the distributed cluster when the original master node fails, obtain the persistence information stored in the persistence system in the original master node, and complete the master upgrade operation.
[0165] The request processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned request processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0166] In another embodiment, FIG10 is a schematic diagram of the structure of a request processing device in an embodiment of the present application. The request processing device provided in the embodiment of the present application can be applied to the original master node in the second cluster, and the second cluster is any cluster in the distributed cluster. As shown in FIG10, the request processing device in the embodiment of the present application may include: a request processing module 21, wherein:
[0167] The request processing module 21 is used to respond to the task request sent by the standby node in the first cluster and process the task request;
[0168] Among them, the task request is a response by the standby node to the task request sent by the upstream end, obtaining the processable status of the task request, and sending it when the processable status is that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the original master node and the standby node are used to process the same type of requests.
[0169] The request processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned request processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0170] In one embodiment, the request processing module 21 is specifically used for:
[0171] Process the task request to obtain the request processing result, and store the request processing result in the persistence system.
[0172] The request processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned request processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0173] In one embodiment, the request processing module further includes:
[0174] A message sending module is used to send a stop service message to the standby node in response to a standby downgrade instruction sent by a control center in a distributed cluster during the process of processing a task request, instructing the standby node to send the task request to a re-selected current master node; the current master node and the standby node process the same request type;
[0175] The information destruction module is used to destroy the control information of the persistent information stored in the persistent system to complete the downgrade operation; wherein the persistent information at least includes the request processing results generated before the current moment.
[0176] The request processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned request processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0177] For the specific definition of the request processing device, please refer to the definition of the request processing method above, which will not be repeated here. Each module in the above request processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0178] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG11. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide processing 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 request processing results. The network interface of the computer device is used to communicate with an external endpoint via a network connection. When the computer program is executed by the processor, a request processing method is implemented.
[0179] Those skilled in the art will understand that the structure shown in FIG. 11 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.
[0180] In one embodiment, a computer device is also 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 technical solution in the above-mentioned request processing method embodiment of the present application is implemented, and its implementation principle and technical effect are similar and will not be repeated here.
[0181] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the technical solution of the request processing method described above in the present application is implemented. The implementation principle and technical effect are similar and will not be repeated here.
[0182] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the technical solution of the request processing method described above in the present application is implemented. The implementation principle and technical effect are similar and will not be repeated here.
[0183] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods 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 memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. 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).
[0184] 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 specification.
[0185] The above-mentioned 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 invention patent. 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 patent of the present application shall be subject to the attached claims.
Claims
1. A request processing method, characterized in that: Applied to a standby node in a first cluster, where the first cluster is any cluster in a distributed cluster; the method includes: In response to a task request sent by an upstream end, obtaining a processable status of the task request; When the processable state is that the standby node cannot process the task request, sending the task request to the original master node to instruct the original master node to process the task request; The original master node and the backup node are used to process the same type of requests, and the original master node is any node in any other cluster in the distributed cluster except the first cluster.
2. The method according to claim 1, characterized in that The obtaining of the processable status of the task request includes: Obtaining the consumed resources required to process the task request and the remaining resources of the standby node; If the consumed resource amount is less than or equal to the remaining resource amount, determining that the processable state is that the standby node can process the task request; Otherwise, it is determined that the processable state is that the standby node cannot process the task request.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: When the processable state indicates that the standby node can process the task request, processing the task request to obtain a request processing result; The request processing result is sent to the original master node, and the original master node is instructed to store the request processing result in a persistence system.
4. The method according to claim 1 or 2, characterized in that: Before sending the task request to the original master node, the method further includes: In case of obtaining the stop service message sent by the original master node, sending the task request to the re-selected current master node, instructing the current master node to process the task request; The stop service message is sent by the current master node after responding to a standby downgrade instruction sent by a control center in the distributed cluster; the current master node and the standby node process the same request type; Correspondingly, the method further includes: In the event of a failure of the original master node, in response to a master upgrade instruction sent by the control center in the distributed cluster, persistent information stored in the persistent system in the original master node is obtained to complete the master upgrade operation.
5. A request processing method, characterized in that: The method is applied to an original master node in a second cluster, where the second cluster is any cluster in a distributed cluster. The method includes: In response to a task request sent by a standby node in the first cluster, processing the task request; Among them, the task request is the standby node responding to the task request sent by the upstream end, obtaining the processable status of the task request, and sending it when the processable status is that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the original master node and the standby node are used to process the same type of requests.
6. The method according to claim 5, characterized in that The processing of the task request includes: The task request is processed to obtain a request processing result, and the request processing result is stored in a persistence system.
7. The method according to claim 5 or 6, characterized in that: The method further comprises: In the process of processing the task request, in response to the standby downgrade instruction sent by the control center in the distributed cluster, a stop service message is sent to the standby node, instructing the standby node to send the task request to the re-selected current master node; the current master node and the standby node process the same request type; The control information of the persistent information stored in the persistent system is destroyed to complete the downgrade operation; wherein the persistent information at least includes the request processing result generated before the current moment.
8. A request processing device, characterized in that: The device comprises: An acquisition module, used for responding to a task request sent by an upstream end and acquiring a processable state of the task request; A first sending module, configured to send the task request to the original master node to instruct the original master node to process the task request when the processable state is that the standby node cannot process the task request; The original master node and the backup node are used to process requests of the same type, and the original master node is any node in any other cluster in the distributed cluster except the first cluster.
9. A request processing device, characterized in that: The device comprises: A request processing module, configured to respond to a task request sent by a standby node in the first cluster and process the task request; Among them, the task request is a response by the standby node to the task request sent by the upstream end, obtaining the processable status of the task request, and sending it when the processable status is that the standby node cannot process the task request; the first cluster is any node in any other cluster in the distributed cluster except the second cluster, and the standby node and the original master node are used to process the same type of requests.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.