Container migration method and device, electronic equipment, storage medium and computer program product
By pre-synchronizing container images and configuration files of edge nodes on cloud hosts and leveraging the high bandwidth transmission capabilities of cloud hosts, new containers can be created directly on the target edge nodes, solving the problem of long migration times for large containers and achieving efficient container migration.
Patent Information
- Application Number
- CN202510977578.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-07-15
Smart Images

Figure CN120492093B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to container migration methods, apparatus, electronic devices, storage media, and computer program products. Background Technology
[0002] Docker is a lightweight containerization platform that uses operating system-level virtualization technology to isolate and run applications. Among related technologies, there are two main solutions for hot migration of Docker containers:
[0003] The first approach primarily utilizes container orchestration frameworks such as Kubernetes and KubeEdge for hot container migration. However, adapting and porting the Kubernetes framework to edge devices requires at least a 4-core, 8GB memory configuration, which is quite resource-intensive.
[0004] The second approach primarily involves analyzing the Docker container configuration based on its working principles, and then reconstructing a container on the target host according to the analyzed configuration to achieve container migration. This approach does not require the Kubernetes framework, thus saving hardware resources. However, in this container migration approach, the migration time is mainly determined by the container size. If the container is large, the migration time will be longer, leading to inefficient container migration. Summary of the Invention
[0005] This disclosure provides container migration methods, apparatus, electronic devices, storage media, and computer program products to at least address the problem in the aforementioned related technologies that if the container is large, the container migration will take a long time, which will lead to low container migration efficiency.
[0006] According to a first aspect of the present disclosure, a container migration method is provided, applied to a cloud host, the cloud host communicating with multiple edge nodes, the container migration method comprising: receiving a migration request for a target container in a source edge node from among the multiple edge nodes; in response to the migration request, sending a migration instruction for the target container and service data of the target container to a target edge node among the multiple edge nodes, wherein the service data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host, and the container image and corresponding configuration file of each container in each of the multiple edge nodes are pre-synchronized to other edge nodes through the cloud host; wherein the migration instruction is used to instruct the target edge node to create a new container corresponding to the target container based on the container image, configuration file and service data of the target container.
[0007] Optionally, it further includes: periodically detecting whether the service data of at least one container installed on each side node has changed; and if it is determined that the service data of a certain container in a certain side node has changed, receiving and saving the changed service data of the certain container in the certain side node.
[0008] Optionally, it also includes: periodically detecting whether the configuration file of at least one container installed on each side node has changed; if it is determined that the configuration file of a certain container in a certain side node has changed, receiving and saving the changed configuration file of the certain container in the certain side node, and synchronizing it to other side nodes.
[0009] Optionally, before sending a migration instruction for the target container and the service data of the target container to the target side node among the plurality of side nodes in response to the migration request, the method further includes: obtaining the load status of each side node among the plurality of side nodes; and selecting one side node from the plurality of side nodes as the target side node based on the load status of each side node.
[0010] Optionally, the load status of the edge node includes at least one of the following: the number of containers currently running on the edge node, the current CPU resource usage of the edge node, and the current memory resource usage of the edge node.
[0011] According to a second aspect of the present disclosure, a container migration method is provided, applied to a target edge node, wherein the target edge node is one of a plurality of edge nodes communicating with a cloud host. The container migration method includes: receiving from the cloud host a migration instruction for a target container in a source edge node among the plurality of edge nodes, and service data of the target container, wherein the service data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host, and the container image and corresponding configuration file of each container in each of the plurality of edge nodes are synchronized to other edge nodes through the cloud host; and in response to the migration instruction, creating a new container corresponding to the target container based on the container image, configuration file and service data of the target container.
[0012] According to a third aspect of the present disclosure, a container migration method is provided, comprising: sending a migration request for a target container in a source edge node to a cloud host through a source edge node among a plurality of edge nodes; and, in response to the migration request, sending a migration instruction for the target container and service data of the target container to a target edge node among the plurality of edge nodes through the cloud host, wherein the service data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host, and the container image and corresponding configuration file of each container in each of the plurality of edge nodes are synchronized to other edge nodes in advance through the cloud host; and, in response to the migration instruction, creating a new container corresponding to the target container based on the container image, configuration file and service data of the target container through the target edge node.
[0013] According to a fourth aspect of the present disclosure, a container migration apparatus is provided, applied to a cloud host, the cloud host communicating with multiple edge nodes. The container migration apparatus includes: a migration request receiving module configured to receive a migration request for a target container in a source edge node among the multiple edge nodes; and a service data sending module configured to, in response to the migration request, send a migration instruction for the target container and service data of the target container to a target edge node among the multiple edge nodes, wherein the service data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host, and the container image and corresponding configuration file of each container in each of the multiple edge nodes are pre-synchronized to other edge nodes through the cloud host; wherein the migration instruction is used to instruct the target edge node to create a new container corresponding to the target container based on the container image, configuration file and service data of the target container.
[0014] Optionally, it also includes: a business data change detection module, configured to periodically detect whether the business data of at least one container installed on each side node has changed; and a changed business data receiving module, configured to receive and save the changed business data of the container in the side node when it is determined that the business data of the container in the side node has changed.
[0015] Optionally, it also includes: a configuration file change detection module, configured to periodically detect whether the configuration file of at least one container installed on each side node has changed; and a changed configuration file receiving module, configured to receive and save the changed configuration file of the container in the side node when it is determined that the configuration file of a certain container in a certain side node has changed, and synchronize it to other side nodes.
[0016] Optionally, it further includes: a load acquisition module, configured to acquire the load status of each of the plurality of side-side nodes; and a side-side node selection module, configured to select one side-side node from the plurality of side-side nodes as the target side-side node based on the load status of each side-side node.
[0017] Optionally, the load status of the edge node includes at least one of the following: the number of containers currently running on the edge node, the current CPU resource usage of the edge node, and the current memory resource usage of the edge node.
[0018] According to a fifth aspect of the present disclosure, a container migration apparatus is provided, applied to a target edge node, the target edge node being one of a plurality of edge nodes communicating with a cloud host. The container migration apparatus includes: a service data receiving module configured to receive from the cloud host a migration instruction for a target container in a source edge node among the plurality of edge nodes, and service data of the target container, wherein the service data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host, and the container image and corresponding configuration file of each container in each of the plurality of edge nodes are synchronized to other edge nodes through the cloud host; and a new container creation module configured to, in response to the migration instruction, create a new container corresponding to the target container based on the container image, configuration file, and service data of the target container.
[0019] According to a sixth aspect of the present disclosure, a container migration apparatus is provided, comprising: a migration request sending module configured to send a migration request for a target container in a source edge node to a cloud host through a plurality of edge nodes; a migration instruction sending module configured to, in response to the migration request, send a migration instruction for the target container and service data of the target container to a target edge node among the plurality of edge nodes through the cloud host, wherein the service data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host, and the container image and corresponding configuration file of each container in each of the plurality of edge nodes are synchronized to other edge nodes in advance through the cloud host; and a container creation module configured to, in response to the migration instruction, create a new container corresponding to the target container based on the container image, configuration file and service data of the target container through the target edge node.
[0020] According to a seventh aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement a container migration method according to the present disclosure.
[0021] According to an eighth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform a container migration method according to the present disclosure.
[0022] According to a ninth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a container migration method according to the present disclosure.
[0023] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects:
[0024] In this disclosure, container images and configuration files of each edge node can be synchronized in advance among multiple edge nodes via a cloud host. When container migration on the source edge node is triggered, the target edge node can directly use the configuration file and container image of the container to be migrated, which are pre-pulled from the cloud host, to perform container migration. This avoids a series of cumbersome operation steps in related technologies, such as searching, packaging, synchronizing the configuration file of the container to be migrated, and downloading the container image of the container to be migrated, when container migration is triggered, thereby shortening the container migration time.
[0025] Additionally, container service data for each of the multiple edge nodes can be pre-stored on cloud servers. When container migration on the source edge node is triggered, the service data of the container to be migrated can be sent from the cloud server to the target edge node. Since cloud servers can provide greater transmission bandwidth than edge nodes, sending the service data of the container to be migrated from the cloud server to the target edge node achieves a faster data transmission rate than sending it directly from the source edge node to the target edge node. This further shortens container migration time and improves container migration efficiency.
[0026] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0027] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0028] Figure 1 This is a schematic diagram illustrating the implementation process of the second container migration scheme in the related technology;
[0029] Figure 2 This is a schematic diagram illustrating a cloud-edge collaborative online hot migration deployment architecture according to exemplary embodiments of the present disclosure;
[0030] Figure 3 This is a flowchart illustrating a container migration method according to an exemplary embodiment of the present disclosure;
[0031] Figure 4 This is a flowchart illustrating another container migration method according to an exemplary embodiment of the present disclosure;
[0032] Figure 5 This is a flowchart illustrating another container migration method according to an exemplary embodiment of the present disclosure;
[0033] Figure 6 This is a block diagram illustrating a container migration apparatus according to an exemplary embodiment of the present disclosure;
[0034] Figure 7 This is a block diagram illustrating another container migration apparatus according to exemplary embodiments of the present disclosure;
[0035] Figure 8 This is a block diagram illustrating another container migration apparatus according to exemplary embodiments of the present disclosure;
[0036] Figure 9 This is a block diagram illustrating an electronic device according to exemplary embodiments of the present disclosure. Detailed Implementation
[0037] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0038] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following examples do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0039] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel cases: "any one of the several items", "a combination of any number of the several items", and "all of the several items". For example, "including at least one of A and B" includes the following three parallel cases: (1) including A; (2) including B; (3) including A and B. Another example is "performing at least one of step one and step two", which means the following three parallel cases: (1) performing step one; (2) performing step two; (3) performing both step one and step two.
[0040] Hot migration technology refers to the process of migrating a virtualized system or application system from one host to another by interrupting business applications within a cluster in the shortest possible time. Currently, hot migration technology for traditional KVM-type virtual machines is relatively mature. However, compared to traditional virtual machines, containers are essentially special processes with a higher dependency on the host machine. Therefore, the hot migration mechanism from virtual machines cannot be directly applied to Docker containers. In this context, the need for cross-side node hot migration of business applications has become an important means to improve system elasticity and reliability.
[0041] As mentioned earlier, there are two main solutions for hot migration of Docker containers in related technologies: the first solution mainly uses container editing and orchestration frameworks such as Kubernetes and KubeEdge to perform hot migration of containers; the second solution mainly analyzes the Docker container configuration based on the working principle of Docker, and then reverse reconstructs a container on the target host according to the analyzed configuration to achieve container migration.
[0042] Figure 1 This is a schematic diagram illustrating the implementation process of the second container migration scheme in the related technology. (Refer to...) Figure 1 The second container migration solution mainly includes the following four parts:
[0043] 1. Migration Preparation Phase
[0044] This phase begins with preparing the environment between the source and destination hosts before migration and synchronizing configuration files and other information to the destination host. This includes establishing an SSL connection and copying the configuration file `config.v2.json`. Then, the container C to be migrated can be exported from the source host and pushed to a private repository, and can be pulled from the private repository on the destination host. (See reference...) Figure 1 "Container C*" represents the container that has been migrated to the destination host. Next, the container data and memory data on the source host need to be rsynced to the destination host, and its dirty data also needs to be synchronized.
[0045] 2. Migrate container images and synchronize files
[0046] Reference Figure 1 "Image" refers to an image currently running on the host machine, while "image*" represents a packaged image used for container hot migration. This "image*" is a container image in a non-running state. In this stage, firstly, a container creation command needs to be executed on the destination host to modify the container's ID name and other information to ensure consistency with the container information on the source host. Then, it can be checked whether the container data on the source host is consistent with the container data on the destination host.
[0047] 3. Restore application services
[0048] At this stage, containers on the source and destination hosts can be frozen, and the container on the destination host can be started and network-related information can be configured using the `docker start` command. At this point, the container on the destination host is officially running and taking over the business.
[0049] 4. Clean up and migrate host resources
[0050] This stage primarily involves clearing information related to the migrated containers from the source host. This can be divided into two scenarios: First, the container migration succeeds. In this case, the container image on the source host, along with temporary files and data generated during the migration process, can be cleaned up and deleted. Second, the container migration fails. In this case, the container on the source host needs to be restarted using the `docker start` command to restore service. Additionally, the container image on the destination host, along with temporary files and data generated during the migration process, needs to be cleaned up and deleted. Furthermore, the reason for the container migration failure should be logged in the system's ` / var / log` directory.
[0051] It should be noted that regardless of the container migration solution mentioned above, it is necessary to temporarily interrupt container services for the migration process. The interruption time can be calculated using the following formula:
[0052] = +
[0053] in, This indicates the time required to locate the configuration files, business data, container image version number, and other information of the container to be migrated when a container migration is triggered. This indicates the time taken to package and export the found content; This indicates the time taken to synchronize the packaged file from the source edge node to the target edge node; This indicates the time taken for the target edge node to pull the container image of the container to be migrated from the application store; This indicates the time taken to create a new container on the target edge node; This indicates the time taken to start the newly created container on the target edge node.
[0054] To ensure the continuity of business services, minimizing the downtime of containerized services has become an urgent issue to address.
[0055] To address the aforementioned issues in related technologies, this disclosure provides a cloud-edge collaborative online hot migration deployment architecture solution. Figure 2 This is a schematic diagram illustrating a cloud-edge collaborative online hot migration deployment architecture according to exemplary embodiments of the present disclosure. (Refer to...) Figure 2 The cloud-edge collaborative online hot migration deployment architecture can mainly include a cloud host (also known as a cloud master station, cloud server, etc.), multiple edge nodes (also known as edge nodes) and multiple end devices (e.g., cameras, temperature sensors, humidity sensors, etc.).
[0056] The "cloud server" is primarily used to coordinate the hot migration process of containers installed on various edge nodes. An "edge node" can refer to a physical device located in a specific area; for example, an edge node could be a terminal device placed next to a street. "End devices" are mainly used to collect external data and synchronize it to their associated containers. It should be noted that the end devices associated with different containers may differ from each other, depending on the type of container. For example, if container A is mainly used to provide video surveillance services, the end devices associated with container A could be cameras; if container B is mainly used to provide weather forecast services, the end devices associated with container B could be temperature sensors, humidity sensors, etc.
[0057] It should be noted that each edge node can install at least one container, and after establishing a connection with the cloud host, each edge node can synchronize the relevant information of each of its installed containers to the cloud host. For example, an edge node can send the container identifier, configuration file, and business data of each container installed on it to the cloud host.
[0058] A "container identifier" uniquely identifies which container it is; different containers have different container identifiers. A "container configuration file" may include, but is not limited to, the following: the container's version number, the amount of CPU / memory / bandwidth resources the container requires, whether the container is associated with any edge devices, and which edge devices it is associated with, etc. Additionally, cloud servers can store a large number of container images. A container image can be understood as an installation package, primarily used to deploy and install containers. These container images can be stored on the cloud server after it is set up, allowing edge nodes to pull and install them.
[0059] After receiving the container identifier and configuration file of at least one container installed on each of the multiple edge nodes, the cloud host can synchronize the container identifier and configuration file of at least one container installed on each edge node to the other edge nodes. In this way, each edge node can store the configuration files of all containers installed on all other edge nodes.
[0060] For example, after each edge node obtains the container identifiers of containers installed on other edge nodes, it can use these identifiers to pull the corresponding container image from the cloud server. In this way, each edge node can also store the container images of all containers installed on all other edge nodes. It should be noted that the container image pulled from the cloud server can be in the form of a compressed file, and this compressed file is only decompressed when a new container is created on the target edge node. Therefore, downloading the container images of containers on other edge nodes in advance on each edge node does not consume much space.
[0061] In this way, by using cloud hosts to pre-synchronize the configuration files and container images of the containers installed on each edge node to other edge nodes, when container migration is triggered, the target edge node can directly use the pre-obtained configuration files and container images of the container to be migrated to perform container migration. This avoids a series of cumbersome operation steps in related technologies, such as searching, packaging, synchronizing the configuration files of the container to be migrated, and downloading the container images of the container to be migrated, when container migration is triggered, thereby shortening the container migration time.
[0062] Additionally, container service data for each of the multiple edge nodes can be pre-stored on cloud servers. When container migration on the source edge node is triggered, the service data of the container to be migrated can be sent from the cloud server to the target edge node. Since cloud servers can provide greater transmission bandwidth than edge nodes, sending the service data of the container to be migrated from the cloud server to the target edge node achieves a faster data transmission rate than sending it directly from the source edge node to the target edge node. This further shortens container migration time and improves container migration efficiency.
[0063] Figure 3 This is a flowchart illustrating a container migration method according to an exemplary embodiment of the present disclosure, applied to a cloud host that can communicate with multiple edge nodes. For example, one or more cloud hosts in a cloud master station can establish associations and network communication with multiple edge nodes, facilitating the cloud host to periodically obtain container configuration information and business data from the edge nodes. The "cloud master station" can be a service cluster that may contain multiple cloud hosts, each of which is primarily used to coordinate the hot migration process of containers installed on the various edge nodes with which it has established connections.
[0064] Reference Figure 3 In step 301, a migration request for a target container can be received from a source edge node among multiple edge nodes. For example, when a source edge node receives a migration instruction from a user for a target container installed on it, it can send a migration request for the target container to the cloud host. For instance, the migration request can include the container identifier of the target container, so that the cloud host can know in a timely manner which container needs to be migrated.
[0065] According to an exemplary embodiment of this disclosure, after receiving a migration request, the cloud host can also obtain the load information of each of the multiple edge nodes. For example, the load information may include, but is not limited to, the number of containers currently running on the edge node, the current CPU resource usage of the edge node, the current memory resource usage of the edge node, etc. The cloud host can select one edge node from the multiple edge nodes as the target edge node based on the load information of each edge node, wherein the lighter the load of the edge node, the greater the probability that the edge node will be selected as the target edge node.
[0066] For example, a cloud server can use at least one of the following parameters—the number of currently running containers, the current CPU resource usage, and the current memory resource usage—to calculate a load metric according to preset calculation rules. This load metric can then be used to select a target edge node. Furthermore, different weights can be assigned to different parameters to calculate the load metric, and so on.
[0067] Alternatively, the fewer containers currently running on a side node, the less CPU resources it currently uses, and the less memory resources it currently uses, the lighter the load on that side node can be, and it can be considered a potential target side node. Conversely, the more containers currently running on a side node, the more CPU resources it currently uses, and the more memory resources it currently uses, the heavier the load on that side node can be, and it can be considered a potential unsuitable target side node.
[0068] It should be noted that this disclosure does not limit the specific method of determining the load of the edge node; the aforementioned implementation is merely an illustrative example.
[0069] In this way, during container migration, cloud hosts can select one edge node from multiple edge nodes based on the load of each edge node to handle the migrated containers. This ensures load balancing across multiple edge nodes, preventing situations where some edge nodes are overloaded and crash, or some edge nodes are underloaded and waste resources. Furthermore, because cloud hosts are allowed to choose target edge nodes from multiple edge nodes based on actual conditions, they have a wider range of options, thus improving the success rate of container migration.
[0070] In step 302, in response to the migration request, the cloud host can send a migration instruction for the target container and the target container's business data to the target edge node among multiple edge nodes. The target container's business data can be synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the multiple edge nodes can be pre-synchronized to other edge nodes via the cloud host. The aforementioned migration instruction can be used to instruct the target edge node to create a new container corresponding to the target container based on the target container's container image, configuration file, and business data to migrate the target container.
[0071] It should be noted that during the process of creating a new container corresponding to the target container on the target side node, it is necessary to freeze the target container on the source side node. For example, the target container on the source side node needs to be "locked." Furthermore, if the target container is associated with end-side devices, it is also necessary to disconnect the connection between the target container and the associated end-side devices. Correspondingly, the target side node also needs to establish new connections with these end-side devices based on the information of the end-side devices associated with the target container contained in the target container's configuration file.
[0072] Furthermore, once a container is frozen, it cannot send or receive data. Therefore, to avoid data loss, the business data generated after the target container is frozen can be stored in the memory of the source edge node. This data can then be synchronized to the target edge node when the container resumes operation. At this point, the new container created on the target edge node can officially run and take over the business operations of the target container.
[0073] According to exemplary embodiments of this disclosure, the cloud host can also periodically detect whether the service data of at least one container installed on each edge node has changed. If it is determined that the service data of a container in a certain edge node has changed, the cloud host can receive and save the changed service data of that container in that edge node. Furthermore, when container migration is triggered, the cloud host can distribute the changed service data of the container to be migrated to the target edge node.
[0074] In this way, the cloud host can check the container's business data on each edge node at a fixed frequency to see if there are any changes, and can synchronize the cloud host incrementally when changes occur. Since the cloud host can provide greater transmission bandwidth than the edge nodes, sending the business data of the container to be migrated from the cloud host to the target edge node achieves a faster data transfer rate than transferring data directly between the source and target edge nodes, thus further shortening container migration time and improving container migration efficiency. Furthermore, compared to synchronizing all business data, both changed and unchanged, incremental data synchronization saves bandwidth and avoids excessive consumption of storage resources.
[0075] According to exemplary embodiments of this disclosure, the cloud host can also periodically detect whether the configuration file of at least one container installed on each edge node has changed. If it is determined that the configuration file of a container in a certain edge node has changed, the cloud host can receive and save the changed configuration file of that container in that edge node, and can synchronize the changed configuration file to other edge nodes so that the other edge nodes can replace the original configuration file of the container with the changed configuration file.
[0076] In this way, the cloud server can check the container configuration files on each edge node at a fixed frequency to see if there are any changes. If changes are found, the cloud server can synchronize the configuration files incrementally, ensuring that the container configuration files stored on each edge node are up-to-date. This guarantees that a usable configuration file can be found immediately during container migration, thus ensuring a high success rate and efficiency in container migration. Furthermore, compared to synchronizing all configuration files, both changed and unchanged, incremental configuration file synchronization saves bandwidth and avoids excessive consumption of storage resources.
[0077] This disclosure proposes a cloud-edge collaborative online hot migration optimization strategy, which can quickly skip the migration preparation stage and the migration container image and synchronization file stage when performing Docker hot migration. This saves the process of generating temporary image files on the source edge node, thereby shortening the migration process and reducing the time spent performing Docker hot migration, achieving second-level business container cloning and recovery.
[0078] Figure 4 This is a flowchart illustrating another container migration method according to an exemplary embodiment of the present disclosure, applied to a target side node, which may be one of a plurality of side nodes communicating with a cloud host.
[0079] Reference Figure 4 In step 401, the target edge node can receive migration instructions for the target container in the source edge node among multiple edge nodes, as well as the target container's business data, from the cloud host. The target container's business data can be synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the multiple edge nodes can be synchronized to other edge nodes through the cloud host.
[0080] It should be noted that the source edge node can receive migration instructions from users for the target containers installed on it. Then, in response to the received migration instructions, the source edge node can send a migration request for the target container to the cloud host. For example, this migration request can include the container identifier of the target container, allowing the cloud host to quickly identify which container needs to be migrated. The cloud host can then use the container identifier included in the migration request to locate the target container's business data, and subsequently distribute the located business data to the target edge node.
[0081] In step 402, the target edge node responds to the migration instruction issued by the cloud host and can create a new container corresponding to the target container based on the container image, configuration file and business data of the target container.
[0082] It should be noted that the configuration file of the target container can be synchronized to the cloud host by the source edge node after establishing a connection with the cloud host, and then distributed to the target edge node by the cloud host; and the container image of the target container can be synchronized to the cloud host by the source edge node after establishing a connection with the cloud host, and then distributed to the target edge node by the cloud host, and then pulled down by the target edge node based on the container image of the target container.
[0083] In this way, when a container migration occurs, since the configuration file and container image of the container to be migrated are pre-downloaded, the target edge node can directly use the existing configuration file and container image to perform the container migration. This avoids a series of cumbersome operations in related technologies, such as searching, packaging, synchronizing the configuration file of the container to be migrated, and downloading the container image of the container to be migrated, when the container migration is triggered, thereby shortening the container migration time.
[0084] Additionally, container service data for each of the multiple edge nodes can be pre-stored on cloud servers. When container migration on the source edge node is triggered, the service data of the container to be migrated can be sent from the cloud server to the target edge node. Since cloud servers can provide greater transmission bandwidth than edge nodes, sending the service data of the container to be migrated from the cloud server to the target edge node achieves a faster data transmission rate than sending it directly from the source edge node to the target edge node. This further shortens container migration time and improves container migration efficiency.
[0085] Figure 5 This is a flowchart illustrating another container migration method according to an exemplary embodiment of the present disclosure.
[0086] Reference Figure 5 In step 501, a migration request for a target container within a source edge node can be sent to the cloud host via a source edge node among multiple edge nodes. Specifically, the source edge node can receive migration instructions from the user for the target container installed on it. Then, in response to the received migration instructions, the source edge node can send a migration request for the target container to the cloud host. For example, the migration request may include the container identifier of the target container, allowing the cloud host to promptly identify which container needs to be migrated.
[0087] In step 502, in response to the received migration request, the cloud host can send migration instructions for the target container and the target container's business data to the target edge node among multiple edge nodes. The target container's business data can be synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the multiple edge nodes can be pre-synchronized to the other edge nodes via the cloud host.
[0088] It should be noted that, as mentioned earlier, after each edge node establishes a connection with the cloud host, it can synchronize the relevant information of each of the multiple containers installed on it to the cloud host. For example, the edge node can send the container identifier, configuration file, and business data of each container installed on it to the cloud host.
[0089] After receiving the container identifiers and configuration files of at least one container installed on each of the multiple edge nodes, the cloud host can synchronize these information to the other edge nodes. This allows each edge node to store the configuration files of all containers installed on all other edge nodes. For example, after obtaining the container identifiers of containers installed on other edge nodes, each edge node can also use these identifiers to pull the container images of the corresponding containers from the cloud host. Thus, each edge node can also store the container images of all containers installed on all other edge nodes.
[0090] In step 503, the target edge node can respond to the received migration instruction and create a new container corresponding to the target container based on the container image, configuration file and business data of the target container.
[0091] Figure 6 This is a block diagram illustrating a container migration apparatus 600 according to an exemplary embodiment of the present disclosure, applied to a cloud host that can communicate with multiple side nodes.
[0092] Reference Figure 6 The container migration device 600 may include a migration request receiving module 601 and a service data sending module 602.
[0093] The migration request receiving module 601 can receive migration requests for the target container in the source side node from multiple side nodes.
[0094] According to an exemplary embodiment of this disclosure, the container migration apparatus 600 may further include a load acquisition module and a side node selection module.
[0095] After receiving a migration request, the load balancing module can obtain the load information of each of the multiple edge nodes. This load information may include, but is not limited to, the number of containers currently running on the edge node, the current CPU resource usage of the edge node, and the current memory resource usage of the edge node. The edge node selection module can then select one edge node as the target edge node based on its load information. The lighter the load of an edge node, the greater the probability that it will be selected as the target edge node.
[0096] In this way, during container migration, cloud hosts can select one edge node from multiple edge nodes based on the load of each edge node to handle the migrated containers. This ensures load balancing across multiple edge nodes, preventing situations where some edge nodes are overloaded and crash, or some edge nodes are underloaded and waste resources. Furthermore, because cloud hosts are allowed to choose target edge nodes from multiple edge nodes based on actual conditions, they have a wider range of options, thus improving the success rate of container migration.
[0097] In response to a migration request, the business data sending module 602 can send a migration instruction for the target container and the target container's business data to the target edge node among multiple edge nodes. The target container's business data can be synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the multiple edge nodes can be pre-synchronized to other edge nodes via the cloud host. The aforementioned migration instruction can be used to instruct the target edge node to create a new container corresponding to the target container based on the target container's container image, configuration file, and business data to perform the migration of the target container.
[0098] According to an exemplary embodiment of this disclosure, the container migration apparatus 600 may further include a business data change detection module and a changed business data receiving module.
[0099] The business data change detection module can periodically detect whether the business data of at least one container installed on each edge node has changed. If it is determined that the business data of a container on a certain edge node has changed, the changed business data receiving module can receive and save the changed business data of that container on that edge node. Furthermore, when container migration is triggered, the cloud host can distribute the changed business data of the container to be migrated to the target edge node.
[0100] In this way, the cloud host can check the container's business data on each edge node at a fixed frequency to see if there are any changes, and can synchronize the cloud host incrementally when changes occur. Since the cloud host can provide greater transmission bandwidth than the edge nodes, sending the business data of the container to be migrated from the cloud host to the target edge node achieves a faster data transfer rate than transferring data directly between the source and target edge nodes, thus further shortening container migration time and improving container migration efficiency. Furthermore, compared to synchronizing all business data, both changed and unchanged, incremental data synchronization saves bandwidth and avoids excessive consumption of storage resources.
[0101] According to an exemplary embodiment of this disclosure, the container migration apparatus 600 may further include a configuration file change detection module and a changed configuration file receiving module.
[0102] The configuration file change detection module can periodically detect whether the configuration files of at least one container installed on each edge node have changed. If it is determined that the configuration file of a container in a certain edge node has changed, the configuration file change receiving module can receive and save the changed configuration file of that container in that edge node, and can synchronize the changed configuration file to other edge nodes so that other edge nodes can use the changed configuration file to replace the original configuration file of the container.
[0103] In this way, the cloud server can check the container configuration files on each edge node at a fixed frequency to see if there are any changes. If changes are found, the cloud server can synchronize the configuration files incrementally, ensuring that the container configuration files stored on each edge node are up-to-date. This guarantees that a usable configuration file can be found immediately during container migration, thus ensuring a high success rate and efficiency in container migration. Furthermore, compared to synchronizing all configuration files, both changed and unchanged, incremental configuration file synchronization saves bandwidth and avoids excessive consumption of storage resources.
[0104] Figure 7 This is a block diagram illustrating another container migration apparatus 700 according to an exemplary embodiment of the present disclosure, applied to a target side node, which may be one of a plurality of side nodes communicating with a cloud host.
[0105] Reference Figure 7 The container migration device 700 may include a business data receiving module 701 and a new container creation module 702.
[0106] The business data receiving module 701 can receive migration instructions and business data of the target container from the source edge node among multiple edge nodes from the cloud host. The business data of the target container can be synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each edge node can be synchronized to other edge nodes through the cloud host.
[0107] The new container creation module 702 responds to the migration instruction issued by the cloud host and can create a new container corresponding to the target container based on the target container's container image, configuration file, and business data.
[0108] Figure 8 This is a block diagram illustrating another container migration apparatus 800 according to an exemplary embodiment of the present disclosure.
[0109] Reference Figure 8 The container migration device 800 may include a migration request sending module 801, a migration instruction sending module 802, and a container creation module 803.
[0110] The migration request sending module 801 can send a migration request for a target container in a source edge node to the cloud host. Specifically, the source edge node can receive migration instructions from the user for the target container installed on it. Then, in response to the received migration instructions, the source edge node can send a migration request for the target container to the cloud host. For example, the migration request can include the container identifier of the target container, so that the cloud host can know in a timely manner which container needs to be migrated.
[0111] In response to a received migration request, the migration instruction sending module 802 can send a migration instruction for the target container and the target container's business data to the target edge node among multiple edge nodes. The target container's business data can be synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the multiple edge nodes can be pre-synchronized to the other edge nodes via the cloud host.
[0112] In response to the received migration instruction, the container creation module 803 can create a new container corresponding to the target container based on the target container's container image, configuration file, and business data.
[0113] Figure 9 This is a block diagram illustrating an electronic device 900 according to an exemplary embodiment of the present disclosure.
[0114] Reference Figure 9The electronic device 900 includes at least one memory 901 and at least one processor 902, wherein the at least one memory 901 stores instructions that, when executed by the at least one processor 902, perform a container migration method according to an exemplary embodiment of the present disclosure.
[0115] As an example, electronic device 900 can be a PC, tablet, personal digital assistant, smartphone, or other device capable of executing the aforementioned instructions. Here, electronic device 900 is not necessarily a single electronic device, but can be any collection of devices or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. Electronic device 900 can also be part of an integrated control system or system manager, or can be configured to interconnect with a portable electronic device locally or remotely (e.g., via wireless transmission) through an interface.
[0116] In electronic device 900, processor 902 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, processor may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, etc.
[0117] The processor 902 can execute instructions or code stored in the memory 901, which can also store data. Instructions and data can also be sent and received via a network through a network interface device, which can employ any known transmission protocol.
[0118] The memory 901 may be integrated with the processor 902, for example, by placing RAM or flash memory within an integrated circuit microprocessor. Alternatively, the memory 901 may include a separate device, such as an external disk drive, a storage array, or other storage device usable by any database system. The memory 901 and the processor 902 may be operatively coupled, or may communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor 902 to read files stored in the memory.
[0119] In addition, the electronic device 900 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of the electronic device 900 can be interconnected via a bus and / or network.
[0120] According to exemplary embodiments of this disclosure, a computer-readable storage medium may also be provided, which, when executed by a processor of an electronic device, enables the electronic device to perform the container migration method described above. Examples of computer-readable storage media include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.
[0121] According to exemplary embodiments of the present disclosure, a computer program product may also be provided, including a computer program that, when executed by a processor, implements the container migration method according to the present disclosure.
[0122] According to the container migration method, apparatus, electronic device, storage medium, and computer program product disclosed herein, the container images and configuration files of each edge node can be synchronized in advance among multiple edge nodes via a cloud host. When the container migration on the source edge node is triggered, the target edge node can directly use the configuration file and container image of the container to be migrated, which are pre-pulled from the cloud host, to perform the container migration. This avoids a series of cumbersome operation steps in related technologies, such as searching, packaging, synchronizing the configuration file of the container to be migrated, and downloading the container image of the container to be migrated, when the container migration is triggered, thereby shortening the container migration time.
[0123] Additionally, container service data for each of the multiple edge nodes can be pre-stored on cloud servers. When container migration on the source edge node is triggered, the service data of the container to be migrated can be sent from the cloud server to the target edge node. Since cloud servers can provide greater transmission bandwidth than edge nodes, sending the service data of the container to be migrated from the cloud server to the target edge node achieves a faster data transmission rate than sending it directly from the source edge node to the target edge node. This further shortens container migration time and improves container migration efficiency.
[0124] According to exemplary embodiments of this disclosure, during container migration, a cloud host can select one side node from multiple side nodes to handle the migrated containers based on the load of each side node. This ensures load balancing across the multiple side nodes, preventing situations where some side nodes are overloaded and crash, or some side nodes are underloaded and waste resources. Furthermore, since the cloud host is allowed to select a target side node from multiple side nodes based on actual conditions, there is a wider range of choices, thus improving the success rate of container migration.
[0125] According to exemplary embodiments of this disclosure, a cloud host can check for changes in container service data on each edge node at a fixed frequency, and can incrementally synchronize the cloud host if changes occur. Since the cloud host provides greater transmission bandwidth than the edge nodes, sending the service data of the container to be migrated from the cloud host to the target edge node achieves a faster data transmission rate than directly transmitting data between the source and target edge nodes, thereby further shortening container migration time and improving container migration efficiency. Furthermore, compared to synchronizing all changed and unchanged service data, incremental data synchronization saves bandwidth and avoids excessive consumption of storage resources.
[0126] According to exemplary embodiments of this disclosure, the cloud host can check the container configuration files on each edge node at a fixed frequency to see if there are any changes. If changes are found, the cloud host can be synchronized incrementally, ensuring that the container configuration files stored on each edge node are up-to-date. This guarantees that a usable configuration file can be found immediately during container migration, thereby ensuring a high success rate and efficiency in container migration. Furthermore, compared to synchronizing all configuration files, both changed and unchanged, incremental configuration file synchronization saves bandwidth and avoids excessive consumption of storage resources.
[0127] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0128] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A container migration method, characterized in that, Applied to cloud servers that communicate with multiple edge nodes, the container migration method includes: Receive a migration request for the target container in the source side node from the plurality of side nodes; In response to the migration request, a migration instruction for the target container and the business data of the target container are sent to the target side node among the plurality of side nodes. The business data of the target container is synchronized to the cloud host by the source side node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the plurality of side nodes are synchronized to other side nodes in advance through the cloud host, so that each side node pre-stores the configuration files and container images of the containers installed on the other side nodes. The container images are in the form of compressed packages. The migration instruction is used to instruct the target edge node to create a new container corresponding to the target container based on the container image, configuration file and business data of the target container.
2. The container migration method as described in claim 1, characterized in that, Also includes: Periodically check whether the business data of at least one container installed on each side node has changed; If it is determined that the service data of a certain container in a certain edge node has changed, the modified service data of the certain container in the certain edge node shall be received and saved.
3. The container migration method as described in claim 1, characterized in that, Also includes: Periodically check whether the configuration file of at least one container installed on each side node has changed; If it is determined that the configuration file of a container in a certain edge node has been changed, the modified configuration file of the container in the certain edge node is received and saved, and synchronized to other edge nodes.
4. The container migration method as described in claim 1, characterized in that, Before sending a migration instruction for the target container and the business data of the target container to the target side node among the plurality of side nodes in response to the migration request, the method further includes: Obtain the load status of each of the multiple edge nodes; Based on the load status of each side node, one side node is selected from the plurality of side nodes as the target side node.
5. The container migration method as described in claim 4, characterized in that, The load condition of the side node includes at least one of the following: The number of containers currently running on the edge node, the current CPU resource usage of the edge node, and the current memory resource usage of the edge node.
6. A container migration method, characterized in that, Applied to a target edge node, which is one of multiple edge nodes communicating with a cloud host, the container migration method includes: The cloud host receives migration instructions for the target container in the source edge node among the plurality of edge nodes, as well as the service data of the target container. The service data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container image and corresponding configuration file of each container in each of the plurality of edge nodes are synchronized to other edge nodes through the cloud host, so that each edge node pre-stores the configuration file and container image of the container installed on the other edge nodes. The container image is in the form of a compressed package. In response to the migration instruction, a new container corresponding to the target container is created based on the target container's container image, configuration file, and business data.
7. A container migration method, characterized in that, include: A migration request for the target container in the source edge node is sent to the cloud host through the source edge node among multiple edge nodes; In response to the migration request, the cloud host sends a migration instruction for the target container and the business data of the target container to the target side node among the plurality of side nodes. The business data of the target container is synchronized to the cloud host by the source side node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the plurality of side nodes are synchronized to other side nodes in advance through the cloud host, so that each side node pre-stores the configuration files and container images of the containers installed on the other side nodes. The container images are in compressed package form. In response to the migration instruction, the target edge node creates a new container corresponding to the target container based on the container image, configuration file, and business data of the target container.
8. A container migration device, characterized in that, Applied to cloud servers, which communicate with multiple edge nodes, the container migration device includes: The migration request receiving module is configured to receive a migration request for a target container in a source edge node from a source edge node among the plurality of edge nodes. The business data sending module is configured to, in response to the migration request, send a migration instruction for the target container and the business data of the target container to the target side node among the plurality of side nodes. The business data of the target container is synchronized to the cloud host by the source side node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the plurality of side nodes are synchronized to other side nodes in advance through the cloud host, so that each side node pre-stores the configuration files and container images of the containers installed on the other side nodes. The container images are in the form of compressed packages. The migration instruction is used to instruct the target edge node to create a new container corresponding to the target container based on the container image, configuration file and business data of the target container.
9. The container migration device as claimed in claim 8, characterized in that, Also includes: The business data change detection module is configured to periodically detect whether the business data of at least one container installed on each side node has changed; The change service data receiving module is configured to receive and save the changed service data of a container in a certain side node when it is determined that the service data of a certain container in a certain side node has changed.
10. The container migration apparatus as claimed in claim 8, characterized in that, Also includes: The configuration file change detection module is configured to periodically detect whether the configuration file of at least one container installed on each side node has changed; The configuration file receiving module is configured to receive and save the modified configuration file of a container in a certain edge node when it is determined that the configuration file of a certain container in a certain edge node has been changed, and synchronize it to other edge nodes.
11. The container migration device as claimed in claim 8, characterized in that, Also includes: The load acquisition module is configured to acquire the load status of each of the plurality of side nodes; The edge node selection module is configured to select one edge node from the plurality of edge nodes as the target edge node based on the load status of each edge node.
12. The container migration apparatus as claimed in claim 11, characterized in that, The load condition of the side node includes at least one of the following: The number of containers currently running on the edge node, the current CPU resource usage of the edge node, and the current memory resource usage of the edge node.
13. A container migration device, characterized in that, Applied to a target edge node, which is one of multiple edge nodes communicating with a cloud host, the container migration device includes: The business data receiving module is configured to receive from the cloud host a migration instruction for a target container in a source edge node among the plurality of edge nodes, as well as business data of the target container. The business data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container image and corresponding configuration file of each container in each of the plurality of edge nodes are synchronized to other edge nodes through the cloud host, so that each edge node pre-stores the configuration file and container image of the containers installed on the other edge nodes. The container image is in the form of a compressed package. The new container creation module is configured to, in response to the migration instruction, create a new container corresponding to the target container based on the target container's container image, configuration file, and business data.
14. A container migration device, characterized in that, include: The migration request sending module is configured to send a migration request for the target container in the source edge node to the cloud host through a source edge node among multiple edge nodes. The migration instruction sending module is configured to, in response to the migration request, send a migration instruction for the target container and the service data of the target container to the target edge node among the plurality of edge nodes via the cloud host. The service data of the target container is synchronized to the cloud host by the source edge node after establishing a connection with the cloud host. The container images and corresponding configuration files of each container in each of the plurality of edge nodes are synchronized to other edge nodes in advance via the cloud host, so that each edge node pre-stores the configuration files and container images of the containers installed on the other edge nodes. The container images are in compressed package form. The container creation module is configured to, in response to the migration instruction, create a new container corresponding to the target container based on the container image, configuration file, and business data of the target container via the target edge node.
15. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the container migration method as described in any one of claims 1 to 5, and / or to implement the container migration method as described in claim 6, and / or to implement the container migration method as described in claim 7.
16. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the container migration method as described in any one of claims 1 to 5, and / or, the container migration method as described in claim 6, and / or, the container migration method as described in claim 7.
17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the container migration method as described in any one of claims 1 to 5, and / or implements the container migration method as described in claim 6, and / or implements the container migration method as described in claim 7.