Edge gateway backup method and device, electronic device and storage medium

By creating business containers and backup containers within edge gateways and switching their roles when failures occur, the problem of low system availability after gateway failure in industrial IoT is solved, improving system availability and processing stability.

CN120179461APending Publication Date: 2025-06-20ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510244977.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

In the field of industrial Internet of Things, in the prior art, the system availability after gateway failure is low, resulting in problems such as high latency, low bandwidth and instability, which cannot meet the requirements of high availability.

Method used

Within the edge gateway, by creating a service container and a backup container, the backup container can synchronously receive service data from the service container. When an exception occurs in a business container, the backup container receives business data and switches to a new business container. The original business container is restarted as a new backup container.

Benefits of technology

Improves system availability in the case of gateway failure, reduces the cost and time of backup and replacement, and ensures timely and stability of business processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179461A_ABST
    Figure CN120179461A_ABST
Patent Text Reader

Abstract

The invention relates to an edge gateway backup method and device, an electronic device and a storage medium, and the method comprises the steps: creating a corresponding service container according to a gateway service in an edge gateway; creating a corresponding backup container according to each service container, wherein the backup container can synchronously receive the service data of the corresponding service container cache region; when detecting that the business container is abnormal, receiving business data through a backup container corresponding to the abnormal business container; and taking the backup container as a new service container, and taking the abnormal service container as a new backup container corresponding to the new service container after being restarted. According to the invention, the availability of the system under the gateway fault condition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and particularly to an edge gateway backup method, apparatus, electronic device, and storage medium. Background Art

[0002] In the field of industrial Internet of Things, to avoid the loss of sub-device data, the system is required to have high reliability and high availability. The role of the gateway is to connect two or more heterogeneous networks so that they can communicate with each other. The industrial Internet of Things gateway integrates heterogeneous sensing networks into the Internet of Things, performs protocol conversion between various protocols in the industrial field and the required communication protocols, and realizes data interaction between different protocols. However, the working environment of industrial gateways is different from that of ordinary Internet of Things gateway devices, and industrial gateways also need to be targeted at harsh industrial application environments. Therefore, gateway redundancy is an indispensable part of the control system. In the prior art, the 1:1 hot backup redundancy technology is mostly used, where two identical gateways are in the running state at the same time. One gateway is in the normal working state, collecting data in real time and reporting it to the controller, and the other is in the standby state and does not participate in data collection. When the working gateway fails, the standby gateway enters the working state to complete seamless switching. However, in some cases, this method directly switches to the standby gateway after the working gateway fails, and the redundancy performance is poor. There are usually situations such as high latency, low bandwidth, and instability, which cannot meet the requirements of high availability on site.

[0003] In view of the problem of low system availability in the case of gateway failure in the related art, no effective solution has been proposed yet. Summary of the Invention

[0004] In this embodiment, an edge gateway backup method, apparatus, electronic device, and storage medium are provided to solve the problem of low system availability in the case of gateway failure in the related art.

[0005] In a first aspect, in this embodiment, an edge gateway backup method is provided, including:

[0006] In the edge gateway, create corresponding service containers according to gateway services;

[0007] Create corresponding backup containers according to each service container, and the backup containers can synchronously receive the service data in the buffer area of the corresponding service containers;

[0008] When it is detected that a service container has an exception, receive service data through the backup container corresponding to the service container with the exception; use the backup container as a new service container, and restart the service container with the exception and use it as a new backup container corresponding to the new service container.

[0009] In some of these embodiments, the service container and the corresponding backup container of the service container are connected through the bridge mode, and the exception detection process of the service container includes:

[0010] Regularly send data packets from the service container to the corresponding backup container of the service container;

[0011] Determine whether the time interval for sending the data packet exceeds a preset time interval. If so, determine that the service container has an exception.

[0012] In some of these embodiments, the data packet includes the status information of the service container, and the exception detection process of the service container further includes:

[0013] Determine whether the status information of the service container indicates that the service container has an exception. If so, determine that the service container has an exception.

[0014] In some of these embodiments, the exception detection process of the service container further includes:

[0015] Establish a shared memory between the service container and the corresponding backup container of the service container;

[0016] Regularly write service data into the shared memory through the service container, and read the service data in the shared memory through the corresponding backup container of the service container;

[0017] Determine the time when the corresponding backup container of the service container reads the shared memory as the reading time;

[0018] Determine whether the reading time exceeds a preset duration threshold. If so, determine that the service container has an exception.

[0019] In some of these embodiments, the shared memory includes the status information of the service container, and the exception detection process of the service container further includes:

[0020] Determine whether the status information of the service container indicates that the service container has an exception. If so, determine that the service container has an exception.

[0021] In some of these embodiments, the receiving of service data by the corresponding backup container of the service container that has an exception includes:

[0022] Real-time process service data through the backup container, and the backup container reads memory from the host machine;

[0023] When it is detected that the service container has an exception, switch the service container to the backup container, and write the memory into the host through the backup container, so that the host can read the service data processed by the backup container.

[0024] In some of the embodiments, receiving service data through the backup container corresponding to the service container with the exception includes:

[0025] Control the backup container to remain in a standby state;

[0026] When the service container has an exception, control the backup container to obtain the service data and process the service data, so that the host can read the service data processed by the backup container.

[0027] In a second aspect, an edge gateway backup device is provided in this embodiment, including: a creation module and an exception handling module, where

[0028] The creation module is configured to create corresponding service containers in the edge gateway according to gateway services; create corresponding backup containers according to each service container, and the backup containers can synchronously receive the service data in the corresponding service container buffer;

[0029] The exception handling module is configured to, when it is detected that the service container has an exception, receive service data through the backup container corresponding to the service container with the exception; use the backup container as a new service container, and restart the service container with the exception as a new backup container corresponding to the new service container.

[0030] In a third aspect, an electronic device is provided in this embodiment, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the edge gateway backup method described in the first aspect above is implemented.

[0031] In a fourth aspect, a storage medium is provided in this embodiment, on which a computer program is stored. When the program is executed by a processor, the edge gateway backup method described in the first aspect above is implemented.

[0032] Compared with the related technologies, in the edge gateway backup method provided in this embodiment, corresponding service containers are created within the edge gateway according to gateway services; corresponding backup containers are created according to each service container, and the backup containers can synchronously receive the service data in the buffer area of the corresponding service containers; when it is detected that a service container has an exception, the backup container corresponding to the service container with the exception receives the service data; the backup container is used as a new service container, and the service container with the exception is restarted and used as a new backup container corresponding to the new service container, improving the availability of the system in case of gateway failures.

[0033] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:

[0035] Figure 1 is a hardware structure block diagram of the terminal of the edge gateway backup method in this embodiment.

[0036] Figure 2 is a flowchart of the edge gateway backup method in this embodiment.

[0037] Figure 3 is a flowchart of another edge gateway backup method in this embodiment.

[0038] Figure 4 is a structure diagram of the edge gateway backup system in this embodiment.

[0039] Figure 5 is a structure block diagram of the edge gateway backup device in this embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0040] To more clearly understand the purpose, technical solution, and advantages of the present application, the present application is described and explained below with reference to the drawings and embodiments.

[0041] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meanings understood by those with ordinary skills in the technical field to which this application belongs. In this application, words such as "a", "one", "a kind of", "the", "these", etc. do not indicate a limitation in quantity, and they can be singular or plural. The terms "comprising", "including", "having" and any variants thereof involved in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent in these processes, methods, products or devices. The terms "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly connected. The "plurality" involved in this application means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: A exists alone, A and B exist simultaneously, and B exists alone. Usually, the character " / " indicates that the objects associated before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific sorting of the objects.

[0042] The method embodiments provided in this embodiment can be executed on a terminal, a computer or a similar computing device. For example, when running on a terminal, Figure 1 is a hardware structure block diagram of the terminal of the edge gateway backup method in this embodiment. As Figure 1 shown, the terminal may include one or more ( Figure 1 only one is shown in the figure) processors 102 and a memory 104 for storing data. Among them, the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above terminal. For example, the terminal may further include more or fewer components than Figure 1 shown in the figure, or have a different configuration from Figure 1 shown.

[0043] The memory 104 can be used to store computer programs, such as software programs and modules of application software, such as the computer program corresponding to the edge gateway backup method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, the above-mentioned method is implemented. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor 102, and these remote memories can be connected to the terminal through a network. Examples of the above-mentioned network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and their combinations.

[0044] The transmission device 106 is used to receive or send data via a network. The above-mentioned network includes the wireless network provided by the communication provider of the terminal. In one instance, the transmission device 106 includes a network adapter (Network Interface Controller, abbreviated as NIC), which can be connected to other network devices through a base station and thus can communicate with the Internet. In one instance, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0045] First, explain the technical terms:

[0046] Internet of Things: A new network architecture based on the Internet, which is a new technology model that combines information technologies such as sensors, intelligent devices, cloud computing, big data, and artificial intelligence. The Internet of Things can connect any object in the physical world to the Internet, realizing functions such as real-time monitoring, intelligent control, and remote operation, so as to achieve the interconnection between things and between people and things.

[0047] Edge computing: It refers to an open platform that integrates capabilities such as network, computing, storage, and application on the side closest to the data source to deliver end-to-end services. Its applications usually run on the edge side, and can achieve faster network service responses, meeting the fundamental needs of industries such as real-time services, artificial intelligence, security, and privacy protection.

[0048] Internet of Things gateway: The link connecting the sensing network and the traditional communication network. As a gateway device, the Internet of Things gateway can realize protocol conversion between the sensing network and the communication network, as well as between different types of sensing networks. It can achieve both wide-area interconnection and local-area interconnection.

[0049] Container: A sandbox technology. Docker is the most popular container technology at present. Its main purpose is to run applications in it and isolate them from the outside world. This sandbox can also be transferred to other host machines. Essentially, a container is a special process. Through technologies such as namespaces, control groups, and chroot, resources, files, devices, status, and configurations are partitioned into an independent space.

[0050] In this embodiment, a method for backing up an edge gateway is provided. Figure 2 It is a flowchart of the method for backing up the edge gateway in this embodiment, as Figure 2 shown. This process includes the following steps:

[0051] Step S201: Inside the edge gateway, create corresponding service containers according to the gateway services.

[0052] At present, after a gateway service fails, an independent gateway is often used as a backup gateway, and the failed gateway is switched to the backup gateway to troubleshoot the problem. However, this method of switching to the backup gateway increases the burden on the cloud platform and also increases costs. In addition, the process of enabling the backup gateway needs to be processed on the cloud platform. The entire process is a cross-network process, and the switching speed is slow, which affects the backup effect of the gateway. To address this, in this embodiment, the backup gateway method is not adopted. Inside the edge gateway, the gateway service is divided into multiple independent services, and corresponding numbers of service containers (docker) are created according to each gateway service. Each container only runs the corresponding gateway service. The specific type of container created can be set according to actual business requirements, and no specific limitation is made in this embodiment. For example, the following containers can be created: an AI container, which is responsible for deploying AI applications and handling AI services, such as power grid big data analysis and sub-device data analysis; an IOT container, which is responsible for deploying IoT programs and handling data conversion and data applications for various IoT access devices. For example, it performs power protocol conversion for industrial control devices, uniformly converting devices with different protocol specifications into a data format that can be recognized and read by network data packets, facilitating reporting through the northbound interface; a MEDIA container, which is responsible for deploying audio and video related applications. After audio and video data is input from the southbound HDMI interface and audio interface, it is processed by the MEDIA container and sent to the cloud through the northbound interface; or vice versa, audio and video data is sent from the cloud, processed by the MEDIA container, and output to the southbound HDMI interface and audio interface. A container management module can also be created for each container, which is responsible for the management, resource allocation, data transmission, and establishment of backup relationships for containers of different service types. The container resources can be dynamically adjusted according to the business operation situation and container characteristics. For example, respective data transmission channels are created for containers of different service types to transmit data outside the container to the data buffer inside the container. When the edge gateway system starts, the container management module creates each service container and the corresponding external buffer according to the configuration file, and completes the mapping between the external buffer and the buffer inside the service container. Among them, each external buffer is isolated from each other and does not affect each other. Combining virtual memory and zero-copy technology, a logical virtual channel between the buffer inside the service container and the external buffer of the container is implemented to complete the mapping between the buffer inside the service container and the external buffer of the service container.

[0053] Step S202: Create corresponding backup containers according to each service container. The backup containers can synchronously receive the service data in the buffer of the corresponding service container.

[0054] Create corresponding backup containers for each service container to back up each service. For example, create an AI backup container for the AI container and deploy AI applications in the AI backup container, which has the same function as the AI container and is also responsible for processing AI services. For the IOT container, create an IOT backup container and deploy IoT programs in the IOT backup container, which has the same function as the IOT container and is responsible for processing IoT services. For the MEDIA container, create a MEDIA backup container and deploy audio and video related applications in the MEDIA backup container, which has the same function as the MEDIA container and is responsible for processing audio and video services.

[0055] And establish a backup relationship between the service container and the backup container so that the backup container can also synchronously receive the service data in the buffer of the corresponding service container. Among them, the data transmission is realized through the hardware interface driver module. The hardware interface driver module first receives the service data and imports the identified service data into the external buffer of the corresponding service container. At the same time, the data is also synchronously copied to the external buffer of the backup container to ensure that the service data imported by the hardware interface driver module remains consistent in the two external buffers. For example, the hardware interface driver identifies AI service data and simultaneously imports the AI service data into the external buffer corresponding to the AI container and the external buffer corresponding to the AI backup container.

[0056] Step S203: When it is detected that an exception occurs in the service container, receive the service data through the backup container corresponding to the service container where the exception occurs; use the backup container as the new service container, and restart the service container where the exception occurs as the new backup container corresponding to the new service container.

[0057] Specifically, when it is detected that a service container has an exception and cannot handle the current service properly, the corresponding backup service container is used to process the current service data. For example, when the AI container has an exception, the AI backup container is switched to the primary container, and the AI backup container is used to process the AI service data to achieve the effect of uninterrupted processing of the AI service. At the same time, the AI backup container is used as the new AI container, that is, the primary container of the AI service, and the abnormal AI container is restarted. The AI container that has returned to normal after restart is used as the new AI backup container to be used to replace the new AI container when the new AI container is abnormal, and so on in a cycle, so that the edge gateway can maintain a normal AI service processing process. Similarly, when the IOT container has an exception, the IOT backup container processes the IoT program, the IOT backup container is used as the new IOT container, the abnormal IOT container is restarted, and the restarted IOT container is used as the new IOT backup container to be used to replace the new IOT container when the new IOT container is abnormal, and so on in a cycle, so that the edge gateway can maintain a normal IoT service processing process. By performing backup processing on each service, when an exception occurs in one service container, only the service container needs to be replaced, and other normal service containers do not need to be processed synchronously, and it is not necessary to activate the backup containers of other services, saving unnecessary service backup replacements, reducing the backup replacement cost, and reducing the processing cost of edge gateway service exceptions. It also saves the space for wiring the backup gateway and the requirements for supporting power supplies, etc.

[0058] Through the above steps S201 to S203, in the edge gateway, corresponding service containers are created according to the gateway services; corresponding backup containers are created according to each service container, and the backup containers can synchronously receive the service data in the corresponding service container buffer area; when it is detected that a service container has an exception, the backup container corresponding to the service container with the exception receives the service data; the backup container is used as the new service container, and the service container with the exception is restarted and used as the new backup container corresponding to the new service container. Compared with the prior art that uses a 1:1 hot backup redundancy technology to specifically set up a backup gateway, in this embodiment, corresponding service containers and backup containers corresponding to each service container are created in the edge gateway. In the case of an exception in the service container, the corresponding backup container is used to process the service data, and there is no need to additionally enable the wireless function of the backup gateway. Its replacement speed is much faster than the process speed of the cross-network between the cloud platform and the edge gateway, improving the availability of the system in the case of gateway failures.

[0059] In some of these embodiments, the service container and the backup container corresponding to the service container are connected through the bridge mode, and the exception detection process of the service container includes:

[0060] Regularly send data packets from a service container to its corresponding backup container; determine whether the time interval for sending data packets exceeds a preset time interval. If so, it is determined that the service container is abnormal.

[0061] Specifically, when the service container and the backup container are started, establish a connection through the bridge mode, enabling the service container and the backup container to communicate in the same network. The service container sends data packets to its corresponding backup container at a preset time interval (e.g., every minute). The backup container continuously monitors the time interval for receiving data packets from the service container. If no new data packets are received within the preset time interval (e.g., more than 2 minutes), the backup container will trigger an anomaly detection mechanism. The backup container can use a heartbeat mechanism to determine the status of the service container. If the service container is working properly, it will regularly send heartbeat packets to the backup container; once the service container has an anomaly (such as crashing, network failure, etc.), the heartbeat packet will be interrupted. When the backup container does not receive a heartbeat packet for more than the preset time interval, it determines that the service container is abnormal. For example, establish a backup relationship between the AI container and the AI backup container through the bridge mode, connect the AI container and the AI backup container, and the AI container sends data packets to the AI backup container at a preset time interval. If the AI backup container does not receive data packets sent by the AI container for more than the preset time interval, it can be determined at this time that the AI container is abnormal.

[0062] In another embodiment, the data packet includes the status information of the service container, and the anomaly detection process of the service container further includes:

[0063] Determine whether the status information of the service container indicates that the service container is abnormal. If so, it is determined that the service container is abnormal.

[0064] Specifically, after the service container and the backup container are connected through a network in bridge mode, when the service container sends a data packet to the backup container, the data packet also includes the status information of the service container. The status information of the service container includes data in multiple dimensions, such as the resource usage of the container (such as CPU, memory, disk I / O, etc.), the running status of the application program (such as whether the service is running normally, whether there are unhandled errors, etc.), and the network connection status (such as port listening situation, network latency, etc.). These status information will be encapsulated into the data packet and transmitted to the backup container through the network. After receiving the data packet sent by the service container, the backup container will parse the received status information, extract key monitoring metrics and status parameters, and analyze the parsed status information according to preset rules and thresholds. For example, if the CPU usage rate exceeds the set threshold (such as 90%), or the memory usage rate continues to increase and approaches the upper limit, it is considered that the service container may have abnormal resource usage. Determine that the service container is abnormal through status information analysis.

[0065] In some of these embodiments, the abnormal detection process of the service container further includes:

[0066] Establish a shared memory between the service container and the backup container corresponding to the service container; regularly write service data into the shared memory by the service container, and read the service data in the shared memory by the backup container corresponding to the service container; determine the time when the backup container corresponding to the service container reads the shared memory as the reading time; determine whether the reading time exceeds a preset duration threshold, and if so, determine that the service container has an abnormality.

[0067] Specifically, create a shared memory on the host (edge gateway), and the container configuration module specifies the mount point of the shared memory based on the configuration file so that both the service container and the backup container can access the same shared memory area. The service container regularly writes service data into the shared memory area, and the backup container regularly reads the service data from the shared memory. The backup container will record the time when it reads the shared memory each time, use the time when the backup container reads the shared memory as the reading time of the backup container, and compare it with the preset reading duration threshold. If it exceeds the preset duration threshold, the backup container will consider that the service container has an abnormality. The use of shared memory can significantly improve the speed of data synchronization and avoid the performance overhead of traditional network communication.

[0068] In another embodiment, the shared memory includes the status information of the service container, and the abnormal detection process of the service container further includes:

[0069] Determine whether the status information of the service container indicates that the service container has an abnormality, and if so, determine that the service container has an abnormality.

[0070] Specifically, in the above embodiment, in the process of detecting whether the service container is abnormal by establishing a shared memory mechanism, when the service container regularly writes service data into the shared memory area, the status information of the service container is also written into the shared memory. The status information of the service container includes data in multiple dimensions, such as the resource usage of the container (such as CPU, memory, disk I / O, etc.), the running status of the application program (such as whether the service is running normally, whether there are unhandled errors, etc.), and the network connection status (such as port listening situation, network latency, etc.). When the backup container reads the shared memory data, it will also read the status information of the service container. After the backup container reads the status information of the service container, it will parse it and extract the key monitoring indicators and status parameters. Analyze the parsed status information according to the preset rules and thresholds. For example, if the CPU usage rate exceeds the set threshold (such as 90%), or the memory usage rate continues to increase and approaches the upper limit, it is considered that the service container may have abnormal resource usage. Determine that the service container has an abnormality through status information analysis.

[0071] In some of these embodiments, receiving service data through a backup container corresponding to a service container with an exception includes:

[0072] Processing service data in real time through the backup container. The backup container reads memory from within the host machine. When it is detected that the service container has an exception, the service container is switched to the backup container, and the memory is written into the host machine through the backup container, so that the host machine reads the service data processed by the backup container.

[0073] Specifically, when the service container and the backup container are connected through the bridge mode, the service container sends data packets to the backup container at a preset time interval. While the service container is running normally, the backup container synchronously simulates processing service data and performs memory interaction with the host machine (edge gateway). The backup container only reads memory from within the host machine and does not write memory into the host machine. At this time, the host machine only reads the service data processed by the service container and does not read the service data processed by the backup container. When it is detected that the service container has an exception, the host machine switches from reading service data from the service container to reading service data from the backup container. At this time, the backup container writes the memory into the host machine, and the host machine reads the service data that has been processed in the backup container. At the same time, the backup container is used as the new service container, and the abnormal service container is restarted. After the update, the abnormal service container is used as the new backup container, and a new backup relationship is re-established, thereby realizing the switching between the service container and the backup container and replacing it for use when the service container has an exception next time. Since the backup container has been synchronously simulating the processing of service data, when the service container has an exception, the host machine directly switches to the backup container, which can ensure the timeliness of service processing, guarantee the normal execution of the service process, and ensure the execution effect of the service.

[0074] In another embodiment, receiving service data through a backup container corresponding to a service container with an exception includes:

[0075] Controlling the backup container to remain in a standby state; when the service container has an exception, controlling the backup container to obtain service data and process the service data, so that the host machine reads the service data processed by the backup container.

[0076] Specifically, in the above embodiments, during the process of detecting whether a service container is abnormal by establishing a shared memory mechanism, when the service container is running normally, the service container processes service data, and the host reads the processed service data from the service container. At this time, the control backup container is in a standby state and does not process the service data received synchronously. When it is detected that the service container is abnormal, the backup container starts to read the service data and processes the service data. At this time, the host switches from reading the processed service data from the service container to reading the processed service data from the backup container, takes the backup container as the new service container, restarts the abnormal service container, and after the update, takes the abnormal service container as the new backup container, re-establishes a new backup relationship, thereby realizing the switching between the service container and the backup container, and replacing and using it when the service container is abnormal next time, so as to realize the switching of the container and ensure the normal and smooth execution of the service. Improve the system availability in case of gateway failure.

[0077] Optionally, for all the above embodiments, the edge gateway can also adopt a microservices architecture. The communication between microservices uses a message bus independent of all application programs, and the service containers and backup containers for each service share a message queue. When the service container is abnormal, the backup container is quickly activated and converted into a service container, and obtains the messages in the message queue of the message bus for business processing.

[0078] Optionally, the container can adopt a port mapping method. The internal ports of the service container and the backup container are both mapped to the external host port. By default, the network traffic is all allocated to the service container. After the service container is abnormal, the network traffic is all allocated to the backup container.

[0079] The method of using the backup container by the edge gateway achieves the effect of hot backup of the edge gateway, but does not need to care about the interaction method between the container and the host, nor the interaction method between the containers, reducing the burden on the cloud platform.

[0080] In this embodiment, an edge gateway backup method is also provided. Figure 3 It is a flowchart of another edge gateway backup method in this embodiment, as Figure 3 shown, and this process includes the following steps:

[0081] Step S301, within the edge gateway, create corresponding service containers according to the gateway services;

[0082] Step S302, create corresponding backup containers according to each service container. The backup containers can synchronously receive the service data in the buffer area of the corresponding service containers;

[0083] Step S303, establish a connection between the service container and the backup container corresponding to the service container through the bridge mode;

[0084] Step S304: Regularly send data packets from the service container to the corresponding backup container of the service container.

[0085] Step S305: In the case where the time for sending the data packet exceeds a preset time threshold or the status information of the service container in the data packet indicates that the service container is abnormal, switch the service container to the backup container so that the host can read the service data processed by the backup container. Among them, before the service container is abnormal, the backup container always processes the service data in real time. The backup container reads the memory from the host but does not write the memory back to the host; and execute Step S309.

[0086] Step S306: Establish a shared memory between the service container and the corresponding backup container of the service container.

[0087] Step S307: Regularly write service data into the shared memory from the service container, and read the service data in the shared memory from the corresponding backup container of the service container.

[0088] Step S308: In the case where the time for the corresponding backup container of the service container to read the shared memory exceeds a preset time threshold or the status information of the service container in the shared memory indicates that the service container is abnormal, control the backup container to obtain the service data and process the service data so that the host can read the service data processed by the backup container. Among them, before the service container is abnormal, the backup container always remains in a standby state.

[0089] Step S309: Use the backup container as the new service container, restart the abnormal service container as the new backup container corresponding to the new service container, and continue to detect whether the service container is abnormal.

[0090] Through the above Steps S301 to S309, compared with the prior art that uses a 1:1 hot backup redundancy technology to specifically set up a backup gateway, in the edge gateway, each service container and the corresponding backup container of each service container are created according to the configuration file. Among them, each service container regularly sends data packets to the corresponding backup container to detect whether each service container is abnormal. In the case where the service container is abnormal, activate the corresponding backup container of the service container, and process the corresponding service data through the backup container. There is no need to additionally enable the wireless function of the backup gateway, and its replacement speed is much faster than the cross-network process speed between the cloud platform and the edge gateway, improving the availability of the system in case of gateway failure.

[0091] Figure 4 This is the structural diagram of the edge gateway backup system in this embodiment, as Figure 4As shown in the figure, in the edge gateway, a container management module 41 is created. The container management module 41 creates each service container 42 and the corresponding backup container 43 for each service container 42 according to the configuration file. Among them, each service container 42 includes an AI container, an IOT container, a MEDIA container, etc.; a backup relationship is established between the service container 42 and the backup container 43; each container contains its own internal buffer a - f, and the container management module 41 creates corresponding external buffers 1 - 6 according to the configuration file, and combines virtual memory and zero-copy technology to implement a logical virtual channel between the internal buffer of the container and the external buffer of the container, completing the mapping between the internal buffer of the container and the external buffer of the container. For example, internal buffer a corresponds to external buffer 1, internal buffer b corresponds to external buffer 2, internal buffer c corresponds to external buffer 3, internal buffer d corresponds to external buffer 4, internal buffer e corresponds to external buffer 5, and internal buffer f corresponds to external buffer 6; the edge gateway performs data transmission through the hardware interface driver 44. When the hardware interface driver 44 recognizes service data, it imports the recognized service data into the external buffer of the corresponding container through direct memory access (Direct Memory Access, abbreviated as DMA), including the external buffer of the corresponding service container 42 and the external buffer of the corresponding backup container 43, and according to the mapping relationship between the internal and external buffers, imports the data into the corresponding internal buffer; when the service container 42 is running normally, the corresponding service container processes the service data, and the host (edge gateway) reads the service data processed by the service container; when it is detected that the service container has an exception, the corresponding backup container is switched to the current service container to process the service data received in its internal buffer. At this time, the host reads the service data processed by this backup container, takes the backup container as the new service container, restarts the abnormal service container to restore normal and uses it as the new backup container, and so on in a cycle to achieve the normal processing of services when the service container fails. Exemplarily: when the hardware interface driver 44 recognizes AI service data, it imports the AI data into external buffer 1 and external buffer 2 through DMA, and then imports the AI service data into internal buffer a and internal buffer b. When the AI container is running normally, the AI container processes the AI service data in internal buffer a and outputs it to the host, and the host reads the service data processed by the AI container; when it is detected that the AI container has an exception, it is switched to the AI backup container to process the AI data in internal buffer b and outputs it to the host, and the host reads the service data processed by the AI backup container, takes the AI backup container as the new AI container, restarts the abnormal AI container to restore normal and uses it as the new AI backup container, and so on in a cycle to achieve the normal processing of the AI service when the AI service container fails.

[0092] In this embodiment, an edge gateway backup device is further provided. This device is used to implement the above-mentioned embodiments and preferred implementation manners, and those that have been described will not be repeated here. The following terms "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0093] Figure 5 is the structural block diagram of the edge gateway backup device in this embodiment. As Figure 5 shown, the device 50 includes: a creation module 51 and an exception handling module 52, where

[0094] The creation module 51 is used to create corresponding service containers within the edge gateway according to the gateway services; create corresponding backup containers according to each service container, and the backup containers can synchronously receive the service data in the corresponding service container buffer area;

[0095] The exception handling module 52 is used to, when it detects that a service container has an exception, receive service data through the backup container corresponding to the service container with the exception; use the backup container as a new service container, and restart the service container with the exception and use it as a new backup container corresponding to the new service container.

[0096] It should be noted that the above-mentioned various modules can be functional modules or program modules, and can be implemented either by software or by hardware. For the modules implemented by hardware, the above-mentioned various modules can be located in the same processor; or the above-mentioned various modules can also be located in different processors in any combined form.

[0097] In this embodiment, an electronic device is further provided, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0098] Optionally, the above-mentioned electronic device may further include a transmission device and input / output devices. Among them, the transmission device is connected to the above-mentioned processor, and the input / output devices are connected to the above-mentioned processor.

[0099] Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through the computer program:

[0100] S1, within the edge gateway, create corresponding service containers according to the gateway services;

[0101] S2, create corresponding backup containers according to each service container, and the backup containers can synchronously receive the service data in the corresponding service container buffer area;

[0102] S3. When an exception occurs in a service container, the backup container corresponding to the service container where the exception occurs receives service data; the backup container is used as the new service container, and the service container where the exception occurs is restarted and used as the new backup container corresponding to the new service container.

[0103] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation manners, and will not be elaborated in this embodiment.

[0104] In addition, in combination with the edge gateway backup method provided in the above embodiments, a storage medium can also be provided in this embodiment to implement it. A computer program is stored on the storage medium; when the computer program is executed by a processor, any one of the edge gateway backup methods in the above embodiments is implemented.

[0105] It should be understood that the specific embodiments described here are only used to explain this application, rather than to limit it. According to the embodiments provided in this application, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the protection scope of this application.

[0106] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data that have been authorized by the user or fully authorized by all parties.

[0107] Obviously, the drawings are only some examples or embodiments of this application. For those of ordinary skill in the art, this application can also be applied to other similar situations based on these drawings without creative work. In addition, it can be understood that although the work done during the development process here may be complex and time-consuming, for those of ordinary skill in the art, some design, manufacturing, or production changes made based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient disclosure of this application.

[0108] The term "embodiment" in this application means that the specific features, structures, or characteristics described in combination with the embodiment can be included in at least one embodiment of this application. The phrase appears in various positions in the specification does not necessarily mean the same embodiment, nor does it mean being independent or alternative to other embodiments and mutually exclusive. Those of ordinary skill in the art can clearly or implicitly understand that the embodiments described in this application can be combined with other embodiments without conflict.

[0109] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0110] The above embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of patent protection. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims

1. An edge gateway backup method, characterized in that: include: In the edge gateway, a corresponding service container is created according to the gateway service; Creating a corresponding backup container according to each business container, wherein the backup container can synchronously receive the business data of the corresponding business container buffer area; When an abnormality is detected in the business container, business data is received through a backup container corresponding to the abnormal business container; the backup container is used as a new business container, and the abnormal business container is restarted as a new backup container corresponding to the new business container.

2. The edge gateway backup method according to claim 1, characterized in that: The business container and the backup container corresponding to the business container establish a connection through a bridge mode, and the abnormality detection process of the business container includes: Sending a data packet to a backup container corresponding to the business container periodically through the business container; It is determined whether the time interval for sending the data packet exceeds a preset time interval, and if so, it is determined that an abnormality occurs in the service container.

3. The edge gateway backup method according to claim 2, characterized in that: The data packet includes the status information of the service container, and the abnormality detection process of the service container further includes: It is determined whether the status information of the service container indicates that an abnormality occurs in the service container. If so, it is determined that an abnormality occurs in the service container.

4. The edge gateway backup method according to claim 1, characterized in that: The abnormality detection process of the business container also includes: Establishing a shared memory between the business container and a backup container corresponding to the business container; Periodically writing the service data into a shared memory through the service container, and reading the service data in the shared memory through a backup container corresponding to the service container; Determine the time when the backup container corresponding to the business container reads the shared memory as the reading time; It is determined whether the reading time exceeds a preset time threshold, and if so, it is determined that an abnormality occurs in the service container.

5. The edge gateway backup method according to claim 4, characterized in that: The shared memory includes the status information of the business container, and the abnormality detection process of the business container further includes: It is determined whether the status information of the service container indicates that an abnormality occurs in the service container. If so, it is determined that an abnormality occurs in the service container.

6. The edge gateway backup method according to claim 2, characterized in that: The receiving the service data through the backup container corresponding to the service container where the exception occurs includes: Processing business data in real time through the backup container, which reads memory from the host machine; When an abnormality is detected in the business container, the business container is switched to the backup container, and the memory is written into the host machine through the backup container, so that the host machine reads the business data processed by the backup container.

7. The edge gateway backup method according to claim 4, characterized in that: The receiving the service data through the backup container corresponding to the service container where the exception occurs includes: Controlling the backup container to maintain a standby state; When an exception occurs in the business container, the backup container is controlled to obtain the business data and process the business data, so that the host machine reads the business data processed by the backup container.

8. An edge gateway backup device, characterized in that: include: Create modules and exception handling modules, where The creation module is used to create a corresponding service container in the edge gateway according to the gateway service; create a corresponding backup container according to each service container, and the backup container can synchronously receive the service data of the corresponding service container cache area; The exception handling module is used to receive business data through a backup container corresponding to the business container where the exception occurs when an exception is detected in the business container; use the backup container as a new business container, and restart the business container where the exception occurs as a new backup container corresponding to the new business container.

9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the edge gateway backup method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the edge gateway backup method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Intelligent FSU edge computing power terminal dual-channel AI safety control system

    CN122268914A