CN116594734A - Container migration method and device, storage medium and electronic equipment - Google Patents

Container migration method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN116594734A
CN116594734A CN202310519699.1A CN202310519699A CN116594734A CN 116594734 A CN116594734 A CN 116594734A CN 202310519699 A CN202310519699 A CN 202310519699A CN 116594734 A CN116594734 A CN 116594734A
Authority
CN
China
Prior art keywords
node
target
container
working node
containers
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310519699.1A
Other languages
Chinese (zh)
Inventor
蔡中原
沈震宇
孙政清
董杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310519699.1A priority Critical patent/CN116594734A/en
Publication of CN116594734A publication Critical patent/CN116594734A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45587Isolation or security of virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a container migration method, a container migration device, a storage medium and electronic equipment. Relates to the field of cloud computing, and the method comprises the following steps: detecting whether each working node in the target management tool has faults or not according to a preset time period; under the condition that a working node fails in the target management tool, determining the failed working node as a failed node, and acquiring node information of the failed node; creating a working node in a target area in a target management tool according to the node information to obtain a target working node; determining target application programs to which each container deployed in the fault node belongs, and determining a container migration sequence according to the number of containers contained in each target application program and the priority of the target application program; all containers in the failed node are migrated to the target working node based on the container migration order. The application solves the problem of low efficiency of manually transferring the container in the related technology.

Description

Container migration method and device, storage medium and electronic equipment
Technical Field
The application relates to the field of cloud computing, in particular to a container migration method, a device, a storage medium and electronic equipment.
Background
With the rapid development of the technology in the cloud computing field, part of stateful applications have realized comprehensive containerization, such as MySQL (Relational Datebase Management System, relational database management system), elastic search (distributed full-text search engine), and the like, and since the stateful applications need to keep the website fixed and the storage content fixed in a running manner, the containers need to be fixed on a host machine to run. In the case of a failure of a host, in the related art, a new physical machine is manually set up as the host, then storage content, website information and the like on the failed host are migrated to the new host, and then a container in the new host is restarted to provide services.
However, in the related art, manually setting up a new physical machine as a host involves more manual processes, such as setting up the physical machine, migrating storage contents, web addresses, etc., when a container needs large-scale fault migration, a lot of labor and time are required for migrating the container, more operation and maintenance costs are consumed, and services provided by an application program are not available during the container migration, and the longer the fault migration time, the longer the service unavailable time, which affects the efficiency of processing services by the application program.
Aiming at the problem of low efficiency of manually transferring containers in the related art, no effective solution is proposed at present.
Disclosure of Invention
The application mainly aims to provide a container migration method, a device, a storage medium and electronic equipment, so as to solve the problem of low efficiency of manually performing container migration in the related technology.
To achieve the above object, according to one aspect of the present application, there is provided a container migration method. The method comprises the following steps: detecting whether each working node in the target management tool has faults or not according to a preset time period, wherein various containers are deployed in each working node; under the condition that a working node fails in the target management tool, determining the failed working node as a failed node, and acquiring node information of the failed node; creating a working node in a target area in a target management tool according to the node information to obtain a target working node, wherein the target area contains a fault node; determining target application programs to which each container deployed in the fault node belongs, and determining a container migration sequence according to the number of containers contained in each target application program and the priority of the target application program; all containers in the failed node are migrated to the target working node based on the container migration order.
Optionally, detecting whether each working node in the target management tool fails according to a preset time period includes: acquiring the memory of each working node, and judging whether the memory is larger than or equal to a memory threshold value; and under the condition that the memory is larger than or equal to the memory threshold value, determining that the working node fails.
Optionally, detecting whether each working node in the target management tool fails according to the preset time period further includes: writing detection files into each working node, and judging whether the detection files in the working nodes are successfully written; under the condition of detecting file writing failure, determining that a working node fails; under the condition that the writing of the detection file is successful, executing the reading operation of the detection file on the working node; and under the condition of detecting file reading failure, determining that the working node fails.
Optionally, creating the working node in the target area in the target management tool according to the node information, and obtaining the target working node includes: creating a target working node containing the same node information as the fault node in the target area, wherein the node information of the fault node at least comprises one of the following: the number of containers deployed by the fault node, the memory of the fault node and the type of the central processing unit of the fault node; and establishing communication connection between the target working node and the target application program to which each container deployed in the fault node belongs.
Optionally, determining the container migration order according to the number of containers contained in each target application and the priority of the target application includes: determining a number of containers contained in each target application; sequencing all target application programs according to the sequence from the small number to the large number of containers to obtain a target sequence; sorting target application programs with the same number of containers in the target sequence according to the priority of the target application programs to obtain an updated target sequence; and sequencing the containers according to the sequence of the target application program of each container in the fault node in the target sequence to obtain the container migration sequence.
Optionally, sorting the target application programs with the same number of containers in the target sequence according to the priority of the target application programs includes: determining a priority of each target application; and sequencing a plurality of target application programs with the same number of containers according to the order of the priority from high to low to obtain an updated target sequence.
Optionally, migrating all containers in the failed node to the target working node based on the container migration order includes: copying the website and the storage information of each container deployed in the fault node to a target working node; and under the condition that the copying of the website and the storage information is successful, migrating each container deployed in the fault node to the target working node according to the container migration sequence.
In order to achieve the above object, according to another aspect of the present application, there is provided a container transfer device. The device comprises: the detection unit is used for detecting whether each working node in the target management tool has faults or not according to a preset time period, wherein various containers are deployed in each working node; a first determining unit, configured to determine, when a working node in the target management tool fails, the failed working node as a failed node, and obtain node information of the failed node; the creating unit is used for creating a working node in a target area in the target management tool according to the node information to obtain a target working node, wherein the target area contains a fault node; a second determining unit, configured to determine a target application program to which each container deployed in the failed node belongs, and determine a container migration order according to the number of containers included in each target application program and the priority of the target application program; and the migration unit is used for migrating all containers in the fault node to the target working node based on the container migration sequence.
According to the application, the following steps are adopted: detecting whether each working node in the target management tool has faults or not according to a preset time period, wherein various containers are deployed in each working node; under the condition that a working node fails in the target management tool, determining the failed working node as a failed node, and acquiring node information of the failed node; creating a working node in a target area in a target management tool according to the node information to obtain a target working node, wherein the target area contains a fault node; determining target application programs to which each container deployed in the fault node belongs, and determining a container migration sequence according to the number of containers contained in each target application program and the priority of the target application program; all containers in the fault node are migrated to the target working node based on the container migration sequence, and the problem of low efficiency of manually performing container migration in the related technology is solved. And creating a target working node for the target area where the fault node is located, and migrating the containers in the fault node to the target working node according to the container migration sequence, so that the effect of improving the container migration efficiency is achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
FIG. 1 is a flow chart of a container migration method provided in accordance with an embodiment of the present application;
FIG. 2 is a block diagram of a target management tool provided in accordance with an embodiment of the present application;
FIG. 3 is a flow chart of an alternative container migration method provided in accordance with an embodiment of the present application;
FIG. 4 is a schematic view of a container transfer device provided in accordance with an embodiment of the present application;
fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the application herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for presentation, analyzed data, etc.) related to the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
The application will be described with reference to preferred embodiments, and FIG. 1 is a flow chart of a method for migrating containers according to an embodiment of the application, as shown in FIG. 1, comprising the steps of:
Step S101, detecting whether each working node in the target management tool has faults according to a preset time period, wherein various containers are deployed in each working node.
Specifically, the preset time period may be set to one day, and the target management tool may be K8s (Kubernetes, orchestration management tool of the portable container). The working nodes are bottom-layer resources on which containers in the application program run, and the target management tool comprises a plurality of working nodes, wherein each working node is provided with a plurality of types of containers. A container is a virtual device that encapsulates all relevant details necessary to run an application, such as an application-dependent operating system. The container in this embodiment may be a stateful container, which is a container that has an impact on current or future operations and needs to record history data, such as MySQL container, when the stateful container is applied to history requests or operations processed. And (3) circularly detecting each working node in the target management tool according to a preset time period, observing the operation index of the working node, such as a memory, and determining whether the working node fails or not by judging the condition that the memory can not overflow.
It should be noted that, when a working node fails, the container in the failed node needs to be migrated, a container scheduling request is sent to a management node in Kubernetes, and the management node schedules the container in the failed node to a target working node according to the resource requirement of the container. The target working node provides the running environment of the container.
It should be noted that, fig. 2 is a structural diagram of a target management tool provided according to an embodiment of the present application, and as shown in fig. 2, the target management tool is K8s, which is a orchestration management tool of a portable container for container service. K8s is deployed in a cluster mode and consists of a Master Node, a Node and an Etcd Node. Master node is management node, which manages and controls the whole cluster. The Node nodes are working nodes, each Node is distributed with some workload, namely a container, by the Master Node, and when a Node is down, the workload on the Node is automatically transferred to other nodes by the Master Node. The Etcd node, i.e., the storage node, is a highly available distributed key-value database for storing metadata of the target management tool.
Step S102, when the working node in the target management tool fails, determining the failed working node as a failed node, and acquiring node information of the failed node.
Specifically, in the case of a failed node, node information of the failed node, for example, an available Area (AZ) where the node is located, a specification (central processing unit, memory), the number of containers in the failed node, and a target application program to which each container belongs, for example, in fig. 2, the failed node is located in an available area A1, a node specification 16C32G, a central processing unit type 16C, and a memory size 32G. The number of the containers is 3, and each container respectively belongs to an application A, an application B and an application C, and the website and the stored information of each container.
Step S103, creating a working node in a target area in the target management tool according to the node information to obtain a target working node, wherein the target area contains a fault node.
Specifically, the target area, i.e., the available Area (AZ) in the target management tool, for example, the target area in which the fault node is located in fig. 2 is the area A1, and after determining the node information of the fault node, a target working node with the same specification (16C 32G) is created in the same available area A1 of the fault node according to the node information.
Step S104, determining the target application program to which each container deployed in the fault node belongs, and determining the container migration sequence according to the number of containers contained in each target application program and the priority of the target application program.
Specifically, each target application program includes a container, and a plurality of containers deployed in the failed node belong to different target application programs, and each target application program needs to implement service content through the containers deployed in the working node when providing services to the outside. Thus, when a working node fails, the container migration sequence is determined for the container migration time in the failed node by referring to the priority of the target application program and the number of containers contained in the target application program. For example, when the containers in the failed node are migrated, the migration sequence is determined according to the number of containers contained in the target application program, and when the number of containers is the same, the migration sequence is determined according to the priority of the target application program.
Step S105, migrating all containers in the failed node to the target working node based on the container migration order.
Specifically, when all containers in the failed node are migrated to the target working node based on the container migration sequence, the network address and the storage information of the containers on the failed node need to be copied to the target working node. And then starting to migrate the containers according to the container migration sequence.
According to the container migration method provided by the embodiment of the application, whether each working node in the target management tool has faults or not is detected according to a preset time period, wherein various containers are deployed in each working node; under the condition that a working node fails in the target management tool, determining the failed working node as a failed node, and acquiring node information of the failed node; creating a working node in a target area in a target management tool according to the node information to obtain a target working node, wherein the target area contains a fault node; determining target application programs to which each container deployed in the fault node belongs, and determining a container migration sequence according to the number of containers contained in each target application program and the priority of the target application program; all containers in the fault node are migrated to the target working node based on the container migration sequence, and the problem of low efficiency of manually performing container migration in the related technology is solved. And creating a target working node for the target area where the fault node is located, and migrating the containers in the fault node to the clear working node according to the container migration sequence, so that the effect of improving the container migration efficiency is achieved.
In the container migration method provided by the embodiment of the present application, detecting whether each working node in the target management tool has a fault according to a preset time period may be caused by that a memory of the working node exceeds a memory threshold, including: acquiring the memory of each working node, and judging whether the memory is larger than or equal to a memory threshold value; and under the condition that the memory is larger than or equal to the memory threshold value, determining that the working node fails.
Specifically, as the service processed by the working node is more and more likely to cause the situation that the memory of the working node exceeds the working threshold, the processing efficiency of the service is affected if the memory of the working node exceeds the memory threshold, so as to detect whether the memory of each working node in the target management tool is greater than or equal to the memory threshold every preset time period, and if the memory of a certain working node is greater than or equal to the memory threshold, determine that the working node fails. The fault node is determined by detecting whether the memory of the working node exceeds a memory threshold value, and the container in the fault node is migrated in time, so that the service of the target application program is prevented from being influenced.
In the container migration method provided by the embodiment of the present application, optionally, detecting whether each working node in the target management tool has a failure according to a preset time period further includes: writing detection files into each working node, and judging whether the detection files in the working nodes are successfully written; under the condition of detecting file writing failure, determining that a working node fails; under the condition that the writing of the detection file is successful, executing the reading operation of the detection file on the working node; and under the condition of detecting file reading failure, determining that the working node fails.
Specifically, when a disk of a working node is damaged, the disk damage can cause the failure of the reading or writing operation of the working node to data, so that a detection file is written into each working node every preset time period, if the failure of writing the detection file of a certain working node is detected, the working node is determined to be faulty, if the success of writing the detection file of the working node is detected, whether the detection file written into the working node can be read normally is also required to be detected, and if the failure of reading the detection file is detected, the working node is determined to be faulty. Whether the working node fails or not is determined by judging whether the detection file in the working node can be written and read normally, so that the phenomenon that the service processing efficiency is not affected in time due to the fact that the failure node is discovered is avoided.
Optionally, in the container migration method provided by the embodiment of the present application, the creating the working node in the target area in the target management tool according to the node information, where the obtaining the target working node includes: creating a target working node containing the same node information as the fault node in the target area, wherein the node information of the fault node at least comprises one of the following: the number of containers deployed by the fault node, the memory of the fault node and the type of the central processing unit of the fault node; and establishing communication connection between the target working node and the target application program to which each container deployed in the fault node belongs.
For example, in fig. 2, the target area where the failed node is located is an area A1, the number of containers in node information of the failed node is 3, the memory is 32G, the cpu is 16C, a target working node with the same specification (16C 32G) is created in the same available area A1 of the failed node according to the node information, the number of deployable containers is set to be 3 in the target working node, and meanwhile, communication connection is established between the target working node and a program a, a program B and a program C of each container deployed in the failed node, so that a target application program can conveniently call the containers in the target working node.
Optionally, in the container migration method provided by the embodiment of the present application, determining the container migration order according to the number of containers included in each target application and the priority of the target application includes: determining a number of containers contained in each target application; sequencing all target application programs according to the sequence from the small number to the large number of containers to obtain a target sequence; sorting target application programs with the same number of containers in the target sequence according to the priority of the target application programs to obtain an updated target sequence; and sequencing the containers according to the sequence of the target application program of each container in the fault node in the target sequence to obtain the container migration sequence.
Specifically, the number of stateful containers of the target application program is created according to the service requirement of the target application program, for example, application a has 4 containers, application B and application C each has 2 containers, the containers of each target application program cooperatively provide services, 1 a application container, 1B application container and 1C application container are deployed on the failure node in fig. 2, and the order of the number of the containers from the small to the large is that: application B (2) =application C (2) < application a (4), then the target sequence is to migrate either application B container or C container before migrating application a container. And determining the migration sequence of the application B and the application C according to the priority of the target application program, and obtaining an updated target sequence after determining, wherein the container migration sequence is the sequence of the target application program of each container in the fault node in the target sequence. And determining the container migration sequence through the number of containers contained in the target application programs and the priority of the target application programs, so that the target application programs with small number of containers are less influenced when the container migration is performed.
Optionally, in the container migration method provided by the embodiment of the present application, ordering the target application programs with the same number of containers in the target sequence according to the priority of the target application programs includes: determining a priority of each target application; and sequencing a plurality of target application programs with the same number of containers according to the order of the priority from high to low to obtain an updated target sequence.
Specifically, the priority of the target application program may be the importance level of the application program of the artificial device, for example, the higher the usage rate of the target application program is, the more users use the target application program, the higher the priority of the target application program is set. The priority of the application A > the priority of the application B > the priority of the application C, the order of the target application programs in the target sequence is that the application B or the application C is migrated firstly, then the application A is migrated, the application B (priority: 4) > the application C (priority: 3) is migrated, and finally the updated target sequence is determined: first migrate application B container, then migrate application C container, and finally migrate application a container. By determining the migration sequence of a plurality of target application programs with the same number of containers according to the priorities of the target application programs, the influence of the target application programs with high priorities on container migration is ensured to be smaller. The service interruption time caused by manual operation is reduced, and the service availability of each stateful application is fully ensured.
In the container migration method provided by the embodiment of the present application, the migration of all containers in the failed node to the target working node based on the container migration order includes: copying the website and the storage information of each container deployed in the fault node to a target working node; and under the condition that the copying of the website and the storage information is successful, migrating each container deployed in the fault node to the target working node according to the container migration sequence.
Specifically, the container website, the stored information and the working node are in a strong binding relationship, so that the container is migrated at the same time. Therefore, the website address and the storage information in the fault node are copied to the target working node. And then migrating the containers in the fault node to the target working node one by one according to the container migration sequence. By autonomous and rapid migration of the stateful application containers in the failed node, service interruption time is greatly reduced, operation and maintenance cost is reduced, stateful service high availability is improved, operation and maintenance cost of a target management tool is saved, and operation and maintenance efficiency is improved.
According to another embodiment of the present application, there is further provided an alternative container migration method, and fig. 3 is a flowchart of the alternative container migration method provided according to an embodiment of the present application. As shown in fig. 3, the method includes:
step S301: the working node provides a container operating environment.
Specifically, the working nodes are bottom-layer resources on which containers in the application program run, and the target management tool comprises a plurality of working nodes, wherein each working node is provided with a plurality of types of containers. A container is a virtual device that encapsulates all relevant details necessary to run an application, such as an application-dependent operating system. The container in this embodiment may be a stateful container, which is a container that has an impact on current or future operations and needs to record history data, such as MySQL container, when the stateful container is applied to history requests or operations processed.
Step S302: and circularly detecting the working node.
Specifically, the operation index of the working node, such as the memory, is observed according to a preset time period, and the situation that the memory overflows is predicted.
Step S303: and judging whether the working node has a fault or not.
Specifically, if the working node fails, the cycle probing of the working node is continued. If the working node fails, such as a memory overflow, or a disk in the working node is corrupted, the next step is performed.
Step S304: and acquiring fault working node information.
Specifically, the working node information may be an available Area (AZ) where the node is located, a specification (cpu, a memory), how many containers are on the working node, which applications the containers respectively belong to, ip of the containers, and storage information of the containers, for example, the faulty working node is in the available Area (AZ) A1, the node specification 16C32G, and 3 containers respectively belong to application a, application B, and application C.
Step S305: a target worker node is created.
Specifically, a target working node with the same specification (16C 32G) is created in the same available area A1 of the fault working node according to the fault working node information.
Step S306: the migration order is specified.
Specifically, each target application program includes a container, and a plurality of containers deployed in the failed node belong to different target application programs, and each target application program needs to implement service content through the containers deployed in the working node when providing services to the outside. Thus, when a failure occurs in a working node, the container in the failed node is migrated in a migration order specified with reference to the priority of the target application and the number of containers contained in the target application. For example, there are 1 a application container, 1B application container, 1C application container on the failed working node, and the number of containers contained in the target application program is from as small as many as: application B (1) =application C (1) < application a (3), then it is determined that application B or C is migrated first, then it is determined according to the priority of the target application program, application B (rank: 4) > application C (rank: 3), and finally the migration order is determined: first migrate application B container, then migrate application C container, and finally migrate application a container.
Step S307: migrating ip of containers on failed working nodes, storing information and containers.
Specifically, when all containers in the faulty working node are migrated to the target working node based on the migration sequence, it is necessary to copy ip and storage information of the containers on the faulty working node to the target working node. And then starting to migrate the container according to the migration sequence.
According to the optional container migration method provided by the embodiment of the application, through autonomous migration of the fault working node, autonomous and rapid migration can be performed on the stateful application container under the fault scene, so that the service interruption time is greatly reduced, the operation and maintenance cost is reduced, and the stateful service high availability is improved.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The embodiment of the application also provides a container migration device, and the container migration device can be used for executing the container migration method provided by the embodiment of the application. The following describes a container migration apparatus provided in an embodiment of the present application.
Fig. 4 is a schematic view of a container transfer device according to an embodiment of the present application. As shown in fig. 4, the apparatus includes:
a detection unit 10, configured to detect whether each working node in the target management tool has a fault according to a preset time period, where each working node is deployed with a plurality of containers;
a first determining unit 20, configured to determine, when there is a failure of a working node in the target management tool, the failed working node as a failed node, and acquire node information of the failed node;
a creating unit 30, configured to create a working node in a target area in the target management tool according to the node information, so as to obtain a target working node, where the target area includes a fault node;
a second determining unit 40, configured to determine a target application program to which each container deployed in the failed node belongs, and determine a container migration order according to the number of containers contained in each target application program and the priority of the target application program;
and a migration unit 50 for migrating all containers in the failed node to the target working node based on the container migration order.
According to the container migration device provided by the embodiment of the application, whether each working node in the target management tool has faults or not is detected according to a preset time period through the detection unit 10, wherein various containers are deployed in each working node; a first determining unit 20 that determines a failed working node as a failed node in the case where there is a failure of the working node in the target management tool, and acquires node information of the failed node; a creating unit 30 for creating a working node in a target area in the target management tool according to the node information to obtain a target working node, wherein the target area contains a fault node; a second determining unit 40 that determines a target application to which each container deployed in the failed node belongs, and determines a container migration order according to the number of containers contained in each target application and the priority of the target application; the migration unit 50 migrates all containers in the failed node to the target working node based on the container migration sequence, solves the problem of low efficiency of manually performing container migration in the related art, and migrates the containers in the failed node to the clear working node according to the container migration sequence by creating the target working node for the target area where the failed node is located, thereby achieving the effect of improving the container migration efficiency.
Optionally, in the container migration apparatus provided in the embodiment of the present application, the detection unit 10 includes: the acquisition module is used for acquiring the memory of each working node and judging whether the memory is larger than or equal to a memory threshold value or not; and the first determining module is used for determining that the working node fails under the condition that the memory is larger than or equal to the memory threshold value.
Optionally, in the container migration apparatus provided in the embodiment of the present application, the detection unit 10 includes: the writing module is used for writing the detection files into each working node and judging whether the detection files in the working nodes are successfully written or not; the second determining module is used for determining that the working node fails under the condition of detecting file writing failure; the reading module is used for executing reading operation on the detection file on the working node under the condition that the detection file is successfully written; and the third determining module is used for determining that the working node fails under the condition of detecting file reading failure.
Optionally, in the container migration apparatus provided in the embodiment of the present application, the creating unit 30 includes: the creating module is used for creating a target working node containing the same node information as the fault node in the target area, wherein the node information of the fault node at least comprises one of the following: the number of containers deployed by the fault node, the memory of the fault node and the type of the central processing unit of the fault node; and the establishing module is used for establishing communication connection between the target working node and the target application program to which each container deployed in the fault node belongs.
Optionally, in the container migration apparatus provided in the embodiment of the present application, the second determining unit 40 includes: a fourth determining module for determining the number of containers contained in each target application; the first ordering module is used for ordering all the target application programs according to the sequence from the small number of containers to the large number of containers to obtain a target sequence; the second sequencing module is used for sequencing the target application programs with the same number of containers in the target sequence according to the priority of the target application programs to obtain an updated target sequence; and the third ordering module is used for ordering the containers according to the sequence of the target application program of each container in the fault node in the target sequence to obtain the container migration sequence.
Optionally, in the container migration apparatus provided in the embodiment of the present application, the second sorting module includes: a determining submodule for determining the priority of each target application program; and the sequencing sub-module is used for sequencing a plurality of target application programs with the same container number according to the sequence from high priority to low priority to obtain an updated target sequence.
Optionally, in the container migration apparatus provided in the embodiment of the present application, the migration unit 50 includes: the copying module is used for copying the website and the storage information of each container deployed in the fault node to the target working node; and the migration module is used for migrating each container deployed in the fault node to the target working node according to the container migration sequence under the condition that the website and the storage information are copied successfully.
The container migration apparatus includes a processor and a memory, the above-described detecting unit 10, the first determining unit 20, the creating unit 30, the second determining unit 40, the migration unit 50, and the like are stored in the memory as program units, and the above-described program units stored in the memory are executed by the processor to realize the corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more kernel parameters to improve the efficiency of container migration.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
Embodiments of the present application provide a computer-readable storage medium having stored thereon a program that, when executed by a processor, implements a container migration method.
The embodiment of the application provides a processor, which is used for running a program, wherein the program runs to execute a container migration method.
Fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present application. As shown in fig. 5, the electronic device 501 includes a processor, a memory, and a program stored on the memory and executable on the processor, and when the processor executes the program, the following steps are implemented: a container migration method. The device herein may be a server, PC, PAD, cell phone, etc.
The application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: a container migration method.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (10)

1. A method of container migration, comprising:
detecting whether each working node in the target management tool has faults or not according to a preset time period, wherein various containers are deployed in each working node;
under the condition that a working node fails in the target management tool, determining the failed working node as a failed node, and acquiring node information of the failed node;
Creating a working node in a target area in the target management tool according to the node information to obtain a target working node, wherein the target area contains the fault node;
determining target application programs to which each container deployed in the fault node belongs, and determining a container migration sequence according to the number of containers contained in each target application program and the priority of the target application program;
and migrating all containers in the fault node to the target working node based on the container migration sequence.
2. The method of claim 1, wherein detecting whether each working node in the target management tool has failed for a predetermined period of time comprises:
acquiring the memory of each working node, and judging whether the memory is larger than or equal to a memory threshold value;
and under the condition that the memory is larger than or equal to the memory threshold value, determining that the working node fails.
3. The method of claim 1, wherein detecting whether each working node in the target management tool has failed for a predetermined period of time further comprises:
writing a detection file into each working node, and judging whether the detection file in the working node is successfully written;
Under the condition that the writing of the detection file fails, determining that the working node fails;
under the condition that the writing of the detection file is successful, executing the reading operation of the detection file on the working node;
and under the condition that the file reading is failed, determining that the working node fails.
4. The method of claim 1, wherein creating a working node in a target area in the target management tool based on the node information, the obtaining a target working node comprises:
creating a target working node containing the same node information as the fault node in the target area, wherein the node information of the fault node at least comprises one of the following: the number of containers deployed by the fault node, the memory of the fault node and the type of the central processing unit of the fault node;
and establishing communication connection between the target working node and a target application program to which each container deployed in the fault node belongs.
5. The method of claim 1, wherein determining the container migration order based on the number of containers contained in each target application and the priority of the target application comprises:
Determining a number of containers contained in each target application;
sequencing all target application programs according to the sequence from the small number to the large number of containers to obtain a target sequence;
sorting the target application programs with the same number of containers in the target sequence according to the priority of the target application programs to obtain an updated target sequence;
and sequencing the containers according to the sequence of the target application program of each container in the fault node in the target sequence to obtain the container migration sequence.
6. The method of claim 5, wherein ordering the same number of target applications in the target sequence as the number of containers according to the priority of the target applications comprises:
determining a priority of each target application;
and sequencing the plurality of target application programs with the same number of containers according to the order of the priority from high to low to obtain the updated target sequence.
7. The method of claim 1, wherein migrating all containers in the failed node to the target working node based on the container migration order comprises:
copying the website and the storage information of each container deployed in the fault node to the target working node;
And under the condition that the website and the storage information are copied successfully, each container deployed in the fault node is migrated to the target working node according to the container migration sequence.
8. A container transfer device, comprising:
the detection unit is used for detecting whether each working node in the target management tool has faults or not according to a preset time period, wherein various containers are deployed in each working node;
a first determining unit, configured to determine, when a working node in the target management tool fails, the failed working node as a failed node, and obtain node information of the failed node;
the creating unit is used for creating a working node in a target area in the target management tool according to the node information to obtain a target working node, wherein the target area contains the fault node;
a second determining unit, configured to determine a target application program to which each container deployed in the failed node belongs, and determine a container migration order according to the number of containers included in each target application program and the priority of the target application program;
and the migration unit is used for migrating all containers in the fault node to the target working node based on the container migration sequence.
9. A non-volatile storage medium, characterized in that the non-volatile storage medium comprises a stored program, wherein the program, when run, controls a device in which the non-volatile storage medium is located to perform the container migration method of any one of claims 1 to 7.
10. An electronic device comprising one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the container migration method of any of claims 1-7.
CN202310519699.1A 2023-05-09 2023-05-09 Container migration method and device, storage medium and electronic equipment Pending CN116594734A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310519699.1A CN116594734A (en) 2023-05-09 2023-05-09 Container migration method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310519699.1A CN116594734A (en) 2023-05-09 2023-05-09 Container migration method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116594734A true CN116594734A (en) 2023-08-15

Family

ID=87593045

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310519699.1A Pending CN116594734A (en) 2023-05-09 2023-05-09 Container migration method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116594734A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116954870A (en) * 2023-09-19 2023-10-27 苏州元脑智能科技有限公司 Migration method, recovery method and device of cross-cluster application and cluster system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116954870A (en) * 2023-09-19 2023-10-27 苏州元脑智能科技有限公司 Migration method, recovery method and device of cross-cluster application and cluster system
CN116954870B (en) * 2023-09-19 2024-02-02 苏州元脑智能科技有限公司 Migration method, recovery method and device of cross-cluster application and cluster system

Similar Documents

Publication Publication Date Title
US11226847B2 (en) Implementing an application manifest in a node-specific manner using an intent-based orchestrator
US11586673B2 (en) Data writing and reading method and apparatus, and cloud storage system
EP3739845B1 (en) Borrowing data storage resources in a distributed file system
CN106406987B (en) Task execution method and device in cluster
CN107968810B (en) Resource scheduling method, device and system for server cluster
CN112346829B (en) Method and equipment for task scheduling
CN107870802B (en) Virtual machine migration method and device
CN111381928B (en) Virtual machine migration method, cloud computing management platform and storage medium
US10620871B1 (en) Storage scheme for a distributed storage system
CN116594734A (en) Container migration method and device, storage medium and electronic equipment
CN113010265A (en) Pod scheduling method, scheduler, memory plug-in and system
CN110737717A (en) database migration method and device
CN113204353A (en) Big data platform assembly deployment method and device
CN111309432B (en) Fault drilling method, device and system
CN110968406B (en) Method, device, storage medium and processor for processing task
CN110059075B (en) Method, device and equipment for migrating database and computer readable medium
CN111435320B (en) Data processing method and device
CN114443248A (en) Object life cycle management method and device, electronic equipment and storage medium
CN113886353A (en) Data configuration recommendation method and device for hierarchical storage management software and storage medium
WO2021096346A1 (en) A computer-implemented system for management of container logs and its method thereof
CN108255820B (en) Method and device for data storage in distributed system and electronic equipment
CN111241068B (en) Information processing method, device and equipment and computer readable storage medium
CN110019494B (en) Media data processing method and device, storage medium and processor
CN116302356A (en) Container deployment method and device, storage medium and electronic equipment
CN116719796A (en) Method and device for determining upgrading result, processor and electronic equipment

Legal Events

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