CN105630571A - Virtual machine creating method and device - Google Patents
Virtual machine creating method and device Download PDFInfo
- Publication number
- CN105630571A CN105630571A CN201410608522.XA CN201410608522A CN105630571A CN 105630571 A CN105630571 A CN 105630571A CN 201410608522 A CN201410608522 A CN 201410608522A CN 105630571 A CN105630571 A CN 105630571A
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- disk
- template
- data
- business
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明提供了一种创建虚拟机的方法及装置。其中,该方法包括:根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上;将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。通过本发明,达到了虚拟机的业务数据可以无缝衔接的效果。
The invention provides a method and device for creating a virtual machine. Wherein, the method includes: creating a first virtual machine according to the business model, wherein the business data corresponding to the business model is separately stored on a predetermined disk mounted on the first virtual machine; converting the first virtual machine into a template virtual machine, and A second virtual machine is generated according to the template virtual machine; business data is copied online from a predetermined disk to a newly created disk, and the newly created disk is mounted on the second virtual machine. Through the present invention, the effect that the service data of the virtual machine can be seamlessly connected is achieved.
Description
技术领域technical field
本发明涉及通信领域,尤其是涉及一种创建虚拟机的方法及装置。The invention relates to the communication field, in particular to a method and device for creating a virtual machine.
背景技术Background technique
目前,很多虚拟机是基于XEN、KVM等底层虚拟化技术创建的,在创建完虚拟机之后,需要为虚拟机安装对应的操作系统、常用的办公软件和业务软件等,例如部署Web服务、Oracle数据库或者Sybase数据库等。由于在一些商用的系统中,很多用户和业务数据都是动态的(即不断变化的),因此,即使在虚拟机转成虚拟机模版后,再利用此虚拟机模版创建新的虚拟机仍然是对静态数据进行拷贝。也就是说,现有技术在利用创建好的虚拟机作为虚拟机模版再次创建虚拟机的时候,缺少对现网不断更新的业务数据进行同步处理的操作。At present, many virtual machines are created based on underlying virtualization technologies such as XEN and KVM. After creating a virtual machine, it is necessary to install the corresponding operating system, common office software, and business software for the virtual machine, such as deploying Web services, Oracle Database or Sybase database, etc. Since in some commercial systems, many user and business data are dynamic (that is, constantly changing), even after the virtual machine is converted into a virtual machine template, it is still a problem to use this virtual machine template to create a new virtual machine. Copy static data. That is to say, when using the created virtual machine as a virtual machine template to recreate the virtual machine in the prior art, there is a lack of synchronous processing of the continuously updated service data of the live network.
因此,现有技术在利用模板创建虚拟机时,无法实时地同步现网不断更新的业务数据。Therefore, in the prior art, when using a template to create a virtual machine, it is impossible to synchronize the constantly updated service data of the live network in real time.
发明内容Contents of the invention
本发明的主要目的在于提供一种虚拟机创建方法及装置,以达到解决现有技术在利用模板创建虚拟机时,无法实时地同步现网不断更新的业务数据的技术问题的目的。The main purpose of the present invention is to provide a method and device for creating a virtual machine, so as to solve the technical problem that the existing technology cannot synchronize the continuously updated service data of the existing network in real time when creating a virtual machine using a template.
为了达到上述目的,根据本发明的一个方面,提供了一种虚拟机创建方法,包括:根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上;将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。In order to achieve the above object, according to one aspect of the present invention, a method for creating a virtual machine is provided, including: creating a first virtual machine according to a business model, wherein the business data corresponding to the business model is separately stored in the first virtual machine mount on the predetermined disk; convert the first virtual machine into a template virtual machine, and generate a second virtual machine based on the template virtual machine; copy the business data from the predetermined disk to the new disk online, and mount the new disk on the second on the virtual machine.
优选地,根据业务模型创建第一虚拟机包括:基于虚拟硬盘格式(VHD)的差分磁盘管理技术,将父节点作为母镜像,根据业务模型设置虚拟机规格,并根据虚拟机规格,为父节点生成一个子节点作为第一虚拟机;为第一虚拟机安装基础数据,其中,基础数据包括系统、补丁、插件以及常用软件;将业务数据单独存储在预定磁盘上,为预定磁盘分配ID标识,并将ID标识和基础数据存储在第一虚拟机的数据库或者配置文件中。Preferably, creating the first virtual machine according to the business model includes: based on the differential disk management technology of the virtual hard disk format (VHD), using the parent node as the parent image, setting the virtual machine specification according to the business model, and setting the virtual machine specification for the parent node according to the virtual machine specification. Generate a child node as the first virtual machine; install basic data for the first virtual machine, wherein the basic data includes systems, patches, plug-ins, and common software; store business data separately on a predetermined disk, assign an ID to the predetermined disk, And store the ID and basic data in the database or configuration file of the first virtual machine.
优选地,根据模板虚拟机生成第二虚拟机包括:将模板虚拟机作为模板,将父节点作为母镜像,为父节点生成一个新的子节点作为第二虚拟机。Preferably, generating the second virtual machine according to the template virtual machine includes: using the template virtual machine as a template, using the parent node as a parent image, and generating a new child node for the parent node as the second virtual machine.
优选地,将业务数据从预定磁盘上在线拷贝到新建磁盘中包括:从数据库中读取ID标识,根据ID标识查找预定磁盘的位置信息;使用位置信息从预定磁盘中对业务数据进行在线拷贝,并分配新建磁盘用于实时存储拷贝的业务数据。Preferably, online copying the service data from the predetermined disk to the new disk includes: reading the ID from the database, searching for the location information of the predetermined disk according to the ID; using the location information to copy the business data online from the predetermined disk, And allocate new disks for real-time storage of copied business data.
优选地,虚拟机规格包括:中央处理器(CPU)信息、内存信息以及网卡信息。Preferably, the virtual machine specification includes: central processing unit (CPU) information, memory information and network card information.
优选地,预定磁盘和新建磁盘的类型包括:Windows系统下的磁盘、或者Linux系统下的磁盘;业务数据包括:短信数据、彩信数据、或者智能网业务数据。Preferably, the types of the predetermined disk and the new disk include: disks under the Windows system or disks under the Linux system; service data include: SMS data, MMS data, or intelligent network service data.
根据本发明的一个方面,提供了一种虚拟机创建装置,包括:创建模块,用于根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上;第一处理模块,用于将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;第二处理模块,用于将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。According to one aspect of the present invention, a virtual machine creation device is provided, including: a creation module for creating a first virtual machine according to a business model, wherein the business data corresponding to the business model is separately stored in the first virtual machine mount on the predetermined disk; the first processing module is used to convert the first virtual machine into a template virtual machine, and generate a second virtual machine according to the template virtual machine; the second processing module is used to online copy business data from the predetermined disk to the newly created disk, and mount the newly created disk on the second virtual machine.
优选地,创建模块包括:第一处理单元,用于基于虚拟硬盘格式(VHD)的差分磁盘管理技术,将父节点作为母镜像,根据业务模型设置虚拟机规格,并根据虚拟机规格,为父节点生成一个子节点作为第一虚拟机;安装单元,用于为第一虚拟机安装基础数据,其中,基础数据包括系统、补丁、插件以及常用软件;第二处理单元,用于将业务数据单独存储在预定磁盘上,为预定磁盘分配ID标识,并将ID标识和基础数据存储在第一虚拟机的数据库或者配置文件中。Preferably, the creation module includes: a first processing unit, used for differential disk management technology based on the virtual hard disk format (VHD), using the parent node as the parent image, setting the virtual machine specification according to the business model, and according to the virtual machine specification, setting The node generates a child node as the first virtual machine; the installation unit is used to install basic data for the first virtual machine, wherein the basic data includes systems, patches, plug-ins and common software; the second processing unit is used to separate business data storing on a predetermined disk, assigning an ID to the predetermined disk, and storing the ID and basic data in the database or configuration file of the first virtual machine.
优选地,第一处理模块包括:生成单元,用于将模板虚拟机作为模板,将父节点作为母镜像,为父节点生成一个新的子节点作为第二虚拟机。Preferably, the first processing module includes: a generation unit, configured to use the template virtual machine as a template, use the parent node as a parent image, and generate a new child node for the parent node as a second virtual machine.
优选地,第二处理模块包括:第三处理单元,用于从数据库中读取ID标识,根据ID标识查找预定磁盘的位置信息;第四处理单元,用于使用位置信息从预定磁盘中对业务数据进行在线拷贝,并分配新建磁盘用于实时存储拷贝的业务数据。Preferably, the second processing module includes: a third processing unit, configured to read the ID from the database, and search for the location information of the predetermined disk according to the ID; a fourth processing unit, configured to use the location information to search for the service from the predetermined disk The data is copied online, and new disks are allocated to store the copied business data in real time.
与现有技术相比,本发明的虚拟机创建方法及装置具有如下技术效果:Compared with the prior art, the virtual machine creation method and device of the present invention have the following technical effects:
在利用模板创建虚拟机的时候,可以单独将业务数据保存在模板虚拟机挂载的业务数据磁盘中,这样在新的虚拟机创建完成后,可以实时地将不断更新的业务数据拷贝到新的虚拟机挂载的业务数据磁盘中,从而可以保证创建的虚拟机在操作系统层面的数据一致性,达到了虚拟机的业务数据可以无缝衔接的效果。When using a template to create a virtual machine, the business data can be saved separately in the business data disk mounted on the template virtual machine, so that after the new virtual machine is created, the continuously updated business data can be copied to the new virtual machine in real time. In the business data disk mounted on the virtual machine, the data consistency of the created virtual machine at the operating system level can be guaranteed, and the business data of the virtual machine can be seamlessly connected.
附图说明Description of drawings
图1是根据本发明实施例的虚拟机创建方法流程图;1 is a flowchart of a method for creating a virtual machine according to an embodiment of the present invention;
图2是根据本发明优选实施例的利用模板虚拟机创建新虚拟机情况下的虚拟机和磁盘的架构示意图;2 is a schematic diagram of the architecture of a virtual machine and a disk in the case of creating a new virtual machine using a template virtual machine according to a preferred embodiment of the present invention;
图3是根据本发明优选实施例的虚拟机转换成虚拟机模版的流程图;Fig. 3 is a flow chart of converting a virtual machine into a virtual machine template according to a preferred embodiment of the present invention;
图4是根据本发明优选实施例的利用虚拟机模版创建新虚拟机的流程图;FIG. 4 is a flowchart of creating a new virtual machine using a virtual machine template according to a preferred embodiment of the present invention;
图5是根据本发明实施例的虚拟机创建装置的结构框图;5 is a structural block diagram of an apparatus for creating a virtual machine according to an embodiment of the present invention;
图6是根据本发明优选实施例的虚拟机创建装置的示意图。Fig. 6 is a schematic diagram of an apparatus for creating a virtual machine according to a preferred embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明的一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域的普通技术人员在没有做出创造性劳动的前提下所获得的所有其它实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明实施例主要提供一种虚拟机创建方法及装置,以使能够在利用模板创建虚拟机时,可以实时地同步现网不断更新的业务数据。The embodiments of the present invention mainly provide a method and device for creating a virtual machine, so that when a template is used to create a virtual machine, the continuously updated service data of the live network can be synchronized in real time.
在对本发明实施例进行描述之前,首先对本发明实施例提供的技术方案解决其技术问题的思路作一个简单介绍:Before describing the embodiments of the present invention, first a brief introduction is made to the idea of solving the technical problems of the technical solutions provided by the embodiments of the present invention:
本发明实施例主要是从三个方面着手提出基于在线业务的虚拟机创建方案:一是根据在线业务的特点设计虚拟机的业务模型,例如在创建虚拟机时将不会变化的业务数据尽量放到单独挂载的磁盘和文件系统中。二是采用VHD的差分磁盘管理技术(一种链式的磁盘技术),这种情况下在父节点只能访问和查看数据,只有在最后的子节点才可以完成对数据的操作和管理,通过在对应的虚拟机上挂载对应的业务数据盘的方式来处理大量的业务数据。三是在根据模版创建业务虚拟机时,首先共享母镜像(也就是父节点),再重新生成子节点,从而完成虚拟机的创建,然后全量在线拷贝虚拟机挂载的业务数据盘,在此过程中,既完成了虚拟机的创建(节省了硬盘资源),同时又能够将经常变化的业务数据盘挂载到了新创建的虚拟机上,基本上解决了现有技术中利用模版创建虚拟机时只能处理静态数据(即无法实时地同步现网不断更新的业务数据)的问题,可以实时同步在线业务。而且,本发明提供的虚拟机创建方案特别适用于基于虚拟机的分布式系统,或者一些在线业务的灾备系统等。The embodiment of the present invention mainly proposes a virtual machine creation scheme based on online business from three aspects: one is to design the business model of the virtual machine according to the characteristics of the online business, for example, when creating a virtual machine, store the business data that will not change to a separately mounted disk and filesystem. The second is to use VHD's differential disk management technology (a chained disk technology). In this case, the parent node can only access and view the data, and only the last child node can complete the data operation and management. Through Mount the corresponding business data disk on the corresponding virtual machine to process a large amount of business data. The third is to create a business virtual machine based on the template, first share the parent image (that is, the parent node), and then regenerate the child nodes to complete the creation of the virtual machine, and then copy the full amount of business data disks mounted on the virtual machine online, here During the process, the creation of the virtual machine is completed (saving hard disk resources), and at the same time, the frequently changing business data disk can be mounted to the newly created virtual machine, which basically solves the problem of using templates to create virtual machines in the prior art. It can only deal with the problem of static data (that is, it cannot synchronize the continuously updated service data of the live network in real time), and it can synchronize online services in real time. Moreover, the virtual machine creation solution provided by the present invention is particularly suitable for distributed systems based on virtual machines, or disaster recovery systems for some online services.
本发明实施例提供了一种虚拟机创建方法。图1是根据本发明实施例的虚拟机创建方法流程图,如图1所示,该流程包括主要包括以下步骤(步骤S102-步骤S106):The embodiment of the present invention provides a method for creating a virtual machine. Fig. 1 is a flow chart of a method for creating a virtual machine according to an embodiment of the present invention. As shown in Fig. 1 , the process includes mainly the following steps (step S102-step S106):
步骤S102,根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上。Step S102, creating a first virtual machine according to the business model, wherein business data corresponding to the business model is separately stored on a predetermined disk mounted on the first virtual machine.
步骤S104,将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机。Step S104, converting the first virtual machine into a template virtual machine, and generating a second virtual machine according to the template virtual machine.
步骤S106,将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。Step S106, online copying the service data from the predetermined disk to the newly created disk, and mounting the newly created disk on the second virtual machine.
通过上述各个步骤,由于业务数据是与其它数据分开保存的,这样的情况下,如果现网不断产生新的业务数据,就可以实时地对这些更新的业务数据进行拷贝并保存在一个新的磁盘中,并将该新磁盘挂载到新建的虚拟机(即上述第二虚拟机)上。Through the above steps, since the service data is stored separately from other data, in this case, if the live network continuously generates new service data, these updated service data can be copied in real time and saved in a new disk , and mount the new disk to the newly created virtual machine (that is, the above-mentioned second virtual machine).
在本发明实施例的一个优选实施方式中,上述步骤S102可以采用这样的方式来实现:首先,可以基于VHD的差分磁盘管理技术,将父节点作为母镜像,根据业务模型设置虚拟机规格,并根据虚拟机规格,为父节点生成一个子节点作为虚拟机,然后,为虚拟机安装基础数据(其中,基础数据可以包括系统、补丁、插件以及常用软件),最后,将业务数据单独存储在预定磁盘上,为预定磁盘分配ID标识,并将ID标识和基础数据存储在第一虚拟机的数据库或者配置文件中。In a preferred implementation of the embodiment of the present invention, the above step S102 can be implemented in the following manner: First, based on the differential disk management technology of VHD, the parent node can be used as the parent image, and the virtual machine specification can be set according to the business model, and According to the virtual machine specification, generate a child node for the parent node as a virtual machine, then install the basic data for the virtual machine (wherein, the basic data can include systems, patches, plug-ins, and common software), and finally, store the business data separately in the predetermined On the disk, assign an ID to the predetermined disk, and store the ID and basic data in the database or configuration file of the first virtual machine.
由于业务数据是单独存储在预定磁盘上的,这样就不会与其它数据混同,以便于在对业务数据和其它数据进行不同的操作时,不会产生相互干扰。Since the service data is stored separately on the predetermined disk, it will not be mixed with other data, so that there will be no mutual interference when performing different operations on the service data and other data.
在本发明实施例的一个优选实施方式中,上述步骤S104可以采用这样的方式来实现:将模板虚拟机作为模板,将父节点作为母镜像,为父节点生成一个新的子节点作为第二虚拟机。In a preferred implementation of the embodiment of the present invention, the above step S104 can be implemented in such a way: use the template virtual machine as a template, use the parent node as the parent image, and generate a new child node for the parent node as the second virtual machine.
也就是说,第二虚拟机是以第一虚拟机为模板创建的,第二虚拟机和第一虚拟机都是父节点的子节点。That is to say, the second virtual machine is created using the first virtual machine as a template, and both the second virtual machine and the first virtual machine are child nodes of the parent node.
在本发明实施例的一个优选实施方式中,在上述步骤S106中,将业务数据从预定磁盘上在线拷贝到新建磁盘中,可以采用这样的方式:先从数据库中读取ID标识,根据ID标识查找预定磁盘的位置信息,再使用位置信息从预定磁盘中对业务数据进行在线拷贝,并分配新建磁盘用于实时存储拷贝的业务数据。In a preferred implementation of the embodiment of the present invention, in the above step S106, the service data is copied online from the predetermined disk to the newly created disk in such a way: first read the ID from the database, and then use the ID to Find the location information of the scheduled disk, then use the location information to copy the business data online from the scheduled disk, and allocate a new disk to store the copied business data in real time.
通过这样的方式,可以将第一虚拟机挂载的专用于保存业务数据的预定磁盘中拷贝出不断更新的业务数据,并保存到可以挂载到第一虚拟机的新建磁盘中,从而保证了现网业务数据的无缝衔接。In this way, the continuously updated business data can be copied from the predetermined disk mounted on the first virtual machine and dedicated to storing business data, and saved to the new disk that can be mounted to the first virtual machine, thus ensuring Seamless connection of live network service data.
在本发明实施例中,虚拟机规格可以包括:中央处理器(CPU)信息、内存信息以及网卡信息。当然,并不局限于此,在实际应用中,虚拟机的规格还可以包括其它信息,例如存储磁盘信息等。In the embodiment of the present invention, the virtual machine specification may include: central processing unit (CPU) information, memory information, and network card information. Of course, it is not limited thereto. In practical applications, the specification of the virtual machine may also include other information, such as storage disk information.
在本发明实施例中,预定磁盘和新建磁盘的类型可以包括:Windows系统下的磁盘、或者Linux系统下的磁盘,例如Windows系统下的D盘、E盘等。另外,业务数据可以包括:短信数据、彩信数据、或者智能网业务数据,当然,在实际应用中的业务数据完全不局限于此,可以包括诸如视频、语音数据等。In the embodiment of the present invention, the types of the predetermined disk and the newly created disk may include: disks under the Windows system, or disks under the Linux system, such as D disks and E disks under the Windows system. In addition, the service data may include: SMS data, MMS data, or intelligent network service data. Of course, the service data in practical applications is not limited to this at all, and may include, for example, video and voice data.
通过本发明实施例提供的上述虚拟机创建方法,能够在使用模版创建虚拟机的时候既可以共享母镜像、保证源文件的一致性(例如,升级操作补丁时只需要更新镜像文件的相关软件),还可以实时地对在线运行的业务数据进行拷贝,从而完成在线业务的无缝对接。Through the above virtual machine creation method provided by the embodiment of the present invention, when creating a virtual machine using a template, the parent image can be shared and the consistency of the source file can be guaranteed (for example, only the relevant software of the image file needs to be updated when upgrading the operation patch) , It can also copy the business data running online in real time, so as to complete the seamless connection of online business.
为了更好地理解上述实施例,以下结合图2至图4以及优选实施例对上述实施例的实现方式进行更加详细的描述和说明。以下优选实施例的实施过程主要如下:In order to better understand the above embodiments, the implementation manners of the above embodiments will be described and illustrated in more detail below in conjunction with FIGS. 2 to 4 and preferred embodiments. The implementation process of the following preferred embodiments is mainly as follows:
首先,根据业务模型创建虚拟机(即上述第一虚拟机),并在该虚拟机上面安装对应的软件等,其中比较重要的是要将对应的业务数据全部放在该虚拟机挂载的磁盘上(尽量保证业务数据存放在独立的磁盘中,即上述预定磁盘),并对该虚拟机挂载的磁盘进行特殊的标识(即上述ID标识),一般情况下,有关虚拟机的数据可以存放在数据库或者配置文件中,因此可以将该ID标识也存放在创建的虚拟机(即上述第一虚拟机)的数据库或配置文件中。在完成虚拟机创建之后,就可以将该虚拟机(第一虚拟机)转换成模版虚拟机。First, create a virtual machine (that is, the above-mentioned first virtual machine) according to the business model, and install corresponding software on the virtual machine, among which it is more important to put all the corresponding business data on the disk mounted on the virtual machine (Try to ensure that the business data is stored in an independent disk, that is, the above-mentioned predetermined disk), and carry out a special identification of the disk mounted on the virtual machine (that is, the above-mentioned ID identification). Generally, the data related to the virtual machine can be stored In the database or configuration file, therefore, the ID can also be stored in the database or configuration file of the created virtual machine (that is, the above-mentioned first virtual machine). After the creation of the virtual machine is completed, the virtual machine (the first virtual machine) can be converted into a template virtual machine.
然后,利用VHD的差分磁盘管理技术,在利用转换成的虚拟机模版进行新的虚拟机创建时可以共享母镜像,同时根据母镜像生成新的子节点,至此,已经完成了基本的利用模版创建虚拟机的流程。Then, using the differential disk management technology of VHD, when using the converted virtual machine template to create a new virtual machine, the parent image can be shared, and a new child node can be generated based on the parent image. So far, the basic template creation has been completed. The process of the virtual machine.
在这之后,可以根据相关的配置信息,在线拷贝相关的业务数据到新的挂载盘中,并将此挂载盘挂载到新创建的虚拟机上,从而完成了整个业务盘的拷贝工作。After that, you can copy the relevant business data online to the new mount disk according to the relevant configuration information, and mount the mount disk to the newly created virtual machine, thus completing the copying of the entire business disk .
最后,启动新创建的虚拟机,也就完成了整个基于在线业务的虚拟机的创建和运行过程。Finally, starting the newly created virtual machine completes the creation and running process of the entire online service-based virtual machine.
请参考图2,图2是根据本发明优选实施例的利用模板虚拟机创建新虚拟机情况下的虚拟机和磁盘的架构示意图,图2中的父节点为母镜像(也就是所有的根据该模版创建虚拟机所用的数据盘),在利用该父亲节点创建虚拟机时都会新生成的一个子节点,一个父节点下面可以挂载多个子节点,子节点为虚拟机独立运行的空间,其中,每个子节点(即每个虚拟机)可以挂载自己的磁盘(例如,Windows系统的D盘、E盘等),在这些虚拟机挂载的数据盘上面可以装载自己的业务(例如,短信、彩信等)。挂载盘承担业务节点的功能包括对所有数据的操作,例如,数据库开户新增和删除的操作的数据所对应的磁盘空间都需要在挂载的磁盘上进行。Please refer to FIG. 2. FIG. 2 is a schematic diagram of the architecture of a virtual machine and a disk in the case of using a template virtual machine to create a new virtual machine according to a preferred embodiment of the present invention. The parent node in FIG. The data disk used to create a virtual machine from the template), a child node will be newly generated when the parent node is used to create a virtual machine, and multiple child nodes can be mounted under a parent node, and the child node is the space for the virtual machine to run independently. Among them, Each child node (that is, each virtual machine) can mount its own disk (for example, D drive, E drive, etc. of the Windows system), and its own business (for example, SMS, MMS, etc.). The mounted disk assumes the functions of the business node, including operations on all data. For example, the disk space corresponding to the data of database account opening and deletion operations needs to be performed on the mounted disk.
同时,还可以通过数据库和配置文件都可以为对应的磁盘做标识,之后在通过模版创建虚拟机的时候,可以通过该标识在线全盘拷贝全部数据。At the same time, you can identify the corresponding disk through both the database and the configuration file, and then when creating a virtual machine through the template, you can use this identification to copy all the data online.
由此可见,该架构的最大优点是:父节点可以提供共享母盘数据,而且数据不能轻易修改,这种方式即能节省数据空间,又能够保证操作系统等层面的数据一致性。同时,在操作系统等需要升级的时候,也能够将该模版转成虚拟机,然后升级相关的插件、补丁等,升级后可以同时被所有的子节点使用。It can be seen that the biggest advantage of this architecture is that the parent node can provide shared master disk data, and the data cannot be easily modified. This method can not only save data space, but also ensure data consistency at the operating system and other levels. At the same time, when the operating system needs to be upgraded, the template can also be converted into a virtual machine, and then related plug-ins, patches, etc. can be upgraded. After the upgrade, it can be used by all child nodes at the same time.
图3是根据本发明优选实施例的虚拟机转换成虚拟机模版的流程图,如图3所示,该流程大致包括以下步骤:Fig. 3 is a flow chart of converting a virtual machine into a virtual machine template according to a preferred embodiment of the present invention. As shown in Fig. 3, the process roughly includes the following steps:
步骤S302,创建普通虚拟机。Step S302, creating a common virtual machine.
步骤S304,为虚拟机安装操作系统、补丁、常用软件等基本数据。Step S304, installing basic data such as an operating system, patches, and commonly used software for the virtual machine.
步骤S306,为虚拟机挂载业务盘并在数据库和配置文件中对业务盘标识。Step S306, mount the service disk for the virtual machine and identify the service disk in the database and the configuration file.
步骤S308,在业务盘中加载业务数据。Step S308, loading business data into the business disk.
步骤S310,将虚拟机转为模版。Step S310, converting the virtual machine into a template.
具体地,虚拟机转换成模板虚拟机的流程可以这样实现:Specifically, the process of converting a virtual machine into a template virtual machine can be implemented as follows:
首先,根据业务设置虚拟机规格(例如,4核CPU、4G内存、网卡等相关信息),创建完裸的虚拟机再安装对应的补丁包、插件以及常用的工具软件等。此时,也就完成了虚拟机基础数据的处理过程。First, set the virtual machine specifications (for example, 4-core CPU, 4G memory, network card and other related information) according to the business, create a bare virtual machine, and then install the corresponding patch packages, plug-ins, and commonly used tool software. At this point, the processing of the basic data of the virtual machine is completed.
然后,在此基础上为创建好的虚拟机挂载相关的虚拟机磁盘,并将该磁盘对应ID唯一标识的数据保存在数据库或者配置文件中,以便在数据恢复过程中使用。Then, on this basis, mount the relevant virtual machine disk for the created virtual machine, and save the data uniquely identified by the corresponding ID of the disk in the database or configuration file, so as to be used in the data recovery process.
最后,在该虚拟机挂载的磁盘中可以挂载对应的业务数据,启动业务数据后就可以将该虚拟机作为正常的服务器或者客户机使用。同时,在该虚拟机装成模版时,除了需要保留该虚拟机对应的配置文件和存储信息外,还需要保留该虚拟机对应挂载磁盘的ID和位置信息。Finally, the corresponding business data can be mounted on the disk mounted on the virtual machine, and the virtual machine can be used as a normal server or client after the business data is started. At the same time, when the virtual machine is installed as a template, in addition to keeping the configuration file and storage information corresponding to the virtual machine, it is also necessary to keep the ID and location information of the corresponding mounted disk of the virtual machine.
图4是根据本发明优选实施例的利用虚拟机模版创建新虚拟机的流程图,如图4所示,该流程大致包括以下步骤:Fig. 4 is a flow chart of using a virtual machine template to create a new virtual machine according to a preferred embodiment of the present invention. As shown in Fig. 4, the process roughly includes the following steps:
步骤S402,在已经创建的虚拟机的镜像节点上创建新的子节点作为新的虚拟机。Step S402, creating a new child node as a new virtual machine on the mirror node of the created virtual machine.
步骤S404,从数据库中读取磁盘配置信息。Step S404, reading disk configuration information from the database.
步骤S406,将磁盘中的业务数据通过快照等方式全量拷贝到新的磁盘中。Step S406, copying all the business data in the disk to the new disk by means of snapshot or the like.
步骤S408,将新磁盘挂载新的虚拟机上。Step S408, mount the new disk on the new virtual machine.
步骤S410,启动新的虚拟机。Step S410, start a new virtual machine.
具体地,利用虚拟机模版创建新虚拟机的流程可以这样实现:Specifically, the process of creating a new virtual machine using a virtual machine template can be implemented as follows:
首先,在原来的虚拟机母节点上拉出新的子节点,同时根据母节点的虚拟机配置文件等生成新的虚拟机(此过程为正常的模版创建虚拟机的流程)。First, a new child node is pulled from the original virtual machine parent node, and a new virtual machine is generated according to the virtual machine configuration file of the parent node (this process is a process of creating a virtual machine from a normal template).
然后,根据数据库中相关磁盘挂载的ID等数据,找到之前虚拟机在线运行的磁盘位置,据此进行在线的全部数据拷贝等操作。Then, according to the data such as the ID mounted on the relevant disk in the database, find the disk location where the virtual machine was running online before, and perform online operations such as copying all data based on this.
最后,在新拷贝的磁盘完成之后,将该磁盘挂载到新创建的虚拟机上,进而完成整个模版创建虚拟机的过程。Finally, after the newly copied disk is completed, mount the disk to the newly created virtual machine, and then complete the process of creating the virtual machine from the entire template.
对应于上述实施例提供的虚拟机创建方法,本发明实施例还提供了一种虚拟机创建装置。Corresponding to the method for creating a virtual machine provided in the foregoing embodiments, an embodiment of the present invention further provides an apparatus for creating a virtual machine.
图5是根据本发明实施例的虚拟机创建装置的结构框图,如图5所示,该虚拟机创建装置主要包括:创建模块10,用于根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上;第一处理模块20,用于将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;第二处理模块30,用于将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。Fig. 5 is a structural block diagram of a virtual machine creation device according to an embodiment of the present invention. As shown in Fig. 5, the virtual machine creation device mainly includes: a creation module 10 for creating a first virtual machine according to a business model, wherein The business data of the business model is separately stored on a predetermined disk mounted on the first virtual machine; the first processing module 20 is configured to convert the first virtual machine into a template virtual machine, and generate a second virtual machine according to the template virtual machine; The second processing module 30 is configured to online copy business data from a predetermined disk to a newly created disk, and mount the newly created disk on the second virtual machine.
在图5所示的虚拟机创建装置的基础上,本发明优选实施例还提供了一种虚拟机创建装置。On the basis of the device for creating a virtual machine shown in FIG. 5 , a preferred embodiment of the present invention further provides a device for creating a virtual machine.
图6是根据本发明优选实施例的虚拟机创建装置的示意图,如图6所示,在该虚拟机创建装置中:FIG. 6 is a schematic diagram of a virtual machine creation device according to a preferred embodiment of the present invention. As shown in FIG. 6, in the virtual machine creation device:
创建模块10可以进一步包括:第一处理单元12,用于基于虚拟硬盘格式(VHD)的差分磁盘管理技术,将父节点作为母镜像,根据业务模型设置虚拟机规格,并根据虚拟机规格,为父节点生成一个子节点作为虚拟机;安装单元14,用于为虚拟机安装基础数据,其中,基础数据包括系统、补丁、插件以及常用软件;第二处理单元16,用于将业务数据单独存储在预定磁盘上,为预定磁盘分配ID标识,并将ID标识和基础数据存储在第一虚拟机的数据库中。The creation module 10 may further include: a first processing unit 12, which is used for differential disk management technology based on the virtual hard disk format (VHD), uses the parent node as the parent image, sets the virtual machine specification according to the business model, and according to the virtual machine specification, for The parent node generates a child node as a virtual machine; the installation unit 14 is used to install basic data for the virtual machine, wherein the basic data includes systems, patches, plug-ins and common software; the second processing unit 16 is used to store business data separately On the predetermined disk, assign an ID to the predetermined disk, and store the ID and basic data in the database of the first virtual machine.
第一处理模块20可以进一步包括:生成单元22,用于将模板虚拟机作为模板,将父节点作为母镜像,为父节点生成一个新的子节点作为第二虚拟机。The first processing module 20 may further include: a generation unit 22 configured to use the template virtual machine as a template, use the parent node as a parent image, and generate a new child node for the parent node as a second virtual machine.
第二处理模块30可以进一步包括:第三处理单元32,用于从数据库中读取ID标识,根据ID标识查找预定磁盘的位置信息;第四处理单元34,用于使用位置信息从预定磁盘中对业务数据进行在线拷贝,并分配新建磁盘用于实时存储拷贝的业务数据。The second processing module 30 may further include: a third processing unit 32, configured to read the ID from the database, and search for the location information of the predetermined disk according to the ID; a fourth processing unit 34, configured to use the location information from the predetermined disk. Copy business data online, and allocate new disks for real-time storage of copied business data.
通过上述实施例或优选实施例,既可以保证虚拟机在系统等层面的基本数据的一致性,同时又可以保证在需要进行同步升级的时候能够针对现网业务数据做到单点升级(不影响其它数据),可以适用于所有其它在线业务节点。而且,通过实际的性能测试和用户反馈的结果来看,本发明提供的虚拟机创建方法,能够很好地满足用户的利用模板虚拟机创建业务虚拟机的要求。Through the above embodiments or preferred embodiments, the consistency of the basic data of the virtual machine at the system level and other levels can be guaranteed, and at the same time, it can be guaranteed that a single-point upgrade can be performed for the existing network service data when synchronous upgrade is required (without affecting Other data), can be applied to all other online business nodes. Moreover, according to the results of the actual performance test and user feedback, the method for creating a virtual machine provided by the present invention can well meet the user's requirement of using a template virtual machine to create a service virtual machine.
以上所述是本发明的优选实施方式,应当指出,对于本领域的普通技术人员来说,在不脱离本发明所述原理的前提下,还可以作出若干改进和润饰,这些改进和润饰也应视为包含在本发明的保护范围之内。The above description is a preferred embodiment of the present invention, it should be pointed out that for those skilled in the art, without departing from the principle of the present invention, some improvements and modifications can also be made, and these improvements and modifications should also be It is deemed to be included within the protection scope of the present invention.
Claims (10)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410608522.XA CN105630571A (en) | 2014-10-31 | 2014-10-31 | Virtual machine creating method and device |
| PCT/CN2015/084352 WO2016065956A1 (en) | 2014-10-31 | 2015-07-17 | Method and device for creating virtual machine |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410608522.XA CN105630571A (en) | 2014-10-31 | 2014-10-31 | Virtual machine creating method and device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN105630571A true CN105630571A (en) | 2016-06-01 |
Family
ID=55856565
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201410608522.XA Pending CN105630571A (en) | 2014-10-31 | 2014-10-31 | Virtual machine creating method and device |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN105630571A (en) |
| WO (1) | WO2016065956A1 (en) |
Cited By (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106201654A (en) * | 2016-06-30 | 2016-12-07 | 国云科技股份有限公司 | A Rescue Method for Virtual Machine System |
| CN106528263A (en) * | 2016-10-21 | 2017-03-22 | 郑州云海信息技术有限公司 | A method for injecting metainformation into virtual machines and performing initialization in a virtualization environment |
| CN106610864A (en) * | 2017-01-01 | 2017-05-03 | 国云科技股份有限公司 | A method for detecting integrity of virtual machine clone |
| CN106775946A (en) * | 2016-12-16 | 2017-05-31 | 无锡华云数据技术服务有限公司 | A kind of virtual machine Method of Creation Process |
| CN106934554A (en) * | 2017-03-20 | 2017-07-07 | 广东电网有限责任公司电力调度控制中心 | The implementation method and device of mirror-image system in a kind of intelligent scheduling automated system |
| CN107643941A (en) * | 2017-10-12 | 2018-01-30 | 郑州云海信息技术有限公司 | The method and apparatus that virtual machine is managed in cloud data system |
| CN107807840A (en) * | 2016-09-09 | 2018-03-16 | 阿里巴巴集团控股有限公司 | A kind of equipment direction connection method and device applied to virtual machine network |
| CN107995319A (en) * | 2018-01-08 | 2018-05-04 | 迈普通信技术股份有限公司 | Virtual unit collocation method and the network equipment |
| CN111767114A (en) * | 2019-12-10 | 2020-10-13 | 北京京东尚科信息技术有限公司 | Method and apparatus for creating cloud host, computer system and readable storage medium |
| CN119376650A (en) * | 2024-12-27 | 2025-01-28 | 苏州元脑智能科技有限公司 | A data migration method, device, product, equipment and medium |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103051687A (en) * | 2012-12-10 | 2013-04-17 | 浪潮(北京)电子信息产业有限公司 | System and method for deploying application service to cloud-storage virtual machine |
| CN103309763A (en) * | 2013-07-04 | 2013-09-18 | 曙光信息产业(北京)有限公司 | Method and device for protection of fault-tolerant mechanism of virtual machine |
| CN103605570A (en) * | 2013-11-18 | 2014-02-26 | 浪潮(北京)电子信息产业有限公司 | Automatic application deployment method and system based on virtual machine template |
| CN103685408A (en) * | 2012-09-18 | 2014-03-26 | 英业达科技有限公司 | Server for providing reading base mirror by storage area network, host and method |
| CN103761168A (en) * | 2014-01-26 | 2014-04-30 | 上海爱数软件有限公司 | Method for mounting backup virtual machine based on nfs volume |
| CN103970908A (en) * | 2014-05-28 | 2014-08-06 | 浪潮电子信息产业股份有限公司 | Virtual machine template IVF storage method |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9665356B2 (en) * | 2012-01-31 | 2017-05-30 | Red Hat, Inc. | Configuration of an application in a computing platform |
-
2014
- 2014-10-31 CN CN201410608522.XA patent/CN105630571A/en active Pending
-
2015
- 2015-07-17 WO PCT/CN2015/084352 patent/WO2016065956A1/en not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103685408A (en) * | 2012-09-18 | 2014-03-26 | 英业达科技有限公司 | Server for providing reading base mirror by storage area network, host and method |
| CN103051687A (en) * | 2012-12-10 | 2013-04-17 | 浪潮(北京)电子信息产业有限公司 | System and method for deploying application service to cloud-storage virtual machine |
| CN103309763A (en) * | 2013-07-04 | 2013-09-18 | 曙光信息产业(北京)有限公司 | Method and device for protection of fault-tolerant mechanism of virtual machine |
| CN103605570A (en) * | 2013-11-18 | 2014-02-26 | 浪潮(北京)电子信息产业有限公司 | Automatic application deployment method and system based on virtual machine template |
| CN103761168A (en) * | 2014-01-26 | 2014-04-30 | 上海爱数软件有限公司 | Method for mounting backup virtual machine based on nfs volume |
| CN103970908A (en) * | 2014-05-28 | 2014-08-06 | 浪潮电子信息产业股份有限公司 | Virtual machine template IVF storage method |
Cited By (14)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106201654A (en) * | 2016-06-30 | 2016-12-07 | 国云科技股份有限公司 | A Rescue Method for Virtual Machine System |
| CN107807840A (en) * | 2016-09-09 | 2018-03-16 | 阿里巴巴集团控股有限公司 | A kind of equipment direction connection method and device applied to virtual machine network |
| CN107807840B (en) * | 2016-09-09 | 2022-01-25 | 阿里巴巴集团控股有限公司 | Equipment direct connection method and device applied to virtual machine network |
| CN106528263A (en) * | 2016-10-21 | 2017-03-22 | 郑州云海信息技术有限公司 | A method for injecting metainformation into virtual machines and performing initialization in a virtualization environment |
| CN106528263B (en) * | 2016-10-21 | 2019-08-02 | 郑州云海信息技术有限公司 | The method injecting metamessage to virtual machine in virtualized environment and being initialized |
| CN106775946A (en) * | 2016-12-16 | 2017-05-31 | 无锡华云数据技术服务有限公司 | A kind of virtual machine Method of Creation Process |
| CN106610864A (en) * | 2017-01-01 | 2017-05-03 | 国云科技股份有限公司 | A method for detecting integrity of virtual machine clone |
| CN106934554A (en) * | 2017-03-20 | 2017-07-07 | 广东电网有限责任公司电力调度控制中心 | The implementation method and device of mirror-image system in a kind of intelligent scheduling automated system |
| CN107643941A (en) * | 2017-10-12 | 2018-01-30 | 郑州云海信息技术有限公司 | The method and apparatus that virtual machine is managed in cloud data system |
| CN107995319A (en) * | 2018-01-08 | 2018-05-04 | 迈普通信技术股份有限公司 | Virtual unit collocation method and the network equipment |
| CN107995319B (en) * | 2018-01-08 | 2021-05-18 | 迈普通信技术股份有限公司 | Virtual device configuration method and network device |
| CN111767114A (en) * | 2019-12-10 | 2020-10-13 | 北京京东尚科信息技术有限公司 | Method and apparatus for creating cloud host, computer system and readable storage medium |
| CN111767114B (en) * | 2019-12-10 | 2024-04-05 | 北京京东尚科信息技术有限公司 | Method and device for creating cloud host, computer system and readable storage medium |
| CN119376650A (en) * | 2024-12-27 | 2025-01-28 | 苏州元脑智能科技有限公司 | A data migration method, device, product, equipment and medium |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2016065956A1 (en) | 2016-05-06 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN105630571A (en) | Virtual machine creating method and device | |
| CN108809722B (en) | Method, device and storage medium for deploying Kubernetes cluster | |
| CN107580083B (en) | Method and system for allocating container IP addresses | |
| CN102594849B (en) | Data backup and recovery method and device, virtual machine snapshot deleting and rollback method and device | |
| US20200081731A1 (en) | Method, system and apparatus for creating virtual machine | |
| CN102955845B (en) | Data access method, device and distributed data base system | |
| US20220357981A1 (en) | Migrating the runtime state of a container between two nodes | |
| CN104572274A (en) | Cross-cloud-point migration system and method | |
| US20180343300A1 (en) | Methods and apparatus to perform data migration in a distributed environment | |
| CN104852965B (en) | A kind of user account project management method and system | |
| CN106339177A (en) | Method and device for creating virtual machines | |
| CN103164525B (en) | WEB application dissemination method and device | |
| CN104281484B (en) | A kind of virtual machine migration method and device | |
| CN104468734A (en) | A Cloning-Based Virtual Cluster Expansion Method | |
| CN104506635A (en) | Fast and efficient cloud mainframe creating and matching method and system | |
| CN113708954B (en) | Network switching method and device, electronic equipment and storage medium | |
| CN105635311A (en) | Method for synchronizing resource pool information in cloud management platform | |
| CN114546725A (en) | Cross-cluster backup method, system, medium and electronic device for stateful application | |
| CN107729515B (en) | Data synchronization method, device and storage medium | |
| CN103207805A (en) | Virtualization-based hard disk reuse system | |
| CN106209445A (en) | A kind of Visualized data centre by network design | |
| CN110413378A (en) | A method and system for creating computing resources under cloud computing | |
| CN108345496A (en) | A kind of method and device of operation application program | |
| CN115480910A (en) | Multi-cluster resource management method and device and electronic equipment | |
| CN108984276A (en) | A kind of host migration method and apparatus |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| WD01 | Invention patent application deemed withdrawn after publication | ||
| WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20160601 |