CN110995504A - Micro-service node exception handling method, device and system - Google Patents

Micro-service node exception handling method, device and system Download PDF

Info

Publication number
CN110995504A
CN110995504A CN201911312432.5A CN201911312432A CN110995504A CN 110995504 A CN110995504 A CN 110995504A CN 201911312432 A CN201911312432 A CN 201911312432A CN 110995504 A CN110995504 A CN 110995504A
Authority
CN
China
Prior art keywords
micro service
service node
abnormal
micro
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911312432.5A
Other languages
Chinese (zh)
Other versions
CN110995504B (en
Inventor
贾军
马岚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201911312432.5A priority Critical patent/CN110995504B/en
Publication of CN110995504A publication Critical patent/CN110995504A/en
Application granted granted Critical
Publication of CN110995504B publication Critical patent/CN110995504B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements
    • H04L41/5003Managing SLA; Interaction between SLA and QoS
    • H04L41/5019Ensuring fulfilment of SLA
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/02Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
    • H04L63/0227Filtering policies
    • H04L63/0236Filtering by address, protocol, port number or service, e.g. IP-address or URL
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Abstract

The application discloses a micro-service node exception handling method, device and system, and relates to the technical field of cloud computing. The specific implementation scheme is as follows: determining abnormal micro service nodes in a micro service architecture through a set server, and synchronously indicating abnormal conditions to other micro service nodes calling the abnormal nodes; the other micro service nodes are enabled to configure access limiting information according to the abnormal indication, the access limiting information is based on the iptable rule, abnormal processing of the micro service node abnormality in the micro service architecture is met, delay caused by the API gateway when the micro service nodes are called is reduced, and therefore communication efficiency between the micro service nodes in the micro service architecture is improved.

Description

Micro-service node exception handling method, device and system
Technical Field
The application relates to the technical field of cloud computing, in particular to a micro-service node exception handling method, device and system.
Background
In the cloud computing era, micro-service architectures are increasingly applied to development and deployment of distributed systems, the micro-service architecture divides an original huge single system into micro-service nodes with independent functions, and each micro-service node can be used for realizing one service function. Meanwhile, a plurality of dependency relationships exist among a plurality of micro service nodes, one micro service node can be called by one or more other micro service nodes, once a certain micro service node in the micro service architecture loses response due to a fault and the like and can not return a request result in a delayed manner, the micro service node calling the micro service node continuously tries to resend the request and waits, service resources are rapidly consumed, and large-area blocking of the micro service nodes in the micro service architecture is caused.
In the prior art, in order to prevent a micro service architecture from being abnormal due to a failure of a node in a micro service node, each micro service node needs to pass through a gateway when calling other nodes, and the gateway can be implemented by a hardware entity or software programming. When one micro service node in the micro service architecture is abnormal, the gateway records the abnormality and returns request failure information to each micro service node which requests the abnormal micro service node through the gateway, so that the micro service node does not retransmit or continuously wait for the request of the abnormal micro service node.
However, with the prior art, even the requests of the normal micro service nodes need to pass through the gateway, so that the requests among the micro service nodes are delayed to a certain extent while the abnormal processing of the micro service nodes is realized, and further, the communication efficiency among the micro service nodes in the micro service architecture is reduced.
Disclosure of Invention
The application provides a micro service node exception handling method, device and system, which can ensure the communication efficiency between micro service nodes while the micro service nodes carry out exception handling.
A first aspect of the present application provides a method for handling exception of a microservice node, including:
the method comprises the steps that a first micro service node receives an abnormal indication of a second micro service node sent by a server; wherein the anomaly indication is used for indicating that the second micro-service node is abnormal;
the first micro service node configures access limiting information according to the abnormal indication; and the access limiting information is used for limiting the first micro service node to call the second micro service node.
To sum up, in the exception handling method for the micro service node provided in the embodiment of the present application, the micro service node with an exception in the micro service architecture can be determined through the set server, and a synchronous exception indication is sent to other micro service nodes calling the exception node; the method and the system enable other micro service nodes to be configured with access limiting information which is based on the iptable rule and is simple and convenient to realize, thereby meeting the requirement of exception handling of micro service node exceptions in a micro service framework, effectively reducing the influence of downstream service exceptions on the service quality of upstream services, and avoiding inestimable loss of products caused by abnormal large-scale diffusion and even out of control.
In an embodiment of the first aspect of the present application, the access restriction information includes: an iptable rule for accessing the second micro service node.
In an embodiment of the first aspect of the present application, the iptable rule includes: a network address and a network port of the second micro service node.
In summary, in the embodiment of the present application, the access restriction of the first micro service node to the second micro service node may be implemented by an iptable rule, and the method is simple and easy to implement, so that the cost of modifying the existing micro service system by using the mechanism of the network protocol stack is almost zero, the exception handling method in the embodiment of the present application may be provided in the micro service system by only deploying a server in the server or the container, and the original micro service system does not need to be upgraded otherwise, so that the consumption of precious resources such as servers is lower.
In an embodiment of the first aspect of the present application, when the first micro service node calls the second micro service node, no other node is needed.
In summary, in the embodiment, the gateway API passed by the calling process is reduced, so that the workload and the economic investment of the operator for setting and maintaining the gateway API are reduced, the exception handling of the exception of the micro service nodes in the micro service architecture is ensured, the delay caused by the passing of the API gateway when the micro service nodes are called is reduced, and the communication efficiency between the micro service nodes in the micro service architecture is improved.
In an embodiment of the first aspect of the present application, the method further includes: and the first micro service node sends an abnormal indication request to the server every first preset time.
In summary, in the embodiment of the present application, after determining an abnormal micro service node, the server stores the abnormal indication, and after a certain time or according to a request of the first micro service node, synchronizes to the first micro service node, thereby avoiding an influence on the performance of the server caused by frequent requests.
In an embodiment of the first aspect of the present application, after the configuring generates the restricted access information, the configuring further includes: when a preset condition is met, the first micro service node deletes the access limiting information; wherein the preset conditions include: and determining that the second micro service node is recovered to be normal, every second preset time, or the access limiting information configured in the first micro service node is larger than a preset number.
In summary, in the embodiment of the present application, the first micro service node may delete the stored access restriction information when the preset condition is met, where the deleted access restriction information may be specific access restriction information or all the stored access restriction information, so as to avoid an influence of the access restriction information on the storage space and performance of the first micro service node.
A second aspect of the present application provides an exception handling method for a microservice node, including:
the server determines that the second micro service node is abnormal;
the server sends the abnormal indication of the second micro service node to a first micro service node; wherein the anomaly indication is used for indicating that the second micro service node is abnormal.
In the method for processing the exception of the micro service node provided by the embodiment of the application, the micro service node with exception in the micro service architecture can be determined through the set server, and the synchronous exception indication is sent to other micro service nodes calling the exception node; the method and the system enable other micro service nodes to be configured with access limiting information which is based on the iptable rule and is simple and convenient to realize, thereby meeting the requirement of exception handling of micro service node exceptions in a micro service framework, effectively reducing the influence of downstream service exceptions on the service quality of upstream services, and avoiding inestimable loss of products caused by abnormal large-scale diffusion and even out of control. Meanwhile, the gateway API passed by the calling process is reduced, so that the workload and the economic investment of an operator for setting and maintaining the gateway API are reduced, the exception handling of the exception of the micro service nodes in the micro service architecture is guaranteed, meanwhile, the delay caused by the passing of the API gateway when the micro service nodes are called is reduced, and the communication efficiency among the micro service nodes in the micro service architecture is improved.
In an embodiment of the second aspect of the present application, the determining, by the server, that a second micro service node of the plurality of micro service nodes is abnormal includes: the server receives indication information, wherein the indication information is used for indicating that the second micro service node is abnormal; and the server determines that the second micro service node is abnormal according to the indication information.
In summary, in this embodiment, the server may determine, in a manual configuration manner, the micro service node where the abnormality occurs, and after receiving the indication information, determine, by the indication information, that the second micro service node is abnormal. Therefore, the system can be operated by the staff at any time, the fault in the system is indicated, the flexibility of the system application is improved, and the system operation efficiency is further improved.
In an embodiment of the second aspect of the present application, the server monitors whether the plurality of microservice nodes are abnormal; and the server determines that a second micro service node in the plurality of micro service nodes is abnormal according to the monitoring result.
In summary, in this embodiment, the server may determine that the abnormal second micro service node is abnormal through an automatic configuration mode, monitor whether all the plurality of micro service nodes in the micro service architecture are abnormal through the external system, and determine that the second micro service node in the plurality of micro service nodes is abnormal according to the monitoring result. Therefore, the intelligent degree of the system is improved, and abnormal micro service nodes can be determined by self without manually participating in a server.
In an embodiment of the second aspect of the present application, before the server sends the abnormal indication of the second micro service node to the first micro service node, the method further includes:
the server receives an abnormal request sent by the first micro service node at intervals of first preset time; the exception request is for determining to the server whether an exception indication is present.
In summary, in the embodiment of the present application, after determining an abnormal micro service node, the server stores the abnormal indication, and after a certain time or according to a request of the first micro service node, synchronizes to the first micro service node, thereby avoiding an influence on the performance of the server caused by frequent requests.
A third aspect of the present application provides an exception handling apparatus for a microservice node, including:
the receiving module is used for receiving the abnormal indication of the second micro service node sent by the server; wherein the anomaly indication is used for indicating that the second micro-service node is abnormal;
the configuration module is used for configuring and generating access limiting information according to the abnormal indication; and the access limiting information is used for limiting the first micro service node to call the second micro service node.
In an embodiment of the third aspect of the present application, the apparatus further includes: a sending module, configured to send an abnormal indication request to the server; the anomaly indication request is used to determine to the server whether an anomaly indication is present.
In an embodiment of the third aspect of the present application, the access restriction information includes: an iptable rule for accessing the second micro service node.
In an embodiment of the third aspect of the present application, the iptable rule includes: a network address and a network port of the second micro service node.
In an embodiment of the third aspect of the present application, the sending module is specifically configured to send the abnormal indication request to the server every first preset time.
In an embodiment of the third aspect of the present application, the configuration module is further configured to delete the access restriction information when a preset condition is met; the preset conditions include: and determining that the second micro service node is recovered to be normal, every second preset time, or the access limiting information configured in the first micro service node is larger than a preset number.
A fourth aspect of the present application provides an exception handling apparatus for a microservice node, including:
the determining module is used for determining that the second micro service node is abnormal;
the sending module is used for sending the abnormal indication of the second micro service node to the first micro service node; wherein the anomaly indication is used for indicating that the second micro service node is abnormal.
In an embodiment of the fourth aspect of the present application, the determining module is specifically configured to,
monitoring whether the micro service nodes are abnormal or not;
and determining that a second micro service node in the plurality of micro service nodes is abnormal according to the monitoring result.
In an embodiment of the fourth aspect of the present application, the method further includes: a receiving module;
the receiving module is used for receiving indication information, and the indication information is used for indicating that the second micro service node is abnormal;
and the determining module is used for determining that the second micro service node is abnormal according to the indication information.
In an embodiment of the fourth aspect of the present application, the method further includes: a receiving module; the first micro service node is used for receiving an abnormal request sent every interval of first preset time; the exception request is for determining to the server whether an exception indication is present.
A fifth aspect of the present application provides an exception handling system for a micro service node, comprising the exception handling apparatus for a micro service node according to any one of the third aspects of the present application as a first micro service node, and the exception handling apparatus for a micro service node according to any one of the fourth aspects of the present application as a server.
A sixth aspect of the present application provides an electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the first or second aspects of the present application.
A seventh aspect of the present application provides a non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any of the first or second aspects of the present application
To sum up, the method, the device and the system for processing the exception of the micro service node provided by the embodiment of the application determine the micro service node with exception in the micro service architecture through the set server, and synchronously instruct the exception to other micro service nodes calling the exception node; other micro service nodes are enabled to configure access limiting information according to the abnormal indication, the access limiting information is based on the iptable rule and is simple and convenient to realize, thereby satisfying the exception handling of the exception of the micro-service node in the micro-service architecture, effectively reducing the influence of the downstream service exception on the service quality of the upstream service, avoiding the immeasurable loss of the product caused by the large-scale diffusion and even the out-of-control of the exception, and simultaneously reducing the gateway API passed in the calling process, thereby not only reducing the workload and the economic investment of the operator for setting and maintaining the gateway API, but also ensuring the exception handling of the exception of the micro-service node in the micro-service architecture, the delay caused by the API gateway when the micro service nodes are called is reduced, and the communication efficiency between the micro service nodes in the micro service architecture is further improved.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a schematic diagram of an application scenario of the present application;
FIG. 2 is a method for handling an exception of a microservice node;
FIG. 3 is a schematic structural diagram of an embodiment of an exception handling system of a microservice node provided in the present application;
fig. 4 is a schematic flowchart of an embodiment of an exception handling method for a microservice node according to the present application;
fig. 5 is a schematic structural diagram of a process included in a microservice node according to the present application;
FIG. 6 is a diagram illustrating a micro service node invocation in the present embodiment;
fig. 7 is a schematic structural diagram of an embodiment of an exception handling apparatus of a microservice node provided in the present application;
fig. 8 is a schematic structural diagram of an embodiment of an exception handling apparatus for a microservice node provided in the present application;
fig. 9 is a block diagram of an electronic device for implementing the micro service node exception handling method according to the embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
… before describing embodiments of the present application in detail, it should be noted that the drawings illustrate the application and technical problems of the embodiments of the present application.
Fig. 1 is a schematic view of an application scenario of the present application, and as shown in fig. 1, when the present application is applied to a system using a micro service structure, an operator providing a service may split an original service system into different micro service nodes, and each micro service node has an independent function and may be respectively used to implement a service function of one service. For example, in fig. 1, an operator may split its service system into a micro service node 1, a micro service node 2, and a micro service node 3 … …, and access the internet through the same API gateway. The nodes such as a World Wide Web (Web) browser, a mobile Application program (APP), a desktop client, an Open Application programming Interface (Open API) and the like which are also accessed to the internet can request services provided by the micro service node through the internet.
More specifically, within the micro service architecture, there may be a call relationship that is invoked between different micro service nodes, for example, if the micro service node 1 may provide a service that manages a user identity (user), and for others, for example: a plurality of microservice nodes such as a post list, a post, a personal center and the like can call the service provided by the microservice node 1, and in some applications, the microservice node providing the service is marked as an upstream service, and the microservice node calling the service of other nodes is marked as a downstream service. However, once a micro service node of a downstream service loses response due to a failure or the like and cannot return a request result in a delay, an upstream service node invoking the failed node continuously attempts to resend the request and waits, service resources are rapidly consumed, and a large area of the micro service node in the micro service architecture is blocked.
In one technique, in order to prevent the micro service architecture from being abnormal due to the failure of the nodes in the micro service node, each micro service node needs to pass through an API gateway (gateway) when calling other nodes, and the calling of the micro service is limited through the API gateway. For example, fig. 2 is an exception handling method of a micro service node, which may be applied to exception handling of the micro service node in the system shown in fig. 1, where, assuming that the micro service node 1 may invoke a service provided by the micro service node 2, when the micro service node 2 is normal, the micro service node 1 sends an invocation request to an API gateway through S10, and then the invocation request is forwarded to the micro service node 2 by the API gateway, and after receiving the invocation request, the micro service node 2 also sends an invocation response to the micro service node 1 through the API gateway in S11 to complete the invocation. After the API gateway can determine that the micro service node 2 is abnormal through S202, if the API gateway receives a call request for the micro service node to call the micro service node 2, the call request is not sent to the micro service node 2, but an abnormal response can be directly returned to the micro service node 1, so that the micro service node 1 finishes calling the micro service node 2, and the micro service node does not resend the request and wait, thereby reducing resource consumption in the micro service structure.
However, in the exception handling method shown in fig. 2, although the API gateway arranged between the microservices nodes implements the processing when the called microservices nodes are abnormal, the set gateway has a small overhead for operators, and also affects the direct interaction between the microservices nodes, so that when the microservices nodes are called, because the communication performed by the gateway is processed by the API gateway, the delay of several milliseconds is generally brought, which is unacceptable in a system with a high real-time requirement, and further, the problem of low communication efficiency between the microservices nodes in the microservices architecture is caused.
Therefore, the present application provides an exception handling method, apparatus, and system for micro service nodes, which can ensure the communication efficiency between the micro service nodes while the micro service nodes perform exception handling.
The technical solution of the present invention will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 3 is a schematic structural diagram of an embodiment of an exception handling system of a microservice node provided in the present application, where the system shown in fig. 3 can be applied to the microservice structure shown in fig. 1, and the system includes: a Server (Server) and a plurality of microserver nodes. The server may provide an API interface, all other micro service nodes may communicate with the server through the API interface, and for the micro service nodes, the micro service nodes having a calling relationship may call each other, and when communicating, each two micro service nodes having a calling relationship do not need to pass through the API gateway shown in fig. 2, but may directly communicate with each other. Wherein, the plurality of microservice nodes can be arranged on one or more entity servers, and the number of the entity servers is not limited.
More specifically, the server may be configured to determine a micro service node in the micro service structure where an exception occurs, and send an exception indication to other related micro service nodes, so that the other micro service nodes configure access restriction information, and prevent continuous call to the exception micro service node. The following description is made in detail with reference to the accompanying drawings.
Fig. 4 is a schematic flowchart of an embodiment of an exception handling method for a micro service node provided in the present application, where the method shown in fig. 4 may be executed by a server and the micro service node in the system shown in fig. 3, and specifically, the exception handling method for the micro service node provided in the present embodiment includes:
s101: the server determines that a second micro service node is abnormal in the plurality of micro service nodes.
Specifically, if the micro service node with the fault is recorded as the second micro service node, in S101, the server provided by the present application can determine the micro service node with the fault in the micro service architecture. Wherein the abnormality occurring in the second microserver node includes but is not limited to: the second micro service node is in fault, the micro service node cannot be called, or a certain first micro service node cannot call the second micro service node.
In a specific implementation manner, a server may determine, in a manual configuration manner, a micro service node where an abnormality occurs, where the server may be connected to an electronic device used by a manager, and when the manager confirms that a second micro service node connected to the server is abnormal, the manager sends indication information to the server through the electronic device to indicate that the second micro service node is abnormal. Therefore, the server may determine that the second micro service node is abnormal through the indication information after receiving the indication information.
In another specific implementation manner, the server may determine that the second micro service node that has the abnormality is abnormal in an automatic configuration manner, where the server may be connected to an external system such as a trace system or an abnormality monitoring system that is provided in the micro service architecture, and monitor whether all of the plurality of micro service nodes in the micro service architecture are abnormal through the external system, and determine that the second micro service node in the plurality of micro service nodes is abnormal according to a monitoring result.
S102: and the first micro service node sends an abnormal indication to the server.
Subsequently, in S102, the first micro service node may send an abnormal indication request to the server every first preset time (for example, every 1 hour) to inquire whether the server has an abnormal indication, where the abnormal indication request may be used to request all abnormal indications in the server or may be used to request abnormal indications of micro service nodes having a call relation with the first micro service node.
It can be understood that, in this embodiment, the first micro service node is taken as an exemplary description, and for each micro service node in the micro service structure, the abnormal indication request may be sent to the server.
S103: and the server sends the abnormal indication of the abnormality of the second micro service node determined in the S101 to the first micro service node.
For the server, after receiving the abnormal indication request sent by the first micro service node in S102, the abnormal indication of the second micro service node determined in S101 may be sent to the first micro service node. Illustratively, if the exception of the second microservice node is that all services cannot invoke the microservice node, the indication of the exception may be represented in the form of a binary element similar to <, second service >; if the exception of the second microservice node is that the first microservice node cannot invoke the second microservice node, the indication of the exception may be represented by a two-tuple form similar to < first service, second service >.
Optionally, in a specific implementation, S102 shown in fig. 4 is a step that may be omitted, that is, the first micro service node may also not send the abnormality indication request to the server, but the server actively sends the abnormality indication directly to the first micro service node having a mutual call relationship with the second micro service node at a certain time after determining that the second micro service node is abnormal; or, the server may synchronize the latest determined abnormal indication of the micro service node with the newly determined abnormal micro service node once every time interval. After the abnormal micro service node is determined, the server stores the abnormal indication and synchronizes the abnormal indication to the first micro service node after a certain time, so that the influence of frequent requests on the performance of the server is avoided.
Furthermore, for all micro service nodes in this embodiment, only the abnormal indication related to itself may be obtained in S103, for example, the first micro service node requests the server for the abnormal indication in the form of < first service, X service >, and ignores the abnormal indication in the form of < Y service, Z service > in the other server.
S104: after receiving an abnormal indication of a second micro service node sent by a server, a first micro service node configures and generates access limiting information, wherein the access limiting information is used for limiting the first micro service node to call the second micro service node with the abnormal condition.
More specifically, fig. 5 is a schematic structural diagram of a process included in a micro service node provided in the present application, where in this application embodiment, an "agent" process is set in each micro service node, and the process may be used to communicate with a server, and after receiving an abnormal indication of a second micro service node sent by the server, further determine a network address (ip address) and a network port number corresponding to the second micro service node, and invoke an iptables process to generate an iptable rule, so as to shield an access performed by the first micro service node to the second micro service node from an access address perspective.
Exemplarily, if the agent process of the first micro service node receives the information that the second micro service node is abnormal, it is determined that the network address corresponding to the second micro service node is 1.1.1.1 and the network port number is 9000, then the agent process calls an iptable rule that the iptables process can generate as follows: iptables-I INPUT-s 1.1.1.1-dport 9000-JDROP, which is used for shielding the first micro service node from accessing the network address and the network port.
Optionally, the agent process of the first micro service node may search for the service of the machine list corresponding to the second micro service node by using the service name in the micro service architecture, and determine the network address and the network port number of the second micro service node, or the exception instruction sent by the server to the agent process of the first micro service node may also include the network address and the network port number of the second micro service node.
Subsequently, for a service process in the first micro service node as shown in fig. 5, since the iptable rule for restricting access is configured, at this time, the first micro service node cannot request a server from the second micro service node corresponding to the iptable rule. In the embodiment shown in fig. 4, the first micro service node does not execute the call request sent to the second micro service node in S105 after S104.
In summary, in the method and system for processing the exception of the micro service node provided in the embodiment of the present application, the micro service node with the exception in the micro service architecture can be determined through the set server, and the synchronous exception indication is sent to other micro service nodes calling the exception node; other micro service nodes are configured with access limiting information based on the iptable rule, and the access limiting information is simple and convenient to realize, so that exception handling of micro service node exception in a micro service framework is met, influence on service quality of upstream service due to downstream service exception can be effectively reduced, and inestimable loss of products caused by large-scale diffusion and even out of control of exception is avoided
Meanwhile, in the embodiment of the present application, the exception of the micro service node is handled through the service area which is set separately, so that when the micro service nodes having a calling relationship are called, the flow of the exception is as shown in fig. 6, where fig. 6 shows a schematic diagram of the calling of the micro service node in this embodiment, when the second micro service node is not abnormal, the calling of the first micro service node to the second micro service node may directly send a calling request through S201 without passing through any other node or server in the middle, and the second micro service node may also directly return a calling response to the first micro service node through S202. Compared with the prior art shown in fig. 2, the gateway API passed by in the calling process is reduced, so that the workload and economic investment of setting and maintaining the gateway API by an operator are reduced, the exception handling of the exception of the micro service nodes in the micro service architecture is ensured, the delay caused by the pass of the API gateway when the micro service nodes are called is reduced, and the communication efficiency between the micro service nodes in the micro service architecture is improved.
Furthermore, the access restriction of the first micro service node to the second micro service node in the embodiment of the present application can be realized by an iptable rule, and the method is simple and easy to implement, so that the modification cost of the existing micro service system through the mechanism of the network protocol stack is almost zero, the exception handling method in the embodiment of the present application can be provided in the micro service system only by deploying a server in a server or a container, other upgrades to the original micro service system are not needed, and the consumption of resources such as precious servers is lower.
Further, in the above embodiment, for the first micro service node configured with the access limiting information, a large amount of access limiting information may be configured during the continuous operation, and therefore, in order to avoid the influence of the access limiting information on the storage space and performance of the first micro service node, the first micro service node may delete the access limiting information stored therein when a preset condition is met, and the deleted information may be specific access limiting information or all the stored access limiting information.
The preset condition may be: when the first micro service node determines that the second micro service node is abnormally relieved and returns to normal, the access limiting information corresponding to the second micro service node can be deleted; or, configuring a second preset time (24 hours) after the access restriction information, deleting the access restriction information corresponding to the second micro service node; or, when the access restriction information configured in the first microservice node is greater than the preset number (100M), deleting the first 50M access restriction information stored first according to the time sequence, or deleting all the 100M access restriction information.
In the embodiments provided in the present application, the method provided in the embodiments of the present application is introduced from the perspective that the execution subject is a micro service node and a server, respectively. In order to implement the functions in the method provided by the embodiments of the present application, the microserver node and the server may further include a hardware structure and/or a software module, and the functions are implemented in the form of a hardware structure, a software module, or a hardware structure and a software module. Whether any of the above-described functions is implemented as a hardware structure, a software module, or a hardware structure plus a software module depends upon the particular application and design constraints imposed on the technical solution.
Fig. 7 is a schematic structural diagram of an embodiment of an exception handling apparatus for a micro service node provided in the present application, where the apparatus shown in fig. 7 may be a first micro service node in the foregoing embodiment of the present application, or may be a chip in the first micro service node, and the apparatus includes: a receiving module 701, a configuration module 702 and a sending module 703. The receiving module 701 is configured to receive an abnormal indication of a second microservice node sent by a server; the abnormality indication is used for indicating that the second micro service node is abnormal; the configuration module 702 is configured to generate access restriction information according to the abnormal indication; the access restriction information is used for restricting the first micro service node from calling the second micro service node.
Optionally, the restricting access information comprises: and the iptable rule is used for accessing the second micro service node.
Optionally, the iptable rule includes: a network address and a network port of the second micro service node.
Optionally, the sending module 703 is configured to send an abnormal indication request to the server; the anomaly indication request is used to determine to the server whether an anomaly indication is present.
Optionally, the sending module 703 is specifically configured to send an abnormal indication request to the server every first preset time.
Optionally, the configuration module 702 is further configured to delete the access restriction information when a preset condition is met; the preset conditions include: and determining that the second micro service node is recovered to be normal, and every second preset time, or the access limiting information configured in the first micro service node is larger than the preset number.
Fig. 8 is a schematic structural diagram of an embodiment of an exception handling apparatus of a microservice node provided in the present application, where the apparatus shown in fig. 8 may be a server in the foregoing embodiment of the present application, or a chip in the server, and the apparatus includes: a determination module 801, a sending module 802 and a receiving module 803. The determining module 801 is configured to determine that the second microservice node is abnormal; the sending module 802 is configured to send the abnormal indication of the second micro service node to the first micro service node; wherein the anomaly indication is used for indicating that the second micro service node is abnormal.
Optionally, the determining module 801 is specifically configured to monitor whether the multiple microservice nodes are abnormal; and determining that a second micro service node in the plurality of micro service nodes is abnormal according to the monitoring result.
Optionally, the receiving module 803 is configured to receive indication information, where the indication information is used to indicate that the second microservice node is abnormal;
the determining module 801 is configured to determine that the second microservice node is abnormal according to the indication information.
Optionally, the receiving module 803 is configured to receive an exception request sent by the first microservice node every first preset time; the exception request is for determining to the server whether an exception indication is present.
The division of the modules in the embodiments of the present application is schematic, and only one logical function division is provided, and in actual implementation, there may be another division manner, and in addition, each functional module in each embodiment of the present application may be integrated in one processor, may also exist alone physically, or may also be integrated in one module by two or more modules. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
The embodiment of the application also provides an exception handling system of the micro service node, which comprises a first micro service node and a server; the first micro service node may be an exception handling device of any one of the micro service nodes shown in fig. 7, and the server may be an exception handling device of any one of the micro service nodes shown in fig. 8.
As shown in fig. 9, fig. 9 is a block diagram of an electronic device for implementing the micro service node exception handling method according to the embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 9, the electronic apparatus includes: one or more processors 901, memory 902, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 9 illustrates an example of a processor 901.
Memory 902 is a non-transitory computer readable storage medium as provided herein. The memory stores instructions executable by at least one processor, so that the at least one processor executes the method executed by the server or the first micro service node in the micro service node exception handling method provided by the application. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method of the microservice node exception handling method provided by the present application.
Memory 902, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the methods in the embodiments of the present application. The processor 901 executes various functional applications and data processing of the server by running non-transitory software programs, instructions and modules stored in the memory 902, that is, a method executed by the server or the first micro service node in the method for implementing the micro service node exception handling method in the above method embodiment.
The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device of the micro service node exception handling method, and the like. Further, the memory 902 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 902 may optionally include a memory remotely located from the processor 901, and these remote memories may be connected to the microserver node exception handling method electronics over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the micro service node exception handling method may further include: an input device 903 and an output device 904. The processor 901, the memory 902, the input device 903 and the output device 904 may be connected by a bus or other means, and fig. 9 illustrates the connection by a bus as an example.
The input device 903 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device of the micro service node abnormality processing method, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or other input devices. The output devices 904 may include a display device, auxiliary lighting devices (e.g., LEDs), tactile feedback devices (e.g., vibrating motors), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (19)

1. An exception handling method for a microservice node is characterized by comprising the following steps:
the method comprises the steps that a first micro service node receives an abnormal indication of a second micro service node sent by a server; wherein the anomaly indication is used for indicating that the second micro-service node is abnormal;
the first micro service node configures access limiting information according to the abnormal indication; and the access limiting information is used for limiting the first micro service node to call the second micro service node.
2. The method of claim 1,
the restricted access information includes: an iptable rule for accessing the second micro service node.
3. The method of claim 2,
the iptable rule comprises: a network address and a network port of the second micro service node.
4. The method according to any one of claims 1 to 3,
and when the first micro service node calls the second micro service node, other nodes do not need to be passed through.
5. The method of claim 1, wherein before the first micro service node receives the indication of the abnormality of the second micro service node sent by the server, the method further comprises:
and the first micro service node sends an abnormal indication request to the server every first preset time.
6. The method of any of claims 1-3, wherein after the configuring generates the restricted access information, further comprising:
when a preset condition is met, the first micro service node deletes the access limiting information;
the preset conditions include: and determining that the second micro service node is recovered to be normal, every second preset time, or the access limiting information configured in the first micro service node is larger than a preset number.
7. An exception handling method for a microservice node is characterized by comprising the following steps:
the server determines that the second micro service node is abnormal;
the server sends the abnormal indication of the second micro service node to a first micro service node; wherein the anomaly indication is used for indicating that the second micro service node is abnormal.
8. The method of claim 7, wherein the server determining that the second microservice node is anomalous comprises:
the server receives indication information, wherein the indication information is used for indicating that the second micro service node is abnormal;
and the server determines that the second micro service node is abnormal according to the indication information.
9. The method of claim 7, wherein the server determining that the second microservice node is anomalous comprises:
the server monitors whether the micro service nodes are abnormal or not;
and the server determines that a second micro service node in the plurality of micro service nodes is abnormal according to the monitoring result.
10. The method of claim 7, wherein before the server sends the indication of the anomaly of the second micro-service node to the first micro-service node, further comprising:
and the server receives an abnormal request sent by the first micro service node at intervals of first preset time.
11. An exception handling apparatus for a microservice node, comprising:
the receiving module is used for receiving the abnormal indication of the second micro service node sent by the server; wherein the anomaly indication is used for indicating that the second micro-service node is abnormal;
the configuration module is used for configuring access limiting information according to the abnormal indication; and the access limiting information is used for limiting the first micro service node to call the second micro service node.
12. The apparatus of claim 11,
the restricted access information includes: an iptable rule for accessing the second micro service node.
13. The apparatus of claim 11,
and when the first micro service node calls the second micro service node, other nodes do not need to be passed through.
14. The apparatus of any of claims 11-13, wherein the configuration module is further configured to,
deleting the access limiting information when a preset condition is met;
the preset conditions include: and determining that the second micro service node is recovered to be normal, every second preset time, or the access limiting information configured in the first micro service node is larger than a preset number.
15. An exception handling apparatus for a microservice node, comprising:
the determining module is used for determining that the second micro service node is abnormal;
the sending module is used for sending the abnormal indication of the second micro service node to the first micro service node; wherein the anomaly indication is used for indicating that the second micro service node is abnormal.
16. The apparatus of claim 15, further comprising:
the receiving module is used for receiving an abnormal request sent by the first micro service node every interval of first preset time; the exception request is for determining to the server whether an exception indication is present.
17. An exception handling system for a microservice node, comprising: the apparatus of any one of claims 11-14, and the apparatus of any one of claims 15-16.
18. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10.
19. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-10.
CN201911312432.5A 2019-12-18 2019-12-18 Micro-service node exception handling method, device and system Active CN110995504B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911312432.5A CN110995504B (en) 2019-12-18 2019-12-18 Micro-service node exception handling method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911312432.5A CN110995504B (en) 2019-12-18 2019-12-18 Micro-service node exception handling method, device and system

Publications (2)

Publication Number Publication Date
CN110995504A true CN110995504A (en) 2020-04-10
CN110995504B CN110995504B (en) 2022-11-08

Family

ID=70095752

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911312432.5A Active CN110995504B (en) 2019-12-18 2019-12-18 Micro-service node exception handling method, device and system

Country Status (1)

Country Link
CN (1) CN110995504B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698266A (en) * 2020-06-30 2020-09-22 平安国际智慧城市科技股份有限公司 Service node calling method, device, equipment and readable storage medium
CN113960954A (en) * 2021-02-01 2022-01-21 厦门市智联信通物联网科技有限公司 Distributed centralized controller based on micro-service architecture
CN115562880A (en) * 2022-08-12 2023-01-03 华能烟台八角热电有限公司 Treatment method and system based on micro-service

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106656604A (en) * 2016-12-23 2017-05-10 郑州云海信息技术有限公司 Microservice request management method, microservice controller and high-concurrence microservice architecture
CN106911648A (en) * 2015-12-23 2017-06-30 阿里巴巴集团控股有限公司 One kind is environmentally isolated method and apparatus
CN108712309A (en) * 2018-06-11 2018-10-26 郑州云海信息技术有限公司 A kind of micro services node means of defence under micro services framework and system
US20190028496A1 (en) * 2017-07-19 2019-01-24 Cisco Technology, Inc. Anomaly detection for micro-service communications
CN109450669A (en) * 2018-10-17 2019-03-08 上海掌门科技有限公司 A kind of method of abnormal alarm, equipment and computer storage medium
CN109582472A (en) * 2018-10-19 2019-04-05 华为技术有限公司 A kind of micro services processing method and equipment
CN109618005A (en) * 2019-01-18 2019-04-12 华为终端有限公司 Method for calling server and proxy server
CN109639572A (en) * 2018-12-06 2019-04-16 网易(杭州)网络有限公司 Route management method, device and micro services system
CN109831504A (en) * 2019-01-31 2019-05-31 泰康保险集团股份有限公司 Micro services request processing method, device and equipment
CN110120961A (en) * 2018-02-06 2019-08-13 北京京东尚科信息技术有限公司 A kind of method of Distributed Services cluster and its route synchronization
JP2019164794A (en) * 2016-09-14 2019-09-26 オラクル・インターナショナル・コーポレイション Single sign-on and single log-out function for multi-tenant identity and data security management cloud service

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106911648A (en) * 2015-12-23 2017-06-30 阿里巴巴集团控股有限公司 One kind is environmentally isolated method and apparatus
JP2019164794A (en) * 2016-09-14 2019-09-26 オラクル・インターナショナル・コーポレイション Single sign-on and single log-out function for multi-tenant identity and data security management cloud service
CN106656604A (en) * 2016-12-23 2017-05-10 郑州云海信息技术有限公司 Microservice request management method, microservice controller and high-concurrence microservice architecture
US20190028496A1 (en) * 2017-07-19 2019-01-24 Cisco Technology, Inc. Anomaly detection for micro-service communications
CN110120961A (en) * 2018-02-06 2019-08-13 北京京东尚科信息技术有限公司 A kind of method of Distributed Services cluster and its route synchronization
CN108712309A (en) * 2018-06-11 2018-10-26 郑州云海信息技术有限公司 A kind of micro services node means of defence under micro services framework and system
CN109450669A (en) * 2018-10-17 2019-03-08 上海掌门科技有限公司 A kind of method of abnormal alarm, equipment and computer storage medium
CN109582472A (en) * 2018-10-19 2019-04-05 华为技术有限公司 A kind of micro services processing method and equipment
CN109639572A (en) * 2018-12-06 2019-04-16 网易(杭州)网络有限公司 Route management method, device and micro services system
CN109618005A (en) * 2019-01-18 2019-04-12 华为终端有限公司 Method for calling server and proxy server
CN109831504A (en) * 2019-01-31 2019-05-31 泰康保险集团股份有限公司 Micro services request processing method, device and equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698266A (en) * 2020-06-30 2020-09-22 平安国际智慧城市科技股份有限公司 Service node calling method, device, equipment and readable storage medium
CN111698266B (en) * 2020-06-30 2023-05-02 深圳赛安特技术服务有限公司 Service node calling method, device, equipment and readable storage medium
CN113960954A (en) * 2021-02-01 2022-01-21 厦门市智联信通物联网科技有限公司 Distributed centralized controller based on micro-service architecture
CN115562880A (en) * 2022-08-12 2023-01-03 华能烟台八角热电有限公司 Treatment method and system based on micro-service
CN115562880B (en) * 2022-08-12 2023-09-12 华能烟台八角热电有限公司 Micro-service-based treatment method and system

Also Published As

Publication number Publication date
CN110995504B (en) 2022-11-08

Similar Documents

Publication Publication Date Title
US10678601B2 (en) Orchestration service for multi-step recipe composition with flexible, topology-aware, and massive parallel execution
CN110995504B (en) Micro-service node exception handling method, device and system
US10003672B2 (en) Apparatus, systems and methods for deployment of interactive desktop applications on distributed infrastructures
US10917294B2 (en) Network function instance management method and related device
CN115495409A (en) Method and system for facilitating inter-container communication via cloud exchange
US20120005680A1 (en) Processing a batched unit of work
US11748163B2 (en) Control token and hierarchical dynamic control
US20070299906A1 (en) Server change management
CN111767069A (en) Applet processing method, server, device and storage medium
US9218226B2 (en) System and methods for remote access to IMS databases
EP3869336A1 (en) Method and apparatus for processing development machine operation task, device and storage medium
CN112925651A (en) Application resource deployment method, device, electronic equipment and medium
KR20220151585A (en) Business data processing method, apparatus, electronic apparatus, storage media and computer program
EP3457668B1 (en) Clustering in unified communication and collaboration services
US11765120B2 (en) Message queue architecture and interface for a multi-application platform
CN114185734A (en) Cluster monitoring method and device and electronic equipment
CN111770176B (en) Traffic scheduling method and device
CN111371629B (en) Network construction and out-of-band management method, device, equipment, medium and cloud platform
US11481228B2 (en) Self-service orchestration platform
CN112084000A (en) Container cluster testing method and device
CN111740859A (en) Test environment deployment method and device, electronic equipment and storage medium
CN115391058A (en) SDN-based resource event processing method, resource creating method and system
Dattatreya Nadig Testing resilience of envoy service proxy with microservices
US10469374B2 (en) Multiple provider framework for virtual switch data planes and data plane migration
CN114968636A (en) Fault processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant