Container cleaning method, device and storage medium based on label routing strategy

By setting up multiple heterogeneous execution body containers in the container and using label routing strategies for data packet distribution, the problem of communication link interruption during container cleaning and switching is solved and communication reliability is improved.

CN116112429BActive Publication Date: 2024-09-06STATE GRID HENAN INFORMATION & TELECOMM CO +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211717673.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2024-09-06
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

In the prior art, the communication link is temporarily interrupted during container cleaning and switching, resulting in poor communication reliability.

Method used

Adopt a container cleaning method based on label routing strategy, set up multiple heterogeneous execution body containers, and determine the data packet distribution path through the label routing strategy. When the container needs to be cleaned and switched, it is forbidden to mark the corresponding label to avoid communication interruption, and use the backup container for Smooth switching.

Benefits of technology

It effectively improves the reliability of communication, avoids communication link interruption during cleaning switching, and ensures the smoothness and safety of container cleaning switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116112429B
    Figure CN116112429B
Patent Text Reader

Abstract

The present invention provides a container cleaning method, device and storage medium based on a label routing strategy, the method comprising: setting M main heterogeneous executable body containers; wherein M is an integer greater than 1, the components of the M main heterogeneous executable body containers are different, and the M main heterogeneous executable body containers are used to execute pre-set application software; when receiving a data packet to be distributed, based on a pre-set label routing strategy, marking the data packet to be distributed with a corresponding label; wherein the label corresponds to at least one main heterogeneous executable body container; based on the label, distributing the data packet to be distributed to the main heterogeneous executable body container corresponding to the label; when determining that there is a first container to be cleaned and switched among the M main heterogeneous executable body containers, prohibiting marking the data packet to be distributed with a first label corresponding to the first container, and cleaning the first container. The embodiment of the present invention effectively improves communication reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication and security technology, and in particular to a container cleaning method, device and storage medium based on a label routing strategy. Background Art

[0002] In the current open source industry model and the normalized network ecological environment of "interdependence", the software and hardware used in various information systems are inevitably "toxic and contaminated", with various vulnerabilities and backdoors causing unknown risks or uncertain threats, and the number of vulnerabilities and backdoors is increasing year by year, and it is difficult to eliminate them at the engineering implementation level. On the theoretical level, mobile target defense and mimicry defense are two revolutionary and innovative active defense theories that can be used to deal with unknown threats caused by unknown vulnerabilities, backdoors, viruses or Trojans at the relevant application level in different fields of cyberspace.

[0003] At present, one of the common implementation methods of the above active defense theory is to virtualize and heterogeneize the software executable body based on the container, and clean and switch the container according to the strategy to block the attacker's process;

[0004] However, in engineering practice, this method has the problem of temporary interruption of the communication link corresponding to the container currently being cleaned and switched, and poor communication reliability. Summary of the invention

[0005] The present invention provides a container cleaning method, device and storage medium based on a label routing strategy, which are used to solve the problem of poor communication reliability in the prior art.

[0006] The present invention provides a container cleaning method based on a label routing strategy, comprising:

[0007] Setting M main heterogeneous executable body containers; wherein M is an integer greater than 1, the components of the M main heterogeneous executable body containers are different, and the M main heterogeneous executable body containers are used to execute pre-set application software;

[0008] When receiving a data packet to be distributed, marking the data packet to be distributed with a corresponding label based on a preset label routing policy; wherein the label corresponds to at least one primary heterogeneous execution body container;

[0009] Based on the label, the to-be-distributed data packet is distributed to a primary heterogeneous execution body container corresponding to the label;

[0010] When it is determined that there is a first container to be cleaned and switched among the M active heterogeneous execution body containers, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, and the first container is cleaned.

[0011] According to a container cleaning method based on a label routing strategy provided by the present invention, the method further includes:

[0012] Set N standby heterogeneous execution body containers; where N is an integer greater than 0;

[0013] After cleaning the first container, the method further comprises:

[0014] When the cleaning cycle of the first container is completed, at least one second container is selected from the N backup heterogeneous execution body containers, and the first container is switched to serve as the main heterogeneous execution body container.

[0015] According to a container cleaning method based on a label routing policy provided by the present invention, when the cleaning cycle of the first container ends, at least one second container is selected from the N backup heterogeneous execution body containers, and the first container is switched to serve as the main heterogeneous execution body container. The method further includes:

[0016] In the preset label table entry, the correspondence between the first container and the first label is deleted, and the correspondence between the second container and the second label is updated; wherein the label table entry is used to characterize the correspondence between each of the primary heterogeneous execution body containers and the label;

[0017] Based on the updated label entry, the label routing policy is updated.

[0018] According to a container cleaning method based on a label routing strategy provided by the present invention, the method further includes:

[0019] When a third container in which an abnormal event occurs exists among the M main heterogeneous execution body containers, it is prohibited to mark the data packet to be distributed with a third label corresponding to the third container, and the third container is cleaned;

[0020] At least one fourth container is selected from the N standby heterogeneous executor containers, and the third container is switched to serve as the main heterogeneous executor container.

[0021] According to a container cleaning method based on a label routing policy provided by the present invention, when receiving a data packet to be distributed, before marking the data packet to be distributed with a corresponding label based on a preset label routing policy, the method further includes:

[0022] generating the label routing strategy based on the first information;

[0023] The first information includes at least one of the following:

[0024] The network address of each of the primary heterogeneous execution body containers;

[0025] Each of the master heterogeneous execution body containers executes a service port of the application software;

[0026] The label table entry is used to represent the correspondence between each of the primary heterogeneous execution body containers and the label.

[0027] According to a container cleaning method based on a label routing policy provided by the present invention, when a data packet to be distributed is received, a corresponding label is marked on the data packet to be distributed based on a preset label routing policy, including:

[0028] When receiving the data packet to be distributed, determining the data flow of the data packet to be distributed;

[0029] Based on the label routing strategy and the data traffic, the data packet to be distributed is marked with a corresponding label.

[0030] The present invention also provides a container cleaning device based on a label routing strategy, comprising:

[0031] A setting module, used to set M main heterogeneous executable body containers; wherein M is an integer greater than 1, the components of the M main heterogeneous executable body containers are different, and the M main heterogeneous executable body containers are used to execute pre-set application software;

[0032] A marking module, configured to mark a corresponding label on a data packet to be distributed based on a preset label routing policy when receiving the data packet to be distributed; wherein the label corresponds to at least one main heterogeneous execution body container;

[0033] A distribution module, configured to distribute the to-be-distributed data packet to a primary heterogeneous execution body container corresponding to the label based on the label;

[0034] The processing module is used for prohibiting marking the first label corresponding to the first container on the data packet to be distributed, and cleaning the first container when it is determined that there is a first container to be cleaned and switched among the M main heterogeneous execution body containers.

[0035] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the container cleaning method based on the label routing strategy described above is implemented.

[0036] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the container cleaning method based on the label routing strategy as described in any one of the above is implemented.

[0037] The present invention also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned container cleaning methods based on the label routing strategy.

[0038] The container cleaning method, device and storage medium based on label routing strategy provided by the present invention are compared with the related art that only one container is set for communication, resulting in a temporary interruption of the communication link corresponding to the container currently being cleaned and switched when the container needs to be cleaned and switched. In the embodiment of the present invention, multiple main heterogeneous execution body containers that can realize communication are set, and the label routing strategy is used to determine to which main heterogeneous execution body container each data packet is distributed. When the first container in the main heterogeneous execution body container needs to be cleaned and switched, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, so as to communicate through other main heterogeneous execution body containers, and clean the first container, which can avoid the temporary interruption of the communication link due to cleaning and switching of the first container, and effectively improve the communication reliability. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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.

[0040] Figure 1 This is one of the flow diagrams of the container cleaning method based on the label routing strategy provided by the present invention;

[0041] Figure 2 This is the second flow chart of the container cleaning method based on the label routing strategy provided by the present invention;

[0042] Figure 3 It is a schematic diagram of the system architecture applied by the container cleaning method based on the label routing strategy provided by the present invention;

[0043] Figure 4 This is the third flow chart of the container cleaning method based on the label routing strategy provided by the present invention;

[0044] Figure 5 It is a structural schematic diagram of a container cleaning device based on a label routing strategy provided by the present invention;

[0045] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings 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.

[0047] The container cleaning method, device and storage medium based on the label routing strategy of the present invention are described below in conjunction with the accompanying drawings.

[0048] Figure 1 This is one of the flow charts of the container cleaning method based on the label routing strategy provided by the present invention, such as Figure 1 As shown, the method includes steps 101 to 104; wherein:

[0049] Step 101: Set M main heterogeneous executable containers; wherein M is an integer greater than 1, the components of the M main heterogeneous executable containers are different, and the M main heterogeneous executable containers are used to execute pre-set application software;

[0050] Step 102: When receiving a data packet to be distributed, based on a preset label routing policy, mark the data packet to be distributed with a corresponding label; wherein the label corresponds to at least one main heterogeneous execution body container;

[0051] Step 103: Distribute the to-be-distributed data packet to the primary heterogeneous execution body container corresponding to the label based on the label;

[0052] Step 104: When it is determined that there is a first container to be cleaned and switched among the M active heterogeneous execution body containers, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, and the first container is cleaned.

[0053] Specifically, in the related art, only one container is set for communication, which causes the container to be unable to communicate normally during the cleaning and switching process, that is, there is a situation where the communication link corresponding to the container currently being cleaned and switched is temporarily interrupted, and the communication reliability is poor.

[0054] In view of the above problems, an embodiment of the present invention proposes a container cleaning method based on a label routing strategy, which can achieve smooth cleaning switching of containers while providing security to ensure smooth communication links.

[0055] In the embodiment of the present invention, M main heterogeneous executor containers are first set. The heterogeneity of these main heterogeneous executor containers is reflected in different components, but their processing processes are the same. When the inputs of the M main heterogeneous executor containers are the same, their output results are also the same.

[0056] It should be noted that the components of the M main heterogeneous executor containers are different, including the following:

[0057] 1) The compilation environments that make up the heterogeneous execution containers are different; for example, the compilation environment is a JDK (Java Development Kit) environment, a Python environment, etc.;

[0058] 2) Use different applications; for example, use different database software such as MySQL, Oracle, etc.

[0059] 3) Use different image versions of applications, for example, use different image versions of databases;

[0060] Optionally, any part that can embody the same function but different composition can be used as a component of the heterogeneous execution body container.

[0061] After setting up M primary heterogeneous executor containers, a label routing policy for the M primary heterogeneous executor containers may be pre-set. When a data packet to be distributed is received, the pre-set label routing policy is used to mark a label corresponding to the data packet to be distributed. The label corresponds to at least one primary heterogeneous executor container, and the label is used to indicate that the data packet to be distributed is distributed to at least one primary heterogeneous executor container corresponding to the label.

[0062] When it is determined that there is a first container to be cleaned and switched among the M main heterogeneous execution body containers, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, so as to avoid distributing the data packet to be distributed to the first container. At this time, the first container can be cleaned without causing a temporary interruption of the communication link.

[0063] In the container cleaning method based on the label routing strategy provided in the embodiment of the present invention, compared with the related art in which only one container is set for communication, resulting in a temporary interruption of the communication link corresponding to the container currently being cleaned and switched when the container needs to be cleaned and switched, the embodiment of the present invention sets multiple main heterogeneous execution body containers that can realize communication, and uses the label routing strategy to determine to which main heterogeneous execution body container each data packet is distributed. When the first container in the main heterogeneous execution body container needs to be cleaned and switched, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, so as to communicate through other main heterogeneous execution body containers, and clean the first container, which can avoid the temporary interruption of the communication link due to cleaning and switching of the first container, and effectively improve the communication reliability.

[0064] Optionally, N standby heterogeneous executable containers may be set; wherein N is an integer greater than 0;

[0065] After the first container is cleaned, when the cleaning cycle of the first container is finished, at least one second container may be selected from the N standby heterogeneous executor containers, and the first container may be switched to serve as the main heterogeneous executor container.

[0066] Specifically, after cleaning the first container, the unavailable first container can be switched. Specifically, when the cleaning cycle of the first container ends, at least one spare heterogeneous executor container can be selected to switch the first container as the main heterogeneous executor container, which effectively ensures that the number of available main heterogeneous executor containers will not decrease, and can further improve the reliability of communication.

[0067] Optionally, when the cleaning cycle of the first container ends, at least one second container is selected from the N backup heterogeneous executable body containers, and the first container is switched to serve as the primary heterogeneous executable body container. Then, in a preset label table item, the correspondence between the first container and the first label is deleted, and the correspondence between the second container and the second label is updated; wherein the label table item is used to characterize the correspondence between each of the primary heterogeneous executable body containers and the label;

[0068] Based on the updated label entry, the label routing policy is updated.

[0069] Specifically, after at least one second container is selected from the N backup heterogeneous execution body containers to switch the first container as the main heterogeneous execution body container, it is also necessary to update the preset label routing policy based on the second container and its corresponding second label, so that the second container can normally receive the data packet to be distributed; specifically, the corresponding relationship between the unavailable first container and the first label can be deleted in the label table entry representing the corresponding relationship between each main heterogeneous execution body container and the label, and the corresponding relationship between the second container and the second label can be updated, and then based on the updated label table entry, the label routing policy is updated, so that the second container can normally receive the data packet to be distributed through the second label.

[0070] Optionally, when a third container in which an abnormal event occurs exists among the M main heterogeneous execution body containers, it is prohibited to mark the data packet to be distributed with a third label corresponding to the third container, and the third container is cleaned;

[0071] At least one fourth container is selected from the N standby heterogeneous executor containers, and the third container is switched to serve as the main heterogeneous executor container.

[0072] Specifically, when there is a third container with an abnormal event among the M main heterogeneous executor containers, it is necessary to avoid continuing to use the third container for communication. Specifically, it can be prohibited to mark the third label corresponding to the third container on the data packet to be distributed, and the third container can be cleaned to avoid distributing the data to be distributed to the third container with the abnormal event. At least one spare heterogeneous executor container is selected to switch the third container as the main heterogeneous executor container, which effectively ensures that the number of available main heterogeneous executor containers will not decrease, and can further improve the reliability of communication.

[0073] Optionally, the occurrence of the abnormal event in the third container may be determined by alarm information from the third container.

[0074] Optionally, the abnormal event occurring in the third container includes, for example, at least one of the following:

[0075] 1) Abnormal network attack events, such as data sent by users containing dangerous keywords or attack codes, which can cause harm to the third container, then the third container needs to be offline and replaced;

[0076] 2) Security issues of the container itself, such as when a backdoor or dangerous vulnerability is detected in a component inside the third container, and the third container needs to be forcibly taken offline;

[0077] 3) When a container reaches a certain period of time, it is necessary to replace the container normally, upgrade the version, or change the image content.

[0078] Optionally, when receiving a data packet to be distributed, before marking a corresponding label on the data packet to be distributed based on a preset label routing policy, the label routing policy may be generated based on the first information;

[0079] The first information includes at least one of the following:

[0080] 1) The network address of each of the primary heterogeneous execution body containers;

[0081] 2) Each of the master heterogeneous execution body containers executes the service port of the application software;

[0082] 3) A label table entry, which is used to represent the correspondence between each of the primary heterogeneous execution body containers and the label.

[0083] Specifically, a label routing strategy can be generated based on the first information. The first information may include the network address of each main heterogeneous execution body container, for example, the network address segment of a certain container is 192.168.1.X; the first information may also include the service port of each main heterogeneous execution body container for executing application software, for example, the service port of a main heterogeneous execution body container for executing application software is 93; the first information may also include a label table entry representing the correspondence between each main heterogeneous execution body container and the label, for example, including the correspondence between the first container and the first label.

[0084] Optionally, when receiving a data packet to be distributed, based on a preset label routing policy, an implementation method of marking a corresponding label on the data packet to be distributed may include:

[0085] When receiving the data packet to be distributed, determining the data flow of the data packet to be distributed;

[0086] Based on the label routing strategy and the data traffic, the data packet to be distributed is marked with a corresponding label.

[0087] Specifically, when a data packet to be distributed is received, the data flow of the data packet to be distributed can be determined, so as to jointly determine the label corresponding to the data packet to be distributed based on the label routing strategy and the data flow, and mark the data packet to be distributed.

[0088] Optionally, based on the label routing policy, a primary heterogeneous execution body container supporting the data traffic of the data packet to be distributed can be selected, and the data packet to be distributed can be marked with a corresponding label so that the primary heterogeneous execution body container supporting the data traffic of the data packet to be distributed can receive the data packet to be distributed.

[0089] The following example illustrates a container cleaning method based on a label routing strategy according to an embodiment of the present invention.

[0090] In order to solve the problem that the communication link is easily interrupted when cleaning and switching containers in software execution body container virtualization and heterogeneity, the embodiment of the present invention proposes to forward data packets through a label-based routing strategy to smoothly switch the traffic of the current heterogeneous execution body container to be cleaned and switched to a new heterogeneous execution body container, while providing security.

[0091] Figure 2 This is the second flow chart of the container cleaning method based on the label routing strategy provided by the present invention, such as Figure 2 As shown, it includes steps 201 to 204; wherein:

[0092] Step 201, configuring parameters of the control module;

[0093] Step 202: Start the system and create primary and backup heterogeneous execution containers;

[0094] Step 203: Load the label table entry to generate a label routing strategy for data distribution;

[0095] Step 204: Clean and switch the main heterogeneous executor container.

[0096] Optionally, the method provided by the embodiment of the present invention may be coordinated and run through a group of functional modules. Figure 3 is a schematic diagram of the system architecture used by the container cleaning method based on the label routing strategy provided by the present invention, such as Figure 3 As shown, the system includes the following five functional modules:

[0097] The control module 301 is mainly responsible for coordinating the operation collaboration of each module, starting and shutting down the entire system, configuring operation parameters, setting cleaning and switching strategies, adding and deleting image files in the data storage module, creating, destroying and cleaning heterogeneous execution body containers, configuring the network parameters of the main and standby heterogeneous execution body containers, setting routing rules (label routing strategies), real-time monitoring of the running host status for logging, etc., and real-time synchronization of the data storage module;

[0098] The data storage module 302 is used to store all data parameters, mainly storing the image files of the application software, and is used to create virtualized containers. The image files of the same application software are packaged and generated according to the requirements of mimicry, and ensure that the containers generated by each image file are heterogeneous. In addition, the data storage module is also responsible for saving log files and parameter data of the control module;

[0099] The data marking module 303 is responsible for marking the incoming data traffic;

[0100] The data distribution module 304 is responsible for filtering data traffic and forwarding the data traffic to the heterogeneous execution body container corresponding to the label for processing according to the label and routing rules;

[0101] The log module 305 is responsible for querying, displaying, exporting and deleting logs.

[0102] Assuming that the data storage module has been installed with several image files of application software, specifically, in step 201, the embodiment of the present invention configures the parameters of the control module, specifically including: logging into the control module, setting the number of active heterogeneous executable body containers and the number of standby heterogeneous executable body containers, setting the time period of cleaning switching, setting the network address segment of the container and the application software service port, etc.; and storing the setting file in the data storage module;

[0103] In step 202, the embodiment of the present invention starts the system and creates the primary and backup heterogeneous executable containers, specifically including: starting the entire system according to the configuration file, pulling the image file through the control module to create the primary and backup heterogeneous executable containers, and automatically configuring the network parameters of each container, and starting the application software in each container; the control module automatically sets the network address of each primary heterogeneous executable container and the label corresponding to the application software service port, generates a label table entry and notifies the data marking module; the control module monitors the status of the running host in real time and records it in the log;

[0104] In step 203, the embodiment of the present invention loads the label table entry to generate the label routing strategy and performs data distribution, which specifically includes: the data marking module generates and loads the label routing strategy according to the network address, the service port of the application software and the label table entry corresponding to the label; when the data traffic arrives, it is labeled according to the label table entry and then handed over to the data forwarding module; the data forwarding module filters the data traffic and forwards it to the corresponding main heterogeneous execution body container according to the label routing strategy;

[0105] In step 204, the embodiment of the present invention cleans and switches the main heterogeneous executor container, specifically including: when the control module monitors that an abnormal event occurs in a main heterogeneous executor container and issues an alarm or its cleaning and switching cycle ends, the control module selects a backup heterogeneous executor container to go online and upgrade it to the main heterogeneous executor container; the control module automatically sets the network address of the newly online main heterogeneous executor container and the label corresponding to the service port of the application software, updates the label table item and notifies the data marking module to update and load the label routing policy according to the label, network address and service port of the application software; the control module takes the old main heterogeneous executor container offline and cleans it for backup, or deletes it and pulls the image file to create a backup heterogeneous executor container, automatically configures its container network parameters, and starts the application software running in each container.

[0106] The following is a complete and clear description of the embodiments of the present invention using docker software and iptable software under the CentOS operating system. Figure 4This is the third flow chart of the container cleaning method based on the label routing strategy provided by the present invention, such as Figure 4 As shown, the method includes:

[0107] S1. Log in to the control module, set the number of active heterogeneous execution body containers to 3, the number of standby heterogeneous execution body containers to 1, set the cleaning switching time period, set the network address segment of the container to 192.168.1.X, and the network address segment allowed to access the container to 192.168.2.X; store the setting file in the data storage module;

[0108] S2. Start the whole system according to the configuration file. The control module randomly pulls the docker image file of the same application software to create three main heterogeneous executor docker containers and one backup heterogeneous executor docker container. The IP address assigned to the main heterogeneous executor docker container 1 is 192.168.1.3, the service port of the application software is 93, the network address range allowed to access the container is 192.168.2.1-192.168.2.85, and the corresponding label value mark=1. The IP address assigned to the main heterogeneous executor docker container 2 is 192.168.1.5, and the application software The service port is 93, the network address segment that allows access to the container is 192.168.2.86-192.168.2.170, and the corresponding label value is mark=3; the IP address assigned to the main heterogeneous execution body docker container 3 is 192.168.1.8, the service port of the application software is 93, and the network address segment that allows access to the container is 192.168.2.171-192.168.2.255, and the corresponding label value is mark=4; confirm that all container IP addresses, application software service ports, network address segments that allow access to containers, and mark value quadruple sequences are not repeated, and generate label table entries. Store the generated parameter data in the data storage module in real time;

[0109] S3. The data marking module generates and loads the policy routing rules in the iptable according to the four-tuple sequence in the label table. When the data traffic arrives, the data marking module will mark the data packet accordingly according to the source IP address and destination port. The marked data packet has a unique identifier. After being transmitted to the data distribution module, it will be forwarded to the corresponding main heterogeneous execution body docker container according to the iptable policy routing rules and processed by the application software;

[0110] S4, assuming that the control module monitors that the main heterogeneous executor docker container 2 has an abnormal event and alarms or its cleaning and switching cycle ends, the control module selects a backup heterogeneous executor docker container to be upgraded to the main heterogeneous executor container 4, sets its IP address to 192.168.1.6, the service port of the application software to 93, and the network address segment allowed to access the container is 192.168.2.86-192.168.2.170, corresponding to the label value mark=6; the control module takes the heterogeneous executor docker container 2 offline or directly deletes and cleans it, and creates a new backup heterogeneous executor docker container; the monitoring module notifies the data marking module that the label table entry needs to be updated, and the data marking module generates and loads the policy routing rule in the iptable according to the new label table entry quaternary sequence group. In this way, the data flow originally marked as mark=3 is marked as the new mark=6; when passing through the data distribution module, the data packet marked as mark=6 is distributed to container 4, realizing smooth switching between different heterogeneous executors.

[0111] The container cleaning device based on the label routing strategy provided by the present invention is described below. The container cleaning device based on the label routing strategy described below and the container cleaning method based on the label routing strategy described above can be referred to each other.

[0112] Figure 5 is a schematic diagram of the structure of a container cleaning device based on a label routing strategy provided by the present invention, such as Figure 5 As shown, the container cleaning device 500 based on the label routing strategy includes:

[0113] A setting module 501 is used to set M main heterogeneous executable body containers; wherein M is an integer greater than 1, the components of the M main heterogeneous executable body containers are different, and the M main heterogeneous executable body containers are used to execute pre-set application software;

[0114] The marking module 502 is used to mark the data packet to be distributed with a corresponding label based on a preset label routing policy when receiving the data packet to be distributed; wherein the label corresponds to at least one main heterogeneous execution body container;

[0115] A distribution module 503, configured to distribute the to-be-distributed data packet to a primary heterogeneous execution body container corresponding to the label based on the label;

[0116] The processing module 504 is configured to prohibit marking the first label corresponding to the first container on the data packet to be distributed, and clean the first container when it is determined that there is a first container to be cleaned and switched among the M active heterogeneous execution body containers.

[0117] In the container cleaning device based on the label routing strategy provided in the embodiment of the present invention, compared with the related art in which only one container is set for communication, resulting in a temporary interruption of the communication link corresponding to the container currently being cleaned and switched when the container needs to be cleaned and switched, the embodiment of the present invention sets multiple main heterogeneous execution body containers that can realize communication, and uses the label routing strategy to determine to which main heterogeneous execution body container each data packet is distributed. When the first container in the main heterogeneous execution body container needs to be cleaned and switched, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, so as to communicate through other main heterogeneous execution body containers and clean the first container, which can avoid the temporary interruption of the communication link due to cleaning and switching of the first container, and effectively improve the communication reliability.

[0118] Optionally, the setting module 501 is further used to: set N standby heterogeneous executable containers; wherein N is an integer greater than 0;

[0119] The container cleaning device 500 based on the label routing strategy also includes:

[0120] The switching module is used to select at least one second container from the N standby heterogeneous execution body containers and switch the first container to serve as the main heterogeneous execution body container when the cleaning cycle of the first container ends.

[0121] Optionally, the container cleaning device 500 based on the label routing strategy further includes: an updating module, configured to:

[0122] In the preset label table entry, the correspondence between the first container and the first label is deleted, and the correspondence between the second container and the second label is updated; wherein the label table entry is used to characterize the correspondence between each of the primary heterogeneous execution body containers and the label;

[0123] Based on the updated label entry, the label routing policy is updated.

[0124] Optionally, the processing module 504 is further configured to: when a third container having an abnormal event occurs exists in the M main heterogeneous execution body containers, prohibit marking the to-be-distributed data packet with a third label corresponding to the third container, and clean the third container;

[0125] The switching module is further used to: select at least one fourth container from the N standby heterogeneous execution body containers, and switch the third container to serve as the main heterogeneous execution body container.

[0126] Optionally, the processing module 504 is further configured to: generate the label routing strategy based on the first information;

[0127] The first information includes at least one of the following:

[0128] The network address of each of the primary heterogeneous execution body containers;

[0129] Each of the master heterogeneous execution body containers executes a service port of the application software;

[0130] The label table entry is used to represent the correspondence between each of the primary heterogeneous execution body containers and the label.

[0131] Optionally, the marking module 502 is specifically used for:

[0132] When receiving the data packet to be distributed, determining the data flow of the data packet to be distributed;

[0133] Based on the label routing strategy and the data traffic, the data packet to be distributed is marked with a corresponding label.

[0134] Figure 6 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 6 As shown, the electronic device 600 may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the container cleaning method based on the label routing strategy, and the method includes:

[0135] Setting M main heterogeneous executable body containers; wherein M is an integer greater than 1, the components of the M main heterogeneous executable body containers are different, and the M main heterogeneous executable body containers are used to execute pre-set application software;

[0136] When receiving a data packet to be distributed, marking the data packet to be distributed with a corresponding label based on a preset label routing policy; wherein the label corresponds to at least one primary heterogeneous execution body container;

[0137] Based on the label, the to-be-distributed data packet is distributed to a primary heterogeneous execution body container corresponding to the label;

[0138] When it is determined that there is a first container to be cleaned and switched among the M active heterogeneous execution body containers, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, and the first container is cleaned.

[0139] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0140] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the container cleaning method based on the label routing strategy provided by the above methods, the method includes:

[0141] Setting M main heterogeneous executable body containers; wherein M is an integer greater than 1, the components of the M main heterogeneous executable body containers are different, and the M main heterogeneous executable body containers are used to execute pre-set application software;

[0142] When receiving a data packet to be distributed, marking the data packet to be distributed with a corresponding label based on a preset label routing policy; wherein the label corresponds to at least one primary heterogeneous execution body container;

[0143] Based on the label, the to-be-distributed data packet is distributed to a primary heterogeneous execution body container corresponding to the label;

[0144] When it is determined that there is a first container to be cleaned and switched among the M active heterogeneous execution body containers, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, and the first container is cleaned.

[0145] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the container cleaning method based on the label routing strategy provided by the above methods, the method comprising:

[0146] Setting M main heterogeneous executable body containers; wherein M is an integer greater than 1, the components of the M main heterogeneous executable body containers are different, and the M main heterogeneous executable body containers are used to execute pre-set application software;

[0147] When receiving a data packet to be distributed, marking the data packet to be distributed with a corresponding label based on a preset label routing policy; wherein the label corresponds to at least one primary heterogeneous execution body container;

[0148] Based on the label, the to-be-distributed data packet is distributed to a primary heterogeneous execution body container corresponding to the label;

[0149] When it is determined that there is a first container to be cleaned and switched among the M active heterogeneous execution body containers, it is prohibited to mark the first label corresponding to the first container on the data packet to be distributed, and the first container is cleaned.

[0150] The device embodiments described above are merely illustrative, 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 may 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 labor.

[0151] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A container cleaning method based on label routing strategy, characterized in that: include: Setting M primary heterogeneous executable containers; wherein M is an integer greater than 1, the M primary heterogeneous executable containers have different components, and the M primary heterogeneous executable containers are used to execute pre-set application software; When receiving a data packet to be distributed, marking the data packet to be distributed with a corresponding label based on a preset label routing policy; wherein the label corresponds to at least one active heterogeneous execution body container; Based on the label, the to-be-distributed data packet is distributed to the primary heterogeneous execution body container corresponding to the label; If it is determined that a first container to be cleaned and switched exists among the M active heterogeneous executor containers, prohibiting marking the first label corresponding to the first container on the data packet to be distributed, and cleaning the first container; The method further comprises: Set N standby heterogeneous execution body containers; where N is an integer greater than 0; After cleaning the first container, the method further includes: When the cleaning cycle of the first container ends, at least one second container is selected from the N backup heterogeneous executor containers, and the first container is switched to serve as the primary heterogeneous executor container; After selecting at least one second container from the N backup heterogeneous executor containers and switching the first container to serve as the primary heterogeneous executor container when the cleaning cycle of the first container ends, the method further includes: In a preset label table entry, the correspondence between the first container and the first label is deleted, and the correspondence between the second container and the second label is updated; wherein the label table entry is used to represent the correspondence between each of the primary heterogeneous executor containers and the label; Based on the updated label entry, the label routing policy is updated.

2. The container cleaning method based on label routing strategy according to claim 1 is characterized in that: The method further comprises: If a third container in which an abnormal event occurs exists among the M active heterogeneous execution body containers, prohibiting marking the to-be-distributed data packet with a third label corresponding to the third container, and cleaning the third container; At least one fourth container is selected from the N backup heterogeneous executor containers, and the third container is switched to serve as the primary heterogeneous executor container.

3. The container cleaning method based on label routing strategy according to claim 1 or 2, characterized in that: When receiving a data packet to be distributed, before marking the data packet to be distributed with a corresponding label based on a preset label routing policy, the method further includes: generating the label routing strategy based on the first information; The first information includes at least one of the following: The network address of each of the primary heterogeneous execution body containers; Each of the master heterogeneous execution body containers executes a service port of the application software; The label table entry is used to represent the correspondence between each of the primary heterogeneous execution body containers and the label.

4. The container cleaning method based on label routing strategy according to claim 1 is characterized in that: When receiving a data packet to be distributed, marking the data packet to be distributed with a corresponding label based on a preset label routing policy includes: When receiving the data packet to be distributed, determining the data flow of the data packet to be distributed; Based on the label routing policy and the data traffic, the data packet to be distributed is marked with a corresponding label.

5. A container cleaning device based on label routing strategy, characterized in that: include: A setting module, configured to set M primary heterogeneous executable containers; wherein M is an integer greater than 1, the M primary heterogeneous executable containers have different components, and the M primary heterogeneous executable containers are used to execute pre-set application software; a marking module, configured to, upon receiving a data packet to be distributed, mark the data packet to be distributed with a corresponding label based on a preset label routing policy; wherein the label corresponds to at least one primary heterogeneous execution body container; A distribution module, configured to distribute the to-be-distributed data packet to a primary heterogeneous execution body container corresponding to the label based on the label; a processing module configured to, when determining that a first container to be cleaned and switched exists among the M active heterogeneous executor containers, prohibit marking the first label corresponding to the first container on the data packet to be distributed, and clean the first container; The setting module is further used to: set N spare heterogeneous execution body containers; wherein N is an integer greater than 0; The container cleaning device based on the label routing policy also includes: a switching module, configured to select at least one second container from the N backup heterogeneous executor containers and switch the first container to serve as the primary heterogeneous executor container when a cleaning cycle of the first container ends; The container cleaning device based on the label routing policy further includes an update module configured to: In a preset label table entry, the correspondence between the first container and the first label is deleted, and the correspondence between the second container and the second label is updated; wherein the label table entry is used to represent the correspondence between each of the primary heterogeneous executor containers and the label; Based on the updated label entry, the label routing policy is updated.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the container cleaning method based on the label routing policy according to any one of claims 1 to 4 is implemented.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the container cleaning method based on the label routing policy according to any one of claims 1 to 4 is implemented.

8. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the container cleaning method based on the label routing policy according to any one of claims 1 to 4 is implemented.