Multi-network redundancy control method and system, electronic equipment and storage medium
By actively detecting the multi-network status and service status of service nodes in the microservice architecture and determining the target physical network port, the delay problem after network failure in the existing technology is solved, achieving faster service response and improving system availability.
Patent Information
- Application Number
- CN202410965154.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-10-01
AI Technical Summary
The existing network redundancy strategy only identifies and switches after a network failure occurs, which results in a significant increase in service response time and delays.
Before receiving a service request initiated by the client, actively detect the multi-network status and service status of each service node in the microservice architecture, determine the target physical network port of each service node, and after receiving the service request initiated by the client , providing the client with the IP address of any target physical network port in each service node.
Through active detection, potential problems are discovered in time to avoid identifying and switching after network failures occur, shortening service response time, avoiding delays, and improving system availability and fault tolerance.
Smart Images

Figure CN118740600A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network switching, and more specifically, particularly relates to a multi-network redundancy control method and system, electronic equipment, and storage medium. Background Art
[0002] With the continuous deepening of technological innovation, the application of microservice cluster architecture in the field of industrial automation is becoming more and more extensive. This architecture initially emerged in the Internet industry, mainly relying on infrastructure such as cloud computing, and its design did not fully consider network redundancy issues. However, in industrial control systems, in addition to the maintenance of the software framework, the maintenance of hardware servers is equally important, and there are higher requirements for the reliability and real-time performance of services. For example, when the network connection fails, the system needs to be able to automatically switch to the backup network to ensure continuity. Therefore, when applying the microservice cluster architecture to the field of industrial control, a network redundancy mechanism must be added to meet the industrial control industry's needs for high reliability and real-time performance.
[0003] The current network redundancy strategy assumes that the network connection is unobstructed when servicing requests. If a communication failure occurs, the system will try to reconnect two or three times. Only after multiple attempts fail will the system determine that the network is faulty and begin searching for and switching to a backup network.
[0004] However, this strategy requires the system to identify and switch after a network failure occurs, which may significantly increase service response time and cause latency issues. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a multi-network redundancy control method and system, an electronic device, and a storage medium, which are used to actively detect the multi-network status and service status of each service node in the cluster, and pre-check the network status before the service request, so as to detect potential problems in time.
[0006] The first aspect of the present application discloses a multi-network redundancy control method, which is applied to a microservice architecture, comprising:
[0007] Setting service node detection conditions in the microservice architecture;
[0008] When the microservice architecture satisfies the service node detection condition, each physical network port of each service node in the microservice architecture is detected to obtain the physical status of each physical network port of each service node; wherein each service node has at least two physical network ports;
[0009] According to the physical status and service status of each of the service nodes, the physical network port that each of the service nodes can provide services is used as the target physical network port; and when a service request initiated by a client is received, the target Internet Protocol IP address of each of the service nodes is sent to the client; wherein the target IP address is the IP address of any target physical network port of the service node.
[0010] Optionally, detecting each physical network port of each service node in the microservice architecture to obtain the physical status of each service node includes:
[0011] For any one of the service nodes, a first detection instruction is sent to the first physical network port of the service node through the first switch. If the first detection instruction returns a detection success, it is determined that the first physical network port of the service node is operating normally. If the first detection instruction does not return a detection success, it is determined that the first physical network port of the service node is faulty. A second detection instruction is sent to the second physical network port of the service node through the second switch. If the second detection instruction returns a detection success, it is determined that the second physical network port of the service node is operating normally. If the second detection instruction does not return a detection success, it is determined that the second physical network port of the service node is faulty.
[0012] Optionally, taking a physical network port that can provide services of each service node as a target physical network port according to the physical state and service state of each service node includes:
[0013] When the physical state of the physical network port is available, determining the physical network port whose physical state is available as a pending physical network port;
[0014] When the service status of the pending physical network port is available, the pending physical network port whose service status is available is determined as the target physical network port.
[0015] Optionally, the process of determining whether the microservice architecture satisfies the service node detection condition includes:
[0016] Determining whether the current time of the microservice architecture is a periodic detection time; and / or,
[0017] Determine whether the microservice architecture is currently generating a probe request.
[0018] Optionally, after detecting each physical network port of each service node in the microservice architecture to obtain the physical status of each service node, the method further includes:
[0019] Maintaining each physical state of the service node and displaying each physical state of the service node.
[0020] Optionally, before sending the target Internet Protocol IP address of each of the service nodes to the client, the method further includes:
[0021] A user network switching request is obtained, and the physical network port IP address indicated in the network switching request is used as the target IP address.
[0022] Optionally, before taking the physical network port that can be provided by each service node as the target physical network port according to the physical state and service state of each service node, the method further includes:
[0023] Establishing a connection between the client and the first physical network port in the master control node through the first switch;
[0024] If the connection between the client and the first physical network port in the master control node fails, establishing a connection between the client and the second physical network port in the master control node through a second switch;
[0025] If the client is successfully connected to the first physical network port of the master control node, it is determined that the client is successfully connected to the master control node, and polling is stopped;
[0026] If the connection between the client and the second physical network port in the master control node is successful, it is determined that the connection between the client and the master control node is successful, and polling is stopped;
[0027] If the connection between the client and the second physical network port in the master control node fails, it is determined that the connection between the client and the master control node fails.
[0028] The second aspect of the present application discloses a multi-network redundant control system, which is applied to a microservice architecture and includes:
[0029] A setting module, used to set the service node detection conditions in the microservice architecture;
[0030] A detection module, used to detect each physical network port of each service node in the microservice architecture when the microservice architecture meets the service node detection condition, and obtain the physical status of each service node; each service node has at least two physical network ports;
[0031] The IP address module is used to use the physical network port that each service node can provide service as the target physical network port according to the physical status and service status of each physical network port of each service node; and when receiving a service request initiated by the client, the target Internet Protocol IP address of each service node is sent to the client; wherein the target IP address is the IP address of any target physical network port of the service node.
[0032] The third aspect of the present application discloses an electronic device, comprising:
[0033] one or more processors;
[0034] a storage device having one or more programs stored thereon;
[0035] When one or more programs are executed by one or more processors, the one or more processors implement the multi-network redundancy control method as described in any one of the first aspects of the present application.
[0036] A fourth aspect of the present application discloses a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the multi-network redundancy control method as described in any one of the first aspects of the present application is implemented.
[0037] It can be seen from the above technical solution that a multi-network redundancy control method provided by the present invention includes: before receiving a service request initiated by a client, actively detecting each physical network port of each service node in the microservice architecture, determining the target physical network port of each service node according to the detected physical status and service status of each physical network port in each service node, and after receiving the service request initiated by the client, providing the client with the IP address of any target physical network port in each service node; then, decoupling the detection from the service, actively detecting the multi-network status and service status of each service node in the cluster, and pre-checking the network status before the service request, so as to timely discover potential problems; thereby avoiding identifying and switching after a network failure occurs, shortening the service response time, and avoiding delays. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 It is a control schematic diagram of a multi-network redundant control system provided by an embodiment of the present invention;
[0040] Figure 2 is a flow chart of a multi-network redundancy control method provided by an embodiment of the present invention;
[0041] Figure 3 It is a detection flow chart involved in a multi-network redundancy control method provided by an embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of a multi-network redundant control system provided by an embodiment of the present invention;
[0043] Figure 5 is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] In the present application, the term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the sentence "comprise one ..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. In addition, the terms "first", "second", "third", "fourth", etc. (if present) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable in appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here, for example.
[0046] In the field of industrial control systems (IC), the application of microservice cluster architecture is relatively new and has not yet become popular. Nevertheless, the traditional monolithic application architecture has implemented a dual-network redundancy solution in the IC industry, which usually involves network redundancy between the client and the server, and ensures network continuity and reliability through a simple polling mechanism.
[0047] However, when moving to a microservice cluster architecture, the situation becomes more complicated. In this architecture, the server is no longer a single entity, but a cluster consisting of multiple service nodes, which are uniformly managed by a master node. Each service node needs to maintain multiple network connections and monitor the connectivity of these connections in real time. This not only increases the complexity of the system, but also poses new challenges to the existing dual-network redundancy solution.
[0048] The embodiment of the present application provides a multi-network redundancy control method for solving the problem in the prior art that a network failure is identified and switched only after it occurs, which may cause a significant increase in service response time and lead to a delay problem.
[0049] See also Figure 1 , microservice architecture service cluster and master control node, the service cluster includes multiple service nodes, for example, three service nodes, and the service nodes can communicate with each other or not.
[0050] The master node provides service registration for service nodes and service discovery for clients; the microservice cluster framework is responsible for the management of software services and the management of the network.
[0051] The service registration of the service node is that each service node registers with the master control node. The master control node listens to the service request of the client. On this basis, the master control node also monitors the network status and provides the user with an available network. The service health check can be achieved by monitoring the network detection; specifically, according to the multi-network redundant control method provided in this application, network control is achieved.
[0052] See also Figure 2 ,Multi-network redundancy control method, applied to microservice architecture, including:
[0053] S101. Set service node detection conditions in the microservice architecture.
[0054] When the microservice architecture meets the service node detection condition, the microservice architecture starts to detect each service node in the microservice architecture. The service node detection condition can be pre-set, and the specific content of the service node detection condition can be in various forms, as long as it can trigger the microservice architecture to detect the service node.
[0055] The service node detection condition can be triggered periodically, according to the request, or according to the operation of the microservice architecture. The service node detection condition can be triggered by multiple situations or by a single situation, which will not be described here one by one.
[0056] Optionally, the process of determining whether the microservice architecture meets the service node detection condition includes:
[0057] Determine whether the current time of the microservice architecture is a periodic detection time; and / or determine whether the microservice architecture currently generates a detection request.
[0058] When the service node detection condition is periodic triggering, it is determined whether the current time of the microservice architecture is the periodic detection time. If so, the microservice architecture is triggered to perform detection. The current time can be counted by a timer, and the periodic detection time can be preset, and detection can be performed every day, every week, every month, etc., or it can be performed in hours and minutes, etc., which will not be described here one by one.
[0059] When the service node detection condition is triggered by a detection request, it is determined whether the microservice architecture currently generates a detection request; if so, the microservice architecture is triggered to perform the detection. The detection request can be obtained by processing the operation data of the microservice architecture, or it can be issued by the host computer, and of course it can be other situations, which will not be described here one by one.
[0060] The service node detection conditions are detection request triggering and periodic triggering. The detection can be triggered when either the detection request triggering or the periodic triggering is met, or the detection can be triggered when both the detection request triggering and the periodic triggering are met.
[0061] Of course, the process of determining whether to trigger may also be other methods, which will not be elaborated here one by one. It depends on the actual situation and is within the scope of protection of this application.
[0062] S102: When the microservice architecture meets the service node detection condition, each physical network port of each service node in the microservice architecture is detected to obtain the physical status of each physical network port of each service node.
[0063] Each service node has at least two physical network ports. Specifically, each service node can be configured with two physical network ports. Accordingly, the microservice architecture has two switches so that each physical network port of the service node can communicate independently. Of course, each service node can also have multiple physical network ports, such as 3, which is not specifically limited here.
[0064] In addition, the number of physical network ports of each service node is generally the same, but it is not ruled out that each network port of the service node communicates with a different switch. Of course, there are also situations where at least two network ports communicate with the same switch, which is not specifically limited here.
[0065] When the microservice architecture meets the service node detection conditions, the detection of each service node in the microservice architecture is triggered; that is, the present application can realize active detection of each service node, rather than passive detection only after a failure or when data interaction is required.
[0066] For each service node, the first physical network port of the service node is detected to obtain the detection result of the first physical network port of the service node, and the second physical network port of the service node is detected to obtain the detection result of the second physical network port of the service node; the detection result of the first physical network port and the detection result of the second physical network port are used as the physical status of each physical network port of the service node.
[0067] Specifically, the detection result may be detection success or detection failure, etc. Correspondingly, other situations may also be included, which will not be described in detail here.
[0068] S103. According to the physical status and service status of each physical network port of each service node, the physical network port that can provide services of each service node is used as the target physical network port; and when receiving the service request initiated by the client, the target Internet Protocol IP address of each service node is sent to the client.
[0069] When the client has a need to obtain data, etc., the client initiates a service request to the microservice architecture. When the microservice architecture receives the service request initiated by the client, it determines the physical network port that can provide the service based on the situation of each service node, and sends the IP address of the physical network port that can provide the service to the client, thereby actively triggering the replacement of the faulty network.
[0070] Specifically, since each service node may have multiple physical network ports, when two physical network ports are both capable of providing services, one physical network port may be selected from the multiple physical network ports, and the address of the physical network port may be used as the target IP address and sent to the client. In other words, the target IP address is the IP address of any target physical network port of the service node.
[0071] In addition, since the microservice architecture can consist of multiple service nodes, the target IP address corresponding to each service node can be sent to the client.
[0072] Taking dual networks as an example, each service node has two network cards, that is, two networks and two IP addresses.
[0073] Use active detection to check whether the two physical network ports of the service node are available. If some of the physical network ports of the service node are available, check whether the service status of the available physical network port is available. If the physical network port is available and the service status is available, determine the IP address of the physical network port. If the client initiates a service request, return the IP address of the physical network port to the client.
[0074] If all physical network ports of the service node are available, a physical network port is randomly selected, and it is determined whether the service status of the selected physical network port is available. If so, the IP address of the physical network port is determined.
[0075] That is to say, based on the availability of the physical network port and the availability of the service status, a logical calculation is performed to send the unique available IP address of each service node to the client. If there are three service nodes, three IP addresses will be sent, and then the client will use these three addresses for communication.
[0076] It should be noted that when any network port or network fails, the system can automatically switch the network or network port through active detection and sending the IP address to the client, thereby improving the system availability.
[0077] When some physical network ports are unavailable, an alarm can be issued to remind maintenance personnel to perform maintenance.
[0078] The specific communication process is handled by the microservice framework. Different microservice frameworks may have different communication methods, which will not be described here one by one. It depends on the actual situation and is within the scope of protection of this application.
[0079] In this embodiment, before receiving a service request initiated by a client, each physical network port of each service node in the microservice architecture is actively detected, and the target physical network port of each service node is determined based on the detected physical status and service status of each physical network port of each service node. After receiving the service request initiated by the client, the IP address of any target physical network port in each service node is provided to the client; then, the detection is decoupled from the service, and the multi-network status and service status of each service node in the cluster are actively detected. Before the service request, the network status is pre-checked to timely discover potential problems; thereby avoiding identifying and switching after a network failure occurs, shortening the service response time, and avoiding delays.
[0080] Optionally, the step S102 involves detecting each physical network port of each service node in the microservice architecture to obtain the physical status of each physical network port of each service node, including:
[0081] For any service node:
[0082] A first detection instruction is sent to the first physical network port of the service node through the first switch. If the first detection instruction returns a successful detection, it is determined that the first physical network port of the service node is operating normally. If the first detection instruction does not return a successful detection, it is determined that the first physical network port of the service node has a fault.
[0083] A second detection instruction is sent to the second physical network port of the service node through the second switch. If the second detection instruction returns a successful detection, it is determined that the second physical network port of the service node is operating normally. If the second detection instruction does not return a successful detection, it is determined that the second physical network port of the service node has a fault.
[0084] It should be noted that the detection processes corresponding to the first switch and the second switch can be performed in parallel or in sequence, with the detection process corresponding to the first switch performed first and then the detection process corresponding to the second switch, or the detection process corresponding to the second switch performed first and then the detection process corresponding to the first switch.
[0085] The above detection program may be set in the main control node, that is, the main control node runs a dedicated thread detection program to detect the IP networks registered by all service nodes.
[0086] like Figure 3 As shown, the following example uses three service nodes and two switches:
[0087] (1) The master control node detects two network cards in service node 1 (network cards in the physical network port), each of which is bound to an IP address.
[0088] If S1a succeeds, it means that NIC a is running normally, that is, physical network port a is running normally, and the network from NIC a to switch A is unobstructed. S1a is a detection instruction from the master node to NIC a of service node 1.
[0089] If S1b is detected successfully, it means that the b network card is running normally, that is, the b physical network port is running normally, and the network from the b network card to the B switch is unobstructed. S1b is a detection instruction from the master node to the b network card of the service node 1.
[0090] If the detection of S1a and S1b is unsuccessful, it means that the network card a and the network card b of service node 1 are not running normally.
[0091] If all detections are successful, the service node 1 can use any IP address, and can also specify an IP address from the available IP addresses through the maintenance interface.
[0092] (2) The master node detects two IP addresses in service node 2. Each network card is bound to an IP address.
[0093] If S2a succeeds in detection, it means that network card a is running normally, that is, physical network port a is running normally, and the network from network card a to switch A is unobstructed. S2a is a detection instruction from the master control node to network card a of service node 2.
[0094] If S2b succeeds, it means that the b network card is running normally, that is, the b physical network port is running normally, and the network from the b network card to the B switch is unobstructed. S2b is a detection instruction from the master node to the b network card of the service node 2.
[0095] If the detection of S2a and S2b is unsuccessful, it means that the network card a and the network card b of service node 2 are not running normally.
[0096] If all detections are successful, the service node 2 can use any IP address, and can also specify an IP address from the available IP addresses through the maintenance interface.
[0097] (3) The master control node detects two IP addresses in service node 3. Each network card is bound to an IP address.
[0098] If S3a detects successfully, it means that network card a is running normally, that is, physical network port a is running normally, and the network from network card a to switch A is unobstructed. S3a is a detection instruction from the master control node to network card a of service node 3.
[0099] If S3b succeeds, it means that the b network card is running normally, that is, the b physical network port is running normally, and the network from the b network card to the B switch is unobstructed. S3b is a detection instruction from the master control node to the b network card of the service node 3.
[0100] If both detection S3a and S3b fail, it means that the network card a and the network card b of service node 3 are not running normally.
[0101] If all detections are successful, the service node 3 can use any IP address, and can also specify an IP address from the available IP addresses through the maintenance interface.
[0102] It should be noted that in order to improve communication efficiency, different service nodes can use different network segments as much as possible. Different network segments are generally different switches. Try to make each service node communication distributed on different switches to prevent a switch failure from affecting the entire business.
[0103] In other words, node health detection is achieved through detection.
[0104] The detection of other service nodes is similar to that of the above service node 1 and service node 2, and will not be described in detail here.
[0105] like Figure 3 As shown, OPS (Operator Station) is an operator station for nuclear power and can be regarded as a client in this application.
[0106] It is worth noting that the client can also be detected. The method of detecting the client node is the same as the method of detecting the server node, which will not be described here one by one.
[0107] When detecting the client's node, the management page of the main control node displays the client's network status for easy management.
[0108] In this embodiment, by actively detecting the service node, not only the physical network port of the service node can be detected for availability, but also the network cable and switch can be detected for availability. Then, the node health detection of the microservice architecture itself is used to maintain the status of the business service.
[0109] It should be noted that before detecting each service node, each service node and client can also be bound to an IP address, specifically:
[0110] (1) Bind the IP address to 0.0.0.0 on the client, so that the framework will collect all local IP addresses by default. Then configure the two IP addresses of the master node in the microservice architecture and poll the two IP addresses of the master node. If the first connection fails, poll the second one. If the first connection succeeds, do not poll the second one.
[0111] Bind IP to 0.0.0.0 on the client: This usually means that the client application is configured to listen to the IP address (0.0.0.0) of all network interfaces instead of a specific IP address. This allows the client to receive requests or responses from any network interface.
[0112] The framework collects all local IP addresses by default: The framework or library used by the client may automatically detect and collect all available IP addresses on the client machine. In this way, the client can use these IP addresses to communicate with other service nodes.
[0113] This mechanism allows the client to automatically try to connect to an alternate service node when facing network instability or service node failure, thereby improving the availability and fault tolerance of the system. At the same time, it also ensures that once a stable connection is established, no additional polling attempts are required, thereby improving efficiency.
[0114] (2) Bind the IP address of the service node to 0.0.0.0. In this way, the framework will monitor all IP addresses of the local machine by default, and then register the service to the master control node. When the master control loads the service, if it finds that it is 0.0.0.0, it will replace the address with multiple IP addresses corresponding to this node.
[0115] The service node binds IP to 0.0.0.0, which usually means that when a service node is started, it sets its listening IP address to 0.0.0.0. This means that the service will accept connection requests from any network interface, rather than being limited to a specific IP address.
[0116] When a service node is bound to 0.0.0.0, the microservice framework using the node will listen to all available IP addresses on the node by default.
[0117] After starting, the service node will register itself with the master node. The master node is responsible for maintaining the status information of all service nodes, including their IP addresses and port numbers.
[0118] When the master node loads the service, if it finds that it is 0.0.0.0, it will change the address to the multiple IP addresses corresponding to this service node: When the master node receives the registration information of the service node, if it finds that the service node uses 0.0.0.0 as the IP address, the master node will convert this address to the actual multiple IP addresses of the service node. The purpose of this is to ensure that other services or clients can access the service node through the correct IP address.
[0119] This mechanism allows service nodes to flexibly accept connections from different networks without pre-specifying specific IP addresses, while ensuring service accessibility and load balancing through intelligent processing by the master node.
[0120] Optionally, the above step S103 involves taking the physical network port that can provide services of each service node as the target physical network port according to the physical state and service state of each service node, including:
[0121] First, when the physical state of the physical network port is available, the physical network port with the available physical state is determined as the pending physical network port; then, when the service state of the pending physical network port is available, the pending physical network port with the available service state is determined as the target physical network port.
[0122] Each physical network port corresponds to a network card, that is, an IP. Each IP has at least one listening service, and the service status is whether the two services are available. For example, if there are two applications deployed on a machine, then both applications can bind to and listen to the same IP, but the ports they listen to are different.
[0123] The physical status refers to the working condition of the network port at the hardware level. For example: connection status: whether the port has been connected to another device through a physical cable; signal detection: whether the port detects the signal from the other end; duplex mode: whether the port works in full-duplex or half-duplex mode; fault: whether the port has physical damage or connection problems.
[0124] The service status refers to whether the network port can provide network services at the logical level. This is usually determined by software configuration and network protocols.
[0125] The service status can be determined by monitoring. The specific monitoring methods are not determined one by one here and will not be described in detail here. It depends on the actual situation and is within the protection scope of this application.
[0126] That is to say, the physical status availability of the physical network port is determined first, and then the service status availability of the physical network port is determined. Both the service status availability and the physical status availability need to be satisfied.
[0127] The availability of the service status is automatically detected by the microservice architecture. The detection process of different microservice architectures may be different. No specific limitation is made here. It depends on the actual situation and is within the scope of protection of this application.
[0128] Optionally, after detecting each physical network port of each service node in the microservice architecture to obtain the physical status of each service node, the following steps are further included:
[0129] Maintain the physical status of each service node and display the physical status of each service node.
[0130] Specifically, the master control node manages the IP address of each service node, and may also manage the status data of each service node, where the status data may include a physical status and a service status.
[0131] The detection of each service node can be performed by the master control node, that is, the master control node actively detects each service node; and after obtaining the detection result, the physical state of each service node is updated according to the detection result to achieve maintenance of each service node.
[0132] Specifically, a maintenance display interface may be configured, and the status data of each service node may be displayed on the maintenance restriction interface, that is, both the physical status and the service status may be displayed, or only the physical status may be displayed. The availability traffic light of each physical network port of each service node may be displayed.
[0133] Optionally, before sending the target Internet Protocol IP address of each service node to the client, the method further includes:
[0134] Get the user's network switching request and use the physical network port IP address indicated in the network switching request as the target IP address.
[0135] In other words, support for manual network switching is provided. Users can specify physical network ports and other operations on the maintenance display interface to generate network switching requests, and then the microservice architecture responds to the request and switches the network. For example, the a network port of service node 1 currently used can be switched to the b network port of service node 1 according to the request. The same is true for other nodes, which will not be repeated here. You can also send a network switching request to switch the network, which will not be repeated here.
[0136] In this embodiment, a dedicated thread is deployed on the main control node to actively detect the dual-network status and service status of each service node in the cluster. According to certain logical calculations, the IP address of the available service is returned to the client for use. The IP address can also be evenly distributed in the two networks, and the status is displayed in real time on the visual interface. Manual switching maintenance is supported, which solves the problems of passive fault discovery, high latency, unobservable and non-manual switching in the prior art. The fault discovery of this application is active, real-time, visualized, and can be switched automatically or manually.
[0137] Optionally, before the above step S103 involves taking the physical network port that can provide services of each service node as the target physical network port according to the physical state and service state of each service node, the following step may also be included:
[0138] According to the polling rules, a connection is established between the client and the master node in the microservice architecture; the master node manages the IP addresses of each service node.
[0139] Optionally, establish a connection between the client and the master node in the microservice architecture according to the polling rule, including:
[0140] A connection is established between the client and the first physical network port in the master control node through the first switch.
[0141] If the connection between the client and the first physical network port in the master control node fails, a connection between the client and the second physical network port in the master control node is established through the second switch.
[0142] If the client is successfully connected to the first physical network port of the master control node, it is determined that the client is successfully connected to the master control node, and polling is stopped.
[0143] If the connection between the client and the second physical network port in the master control node is successful, it is determined that the connection between the client and the master control node is successful, and polling is stopped.
[0144] If the connection between the client and the second physical network port in the master control node fails, it is determined that the connection between the client and the master control node fails.
[0145] In the microservice cluster architecture, the stability of the network is crucial to the continuity of the service. However, network problems such as network card failure, network cable damage or switch failure may cause service interruption. In order to meet these challenges, the method provided by this application can actively detect: through advanced network monitoring technology, the state of the physical network is perceived in real time, and potential fault points are discovered in time. Service health check: through active detection, regular inspection of the running status of the service is achieved to ensure the health and performance of the service. Fault warning can be provided: when a network or service anomaly is detected, the system will automatically issue an early warning to remind the operation and maintenance team to take action. A visual management interface can be provided: an intuitive management interface is provided to display the network status and health check results, so that the operation and maintenance personnel can quickly understand the operation of the entire cluster. Manual network routing selection can be performed: allowing the operation and maintenance personnel to manually select the optimal network route according to actual needs to optimize the communication path of the service. Flexible network control can be performed: support maintenance and upgrade operations on the specified network to improve the reliability and service quality of the network; thereby minimizing service interruptions and ensuring high availability and business continuity of the microservice cluster.
[0146] Another embodiment of the present application provides a multi-network redundant control system applied to a microservice architecture.
[0147] See also Figure 4 , the multi-network redundant control system includes:
[0148] The setting module 101 is used to set the service node detection conditions in the microservice architecture.
[0149] The detection module 102 is used to detect each physical network port of each service node in the microservice architecture when the microservice architecture meets the service node detection condition to obtain the physical status of each service node; each service node has at least two physical network ports.
[0150] The IP address module 103 is used to use the physical network port that each service node can provide services as the target physical network port based on the physical status and service status of each service node; and when receiving a service request initiated by the client, the target Internet Protocol IP address of each service node is sent to the client; wherein the target IP address is the IP address of any target physical network port of the service node.
[0151] Optionally, the detection module 102 is used to detect each physical network port of each service node in the microservice architecture, and when obtaining the physical status of each service node, it is specifically used to:
[0152] For any service node, a first detection instruction is sent to the first physical network port of the service node through the first switch. If the first detection instruction returns a successful detection, it is determined that the first physical network port of the service node is operating normally. If the first detection instruction does not return a successful detection, it is determined that the first physical network port of the service node is faulty. A second detection instruction is sent to the second physical network port of the service node through the second switch. If the second detection instruction returns a successful detection, it is determined that the second physical network port of the service node is operating normally. If the second detection instruction does not return a successful detection, it is determined that the second physical network port of the service node is faulty.
[0153] The specific working process and principle of each of the above modules are detailed in the multi-network redundancy control method provided in the above embodiment, which will not be described here one by one. It depends on the actual situation and is within the protection scope of this application.
[0154] In this embodiment, the setting module 101 sets the service node detection conditions in the microservice architecture; the detection module 102 detects each physical network port of each service node in the microservice architecture when the microservice architecture meets the service node detection conditions to obtain the physical status of each service node; each service node has at least two physical network ports; the IP address module 103 uses the physical network port that each service node can provide services as the target physical network port based on the physical status and service status of each service node; and when receiving the service request initiated by the client, the target Internet Protocol IP address of each service node is sent to the client; wherein the target IP address is the IP address of any target physical network port of the service node; further, the detection is decoupled from the service, and the multi-network status and service status of each service node in the cluster are actively detected. Before the service request, the network status is pre-checked to timely discover potential problems; thereby avoiding identifying and switching after the network failure occurs, shortening the service response time, and avoiding delays.
[0155] Another embodiment of the present application provides a storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, a multi-network redundancy control method as described in any one of the above embodiments is implemented.
[0156] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0157] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0158] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0159] Another embodiment of the present invention provides an electronic device, such as Figure 5 As shown, including:
[0160] One or more processors 201.
[0161] The storage device 202 stores one or more programs.
[0162] When one or more programs are executed by one or more processors 201, the one or more processors 201 implement a multi-network redundancy control method as in any one of the above embodiments.
[0163] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart.
[0164] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
[0165] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.
[0166] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0167] The features recorded in the various embodiments in this specification can be replaced or combined with each other, and the same and similar parts between the various embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0168] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0169] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A multi-network redundancy control method, characterized in that: Applied to microservice architecture, including: Setting service node detection conditions in the microservice architecture; When the microservice architecture satisfies the service node detection condition, each physical network port of each service node in the microservice architecture is detected to obtain the physical status of each physical network port of each service node; wherein each service node has at least two physical network ports; According to the physical status and service status of each of the service nodes, the physical network port that each of the service nodes can provide services is used as the target physical network port; and when a service request initiated by a client is received, the target Internet Protocol IP address of each of the service nodes is sent to the client; wherein the target IP address is the IP address of any target physical network port of the service node.
2. The multi-network redundancy control method according to claim 1, characterized in that: The detecting each physical network port of each service node in the microservice architecture to obtain the physical status of each service node includes: For any one of the service nodes, a first detection instruction is sent to the first physical network port of the service node through the first switch. If the first detection instruction returns a detection success, it is determined that the first physical network port of the service node is operating normally. If the first detection instruction does not return a detection success, it is determined that the first physical network port of the service node is faulty. A second detection instruction is sent to the second physical network port of the service node through the second switch. If the second detection instruction returns a detection success, it is determined that the second physical network port of the service node is operating normally. If the second detection instruction does not return a detection success, it is determined that the second physical network port of the service node is faulty.
3. The multi-network redundancy control method according to claim 1, characterized in that: The method of taking a physical network port that can be provided by each service node as a target physical network port according to the physical state and service state of each service node includes: When the physical state of the physical network port is available, determining the physical network port whose physical state is available as a pending physical network port; When the service status of the pending physical network port is available, the pending physical network port whose service status is available is determined as the target physical network port.
4. The multi-network redundancy control method according to claim 1, characterized in that: The process of determining whether the microservice architecture satisfies the service node detection condition includes: Determining whether the current time of the microservice architecture is a periodic detection time; and / or, Determine whether the microservice architecture is currently generating a probe request.
5. The multi-network redundancy control method according to claim 1, characterized in that: After detecting each physical network port of each service node in the microservice architecture to obtain the physical status of each service node, the method further includes: Maintaining each physical state of the service node and displaying each physical state of the service node.
6. The multi-network redundancy control method according to claim 1, characterized in that: Before sending the target Internet Protocol IP address of each of the service nodes to the client, the method further includes: A user network switching request is obtained, and the physical network port IP address indicated in the network switching request is used as the target IP address.
7. The multi-network redundancy control method according to claim 1, characterized in that: Before taking the physical network port that can provide services of each service node as the target physical network port according to the physical state and service state of each service node, the method further includes: Establishing a connection between the client and the first physical network port in the master control node through the first switch; If the connection between the client and the first physical network port in the master control node fails, establishing a connection between the client and the second physical network port in the master control node through a second switch; If the client is successfully connected to the first physical network port of the master control node, it is determined that the client is successfully connected to the master control node, and polling is stopped; If the connection between the client and the second physical network port in the master control node is successful, it is determined that the connection between the client and the master control node is successful, and polling is stopped; If the connection between the client and the second physical network port in the master control node fails, it is determined that the connection between the client and the master control node fails.
8. A multi-network redundant control system, characterized in that: Applications in microservice architecture include: A setting module, used to set the service node detection conditions in the microservice architecture; A detection module, used to detect each physical network port of each service node in the microservice architecture when the microservice architecture meets the service node detection condition, and obtain the physical status of each service node; each service node has at least two physical network ports; The IP address module is used to use the physical network port that each service node can provide service as the target physical network port according to the physical status and service status of each physical network port of each service node; and when receiving a service request initiated by the client, the target Internet Protocol IP address of each service node is sent to the client; wherein the target IP address is the IP address of any target physical network port of the service node.
9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon; When one or more programs are executed by one or more processors, the one or more processors implement the multi-network redundancy control method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the multi-network redundancy control method as described in any one of claims 1 to 7 is implemented.
