CN116302529A - Method and device for migrating host application based on Linux container - Google Patents

Method and device for migrating host application based on Linux container Download PDF

Info

Publication number
CN116302529A
CN116302529A CN202310250069.9A CN202310250069A CN116302529A CN 116302529 A CN116302529 A CN 116302529A CN 202310250069 A CN202310250069 A CN 202310250069A CN 116302529 A CN116302529 A CN 116302529A
Authority
CN
China
Prior art keywords
target
migration
linux container
data
migrated
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
CN202310250069.9A
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.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud Technology Co Ltd
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 Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202310250069.9A priority Critical patent/CN116302529A/en
Publication of CN116302529A publication Critical patent/CN116302529A/en
Pending legal-status Critical Current

Links

Images

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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • G06F9/5088Techniques for rebalancing the load in a distributed system involving task migration
    • 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
    • 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 invention discloses a migration method and a migration device of host application based on a Linux container, which belong to the technical field of container platforms and are applied to a system for migrating host application based on the Linux container, wherein the system comprises a source machine, a control machine and a target machine; a migration proxy service is deployed on a source host through a migration console, a target Linux container is established through an LXD interface of a Linux container cluster, and a target root file system in a source machine is realized And the data to be migrated of the application program and the application program are migrated to the target Linux container.

Description

Method and device for migrating host application based on Linux container
Technical Field
The invention belongs to the technical field of container platforms, and particularly relates to a migration method and device of host application based on a Linux container.
Background
Application migration refers to the migration of software applications from one IT system to another, and is generally divided into four classes: 1) Re-hosting: directly moving an application from one platform to another without major modification; 2) And (3) reconstruction: make major changes to applications to run in new environments, such as micro-service splitting of monomeric applications; 3) Replacing a platform: when migrating to a new environment, partial modification of the application is required; 4) Replacement: i.e. giving up an application to change from another solution.
By re-hosting as application migration, applications are typically migrated from the source machine to the virtual machine, bare metal, or container platform of the hosting party environment. Compared with a virtual machine, the container is lighter in weight as a bearing technology, and can isolate fine-grained resources and further improve the utilization rate of the resources; compared with a virtual machine, the container has the characteristics of light weight, quick starting, less occupied resources and the like, and is more suitable for application arrangement; the container abstracts a layer of application execution environment on the IaaS layer computing resource, and the private cloud, the hybrid cloud and the public cloud migration are realized conveniently based on the container. For stock applications of partially traditional architecture, containerization is a challenge, often involving application modification, application splitting, and even architecture tuning. Some stock applications are in a state of stopping development, and even users are not aware of specific dependencies (system calls, dynamic libraries, inter-process calls, etc.) on applications, such traditional stock applications are difficult to migrate to application-level container platforms such as dockers by means of mirror construction, devops, etc. Some traditional stock applications are difficult to containerize at the application level, restricting migration to the modern cloud infrastructure based on containers.
Disclosure of Invention
The embodiment of the invention aims to provide a migration method of host applications based on a Linux container and a migration device of host applications based on the Linux container, so as to migrate stock applications which are difficult to be subjected to application-level containerization to the Linux container and construct a modern cloud infrastructure.
In order to solve the technical problems, the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a migration method of a host application based on a Linux container, which is applied to a system for migrating a host application based on a Linux container, where the system includes a source machine, a controller and a target machine, and is characterized in that the method includes:
deploying a Linux container cluster through the LXD in the target machine;
deploying a migration control console through the control machine, inputting login information of the source host computer at the migration control console, and creating a migration task; deploying a migration proxy service at the source host through the migration console;
creating a target Linux container through an LXD interface of the Linux container cluster;
target root file system in source machine And the data to be migrated of the application program and the application program are migrated to the target Linux container.
Optionally, the creating a migration task includes the following:
determining the catalogue of the data to be migrated and the catalogue of the data to be excluded;
configuring parameters of a target Linux container;
and configuring migration parameters.
Optionally, after the deploying, by the migration console, a migration proxy service at the source host, before the migrating the target data in the source machine to the target Linux container, the method further comprises:
evaluating a migration environment by the source host;
wherein evaluating the migration environment by the source host includes:
collecting basic resource use information of a source machine, checking the migration parameters and collecting kernel information of the source machine.
Optionally, the migrating the data to be migrated in the source machine to the target Linux container includes:
creating a mount name space and a temporary directory, mounting a data directory of a source host to the temporary directory, and masking the directory of the data to be removed in the data directory to obtain the directory of the data to be migrated;
and migrating the data to be migrated to the target Linux container through a target calling parameter.
Optionally, after the creating the mount namespace and the temporary directory, the method further comprises:
mounting a source host rootfs to the temporary directory;
the step of migrating the data to be migrated to the target Linux container through the target calling parameter comprises the following steps:
and migrating the data to be migrated to a catalog of the rootfs of the target Linux container through a target calling parameter.
Optionally, after the migration of the data to be migrated to the directory where the rootfs of the target Linux container is located through the target call parameter, the method further includes:
reporting migration state information;
and in a state that migration of the data to be migrated to the catalog of the rootfs of the target Linux container is completed through the target call parameter, issuing an ending instruction through the migration console.
Optionally, after the issuing of the end instruction by the migration console, the method further comprises:
the migration console is used for emptying target files in rootfs of the target Linux container;
and configuring a network according to the type of the operating system in the target Linux container and adjusting the configuration of the target application program.
Optionally, after the migration of the data to be migrated in the source machine to the target Linux container, the method further comprises;
executing target operation on the target Linux container;
the target operation includes the following: and adjusting the CPU memory of the target Linux container, transmitting target equipment to the target Linux container, and backing up the data in the target Linux container.
Optionally, in said source machine, a target root file system After the data to be migrated of the application program and the application program are migrated to the target Linux container, the method further comprises:
and starting the target Linux container.
In a second aspect, a migration apparatus of a host application based on a Linux container is applied to a system for migrating a host application based on a Linux container, where the system includes a source machine, a controller, and a target machine, and includes:
the first deployment module is used for deploying the Linux container cluster through the LXD in the target machine;
the second deployment module is used for deploying a migration control console through the control machine, inputting login information of the source host computer and creating a migration task at the migration control console, and deploying a migration proxy service at the source host computer through the migration control console;
the creating module is used for creating a target Linux container through the LXD interface of the Linux container cluster;
a migration module, configured to migrate a target root file system in the source machine And the data to be migrated of the application program and the application program are migrated to the target Linux container.
Optionally, the creating a migration task includes the following:
determining the catalogue of the data to be migrated and the catalogue of the data to be excluded;
configuring parameters of a target Linux container;
and configuring migration parameters.
Optionally, the device for migrating host applications based on Linux containers further comprises:
the evaluation module is used for evaluating the migration environment through the source host;
wherein evaluating the migration environment by the source host includes:
collecting basic resource use information of a source machine, checking the migration parameters and collecting kernel information of the source machine.
Optionally, the migration module is specifically configured to:
creating a mount name space and a temporary directory, mounting a data directory of a source host to the temporary directory, and masking the directory of the data to be removed in the data directory to obtain the directory of the data to be migrated;
and migrating the data to be migrated to the target Linux container through a target calling parameter.
Optionally, the device for migrating host applications based on Linux containers further comprises:
the mounting module is used for mounting the rootfs of the source host to the temporary directory;
the migration module is specifically configured to:
and migrating the data to be migrated to a catalog of the rootfs of the target Linux container through a target calling parameter.
Optionally, the device for migrating host applications based on Linux containers further comprises:
the reporting module is used for reporting migration state information;
and in a state that migration of the data to be migrated to the catalog of the rootfs of the target Linux container is completed through the target call parameter, issuing an ending instruction through the migration console.
Optionally, the device for migrating host applications based on Linux containers further comprises:
the cleaning module is used for cleaning target files in rootfs of the target Linux container through the migration console;
and the configuration module is used for configuring a network according to the type of the operating system in the target Linux container and adjusting the configuration of the target application program.
Optionally, the device for migrating host applications based on Linux containers further comprises:
the execution module is used for executing target operation on the target Linux container;
the target operation includes the following: and adjusting the CPU memory of the target Linux container, transmitting target equipment to the target Linux container, and backing up the data in the target Linux container.
Optionally, the device for migrating host applications based on Linux containers further comprises:
and the starting module is used for starting the target Linux container.
The method and the device for migrating the host application based on the Linux container have the advantages that the method and the device for migrating the host application based on the Linux container are applied to a system for migrating the host application based on the Linux container, and the system comprises a source machine,A control machine and a target machine, comprising: deploying a Linux container cluster through LXD in the target machine, deploying a migration control console through the control machine, inputting login information of the source host at the migration control console, and creating a migration task; deploying a migration proxy service on the source host through the migration console, creating a target Linux container through an LXD interface of the Linux container cluster, and enabling a target root file system in the source machine to be realized And the data to be migrated of the application program and the application program are migrated to the target Linux container. The migration console and the migration agent migrate the stock application to the Linux container, and migrate the stock application which is difficult to be containerized at the application level to the Linux container, and the Linux container is used as a bearing technology, so that the upper-layer service is convenient to arrange and manage, and the modern cloud infrastructure is constructed.
Drawings
FIG. 1 is a schematic flow chart of a migration method of a host application based on a Linux container according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a system for migrating a host application based on a Linux container according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of application migration provided in an embodiment of the present invention;
FIG. 4 is an overall flowchart of application migration provided by an embodiment of the present invention;
FIG. 5 is a schematic diagram of a Linux container, which is a service bearer technique used in an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a migration device of a host application based on a Linux container according to an embodiment of the present invention.
The achievement of the object, functional features and advantages of the present invention will be further described with reference to the embodiments, referring to the accompanying drawings.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present invention may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type, and are not limited to the number of objects, such as the first object may be one or more.
For clarity of description of the invention, the following explanation is provided for the relevant definitions mentioned in connection with the present invention:
linux Containers (LXC): the system is a user space interface of Linux kernel container function, is an operating system layer virtualization technology, uses cgroups as resource isolation, uses PID namespaces, network namespaces, mount namespaces, user namespaces and the like as process, network, file system, user and the like isolation, provides a relatively independent running environment for application software, and can be combined with SELinux, apparmor, seccomp and other technologies to serve as container security.
A Docker or the like container serves as an application-level container, and contains the necessary dependencies for software to run, one container corresponds to each application, and the application lifecycle is consistent with the container. Such application-level containers are generally used as a software release mechanism, and when service is upgraded, the newly-built container is replaced by the mirror image without service upgrading in the original container. The Linux container is used as a system-level container, and contains a complete operating system such as centos7, ubuntu20.04 and the like, and the conventional configuration management and deployment tools can be directly used for the Linux container. A user can store a plurality of services in a Linux container and use systems and the like for background process management, a single process is hung up to prevent the container from being withdrawn, the operation of restarting the virtual machine is supported, and the whole use experience is very close to that of the virtual machine.
The Linux container provides a user space interface which covers almost all container functions supported by the upstream kernel, and the interface is very low and has high use threshold. The Linux container management service (Linux container hypervisor, LXD) manages Linux containers through libraries such as liblxc, provides user-friendly command line tools and REST APIs, provides basic functions such as network management, storage pool management, image management and container snapshot, and enables users to create, update, backup, migrate and the like Linux containers through LXD, so that Linux container use is simplified. The LXD deployment supports two modes of a single node and a cluster, in the cluster mode, the LXD nodes are used for data storage through a distributed database of dqlite, and the nodes are used as members to join the LXD cluster to form a Linux container cluster.
The migration method of the host application based on the Linux container provided by the embodiment of the invention is described in detail below through specific embodiments and application scenes thereof with reference to the accompanying drawings.
Example 1
Referring to fig. 1, a flow diagram of a migration method of a host application based on a Linux container according to an embodiment of the present invention is shown.
The invention provides a migration method of host application based on Linux container, which is applied to a system of host application based on Linux container migration, the system comprises a source machine, a controller and a target machine, as shown in figure 2, which is a system schematic diagram of host application based on Linux container migration provided by the embodiment of the invention, and is composed of three parts of the source machine, the controller and the target machine, the method comprises the following steps:
s101: deploying a Linux container cluster through the LXD in the target machine;
specifically, for a target machine deployment LXD environment, a Linux container management interface is provided for migration console calls. The Linux container runs a complete operating system, and in-container services can use functions of the operating system such as process management, storage management, device management and file system management, but because the Linux container is isolated based on a naming space, rather than virtualized as a virtual machine management system, extra configuration is needed through LXD when devices such as a disk and a GPU are managed in the Linux container.
For example, fig. 3 is a schematic diagram of application migration provided by an embodiment of the present invention, where a Web service is composed of nginnx, tomcat, and Mysql, and is located on the same source host. And deploying a three-node Linux container cluster through LXD, wherein the LXD storage pool is hung on the LVM for subsequent capacity expansion, or the storage pool is built based on ZFS for disk size limitation. Linux container networks may be built based on Bridge or mac vlan technology. The container network and the host network are communicated with the plane, and interfaces such as Linux container management and the like are exposed through LXD. The set of applications is migrated to a three node Linux container cluster, where nmginx and Tomcat migrate to two Linux containers on node 1 and Mysql migrates to a Linux container on node 2.
S102: deploying a migration control console through the control machine, inputting login information of the source host computer at the migration control console, and creating a migration task; deploying a migration proxy service at the source host through the migration console;
specifically, after the Linux container cluster deployment is completed, a migration console is deployed on a control machine, SSH login information of a host computer where the Web service is located is input, and a login user needs to support the close-free root. The Linux container cluster LXD access address is configured at the migration console to manage the Linux container environment.
The source machine runs the stock application to be migrated and the migration proxy service, the stock application to be migrated receives the instruction issued by the migration console, performs full migration and increment synchronization based on technologies such as a mount namespace and rsync, inotify, and reports migration progress, logs, monitoring indexes and the like to the migration console. The migration control console collects and analyzes the application environment to be migrated, describes the whole migration process through task flows, and provides a task flow management function.
After the migration console deployment is completed, indicating that the environment preparation is completed, the application migration step is entered. First a migration task is created, e.g. at a migration console, with the user creating the migration task at application granularity. In this example, three migration tasks including nmginx, tomcat and Mysql need to be created, and the user inputs basic information of each migration task.
Optionally, the creating a migration task includes the following: and determining the catalogues of the data to be migrated and the catalogues of the data to be excluded, configuring parameters of a target Linux container, and configuring migration parameters.
Specifically, the directory of data to be migrated may be a selected directory inventory of data to be migrated, such as a default migration root file system (rootfs). If the service has data in the data directory (non-system disk), it needs to be specified. The catalog of the data to be excluded can be an exclusion specific catalog, such as migration Nginx, and Mysql installation catalog and data catalog on the same host machine need to be excluded. The parameters of the configuration target Linux container can be CPU, memory, storage size and selection target Linux container eth0 network card IP required by the configuration target Linux container. The configuration migration parameters may be migration bandwidth limitations, kernel requirements, etc.
Optionally, when the number of source hosts is plural, entering the basic information of each migration task further includes: a migration source host is specified.
And entering an application migration step, and deploying a migration proxy service and performing migration environment assessment on the source host.
S103: creating a target Linux container through an LXD interface of the Linux container cluster;
optionally, calling an LXD interface of the Linux cluster, and creating a Linux container with type as a rule and mod as a push type; such containers rootfs are empty and are dedicated to migration.
S104: target root file system in source machine And the data to be migrated of the application program and the application program are migrated to the target Linux container.
Optionally, in said source machine, a target root file system After the data to be migrated of the application program and the application program are migrated to the target Linux container, the method further comprises: and starting the target Linux container.
The embodiment of the invention migrates the stock application which is difficult to be containerized at the application level to the Linux container through the migration console and the migration agent. The Linux container is used as a bearing technology, so that the upper layer service is convenient to arrange and manage, and a modern cloud infrastructure is constructed.
In a possible embodiment, after step S103, before step S104, the method further comprises step S105:
s105: evaluating a migration environment by the source host;
wherein evaluating the migration environment by the source host includes:
collecting basic resource use information of a source machine, checking the migration parameters and collecting kernel information of the source machine.
Specifically, the basic resource use information of the source machine, such as a CPU, a memory, a bandwidth, a storage size and the like, is collected and reported to the migration console for the front end to display the resource monitoring information; checking whether the migration parameters can be correct for the data directory; and collecting the kernel information of the source machine, such as a shared host kernel of the Linux container, wherein the kernel information of the source machine is collected and fed back to a console so as to enable a user to evaluate whether the target machine kernel meets the requirements.
In one possible implementation, step S104 may be accomplished by sub-steps S1041 to S1042:
s1041: creating a mount name space and a temporary directory, mounting a data directory of a source host to the temporary directory, and masking the directory of the data to be removed in the data directory to obtain the directory of the data to be migrated;
s1042: and migrating the data to be migrated to the target Linux container through a target calling parameter.
In a possible embodiment, step S1043 may be further included after step S1041:
s1043: mounting a source host rootfs to the temporary directory;
the step of migrating the data to be migrated to the target Linux container through the target calling parameter comprises the following steps:
and migrating the data to be migrated to a catalog of the rootfs of the target Linux container through a target calling parameter.
For example, a mount namespace and a temporary directory are created, a source host rootfs and a data directory are mounted in the temporary directory in a read-only manner, masking processing is performed on the directory to be excluded under the temporary directory, rsync calling parameters are prepared, and all files under the temporary directory are copied to the directory where the target Linux container rootfs is located through rsync; for example, the target Linux container rootfs copies all files under the source host temporary directory to the target machine directory when the target Linux container rootfs is in the host directory/app/lxd/storage-pool/containers/nginx/rootfs, the content is empty, and rsync is migrated, and the files are used as the container rootfs.
In a possible implementation manner, after the migration of the data to be migrated to the directory where the rootfs of the target Linux container is located through the target call parameter, the method further includes:
reporting migration state information;
and in a state that migration of the data to be migrated to the catalog of the rootfs of the target Linux container is completed through the target call parameter, issuing an ending instruction through the migration console.
Specifically, in the migration process, migration status information may be reported, so that after the main body is migrated, real-time synchronization is performed based on rsync+inotify, and an end instruction is waited for the migration console to issue.
In a possible implementation manner, after the issuing of the end instruction by the migration console, the method further includes:
the migration console is used for emptying target files in rootfs of the target Linux container;
and configuring a network according to the type of the operating system in the target Linux container and adjusting the configuration of the target application program.
For example, before starting a Linux container, the migration console may perform some modification operations on the Linux container rootfs, including emptying/etc/fstab. As the Linux container has only one rootfs at the moment, the/etc/fstab files copied by the source machine need to be cleaned, and the container startup failure is avoided. The method can also comprise the steps of identifying the type of a Linux operating system release in a container, emptying the original network equipment configuration, preparing the network configuration according to the used container network scheme, such as using a bridge+static IP scheme, and preparing an ifcfg-eth0 network configuration file for a centos system.
In a possible embodiment, before step S104, the method further includes step S106:
s106, executing target operation on the target Linux container;
the target operation includes the following: and adjusting the CPU memory of the target Linux container, transmitting target equipment to the target Linux container, and backing up the data in the target Linux container.
Fig. 4 is an overall flowchart of application migration provided in the embodiment of the present invention, and service authentication is required after migration is completed, so as to ensure that migrated application data can be successfully run. Specifically, the Linux container uses a new IP, and only one rootfs does not have other data disk mounts, if there is a dependency in the application, some application-side configuration adjustments such as the address of the tim access Mysql need to be made, or the Linux container-side adjustments, such as hanging the host data disk into the container through LXD. After the application runs normally, a cutting point is coordinated to cut, migration is completed, and migration of the host application to the Linux container is completed.
For the application, except the configuration such as the IP address, the running environment (such as an operating system, software dependence and the like) is almost consistent with the original machine, and a user can execute target operation on the target Linux container like maintaining a host application, and maintain the application in the Linux container, such as upgrading application, directly log in the container for upgrading.
The common operation and maintenance operations can be performed on the target Linux container, and the target operations comprise:
1) CPU memory adjustment: if longitudinal expansion is needed, the CPU memory limit of the Linux container can be adjusted, the container is not required to be closed, and the Linux container takes effect dynamically;
2) And (3) equipment transparent transmission: if the user has the requirements on the equipment such as the data disk, the GPU and the like, the corresponding equipment of the host machine can be directly and thoroughly transferred to a Linux container for application;
3) Backup recovery: the user can make a granular backup of the Linux container besides making a granular backup of the application. Backing up the whole Linux container rootfs, and recovering in any Linux container environment according to the backup file;
4) Linux container migration: if a user needs to perform application cross-host and even cross-cloud migration, the migration is very convenient and quick by taking a Linux container as granularity, and the Linux container supports cold migration and criu-based hot migration.
As shown in FIG. 5, as an application operation carrier technology, compared with the operation carrier technology such as a Docker container, the Linux container is more similar to the use experience of a virtual machine, the conventional stock application can be smoothly migrated to Linux container clusters running on various clouds based on the migration scheme without modification, and the migration scheme has smoothness. And a Linux container bearing technology is used, so that the subsequent deployment architecture evolution is facilitated.
The following describes, by a specific embodiment, an overall flow of a migration method of a host application based on a Linux container according to an embodiment of the present invention:
preparing environment: preparing 3 virtual machines configured as a 16G memory, an 8-core CPU and above, and deploying a set of Linux container clusters through LXD; preparing a virtual machine with 4GB memory and 2 core CPU, and deploying a set of demo service such as Nginx+Tomcat+Mysql; preparing a virtual machine with 8GB memory and 4 core CPU, and deploying an application migration platform.
Application migration: logging in an application migration platform, inputting migration parameters, and creating migration tasks of Nginx, tomcat and Mysql; after the migration task is finished, the Linux container cluster is newly added with three Linux containers, and Nginx, tomcat and Mysql are respectively operated; logging in the Linux container, modifying the configuration of the nmginx and Tomcat, such as the service address of the back-end of the nmginx, the address of the Tomcat application accessing Mysql, and the like.
And (3) service verification: and verifying the application basic function and ending the migration task.
The embodiment of the invention migrates the stock application to the Linux container through the migration console and the migration agent, and the method smoothly migrates the traditional stock application inconvenient to be application-level containerized to the system-level container. Compared with a virtual machine, the method has the characteristics of quick start and stop, finer granularity resource isolation (easy improvement of resource utilization rate), finer granularity operation bearing (easy migration and arrangement) and the like, the Linux container is irrelevant to cloud platforms, a layer of application operation carrier can be abstracted on various cloud platforms through the Linux container, and the application can realize scene migration in private cloud, mixed cloud, public cloud and the like based on the scheme, so that smooth transition of service deployment scenes is facilitated.
Example two
Referring to fig. 6, a schematic structural diagram of a migration apparatus 60 of a host application based on a Linux container according to an embodiment of the present invention is shown.
A migration apparatus 60 for a Linux container-based host application, which is applied to a system for migrating a host application based on a Linux container, the system including a source machine, a controller, and a target machine, comprising:
a first deployment module 601, configured to deploy a Linux container cluster through LXD in the target machine;
the second deployment module 602 is configured to deploy a migration console through the control machine, enter login information of the source host at the migration console, and create a migration task, and deploy a migration proxy service at the source host through the migration console;
a creating module 603, configured to create a target Linux container through an LXD interface of the Linux container cluster;
migration module 604, configured to use the target root file system in the source machine And the data to be migrated of the application program and the application program are migrated to the target Linux container.
Optionally, the creating a migration task includes the following:
determining the catalogue of the data to be migrated and the catalogue of the data to be excluded;
configuring parameters of a target Linux container;
and configuring migration parameters.
Optionally, the device 60 for migrating a host application based on the Linux container further includes:
an evaluation module 605 for evaluating a migration environment by the source host;
wherein evaluating the migration environment by the source host includes:
collecting basic resource use information of a source machine, checking the migration parameters and collecting kernel information of the source machine.
Optionally, the migration module 604 is specifically configured to:
creating a mount name space and a temporary directory, mounting a data directory of a source host to the temporary directory, and masking the directory of the data to be removed in the data directory to obtain the directory of the data to be migrated;
and migrating the data to be migrated to the target Linux container through a target calling parameter.
Optionally, the device 60 for migrating a host application based on the Linux container further includes:
a mounting module 606, configured to mount a source host rootfs to the temporary directory;
the migration module 604 is specifically configured to:
and migrating the data to be migrated to a catalog of the rootfs of the target Linux container through a target calling parameter.
Optionally, the device for migrating host applications based on Linux containers further comprises:
a reporting module 607, configured to report migration status information;
and in a state that migration of the data to be migrated to the catalog of the rootfs of the target Linux container is completed through the target call parameter, issuing an ending instruction through the migration console.
Optionally, the device 60 for migrating a host application based on the Linux container further includes:
a cleaning module 608, configured to clean up, by using the migration console, a target file in rootfs of a target Linux container;
a configuration module 609 is configured to configure a network and adjust the configuration of the target application according to the type of the operating system in the target Linux container.
Optionally, the device 60 for migrating a host application based on the Linux container further includes:
optionally, the device 60 for migrating a host application based on the Linux container further includes:
an execution module 610, configured to execute a target operation on the target Linux container;
the target operation includes the following: and adjusting the CPU memory of the target Linux container, transmitting target equipment to the target Linux container, and backing up the data in the target Linux container.
Optionally, the device 60 for migrating a host application based on the Linux container further includes:
a starting module 611, configured to start the target Linux container.
The migration device 60 for a host application based on a Linux container provided in the embodiment of the present invention can implement each process implemented in the above method embodiment, and in order to avoid repetition, a description is omitted here.
In the embodiment of the invention, a first deployment module deploys a Linux container cluster through LXD in the target machine, a second deployment module deploys a migration console through the control machine, inputs login information of the source host and creates a migration task at the migration console, deploys migration proxy service at the source host through the migration console, and a creation module creates a target Linux container through LXD interface of the Linux container cluster, and the migration module creates a target root file system in the source machine And the data to be migrated of the application program and the application program are migrated to the target Linux container. The migration console and the migration agent migrate the stock application to the Linux container, and migrate the stock application which is difficult to be containerized at the application level to the Linux container, and the Linux container is used as a bearing technology, so that the upper-layer service is convenient to arrange and manage, and the modern cloud infrastructure is constructed.
The virtual system in the embodiment of the invention can be a device, a component in a terminal, an integrated circuit or a chip.
Furthermore, it should be noted that the above-described embodiments of the apparatus are illustrative only and are not limiting on the scope of the invention. In practical applications, those skilled in the art may select some or all modules according to actual needs to achieve the purpose of the embodiment, which is not limited herein.
In addition, technical details not described in detail in the present embodiment may refer to the migration method and apparatus for host applications based on Linux containers provided in any embodiment of the present invention, which are not described herein again.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the invention.

Claims (10)

1. A migration method of host application based on Linux container, which is applied to a system for migrating host application based on Linux container, the system comprises a source machine, a control machine and a target machine, and the method is characterized in that:
deploying a Linux container cluster through the LXD in the target machine;
deploying a migration control console through the control machine, inputting login information of the source host at the migration control console, creating a migration task, and deploying a migration proxy service at the source host through the migration control console;
creating a target Linux container through an LXD interface of the Linux container cluster;
target root file system in source machine And the data to be migrated of the application program and the application program are migrated to the target Linux container.
2. The method of claim 1, wherein creating a migration task comprises:
determining the catalogue of the data to be migrated and the catalogue of the data to be excluded;
configuring parameters of a target Linux container;
and configuring migration parameters.
3. The method of claim 1, wherein after the deploying a migration proxy service at the source host by the migration console, before the migrating target data in the source machine to the target Linux container, the method further comprises:
evaluating a migration environment by the source host;
wherein evaluating the migration environment by the source host includes:
collecting basic resource use information of a source machine, checking the migration parameters and collecting kernel information of the source machine.
4. The method of claim 2, wherein the migrating data to be migrated in the source machine to the target Linux container comprises:
creating a mount name space and a temporary directory, mounting a data directory of a source host to the temporary directory, and masking the directory of the data to be removed in the data directory to obtain the directory of the data to be migrated;
and migrating the data to be migrated to the target Linux container through a target calling parameter.
5. The method of claim 4, wherein after the creating the mount namespace and temporary directory, the method further comprises:
mounting a source host rootfs to the temporary directory;
the step of migrating the data to be migrated to the target Linux container through the target calling parameter comprises the following steps:
and migrating the data to be migrated to a catalog of the rootfs of the target Linux container through a target calling parameter.
6. The method of claim 5, wherein after the migration of the data to be migrated to the directory where the rootfs of the target Linux container is located by the target call parameter, the method further comprises:
reporting migration state information;
and in a state that migration of the data to be migrated to the catalog of the rootfs of the target Linux container is completed through the target call parameter, issuing an ending instruction through the migration console.
7. The method of claim 6, wherein after said issuing an end instruction by said migration console, said method further comprises:
the migration console is used for emptying target files in rootfs of the target Linux container;
and configuring a network according to the type of the operating system in the target Linux container and adjusting the configuration of the target application program.
8. The method of claim 1, wherein after said migrating data to be migrated in said source machine to said target Linux container, said method further comprises;
executing target operation on the target Linux container;
the target operation includes the following: and adjusting the CPU memory of the target Linux container, transmitting target equipment to the target Linux container, and backing up the data in the target Linux container.
9. The method of claim 1, wherein in said source machine is said to be said target root file system After the data to be migrated of the application program and the application program are migrated to the target Linux container, the method further comprises:
and starting the target Linux container.
10. A migration apparatus of a host application based on a Linux container, which is applied to a system for migrating a host application based on a Linux container, wherein the system comprises a source machine, a controller and a target machine, and comprises:
the first deployment module is used for deploying the Linux container cluster through the LXD in the target machine;
the second deployment module is used for deploying a migration control console through the control machine, inputting login information of the source host computer and creating a migration task at the migration control console, and deploying a migration proxy service at the source host computer through the migration control console;
the creating module is used for creating a target Linux container through the LXD interface of the Linux container cluster;
a migration module, configured to migrate a target root file system in the source machine And the data to be migrated of the application program and the application program are migrated to the target Linux container.
CN202310250069.9A 2023-03-13 2023-03-13 Method and device for migrating host application based on Linux container Pending CN116302529A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310250069.9A CN116302529A (en) 2023-03-13 2023-03-13 Method and device for migrating host application based on Linux container

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310250069.9A CN116302529A (en) 2023-03-13 2023-03-13 Method and device for migrating host application based on Linux container

Publications (1)

Publication Number Publication Date
CN116302529A true CN116302529A (en) 2023-06-23

Family

ID=86783010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310250069.9A Pending CN116302529A (en) 2023-03-13 2023-03-13 Method and device for migrating host application based on Linux container

Country Status (1)

Country Link
CN (1) CN116302529A (en)

Similar Documents

Publication Publication Date Title
JP7391862B2 (en) AUTOMATICALLY DEPLOYED INFORMATION TECHNOLOGY (IT) SYSTEMS AND METHODS
US10050850B2 (en) Rack awareness data storage in a cluster of host computing devices
US9389791B2 (en) Enhanced software application platform
US10216758B2 (en) Multi-tenant production and test deployments of Hadoop
JP5681465B2 (en) Information processing system, information processing apparatus, preparation method, program, and recording medium
US20160162317A1 (en) Configuring monitoring for virtualized servers
US9413819B1 (en) Operating system interface implementation using network-accessible services
US11822949B2 (en) Guest cluster deployed as virtual extension of management cluster in a virtualized computing system
US20070061441A1 (en) Para-virtualized computer system with I/0 server partitions that map physical host hardware for access by guest partitions
US20140007092A1 (en) Automatic transfer of workload configuration
JP2016507100A (en) Master Automation Service
JP2015534167A (en) System and method for providing a service management engine for use in a cloud computing environment
US11210132B2 (en) Virtual machine migration in virtualization environment having different virtualization systems
US11343141B2 (en) Methods and apparatus to migrate physical server hosts between virtual standard switches and virtual distributed switches in a network
CN111343219B (en) Computing service cloud platform
CN117897691A (en) Use of remote PODs in Kubernetes
JP2015526830A (en) Integrated computing platform deployed within an existing computing environment
Fenn et al. An evaluation of KVM for use in cloud computing
Childs et al. A single-computer grid gateway using virtual machines
CN116028463A (en) Method for constructing large data platform with separated storage and calculation
CN116302529A (en) Method and device for migrating host application based on Linux container
CN117389713B (en) Storage system application service data migration method, device, equipment and medium
Toimela Containerization of telco cloud applications
Tan et al. An assessment of eucalyptus version 1.4
Chen et al. Towards the automated fast deployment and clone of private cloud service: the ezilla toolkit

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