CN108076078A - A kind of cloud host creation method, device and cloud service system - Google Patents
A kind of cloud host creation method, device and cloud service system Download PDFInfo
- Publication number
- CN108076078A CN108076078A CN201610983593.7A CN201610983593A CN108076078A CN 108076078 A CN108076078 A CN 108076078A CN 201610983593 A CN201610983593 A CN 201610983593A CN 108076078 A CN108076078 A CN 108076078A
- Authority
- CN
- China
- Prior art keywords
- target
- node
- image file
- cache
- cache node
- 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
-
- 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明实施例公开了一种云主机创建方法、装置及云服务系统。该方法应用于云服务系统中的目标计算节点,包括:接收针对目标云主机的创建指令;判断本地是否保存有创建目标云主机所需的目标镜像文件;若未保存,从缓存节点中确定目标缓存节点;向目标缓存节点发送获取目标镜像文件的第一请求;接收目标缓存节点根据第一请求反馈的目标信息;判断目标信息是否为目标镜像文件;若为是,根据目标镜像文件创建目标云主机;若为否,向镜像节点发送获取目标镜像文件的第二请求;接收镜像节点根据第二请求反馈的目标镜像文件;根据目标镜像文件创建目标云主机。本发明实施例可以减小镜像文件的拉取时间,缩短云主机的创建时间。
The embodiment of the invention discloses a cloud host creation method, device and cloud service system. The method is applied to the target computing node in the cloud service system, including: receiving the creation instruction for the target cloud host; judging whether the target image file required to create the target cloud host is saved locally; if not saved, determining the target from the cache node Cache node; send the first request to obtain the target image file to the target cache node; receive the target information fed back by the target cache node according to the first request; judge whether the target information is the target image file; if yes, create the target cloud according to the target image file Host; if not, send a second request to the mirror node for obtaining the target mirror file; receive the target mirror file fed back by the mirror node according to the second request; create a target cloud host according to the target mirror file. The embodiment of the present invention can reduce the pulling time of the image file and shorten the creation time of the cloud host.
Description
技术领域technical field
本发明涉及虚拟化技术领域,特别涉及一种云主机创建方法、装置及云服务系统。The present invention relates to the technical field of virtualization, in particular to a cloud host creation method, device and cloud service system.
背景技术Background technique
在云计算技术中,云主机是通过虚拟化技术在一台物理机器上模拟出的多个类似独立主机的部分,它们共享一个物理机器的硬件资源,其中,物理机器也可称为宿主机。随着虚拟化技术的普及和商业化,越来越多的用户需要在宿主机上创建云主机来提高宿主机的利用率。In cloud computing technology, a cloud host is a plurality of parts similar to independent hosts simulated on a physical machine through virtualization technology, and they share the hardware resources of a physical machine. The physical machine can also be called a host. With the popularization and commercialization of virtualization technology, more and more users need to create cloud hosts on host machines to improve the utilization rate of host machines.
例如,OpenStack(云计算管理平台)架构中,在一台宿主机上创建一台云主机时,首先需要获得该云主机的系统盘镜像文件,在获得上述系统盘镜像文件后,宿主机才可以根据该镜像文件来创建云主机。For example, in the OpenStack (cloud computing management platform) architecture, when creating a cloud host on a host machine, you first need to obtain the system disk image file of the cloud host. After obtaining the above system disk image file, the host machine can Create a cloud host based on the image file.
具体的,获得上述系统盘镜像文件时,如果宿主机中保存有云主机对应的镜像文件,则直接将该宿主机中保存的镜像文件拷贝为该云主机的系统盘镜像文件;如果该宿主机中未保存该云主机对应的镜像文件,则需要通过OpenStack架构中的Glance服务器来拉取上述系统盘镜像文件。其中,Glance服务器用于提供OpenStack的镜像服务,用来注册、登陆和检索虚拟机镜像。Specifically, when the above-mentioned system disk image file is obtained, if the image file corresponding to the cloud host is stored in the host machine, the image file stored in the host machine is directly copied as the system disk image file of the cloud host machine; if the host machine If the image file corresponding to the cloud host is not saved in the cloud host, you need to pull the above system disk image file through the Glance server in the OpenStack architecture. Among them, the Glance server is used to provide the image service of OpenStack, and is used to register, log in and retrieve the virtual machine image.
通常情况下,应用上述方式可以成功创建云主机,但是当并发创建大批量云主机、且宿主机上均无云主机对应的系统盘镜像文件时,宿主机将大量访问Glance服务器来拉取对应的镜像文件,导致Glance服务器的压力较大,镜像文件的拉取时间较长,使得大批量云主机的创建时间延长甚至创建时间不可控。Normally, cloud hosts can be successfully created by applying the above methods, but when a large number of cloud hosts are created concurrently and there is no system disk image file corresponding to the cloud host on the host machine, the host machine will access the Glance server in large numbers to pull the corresponding Image files lead to high pressure on the Glance server, and the pull time of image files is longer, which makes the creation time of a large number of cloud hosts longer or even uncontrollable.
发明内容Contents of the invention
本发明实施例的目的在于提供一种云主机创建方法、装置及云服务系统,以实现镜像文件的高并发下载,减小镜像文件的拉取时间,缩短云主机的创建时间。具体技术方案如下:The purpose of the embodiments of the present invention is to provide a cloud host creation method, device and cloud service system, so as to realize high concurrent downloading of image files, reduce the pull time of image files, and shorten the creation time of cloud hosts. The specific technical scheme is as follows:
为达到上述目的,本发明实施例公开了一种云主机创建方法,应用于云服务系统中的目标计算节点,其中,所述云服务系统包括:计算节点、提供数据缓存服务的缓存节点、提供云主机镜像服务的镜像节点,所述方法包括:In order to achieve the above purpose, the embodiment of the present invention discloses a method for creating a cloud host, which is applied to a target computing node in a cloud service system, wherein the cloud service system includes: a computing node, a cache node providing data caching services, providing A mirror node of cloud host mirror service, the method includes:
接收针对目标云主机的创建指令;Receive creation instructions for the target cloud host;
判断本地是否保存有目标镜像文件,其中,所述目标镜像文件为创建所述目标云主机所需的镜像文件;Judging whether there is a target image file stored locally, wherein the target image file is an image file required for creating the target cloud host;
若未保存,从所述缓存节点中确定目标缓存节点;If not saved, determine the target cache node from the cache nodes;
向所述目标缓存节点发送获取所述目标镜像文件的第一请求;sending a first request for obtaining the target image file to the target cache node;
接收所述目标缓存节点根据所述第一请求反馈的目标信息;receiving target information fed back by the target cache node according to the first request;
判断所述目标信息是否为所述目标镜像文件;judging whether the target information is the target image file;
若为是,根据所述目标镜像文件创建所述目标云主机;If yes, create the target cloud host according to the target image file;
若为否,向所述镜像节点发送获取所述目标镜像文件的第二请求;接收所述镜像节点根据所述第二请求反馈的所述目标镜像文件;根据所述目标镜像文件创建所述目标云主机。If not, send a second request for obtaining the target image file to the mirror node; receive the target mirror file fed back by the mirror node according to the second request; create the target according to the target mirror file cloud host.
可选的,所述缓存节点包括:主缓存节点和所述主缓存节点对应的从缓存节点,所述从缓存节点缓存的镜像文件与所述主缓存节点缓存的镜像文件相同;Optionally, the cache node includes: a primary cache node and a secondary cache node corresponding to the primary cache node, where the image file cached by the secondary cache node is the same as the image file cached by the primary cache node;
所述从所述缓存节点中确定目标缓存节点的步骤,包括:The step of determining the target cache node from the cache nodes includes:
根据预设的计算节点与缓存节点的关联关系,从所述缓存节点中确定目标缓存节点。According to the preset association relationship between computing nodes and cache nodes, the target cache node is determined from the cache nodes.
可选的,所述预设的计算节点与缓存节点的关联关系,按照以下方式生成:Optionally, the preset association relationship between computing nodes and cache nodes is generated in the following manner:
根据缓存节点的数量N,确定各个缓存节点的序号,其中,所述序号为[0,N-1]区间的整数,任意两个缓存节点的序号均不相同;According to the number N of cache nodes, determine the sequence number of each cache node, wherein the sequence number is an integer in the interval [0, N-1], and the sequence numbers of any two cache nodes are different;
计算各个计算节点的标识信息的目标哈希值H;Calculate the target hash value H of the identification information of each computing node;
按照以下表达式计算各个计算节点对应的目标取模值M:Calculate the target modulo value M corresponding to each computing node according to the following expression:
M=mod(H,N);M=mod(H,N);
对于每一计算节点,确定序号与该计算节点的目标取模值相同的缓存节点,建立该计算节点与所确定缓存节点之间的关联关系。For each computing node, determine the cache node whose sequence number is the same as the target modulo value of the computing node, and establish an association relationship between the computing node and the determined cache node.
为达到上述目的,本发明实施例还公开了一种云主机创建装置,应用于云服务系统中的目标计算节点,其中,所述云服务系统包括:计算节点、提供数据缓存服务的缓存节点、提供云主机镜像服务的镜像节点,所述装置包括:To achieve the above purpose, the embodiment of the present invention also discloses a cloud host creation device, which is applied to a target computing node in a cloud service system, wherein the cloud service system includes: a computing node, a cache node providing data caching services, A mirror node that provides cloud host mirror service, the device includes:
第一接收模块,用于接收针对目标云主机的创建指令;The first receiving module is used to receive the creation instruction for the target cloud host;
第一判断模块,用于判断本地是否保存有目标镜像文件,其中,所述目标镜像文件为创建所述目标云主机所需的镜像文件;The first judging module is used to judge whether there is a target image file stored locally, wherein the target image file is an image file required for creating the target cloud host;
确定模块,用于在所述第一判断模块判断出本地未保存所述目标镜像文件时,从所述缓存节点中确定目标缓存节点;A determination module, configured to determine the target cache node from the cache nodes when the first determination module determines that the target image file is not saved locally;
发送模块,用于向所述目标缓存节点发送获取所述目标镜像文件的第一请求;A sending module, configured to send a first request for acquiring the target image file to the target cache node;
第二接收模块,用于接收所述目标缓存节点根据所述第一请求反馈的目标信息;A second receiving module, configured to receive target information fed back by the target cache node according to the first request;
第二判断模块,用于判断所述目标信息是否为所述目标镜像文件;A second judging module, configured to judge whether the target information is the target image file;
第一创建模块,用于在所述第二判断模块判断出所述目标信息是所述目标镜像文件时,根据所述目标镜像文件创建所述目标云主机;A first creation module, configured to create the target cloud host according to the target image file when the second judgment module determines that the target information is the target image file;
第二创建模块,用于在所述第二判断模块判断出所述目标信息不是所述目标镜像文件时,向所述镜像节点发送获取所述目标镜像文件的第二请求;接收所述镜像节点根据所述第二请求反馈的所述目标镜像文件;根据所述目标镜像文件创建所述目标云主机。A second creating module, configured to send a second request for acquiring the target image file to the image node when the second judging module determines that the target information is not the target image file; and receive the image node According to the target image file fed back by the second request; creating the target cloud host according to the target image file.
可选的,所述缓存节点包括:主缓存节点和所述主缓存节点对应的从缓存节点,所述从缓存节点缓存的镜像文件与所述主缓存节点缓存的镜像文件相同;Optionally, the cache node includes: a primary cache node and a secondary cache node corresponding to the primary cache node, where the image file cached by the secondary cache node is the same as the image file cached by the primary cache node;
所述确定模块,用于:The determining module is used for:
根据预设的计算节点与缓存节点的关联关系,从所述缓存节点中确定目标缓存节点。According to the preset association relationship between computing nodes and cache nodes, the target cache node is determined from the cache nodes.
可选的,所述预设的计算节点与缓存节点的关联关系为:Optionally, the preset association relationship between computing nodes and cache nodes is:
按照以下方式生成的:Generated as follows:
根据缓存节点的数量N,确定各个缓存节点的序号,其中,所述序号为[0,N-1]区间的整数,任意两个缓存节点的序号均不相同;According to the number N of cache nodes, determine the sequence number of each cache node, wherein the sequence number is an integer in the interval [0, N-1], and the sequence numbers of any two cache nodes are different;
计算各个计算节点的标识信息的目标哈希值H;Calculate the target hash value H of the identification information of each computing node;
按照以下表达式计算各个计算节点对应的目标取模值M:Calculate the target modulo value M corresponding to each computing node according to the following expression:
M=mod(H,N);M=mod(H,N);
对于每一计算节点,确定序号与该计算节点的目标取模值相同的缓存节点,建立该计算节点与所确定缓存节点之间的关联关系。For each computing node, determine the cache node whose sequence number is the same as the target modulo value of the computing node, and establish an association relationship between the computing node and the determined cache node.
为达到上述目的,本发明实施例还公开了一种云服务系统,所述系统包括:计算节点、提供数据缓存服务的缓存节点、提供云主机镜像服务的镜像节点,其中,In order to achieve the above purpose, the embodiment of the present invention also discloses a cloud service system, the system includes: a computing node, a cache node providing data caching service, and a mirroring node providing cloud host mirroring service, wherein,
所述计算节点,用于:接收针对目标云主机的创建指令;判断本地是否保存有目标镜像文件,其中,所述目标镜像文件为创建所述目标云主机所需的镜像文件;若未保存,从所述缓存节点中确定目标缓存节点;向所述目标缓存节点发送获取所述目标镜像文件的第一请求;The computing node is used to: receive a creation instruction for the target cloud host; determine whether a target image file is stored locally, wherein the target image file is the image file required for creating the target cloud host; if not saved, Determining a target cache node from the cache nodes; sending a first request for acquiring the target image file to the target cache node;
所述缓存节点,用于:接收所述计算节点发送的获取所述目标镜像文件的第一请求;根据所述第一请求,向所述计算节点反馈目标信息;The cache node is configured to: receive a first request for acquiring the target image file sent by the computing node; and feed back target information to the computing node according to the first request;
所述计算节点,还用于:接收所述目标缓存节点根据所述第一请求反馈的目标信息;判断所述目标信息是否为所述目标镜像文件;若为是,根据所述目标镜像文件创建所述目标云主机;若为否,向所述镜像节点发送获取所述目标镜像文件的第二请求;The computing node is further configured to: receive the target information fed back by the target cache node according to the first request; determine whether the target information is the target image file; if yes, create a target image file based on the target image file The target cloud host; if not, send a second request for obtaining the target mirror file to the mirror node;
所述镜像节点,用于:接收所述计算节点发送的获取所述目标镜像文件的第二请求;根据所述第二请求,向所述计算节点反馈所述目标镜像文件;The image node is configured to: receive a second request for acquiring the target image file sent by the computing node; feed back the target image file to the computing node according to the second request;
所述计算节点,还用于:接收所述镜像节点根据所述第二请求反馈的所述目标镜像文件;根据所述目标镜像文件创建所述目标云主机。The computing node is further configured to: receive the target image file fed back by the image node according to the second request; create the target cloud host according to the target image file.
可选的,所述缓存节点包括:主缓存节点和所述主缓存节点对应的从缓存节点,所述从缓存节点缓存的镜像文件与所述主缓存节点缓存的镜像文件相同;Optionally, the cache node includes: a primary cache node and a secondary cache node corresponding to the primary cache node, where the image file cached by the secondary cache node is the same as the image file cached by the primary cache node;
所述计算节点,具体用于:根据预设的计算节点与缓存节点的关联关系,从所述缓存节点中确定目标缓存节点。The computing node is specifically configured to: determine a target caching node from among the caching nodes according to a preset association relationship between computing nodes and caching nodes.
可选的,所述计算节点,具体用于:根据缓存节点的数量N,确定各个缓存节点的序号,其中,所述序号为[0,N-1]区间的整数,任意两个缓存节点的序号均不相同;计算该计算节点的标识信息的目标哈希值H;按照以下表达式计算该计算节点对应的目标取模值M:M=mod(H,N);确定序号与该计算节点的目标取模值相同的缓存节点,建立该计算节点与所确定缓存节点之间的关联关系。Optionally, the computing node is specifically configured to: determine the sequence number of each cache node according to the number N of cache nodes, where the sequence number is an integer in the interval [0, N-1], and any two cache nodes The sequence numbers are all different; calculate the target hash value H of the identification information of the computing node; calculate the target modulo value M corresponding to the computing node according to the following expression: M=mod (H, N); determine the sequence number and the computing node The target cache node with the same modulus value is established, and an association relationship between the computing node and the determined cache node is established.
可选的,所述镜像节点,还用于:向所述缓存节点反馈所述目标镜像文件;Optionally, the image node is further configured to: feed back the target image file to the cache node;
所述缓存节点,还用于:接收所述镜像节点反馈的所述目标镜像文件,并缓存所述目标镜像文件。The cache node is further configured to: receive the target image file fed back by the mirror node, and cache the target image file.
可选的,所述缓存节点,具体用于:判断本地缓存的数据量是否达到预设阈值,如果否,缓存所述目标镜像文件,如果是,确定本地要删除的镜像文件,删除所述要删除的镜像文件,缓存所述目标镜像文件。Optionally, the cache node is specifically used to: determine whether the amount of data cached locally reaches a preset threshold, if not, cache the target image file, if yes, determine the image file to be deleted locally, and delete the desired image file. For the deleted image file, the target image file is cached.
可选的,所述缓存节点包括:主缓存节点和所述主缓存节点对应的从缓存节点;Optionally, the cache node includes: a master cache node and a slave cache node corresponding to the master cache node;
所述镜像节点,具体用于:向所述主缓存节点反馈所述目标镜像文件;The image node is specifically used to: feed back the target image file to the primary cache node;
所述主缓存节点,用于:接收所述镜像节点反馈的所述目标镜像文件,并缓存所述目标镜像文件,再向所述从缓存节点反馈所述目标镜像文件;The primary cache node is configured to: receive the target image file fed back by the mirror node, cache the target image file, and then feed back the target image file to the slave cache node;
所述从缓存节点,用于:接收所述主缓存节点反馈的目标镜像文件,并缓存所述目标镜像文件。The slave cache node is configured to: receive the target image file fed back by the master cache node, and cache the target image file.
可选的,所述系统还包括:用于提供数据存储服务的存储节点;Optionally, the system further includes: a storage node for providing data storage services;
所述镜像节点,还用于:接收用户上传的镜像文件,并利用对象存储技术,将所述用户上传的镜像文件存储至所述存储节点;The mirroring node is further configured to: receive the mirroring file uploaded by the user, and store the mirroring file uploaded by the user in the storage node by using object storage technology;
所述存储节点,用于:存储所述用户上传的镜像文件。The storage node is configured to: store the image file uploaded by the user.
由以上可见,本发明实施例提供的方案中,计算节点在接收到针对目标云主机的创建指令后,首先判断本地是否缓存有对应的目标镜像文件,如果没有,则向缓存节点请求该目标镜像文件,在缓存节点也没有缓存该目标镜像文件的情况下,才向镜像节点请求该目标镜像文件。It can be seen from the above that in the solution provided by the embodiment of the present invention, after the computing node receives the creation instruction for the target cloud host, it first judges whether the corresponding target image file is cached locally, and if not, requests the target image file from the cache node file, and only when the cache node does not cache the target image file, it requests the target image file from the mirror node.
可见,应用本发明实施例提供的方案,可以降低镜像节点的访问压力,实现镜像文件的高并发下载,减小镜像文件的拉取时间,缩短云主机的创建时间。It can be seen that applying the solutions provided by the embodiments of the present invention can reduce the access pressure of mirror nodes, realize high concurrent download of mirror files, reduce the time for pulling mirror files, and shorten the creation time of cloud hosts.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明实施例提供的一种云主机创建方法的流程示意图;FIG. 1 is a schematic flow diagram of a method for creating a cloud host provided by an embodiment of the present invention;
图2为本发明实施例提供的一个具体实施例的示意图;Fig. 2 is a schematic diagram of a specific embodiment provided by the embodiment of the present invention;
图3为本发明实施例提供的一种云主机创建装置的结构示意图;FIG. 3 is a schematic structural diagram of a cloud host creation device provided by an embodiment of the present invention;
图4为本发明实施例提供的云主服务系统的第一种结构示意图;FIG. 4 is a first structural schematic diagram of a cloud master service system provided by an embodiment of the present invention;
图5为本发明实施例提供的云主服务系统的第二种结构示意图;FIG. 5 is a second structural schematic diagram of the cloud master service system provided by the embodiment of the present invention;
图6为本发明实施例提供的云主服务系统的第三种结构示意图;FIG. 6 is a schematic diagram of the third structure of the cloud host service system provided by the embodiment of the present invention;
图7为本发明实施例提供的云主服务系统的第四种结构示意图;FIG. 7 is a schematic diagram of a fourth structure of a cloud host service system provided by an embodiment of the present invention;
图8为本发明实施例提供的云主服务系统的第五种结构示意图;8 is a schematic diagram of a fifth structure of the cloud master service system provided by the embodiment of the present invention;
图9为本发明实施例提供的云主服务系统的第六种结构示意图。FIG. 9 is a schematic diagram of a sixth structure of a cloud master service system provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。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 creative efforts fall within the protection scope of the present invention.
先对本申请文件中涉及到的技术用语进行简单介绍。A brief introduction to the technical terms involved in this application document is given first.
Redis缓存是一个高性能的可基于内存亦可持久化的日志型、key-value存储系统,它支持存储的value类型包括string(字符串)、list(链表)、set(集合)和zset(有序集合),为了保证效率,数据通常都是缓存在内存中,同时还可以将内存中的数据保存在本地磁盘中,重启的时候可以再次加载进行使用。在此基础上,Redis缓存技术还可以实现master-slave(主从)同步,即一个master(主节点)可以拥有多个slave(从节点),而一个slave又可以拥有多个slave,将master中的数据同步到master对应的slave中,再由每个slave将数据同步到该slave对应的slave中。Redis cache is a high-performance log type and key-value storage system that can be based on memory and can be persisted. It supports stored value types including string (string), list (linked list), set (collection) and zset (with order collection), in order to ensure efficiency, data is usually cached in memory, and at the same time, the data in memory can also be saved in the local disk, and can be loaded again for use when restarting. On this basis, Redis caching technology can also realize master-slave (master-slave) synchronization, that is, a master (master node) can have multiple slaves (slave nodes), and a slave can have multiple slaves. The data is synchronized to the slave corresponding to the master, and then each slave synchronizes the data to the slave corresponding to the slave.
Glance是OpenStack的镜像服务组件,提供虚拟机镜像的发现、注册、取得服务,Glance提供的API(应用程序接口)可以查询虚拟机镜像的元数据、获得镜像。通过Glance,虚拟机镜像可以被存储到多种存储上,比如文件存储或者对象存储。Glance is the image service component of OpenStack, which provides virtual machine image discovery, registration, and acquisition services. The API (application program interface) provided by Glance can query the metadata of the virtual machine image and obtain the image. With Glance, virtual machine images can be stored on a variety of storage, such as file storage or object storage.
为解决现有技术问题,本发明实施例提供了一种云主机创建方法、装置及云服务系统。下面首先对本发明实施例所提供的一种云主机创建方法进行详细说明。In order to solve the problems in the prior art, the embodiment of the present invention provides a cloud host creation method, device and cloud service system. A method for creating a cloud host provided by an embodiment of the present invention will firstly be described in detail below.
需要说明的是,本发明实施例所提供的云主机创建方法可以应用于云服务系统中的任一目标计算节点,其中,该云服务系统可以包括:计算节点、提供数据缓存服务的缓存节点、提供云主机镜像服务的镜像节点。It should be noted that the cloud host creation method provided by the embodiment of the present invention can be applied to any target computing node in the cloud service system, wherein the cloud service system can include: computing nodes, caching nodes providing data caching services, A mirror node that provides cloud host mirroring services.
其中,该云服务系统可以是基于Openstack框架的云服务系统,也可以是其他类型的云服务系统,提供数据缓存服务的缓存节点可以是基于Redis缓存技术的缓存节点,也可以是其他类型的缓存节点,本发明实施例对此均不做限定。Wherein, the cloud service system may be a cloud service system based on the Openstack framework, or other types of cloud service systems, and the cache nodes providing data cache services may be cache nodes based on Redis cache technology, or other types of caches The node is not limited in this embodiment of the present invention.
图1为本发明实施例提供的云主机创建方法的第一种流程示意图,该方法可以包括:Fig. 1 is a schematic flow chart of the first method for creating a cloud host provided by an embodiment of the present invention, the method may include:
S101,接收针对目标云主机的创建指令。S101. Receive a creation instruction for a target cloud host.
其中,该创建指令中至少需要携带目标云主机的标识信息,当然,该指令中还可以携带其他信息,如:创建目标云主机所需的镜像文件的标识信息等,本发明实施例对此不进行限定。Wherein, the creation instruction needs to carry at least the identification information of the target cloud host. Of course, the instruction can also carry other information, such as: the identification information of the image file required to create the target cloud host. This embodiment of the present invention does not To limit.
S102,判断本地是否保存有目标镜像文件,其中,目标镜像文件为创建目标云主机所需的镜像文件;若未保存,执行S103。S102. Determine whether a target image file is saved locally, wherein the target image file is an image file required for creating a target cloud host; if not saved, execute S103.
例如,目标镜像文件可以是目标云主机的系统盘镜像文件,也可以是其他类型的镜像文件,本发明实施例对此不做限定。For example, the target image file may be a system disk image file of the target cloud host, or other types of image files, which is not limited in this embodiment of the present invention.
可以理解的,一台宿主机中可以创建多台云主机,那么,如果该目标计算节点已经创建过该目标云主机,则目标计算节点本地已经保存有该目标镜像文件。又或者,该目标计算节点之前未创建过该目标云主机,但是目标镜像文件被镜像节点预先保存到了该目标计算节点,则目标计算节点本地同样也保存有该目标镜像文件。It can be understood that multiple cloud hosts can be created in one host computer, and if the target computing node has already created the target cloud host, the target computing node has already stored the target image file locally. Or, the target computing node has not created the target cloud host before, but the target image file is saved to the target computing node by the image node in advance, then the target computing node also saves the target image file locally.
因此,在接收到针对目标云主机的创建指令时,可以先判断本地是否保存有该目标云主机对应的目标镜像文件,如果是,则可以直接根据本地存储的目标镜像文件来创建目标云主机,这样就不用从镜像节点获得目标镜像文件了,加快了获得目标镜像文件的速度,进而降低了镜像节点的访问压力,缩短了云主机的创建时间。Therefore, when receiving the creation instruction for the target cloud host, it can be judged whether the target image file corresponding to the target cloud host is stored locally, and if so, the target cloud host can be created directly according to the target image file stored locally. In this way, there is no need to obtain the target image file from the image node, which speeds up the speed of obtaining the target image file, thereby reducing the access pressure of the image node and shortening the creation time of the cloud host.
其中,根据镜像文件创建云主机的具体过程为现有技术,在此不做赘述。Wherein, the specific process of creating the cloud host according to the image file is an existing technology, and will not be repeated here.
S103,从缓存节点中确定目标缓存节点。S103. Determine a target cache node from cache nodes.
由于提供数据缓存服务的缓存节点中缓存有不同的云主机对应的镜像文件,因此,当目标计算节点本地未保存目标镜像文件时,可以从云服务系统中的缓存节点中获取该目标镜像文件。Since the image files corresponding to different cloud hosts are cached in the cache nodes that provide the data cache service, when the target computing node does not store the target image file locally, the target image file can be obtained from the cache node in the cloud service system.
可以理解的,在云服务系统可以设置一个缓存节点,所有计算节点可以向这一个缓存节点获取所需要的镜像文件。但是,这样会导致这一个缓存节点的读取压力过大。因此,云服务系统中可以设置多个缓存节点,以减轻各个缓存节点的读取压力。It can be understood that a cache node can be set in the cloud service system, and all computing nodes can obtain required image files from this cache node. However, this will cause excessive reading pressure on this cache node. Therefore, multiple cache nodes can be set in the cloud service system to reduce the reading pressure of each cache node.
可以理解的,当云服务系统中包含多个缓存节点时,可以将其中一个缓存节点设置为主缓存节点,而将其他的缓存节点设置为主缓存节点对应的从缓存节点,并且从缓存节点缓存的镜像文件与主缓存节点缓存的镜像文件相同,也就是说,所有的缓存节点中缓存的镜像文件完全相同。It can be understood that when the cloud service system contains multiple cache nodes, one of the cache nodes can be set as the master cache node, and the other cache nodes can be set as slave cache nodes corresponding to the master cache node, and the slave cache nodes cache The image file of the cache node is the same as the image file cached by the main cache node, that is to say, the image files cached in all cache nodes are exactly the same.
在实际应用中,可以通过Redis缓存技术的数据同步机制来实现从缓存节点缓存的镜像文件与主缓存节点缓存的镜像文件相同。具体的,Redis缓存技术的数据同步机制为现有技术,在此不做赘述。In practical applications, the data synchronization mechanism of the Redis cache technology can be used to realize that the mirror file cached by the slave cache node is the same as the mirror file cached by the master cache node. Specifically, the data synchronization mechanism of the Redis cache technology is an existing technology, and details are not described here.
在这种情况下,由于所有的缓存节点中缓存的镜像文件完全相同,那么,目标计算节点可以从任一个缓存节点中获取目标镜像文件。这种方式,可以进一步提高云服务系统中计算节点并发下载镜像文件的性能,并且镜像文件并发下载的能力可以随着从缓存节点数量的增加而线性增加。In this case, since the image files cached in all the cache nodes are exactly the same, the target computing node can obtain the target image file from any cache node. In this way, the performance of concurrent downloading of image files by computing nodes in the cloud service system can be further improved, and the ability of concurrent downloading of image files can increase linearly with the increase in the number of secondary cache nodes.
例如,目标计算节点可以在所有的缓存节点中随机选择一个缓存节点作为目标缓存节点。但是,这种方式可能会导致在某一个时间点、较多的计算节点同时向同一个缓存节点请求镜像文件,造成该缓存节点的读取压力较大。For example, the target computing node may randomly select a cache node from all cache nodes as the target cache node. However, this method may cause more computing nodes to request image files from the same cache node at a certain point in time, resulting in greater reading pressure on the cache node.
因此,为了均衡各个缓存节点的读取压力,在一种优选的实施方式中,从缓存节点中确定目标缓存节点的步骤,可以包括:Therefore, in order to balance the reading pressure of each cache node, in a preferred embodiment, the step of determining the target cache node from the cache nodes may include:
根据预设的计算节点与缓存节点的关联关系,从缓存节点中确定目标缓存节点。The target cache node is determined from the cache nodes according to the preset association relationship between the computing node and the cache node.
可以理解的,将每个计算节点与一个缓存节点建立关联关系,则一个缓存节点仅与固定个数的计算节点具有关联关系,每个缓存节点只需要向固定个数的计算节点提供镜像文件的读取服务,也就不会产生一个缓存节点在同一个时刻需要向较多的计算节点提供服务的现象,因此可以减轻各个缓存节点的读取压力。It can be understood that if each computing node is associated with a cache node, then a cache node only has an association relationship with a fixed number of computing nodes, and each cache node only needs to provide a fixed number of computing nodes with image files. Read service, there will be no phenomenon that a cache node needs to provide services to more computing nodes at the same time, so the reading pressure of each cache node can be reduced.
其中,上述预设的计算节点与缓存节点的关联关系,可以按照以下方式生成:Among them, the above preset relationship between computing nodes and cache nodes can be generated in the following manner:
根据缓存节点的数量N,确定各个缓存节点的序号,其中,所述序号为[0,N-1]区间的整数,任意两个缓存节点的序号均不相同;According to the number N of cache nodes, determine the sequence number of each cache node, wherein the sequence number is an integer in the interval [0, N-1], and the sequence numbers of any two cache nodes are different;
计算各个计算节点的标识信息的目标哈希值H;Calculate the target hash value H of the identification information of each computing node;
按照以下表达式计算各个计算节点对应的目标取模值M:Calculate the target modulo value M corresponding to each computing node according to the following expression:
M=mod(H,N);M=mod(H,N);
对于每一计算节点,确定序号与该计算节点的目标取模值相同的缓存节点,建立该计算节点与所确定缓存节点之间的关联关系。For each computing node, determine the cache node whose sequence number is the same as the target modulo value of the computing node, and establish an association relationship between the computing node and the determined cache node.
其中,各个计算节点的标识信息可以为计算节点的IP地址(Internet ProtocolAddress、互联网协议地址)、MAC地址(MAC Address,物理地址),等等,还可以是其他的能够唯一标识该计算节点的信息,都是合理的,本发明实施例对此不进行限定。Wherein, the identification information of each computing node may be the computing node's IP address (Internet Protocol Address, Internet Protocol Address), MAC address (MAC Address, physical address), etc., and may also be other information that can uniquely identify the computing node , are all reasonable, and are not limited in this embodiment of the present invention.
计算各个计算节点的标识信息的目标哈希值可以利用预设的哈希算法实现,其中,哈希算法的输入值可以是纯数字,也可以是包含数字、字母和符号的字符串,而哈希算法的输出则是一个正整数。由于利用哈希算法计算哈希值为现有技术,此处不进行赘述。The calculation of the target hash value of the identification information of each computing node can be realized by using a preset hash algorithm, where the input value of the hash algorithm can be pure numbers, or a string containing numbers, letters and symbols, and the hash The output of the Greek algorithm is a positive integer. Since the calculation of the hash value using the hash algorithm is an existing technology, details are not described here.
本领域技术人员公知的是,mod(a,b)为MOD函数,该函数用于进行取模运算,其中,a为被除数,b为除数。当a、b均为正整数时,取模运算的结果为a除以b的余数。It is known to those skilled in the art that mod(a, b) is a MOD function, which is used for modulo calculation, where a is the dividend and b is the divisor. When a and b are both positive integers, the result of the modulo operation is the remainder of dividing a by b.
可以理解的,对于上述计算目标取模值M的表达式,当N确定后,对于任意一个正整数H按照上述表达式执行取模运算,得到的目标取模值必然为[0,N-1]区间中的某一整数值。It can be understood that, for the expression of the above calculation target modulo value M, when N is determined, for any positive integer H, the modulo operation is performed according to the above expression, and the obtained target modulo value must be [0, N-1 ] an integer value in the interval.
由以上可知,各个缓存节点的序号为[0,N-1]区间的整数,且任意两个缓存节点的序号均不相同,而目标取模值同样为[0,N-1]区间中的某一整数;所以,对于每个计算节点,当对应的目标取模值确定后,必然存在一个序号为该目标取模值的缓存节点,则此时将该缓存节点与该计算节点建立关联关系。It can be seen from the above that the serial number of each cache node is an integer in the interval [0, N-1], and the serial numbers of any two cache nodes are different, and the target modulo value is also the integer in the interval [0, N-1] A certain integer; therefore, for each computing node, when the corresponding target modulo value is determined, there must be a cache node with the serial number of the target modulo value, and then the cache node is associated with the computing node at this time .
示例性的,在云服务系统中缓存节点的数量为10,将主缓存节点的序号确定为0、其他从缓存节点的序号依次确定为1~9,对各个计算节点的IP地址执行哈希算法得到对应的目标哈希值H,该目标哈希值H为正整数值,基于目标哈希值H和缓存节点的数量N可以计算各个计算节点对应的目标取模值。Exemplarily, the number of cache nodes in the cloud service system is 10, the sequence number of the master cache node is determined as 0, and the sequence numbers of other slave cache nodes are determined as 1-9 in turn, and the hash algorithm is performed on the IP addresses of each computing node The corresponding target hash value H is obtained, and the target hash value H is a positive integer value. Based on the target hash value H and the number N of cache nodes, the target modulo value corresponding to each computing node can be calculated.
例如,对计算节点A、B的IP地址执行哈希算法得到的哈希值H分别为54、100,再将哈希值54、100对缓存节点的数量10按照上述表达式执行取模运算得到的取模值分别为4、0,则将计算节点A与序号为4的从缓存节点建立关联关系、计算节点B与序号为0的主缓存节点建立关联关系。For example, the hash values H obtained by performing the hash algorithm on the IP addresses of computing nodes A and B are 54 and 100 respectively, and then the hash values 54 and 100 are calculated by performing a modulo operation on the number of cache nodes 10 according to the above expression. The modulo values of are 4 and 0 respectively, then the computing node A is associated with the slave cache node whose serial number is 4, and the computing node B is associated with the primary cache node whose serial number is 0.
当然,还可以按照其他方法建立计算节点与缓存节点之间的关联关系,本发明实施例对此不进行限定。Of course, other methods may also be used to establish the association relationship between the computing node and the cache node, which is not limited in this embodiment of the present invention.
另外,应该注意的是,在本实施例中,缓存节点的序号是用于确定缓存节点与不同目标取模值的对应关系,本实施例可以不限定序号的确定方式,也可以不限定缓存节点的具体序号,但必须要指定每一个缓存节点与目标取模值的对应关系。In addition, it should be noted that in this embodiment, the serial number of the cache node is used to determine the corresponding relationship between the cache node and different target modulo values. This embodiment may not limit the determination method of the serial number, or may not limit the cache node The specific sequence number, but the corresponding relationship between each cache node and the target modulo value must be specified.
例如:现有8个缓存节点,目标取模值必然为[0,7]区间的整数,确定各个缓存节点的序号分别为7、12、52、9、18、35、29和77,同时建立对应关系:缓存节点7、12、52、9、18、35、29和77分对应目标取模值0、1、2、3、4、5、6和7。所以对于每一计算节点,当计算得到该计算节点对应的目标取模值时,可以建立该计算节点与该目标取模值对应的缓存节点之间的关联关系,假设该目标取模值为6,则建立该计算节点与序号为29的缓存节点之间的关联关系。For example: there are currently 8 cache nodes, and the target modulo value must be an integer in the interval [0, 7]. The serial numbers of each cache node are determined to be 7, 12, 52, 9, 18, 35, 29, and 77, and the Correspondence: Cache nodes 7, 12, 52, 9, 18, 35, 29, and 77 points correspond to target modulo values 0, 1, 2, 3, 4, 5, 6, and 7. Therefore, for each computing node, when the target modulus value corresponding to the computing node is calculated, the association relationship between the computing node and the cache node corresponding to the target modulus value can be established, assuming that the target modulus value is 6 , an association relationship between the computing node and the cache node with the serial number 29 is established.
再如,现有5个缓存节点,目标取模值必然为[0,4]区间的整数,标记各个缓存节点分别为缓存节点a、b、c、d和e,同时建立对应关系:标记为a、b、c、d和e的缓存节点分对应目标取模值0、1、2、3和4。所以对于每一计算节点,当计算得到该计算节点对应的目标取模值时,可以建立该计算节点与该目标取模值对应的缓存节点之间的关联关系,假设目标取模值为3,则建立该计算节点与序号为d的缓存节点之间的关联关系。For another example, there are currently 5 cache nodes, and the target modulo value must be an integer in the interval [0, 4]. Mark each cache node as cache node a, b, c, d, and e respectively, and establish a corresponding relationship at the same time: mark as The cache nodes of a, b, c, d, and e correspond to the target modulo values 0, 1, 2, 3, and 4. Therefore, for each computing node, when the target modulus value corresponding to the computing node is calculated, the association relationship between the computing node and the cache node corresponding to the target modulus value can be established, assuming that the target modulus value is 3, Then establish an association relationship between the computing node and the cache node with the serial number d.
需要说明的是,每个计算节点只与一个缓存节点建立关联关系的方式较为简单,可以达到均衡各个缓存节点的读取压力的目的。然而,在另一种实现方式中,也可以将一个计算节点与多个缓存节点建立关联关系,这样,当一个缓存节点出现故障时,该计算节点可以从建立关联关系的其他缓存节点中获取镜像文件。It should be noted that it is relatively simple to establish an association relationship between each computing node and only one cache node, which can achieve the purpose of balancing the reading pressure of each cache node. However, in another implementation, it is also possible to associate a computing node with multiple cache nodes, so that when a cache node fails, the computing node can obtain images from other cache nodes that have established an association relationship. document.
S104,向目标缓存节点发送获取目标镜像文件的第一请求。S104. Send a first request for acquiring the target image file to the target cache node.
其中,该第一请求中至少需要携带目标镜像文件的标识信息,当然,该请求中还可以携带其他信息,本发明实施例对此不做限定。Wherein, the first request needs to carry at least the identification information of the target image file. Of course, the request can also carry other information, which is not limited in this embodiment of the present invention.
S105,接收目标缓存节点根据第一请求反馈的目标信息。S105. Receive target information fed back by the target cache node according to the first request.
可以理解的,第一请求中携带有目标镜像文件的标识信息,因此目标缓存节点可以根据第一请求中的该标识信息,判断自身是否缓存有目标镜像文件。It can be understood that the first request carries the identification information of the target image file, so the target cache node can judge whether it has cached the target image file according to the identification information in the first request.
当目标缓存节点中缓存有目标镜像文件时,目标缓存节点反馈给目标计算节点的目标信息可以为目标镜像文件本身;当目标缓存节点中未缓存目标镜像文件时,目标缓存节点反馈给目标计算节点的目标信息可以为:目标缓存节点未缓存目标镜像文件的消息。When the target image file is cached in the target cache node, the target information fed back by the target cache node to the target computing node can be the target image file itself; when the target image file is not cached in the target cache node, the target cache node feeds back to the target computing node The target information of may be: a message that the target cache node does not cache the target image file.
S106,判断目标信息是否为目标镜像文件;若为是,执行S107,若为否,执行S108。S106, judging whether the target information is the target image file; if yes, execute S107; if not, execute S108.
可以理解的,当目标计算节点接收到目标缓存节点反馈的目标信息后,首先可以判断目标信息是否为镜像文件,如果目标信息不是镜像文件,则可以直接判定目标信息不是目标镜像文件。Understandably, when the target computing node receives the target information fed back by the target cache node, it can first determine whether the target information is an image file, and if the target information is not an image file, it can directly determine that the target information is not a target image file.
进一步的,如果目标信息是镜像文件,则可以继续判断目标信息中的标识信息是否与目标镜像文件的标识信息相匹配,如果不匹配,则可以判定目标信息不是目标镜像文件,如果匹配,则可以判定目标信息为目标镜像文件。Further, if the target information is an image file, it can continue to judge whether the identification information in the target information matches the identification information of the target image file, if it does not match, it can be determined that the target information is not a target image file, and if it matches, it can be It is determined that the target information is the target image file.
另外,由于镜像文件是特定类型的文件,其文件格式可以为:ISO、BIN、IMG、GHO等,因此,可以通过判断目标信息是否为特定类型的文件,来判断目标信息是否为镜像文件。In addition, since the image file is a specific type of file, its file format can be: ISO, BIN, IMG, GHO, etc. Therefore, whether the target information is a mirror file can be determined by judging whether the target information is a specific type of file.
S107,根据目标镜像文件创建目标云主机。S107. Create a target cloud host according to the target image file.
S108,向镜像节点发送获取目标镜像文件的第二请求;接收镜像节点根据第二请求反馈的目标镜像文件;根据目标镜像文件创建目标云主机。S108, sending a second request for acquiring a target image file to the image node; receiving the target image file fed back by the image node according to the second request; creating a target cloud host according to the target image file.
其中,该第二请求中至少需要携带目标镜像文件的标识信息,当然,该请求中还可以携带其他信息,本发明实施例对此不做限定。Wherein, the second request needs to carry at least the identification information of the target image file, and of course, the request can also carry other information, which is not limited in this embodiment of the present invention.
可以理解的,当目标缓存节点反馈了目标镜像文件,则目标计算节点可以根据目标镜像文件创建目标云主机,如果目标缓存节点未反馈目标镜像文件,则目标计算节点还需要向镜像节点请求目标镜像文件。It can be understood that when the target cache node feeds back the target image file, the target computing node can create the target cloud host according to the target image file, and if the target cache node does not feed back the target image file, the target computing node also needs to request the target image from the mirror node document.
需要说明的是,实际应用中,镜像节点本身可以存储镜像文件,也可以不存储镜像文件、而只是作为数据库记录镜像文件的存储位置信息。It should be noted that, in practical applications, the mirroring node itself may store the mirroring file, or may not store the mirroring file, but only record the storage location information of the mirroring file as a database.
当镜像节点不存储镜像文件时,镜像节点可以向目标计算节点反馈目标镜像文件的存储位置,由目标计算节点从存储位置处拉取目标镜像文件,或者,由镜像节点将目标镜像文件从存储位置处拉取到目标计算节点,等等,都是合理的,本发明实施例对此不做限定。When the image node does not store the image file, the image node can feed back the storage location of the target image file to the target computing node, and the target computing node pulls the target image file from the storage location, or the image node pulls the target image file from the storage location It is reasonable to pull to the target computing node, etc., which is not limited in this embodiment of the present invention.
由以上可见,本实施例提供的方案中,计算节点在接收到针对目标云主机的创建指令后,首先判断本地是否缓存有对应的目标镜像文件,如果没有,则向缓存节点请求该目标镜像文件,在缓存节点也没有缓存该目标镜像文件的情况下,才向镜像节点请求该目标镜像文件。可见,应用本实施例提供的方案,可以降低镜像节点的访问压力,实现镜像文件的高并发下载,减小镜像文件的拉取时间,缩短云主机的创建时间。It can be seen from the above that in the solution provided by this embodiment, after receiving the creation instruction for the target cloud host, the computing node first judges whether there is a corresponding target image file in the local cache, and if not, requests the target image file from the cache node , only when the cache node does not cache the target image file, the target image file is requested from the mirror node. It can be seen that applying the solution provided by this embodiment can reduce the access pressure of mirror nodes, realize high concurrent download of mirror files, reduce the time for pulling mirror files, and shorten the creation time of cloud hosts.
下面以一个具体实施例对本发明实施例所提供的一种云主机创建方法进行说明。A method for creating a cloud host provided by an embodiment of the present invention will be described below with a specific embodiment.
如图2所示的一个具体实施例中的云服务系统的结构示意图,其中,Redis节点为基于Redis缓存技术的缓存节点,分为一个Redis主节点和多个Redis从节点,Glance服务器为提供云主机镜像服务的镜像节点,Glance服务器不存储镜像文件、只记录各个镜像文件的存储位置信息,存储节点用于存储镜像文件。A schematic structural diagram of a cloud service system in a specific embodiment as shown in Figure 2, wherein the Redis node is a cache node based on Redis cache technology, which is divided into a Redis master node and a plurality of Redis slave nodes, and the Glance server provides cloud The mirror node of the host mirror service, the Glance server does not store mirror files, but only records the storage location information of each mirror file, and the storage node is used to store mirror files.
并且,预先建立了各个计算节点与Redis节点的关联关系,如:计算节点与序号为0的Redis主节点关联、计算节点2和3均与序号为1的Redis从节点关联。其中,关联关系是根据对各个计算节点的IP地址执行哈希算法、并将得到的哈希值对Redis节点的数量取模得到的取模值生成的。Moreover, the association relationship between each computing node and the Redis node is established in advance, for example, the computing node is associated with the Redis master node whose serial number is 0, and the computing nodes 2 and 3 are both associated with the Redis slave node whose serial number is 1. Wherein, the association relationship is generated according to a modulo value obtained by performing a hash algorithm on the IP addresses of each computing node and moduloing the obtained hash value on the number of Redis nodes.
示例性的,如果计算节点2接收到了创建云主机的指令,那么,计算节点2首先判断本地是否保存有创建该云主机所需的目标镜像文件,如果有,则直接根据本地保存的目标镜像文件创建云主机;否则,向与计算节点2关联的序号为1的Redis从节点请求目标镜像文件,如果该Redis从节点缓存有目标镜像文件,则计算节点就可以根据该Redis从节点反馈的目标镜像文件创建云主机,如果该Redis从节点未缓存目标镜像文件,则还需要向Glance服务器请求目标镜像文件,Glance服务器根据目标镜像文件的存储位置将目标镜像文件从对应的存储节点拉取到计算节点2。Exemplarily, if computing node 2 receives an instruction to create a cloud host, then computing node 2 first determines whether the target image file required to create the cloud host is stored locally, and if so, directly according to the target image file stored locally Create a cloud host; otherwise, request the target image file from the Redis slave node with the serial number 1 associated with computing node 2. If the Redis slave node caches the target image file, the computing node can use the target image fed back by the Redis slave node File creation cloud host, if the Redis slave node does not cache the target image file, you need to request the target image file from the Glance server, and the Glance server will pull the target image file from the corresponding storage node to the computing node according to the storage location of the target image file 2.
由以上描述可知,计算节点在接收到针对目标云主机的创建指令后,首先判断本地是否缓存有对应的目标镜像文件,如果没有,则向缓存节点请求该目标镜像文件,在缓存节点也没有缓存该目标镜像文件的情况下,才向镜像节点请求该目标镜像文件。可见,应用本具体实施例,可以降低镜像节点的访问压力,实现镜像文件的高并发下载,减小镜像文件的拉取时间,缩短云主机的创建时间。It can be seen from the above description that after the computing node receives the creation command for the target cloud host, it first judges whether the corresponding target image file is cached locally. If not, it requests the target image file from the cache node, and there is no cache in the cache node. In the case of the target image file, the target image file is requested from the mirror node. It can be seen that the application of this specific embodiment can reduce the access pressure of mirror nodes, realize high concurrent download of mirror files, reduce the pull time of mirror files, and shorten the creation time of cloud hosts.
与上述的云主机创建方法相对应,本发明实施例还提供了一种云主机创建装置。Corresponding to the above method for creating a cloud host, an embodiment of the present invention also provides a device for creating a cloud host.
该装置可以应用于云服务系统中的目标计算节点,其中,该云服务系统可以包括:计算节点、提供数据缓存服务的缓存节点、提供云主机镜像服务的镜像节点。The device can be applied to a target computing node in a cloud service system, wherein the cloud service system can include: a computing node, a cache node providing data caching services, and a mirroring node providing cloud host mirroring services.
与图1所示的方法实施例相对应,图3为本发明实施例提供的云主机创建装置的第一种结构示意图,该装置可以包括:Corresponding to the method embodiment shown in FIG. 1, FIG. 3 is a first structural schematic diagram of a cloud host creation device provided by an embodiment of the present invention, and the device may include:
第一接收模块301,用于接收针对目标云主机的创建指令;The first receiving module 301 is configured to receive a creation instruction for a target cloud host;
第一判断模块302,用于判断本地是否保存有所述目标镜像文件,其中,所述目标镜像文件为创建所述目标云主机所需的镜像文件;The first judging module 302 is used to judge whether the target image file is saved locally, wherein the target image file is an image file required for creating the target cloud host;
确定模块303,用于在所述第一判断模块302判断出本地未保存所述目标镜像文件时,从所述缓存节点中确定目标缓存节点;A determination module 303, configured to determine the target cache node from the cache nodes when the first determination module 302 determines that the target image file is not saved locally;
发送模块304,用于向所述目标缓存节点发送获取所述目标镜像文件的第一请求;A sending module 304, configured to send a first request for acquiring the target image file to the target cache node;
第二接收模块305,用于接收所述目标缓存节点根据所述第一请求反馈的目标信息;The second receiving module 305 is configured to receive target information fed back by the target cache node according to the first request;
第二判断模块306,用于判断所述目标信息是否为所述目标镜像文件;A second judging module 306, configured to judge whether the target information is the target image file;
第一创建模块307,用于在所述第二判断模块306判断出所述目标信息是所述目标镜像文件时,根据所述目标镜像文件创建所述目标云主机;The first creation module 307 is configured to create the target cloud host according to the target image file when the second judgment module 306 determines that the target information is the target image file;
第二创建模块308,用于在所述第二判断模块306判断出所述目标信息不是所述目标镜像文件时,向所述镜像节点发送获取所述目标镜像文件的第二请求;接收所述镜像节点根据所述第二请求反馈的所述目标镜像文件;根据所述目标镜像文件创建所述目标云主机。The second creation module 308 is configured to send a second request for acquiring the target image file to the image node when the second judging module 306 determines that the target information is not the target image file; receive the The image node feeds back the target image file according to the second request; and creates the target cloud host according to the target image file.
在实际应用中,所述缓存节点可以包括:主缓存节点和所述主缓存节点对应的从缓存节点,所述从缓存节点缓存的镜像文件与所述主缓存节点缓存的镜像文件相同;In practical applications, the cache node may include: a master cache node and a slave cache node corresponding to the master cache node, where the image file cached by the slave cache node is the same as the mirror file cached by the master cache node;
所述确定模块303,可以用于:The determining module 303 may be used for:
根据预设的计算节点与缓存节点的关联关系,从所述缓存节点中确定目标缓存节点。According to the preset association relationship between computing nodes and cache nodes, the target cache node is determined from the cache nodes.
在实际应用中,所述预设的计算节点与缓存节点的关联关系可以为:In practical applications, the preset relationship between computing nodes and cache nodes may be:
按照以下方式生成的:Generated as follows:
根据缓存节点的数量N,确定各个缓存节点的序号,其中,所述序号为[0,N-1]区间的整数,任意两个缓存节点的序号均不相同;According to the number N of cache nodes, determine the sequence number of each cache node, wherein the sequence number is an integer in the interval [0, N-1], and the sequence numbers of any two cache nodes are different;
计算各个计算节点的标识信息的目标哈希值H;Calculate the target hash value H of the identification information of each computing node;
按照以下表达式计算各个计算节点对应的目标取模值M:Calculate the target modulo value M corresponding to each computing node according to the following expression:
M=mod(H,N);M=mod(H,N);
对于每一计算节点,确定序号与该计算节点的目标取模值相同的缓存节点,建立该计算节点与所确定缓存节点之间的关联关系。For each computing node, determine the cache node whose sequence number is the same as the target modulo value of the computing node, and establish an association relationship between the computing node and the determined cache node.
由以上可见,本实施例提供的方案中,计算节点在接收到针对目标云主机的创建指令后,首先判断本地是否缓存有对应的目标镜像文件,如果没有,则向缓存节点请求该目标镜像文件,在缓存节点也没有缓存该目标镜像文件的情况下,才向镜像节点请求该目标镜像文件。可见,应用本实施例提供的方案,可以降低镜像节点的访问压力,实现镜像文件的高并发下载,减小镜像文件的拉取时间,缩短云主机的创建时间。It can be seen from the above that in the solution provided by this embodiment, after receiving the creation instruction for the target cloud host, the computing node first judges whether there is a corresponding target image file in the local cache, and if not, requests the target image file from the cache node , only when the cache node does not cache the target image file, the target image file is requested from the mirror node. It can be seen that applying the solution provided by this embodiment can reduce the access pressure of mirror nodes, realize high concurrent download of mirror files, reduce the time for pulling mirror files, and shorten the creation time of cloud hosts.
与上述的云主机创建方法、装置相对应,本发明实施例还提供了一种云服务系统。Corresponding to the above-mentioned method and device for creating a cloud host, an embodiment of the present invention also provides a cloud service system.
图4为本发明实施例提供的一种云服务系统的第一种结构示意图,该系统可以包括:计算节点401、提供数据缓存服务的缓存节点402、提供云主机镜像服务的镜像节点403,其中,FIG. 4 is a schematic diagram of the first structure of a cloud service system provided by an embodiment of the present invention. The system may include: a computing node 401, a cache node 402 providing data caching services, and a mirroring node 403 providing cloud host mirroring services, wherein ,
所述计算节点401,可以用于:接收针对目标云主机的创建指令;判断本地是否保存有所述目标镜像文件,其中,所述目标镜像文件为创建所述目标云主机所需的镜像文件;若未保存,从所述缓存节点402中确定目标缓存节点;向所述目标缓存节点发送获取所述目标镜像文件的第一请求;The computing node 401 may be configured to: receive a creation instruction for the target cloud host; determine whether the target image file is stored locally, wherein the target image file is an image file required for creating the target cloud host; If it is not saved, determine the target cache node from the cache node 402; send a first request for obtaining the target image file to the target cache node;
所述缓存节点402,可以用于:接收所述计算节点401发送的获取所述目标镜像文件的第一请求;根据所述第一请求,向所述计算节点401反馈目标信息;The cache node 402 may be configured to: receive a first request for acquiring the target image file sent by the computing node 401; feed back target information to the computing node 401 according to the first request;
所述计算节点401,还可以用于:接收所述目标缓存节点根据所述第一请求反馈的目标信息;判断所述目标信息是否为所述目标镜像文件;若为是,根据所述目标镜像文件创建所述目标云主机;若为否,向所述镜像节点403发送获取所述目标镜像文件的第二请求;The computing node 401 may also be configured to: receive the target information fed back by the target cache node according to the first request; determine whether the target information is the target image file; if yes, according to the target image file The file creates the target cloud host; if not, send a second request for obtaining the target mirror file to the mirror node 403;
所述镜像节点403,可以用于:接收所述计算节点401发送的获取所述目标镜像文件的第二请求;根据所述第二请求,向所述计算节点401反馈所述目标镜像文件;The image node 403 may be configured to: receive a second request for acquiring the target image file sent by the computing node 401; feed back the target image file to the computing node 401 according to the second request;
所述计算节点401,还可以用于:接收所述镜像节点403根据所述第二请求反馈的所述目标镜像文件;根据所述目标镜像文件创建所述目标云主机。The computing node 401 may also be configured to: receive the target image file fed back by the image node 403 according to the second request; and create the target cloud host according to the target image file.
如图5所示的本发明实施例提供的云服务系统的第二种结构示意图,在图4所示实施例的基础上,As shown in FIG. 5, it is a second structural schematic diagram of the cloud service system provided by the embodiment of the present invention. On the basis of the embodiment shown in FIG. 4,
所述缓存节点402可以包括:主缓存节点4021和所述主缓存节点4021对应的从缓存节点4022,所述从缓存节点4022缓存的镜像文件与所述主缓存节点4021缓存的镜像文件相同;The cache node 402 may include: a master cache node 4021 and a slave cache node 4022 corresponding to the master cache node 4021, the image file cached by the slave cache node 4022 is the same as the mirror file cached by the master cache node 4021;
所述计算节点401,具体可以用于:根据预设的计算节点与缓存节点的关联关系,从所述缓存节点402中确定目标缓存节点。The computing node 401 may specifically be configured to: determine a target caching node from the caching nodes 402 according to a preset association relationship between computing nodes and caching nodes.
在本发明的一种实现方式中,所述计算节点401,具体可以用于:根据缓存节点402的数量N,确定各个缓存节点402的序号,其中,所述序号为[0,N-1]区间的整数,任意两个缓存节点402的序号均不相同;计算该计算节点401的标识信息的目标哈希值H;按照以下表达式计算该计算节点401对应的目标取模值M:M=mod(H,N);确定序号与该计算节点401的目标取模值相同的缓存节点402,建立该计算节点401与所确定缓存节点402之间的关联关系。In an implementation manner of the present invention, the computing node 401 may be specifically configured to: determine the sequence number of each cache node 402 according to the number N of cache nodes 402, wherein the sequence number is [0, N-1] An integer in the interval, the sequence numbers of any two cache nodes 402 are different; calculate the target hash value H of the identification information of the computing node 401; calculate the target modulo value M corresponding to the computing node 401 according to the following expression: M= mod(H, N); determine the cache node 402 whose serial number is the same as the target modulo value of the computing node 401 , and establish an association relationship between the computing node 401 and the determined cache node 402 .
由以上可见,本实施例提供的方案中,计算节点在接收到针对目标云主机的创建指令后,首先判断本地是否缓存有对应的目标镜像文件,如果没有,则向缓存节点请求该目标镜像文件,在缓存节点也没有缓存该目标镜像文件的情况下,才向镜像节点请求该目标镜像文件。可见,应用本实施例提供的方案,可以降低镜像节点的访问压力,实现镜像文件的高并发下载,减小镜像文件的拉取时间,缩短云主机的创建时间。It can be seen from the above that in the solution provided by this embodiment, after receiving the creation instruction for the target cloud host, the computing node first judges whether there is a corresponding target image file in the local cache, and if not, requests the target image file from the cache node , only when the cache node does not cache the target image file, the target image file is requested from the mirror node. It can be seen that applying the solution provided by this embodiment can reduce the access pressure of mirror nodes, realize high concurrent download of mirror files, reduce the time for pulling mirror files, and shorten the creation time of cloud hosts.
如图6所示的本发明实施例提供的云服务系统的第三种结构示意图,在图4所示实施例的基础上,As shown in FIG. 6, it is a schematic diagram of the third structure of the cloud service system provided by the embodiment of the present invention. On the basis of the embodiment shown in FIG. 4,
所述镜像节点403,还可以用于:向所述缓存节点402反馈所述目标镜像文件;The image node 403 may also be configured to: feed back the target image file to the cache node 402;
所述缓存节点402,还可以用于:接收所述镜像节点403反馈的所述目标镜像文件,并缓存所述目标镜像文件。The cache node 402 may also be configured to: receive the target image file fed back by the mirror node 403, and cache the target image file.
可以理解的,缓存节点402可以用于缓存镜像文件,镜像节点403可以用于存储镜像文件或存储镜像文件的存储位置信息。镜像节点403可以在计算节点401向缓存节点402发送获取镜像文件的请求之前,向缓存节点402反馈该镜像文件,以便于计算节点401可以从缓存节点401获取镜像文件;也可以在计算节点401向镜像节点403发送获取镜像文件的请求之后,向缓存节点402反馈该镜像文件,以便于计算节点401在下次需要获取该镜像文件时可以从缓存节点402处获得。It can be understood that the cache node 402 may be used for caching the image file, and the image node 403 may be used for storing the image file or storing location information of the image file. The image node 403 can feed back the image file to the cache node 402 before the computing node 401 sends the request for obtaining the image file to the cache node 402, so that the computing node 401 can obtain the image file from the cache node 401; After the image node 403 sends the request for obtaining the image file, it feeds back the image file to the cache node 402, so that the computing node 401 can obtain the image file from the cache node 402 when it needs to obtain the image file next time.
可以理解的是,缓存节点402能够提供的缓存资源是有限的,为了不影响缓存节点402的正常运行,缓存节点402中所缓存的数据量不能过大。因此,可以预先设置缓存节点402可缓存数据量的最大值。It can be understood that the cache resources that the cache node 402 can provide are limited. In order not to affect the normal operation of the cache node 402, the amount of data cached in the cache node 402 cannot be too large. Therefore, the maximum amount of data that can be cached by the cache node 402 can be preset.
在这种情况下,所述缓存节点402,具体可以用于:判断本地缓存的数据量是否达到预设阈值,如果否,缓存所述目标镜像文件,如果是,确定本地要删除的镜像文件,删除所述要删除的镜像文件,缓存所述目标镜像文件。In this case, the cache node 402 may specifically be used to: determine whether the amount of data cached locally reaches a preset threshold, if not, cache the target image file, and if so, determine the image file to be deleted locally, The image file to be deleted is deleted, and the target image file is cached.
具体的,由于在缓存节点402中缓存时间最早的镜像文件被再次获取的概率相对来说比较小,因此可以将缓存时间最早的镜像文件确定为要删除的镜像文件;Specifically, since the probability that the image file with the earliest cache time is acquired again in the cache node 402 is relatively small, the image file with the earliest cache time can be determined as the image file to be deleted;
还可以根据已缓存的镜像文件的访问频率,将访问频率最小的镜像文件确定为要删除的镜像文件;It is also possible to determine the image file with the least access frequency as the image file to be deleted according to the access frequency of the cached image file;
还可以根据已缓存的镜像文件的重要程度,将重要程度最低的镜像文件确定为要删除的镜像文件。Alternatively, according to the importance of the cached image files, the image file with the least importance may be determined as the image file to be deleted.
当然,本申请只是以上述为例进行说明,实际应用中,还可以根据其他原则确定要删除的镜像文件,本申请并不对此进行限定。Of course, this application only uses the above as an example for illustration. In practical applications, the image file to be deleted can also be determined according to other principles, and this application does not limit this.
在另一种实现方式中,如果缓存节点402中缓存的数据量达到了预设阈值,也可以不进行缓存镜像文件的处理操作。In another implementation manner, if the amount of data cached in the cache node 402 reaches a preset threshold, the cache image file may not be processed.
如图7所示的本发明实施例提供的云服务系统的第四种结构示意图,在图6所示实施例的基础上,所述缓存节点402可以包括:主缓存节点4021和所述主缓存节点4021对应的从缓存节点4022;FIG. 7 is a schematic diagram of the fourth structure of the cloud service system provided by the embodiment of the present invention. On the basis of the embodiment shown in FIG. 6, the cache node 402 may include: a primary cache node 4021 and the primary cache The slave cache node 4022 corresponding to the node 4021;
所述镜像节点402,具体可以用于:向所述主缓存节点4021反馈所述目标镜像文件;The mirroring node 402 may be specifically configured to: feed back the target mirroring file to the primary cache node 4021;
所述主缓存节点4021,可以用于:接收所述镜像节点402反馈的所述目标镜像文件,并缓存所述目标镜像文件,再向所述从缓存节点4022反馈所述目标镜像文件;The primary cache node 4021 may be configured to: receive the target image file fed back by the mirror node 402, cache the target image file, and then feed back the target image file to the slave cache node 4022;
所述从缓存节点4022,可以用于:接收所述主缓存节点4021反馈的目标镜像文件,并缓存所述目标镜像文件。The slave cache node 4022 may be configured to: receive the target image file fed back by the master cache node 4021, and cache the target image file.
可以理解的,主缓存节点4021将镜像节点反馈的镜像文件反馈给对应的从缓存节点4022,可以实现主缓存节点4021与从缓存节点4022中的数据同步,即,主缓存节点4021中缓存的镜像文件与从缓存节点4022中缓存的镜像文件相同。It can be understood that the master cache node 4021 feeds back the image file fed back by the mirror node to the corresponding slave cache node 4022, which can realize data synchronization between the master cache node 4021 and the slave cache node 4022, that is, the mirror image cached in the master cache node 4021 The file is the same as the image file cached from the cache node 4022.
这样,只要缓存节点402中缓存有目标镜像文件,则计算节点从任一个缓存节点402均可以获得该目标镜像文件,这种方式可以进一步提高云服务系统中计算节点401并发下载镜像文件的性能。In this way, as long as the target image file is cached in the cache node 402, the computing node can obtain the target image file from any cache node 402, and this method can further improve the performance of concurrently downloading the image file by the computing node 401 in the cloud service system.
具体的,主缓存节点4021缓存目标镜像文件的方法可以参照上述图6所示实施例的相关描述,这里不做赘述。Specifically, for the method for caching the target image file by the primary cache node 4021, reference may be made to the relevant description of the embodiment shown in FIG. 6 above, and details are not repeated here.
示例性的,在图2所示的具体实施例中,镜像节点为Glance服务器,缓存节点为Redis节点,包括一个Redis主节点和多个Redis从节点,Redis主节点可以将自身缓存的数据同步到各个Redis从节点上,实现Redis节点的主从同步。其中,Glance服务器用于存储镜像文件的存储位置信息,在Glance服务器中可以设置镜像管理(image-management)模块,用于将镜像文件从对应的存储节点拉取到Redis主节点中。Exemplary, in the specific embodiment shown in Figure 2, mirror node is Glance server, cache node is Redis node, includes a Redis master node and a plurality of Redis slave nodes, and Redis master node can synchronize the data cached by itself to On each Redis slave node, master-slave synchronization of Redis nodes is realized. Wherein, the Glance server is used to store the storage location information of the image file, and an image-management (image-management) module can be set in the Glance server to pull the image file from the corresponding storage node to the Redis master node.
本具体实施例中,采用Redis缓存技术对镜像文件进行缓存,并且利用Redis主从同步机制,保证了不同Redis节点上数据的一致性,采用多个Redis缓存节点的方式,使得镜像文件并发下载的能力可以随着Redis从节点数量的增加而线性增加。In this specific embodiment, the image file is cached using the Redis cache technology, and the Redis master-slave synchronization mechanism is used to ensure the consistency of data on different Redis nodes, and the mode of multiple Redis cache nodes is adopted to make the image file download concurrently. Capacity can scale linearly with the number of Redis slave nodes.
如图8所示的本发明实施例提供的云服务系统的第五种结构示意图,在图4所示实施例的基础上,该系统还可以包括:用于提供数据存储服务的存储节点404;FIG. 8 is a schematic diagram of a fifth structure of the cloud service system provided by the embodiment of the present invention. On the basis of the embodiment shown in FIG. 4, the system may further include: a storage node 404 for providing data storage services;
所述镜像节点403,还可以用于:接收用户上传的镜像文件,并利用对象存储技术,将用户上传的镜像文件存储至所述存储节点404;The image node 403 can also be used to: receive the image file uploaded by the user, and store the image file uploaded by the user to the storage node 404 by using object storage technology;
所述存储节点404,可以用于:存储所述用户上传的镜像文件。The storage node 404 may be configured to: store the image file uploaded by the user.
可以理解的,当用户需要在计算节点上创建新的云主机的时候,需要预先将该新的云主机对应的镜像文件上传到该云服务系统中,其中,该新的云主机对应的镜像文件可以理解为:用户自定义的镜像文件。Understandably, when a user needs to create a new cloud host on a computing node, the image file corresponding to the new cloud host needs to be uploaded to the cloud service system in advance, wherein the image file corresponding to the new cloud host It can be understood as: a user-defined image file.
需要说明的是,对象存储技术是一种网络存储架构,核心是将数据通路(数据读或写)与控制通路(元数据)分离,并且基于对象存储设备(Object-based Storage Dexice,OSD)构建存储系统,每个对象存储设备具有一定的智能,能够自动管理其上的数据分布。关于对象存储技术的具体介绍可以参见现有技术,在此不做赘述。It should be noted that object storage technology is a network storage architecture, the core of which is to separate the data path (data read or write) from the control path (metadata), and based on the object storage device (Object-based Storage Dexice, OSD) construction In the storage system, each object storage device has certain intelligence and can automatically manage the distribution of data on it. For the specific introduction of the object storage technology, reference may be made to the prior art, and details are not repeated here.
由以上实施例的描述可知,镜像节点403可以不保存镜像文件、而只保存镜像文件的存储位置信息,因此,镜像节点可以利用对象存储技术,将用户上传的镜像文件存储到存储节点404中,记录并保存该镜像文件的存储位置信息。As can be seen from the description of the above embodiments, the mirroring node 403 may not store the mirroring file, but only saves the storage location information of the mirroring file. Therefore, the mirroring node may utilize the object storage technology to store the mirroring file uploaded by the user in the storage node 404, Record and save the storage location information of the image file.
为了避免存储节点404出现故障而导致用户上传的镜像文件丢失或不可用,镜像节点还可以将用户上传的镜像文件保存到一计算节点401中。具体的,可以基于所有的计算节点401中保存的数据的数据量,按照容量均衡策略选择一计算节点401来保存该镜像文件。In order to prevent the image file uploaded by the user from being lost or unavailable due to failure of the storage node 404 , the image node may also save the image file uploaded by the user to a computing node 401 . Specifically, based on the amount of data stored in all computing nodes 401, a computing node 401 may be selected to save the image file according to a capacity balancing policy.
在对用户上传的镜像文件进行存储之后,镜像节点403还可以将该镜像文件发送给缓存节点402进行缓存,以便于计算节点401可以从缓存节点402获取该镜像文件。After storing the image file uploaded by the user, the image node 403 can also send the image file to the cache node 402 for caching, so that the computing node 401 can obtain the image file from the cache node 402 .
实际应用中,缓存节点402在对该用户上传的镜像文件进行缓存时,可以先判断本地缓存的数据量是否达到预设阈值,如果否,缓存该镜像文件,如果是,确定本地要删除的镜像文件,删除要删除的镜像文件后,再缓存该镜像文件。在另一种实现方式中,如果缓存节点402中缓存的数据量达到了预设阈值,也可以不进行缓存该镜像文件的处理操作。In practical applications, when the cache node 402 caches the image file uploaded by the user, it may first determine whether the amount of data cached locally reaches a preset threshold, if not, cache the image file, and if so, determine the image file to be deleted locally. file, delete the image file to be deleted, and then cache the image file. In another implementation manner, if the amount of data cached in the cache node 402 reaches a preset threshold, the image file may not be cached.
具体的,缓存节点402缓存用户上传的镜像文件的方法可以参照上述图6所示实施例的相关描述,这里不做赘述。Specifically, for the method for caching the image file uploaded by the user by the caching node 402, reference may be made to the relevant description of the embodiment shown in FIG. 6 above, and details are not repeated here.
在一种优选的实施例中,如图9所示的本发明实施例提供的云服务系统的第六种结构示意图,在图8所示实施例的基础上,缓存节点402可以包括:主缓存节点4021和主缓存节点4021对应的从缓存节点4022。In a preferred embodiment, FIG. 9 is a schematic diagram of the sixth structure of the cloud service system provided by the embodiment of the present invention. On the basis of the embodiment shown in FIG. 8 , the cache node 402 may include: primary cache The node 4021 and the slave cache node 4022 corresponding to the master cache node 4021.
镜像节点403可以将用户上传的镜像文件反馈给主缓存节点4021,由主缓存节点4021缓存该镜像文件,并将该镜像文件反馈给从缓存节点4022,在从缓存节点4022中也对该镜像文件进行缓存。The image node 403 can feed back the image file uploaded by the user to the master cache node 4021, the master cache node 4021 caches the image file, and feeds the image file back to the slave cache node 4022, and the mirror file is also stored in the slave cache node 4022. for caching.
具体的,主缓存节点4021和从缓存节点4022缓存用户上传的镜像文件的方法可以参照上述图7所示实施例的相关描述,这里不做赘述。Specifically, for the method of caching the image file uploaded by the user by the master cache node 4021 and the slave cache node 4022, reference may be made to the relevant description of the above embodiment shown in FIG. 7 , which will not be repeated here.
这样,每个缓存节点402都对用户上传的镜像文件进行了缓存,则计算节点401从任一个缓存节点402均可以获得该镜像文件,这种方式可以进一步提高云服务系统中计算节点并发下载镜像文件的性能。In this way, each cache node 402 has cached the image file uploaded by the user, and the computing node 401 can obtain the image file from any cache node 402. This method can further improve the concurrent downloading of images by computing nodes in the cloud service system. file performance.
示例性的,如图2所示的具体实施例,利用对象存储技术,Glance服务器首先将用户上传的镜像文件存储在一存储节点中,然后按照容量均衡策略选择一计算节点,由image-management模块将该镜像文件拉取到所选择的计算节点进行存储。Glance服务器还可以触发image-management模块,将该镜像文件拉取到Redis主节点中,如果Redis主节点中缓存的数据量已达到预设阈值,则不对该镜像文件进行缓存处理,当计算节点创建该镜像文件对应的云主机时,Redis主节点再采取LRU(近期最少使用)策略,将已缓存的镜像文件中在最近一段预设时长内访问频率最小的镜像文件删除后,再对该用户上传的镜像文件进行缓存。Exemplarily, in the specific embodiment shown in Figure 2, using the object storage technology, the Glance server first stores the image file uploaded by the user in a storage node, and then selects a computing node according to the capacity balancing strategy, and the image-management module Pull the image file to the selected computing node for storage. The Glance server can also trigger the image-management module to pull the image file to the Redis master node. If the amount of data cached in the Redis master node has reached the preset threshold, the image file will not be cached. When the computing node is created When the image file corresponds to the cloud host, the Redis master node adopts the LRU (least recently used) strategy to delete the image file with the least access frequency in the latest preset period of time among the cached image files, and then Uploaded image files are cached.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置及系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for relevant parts, please refer to part of the description of the method embodiments.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present invention are included in the protection scope of the present invention.
Claims (13)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610983593.7A CN108076078A (en) | 2016-11-09 | 2016-11-09 | A kind of cloud host creation method, device and cloud service system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610983593.7A CN108076078A (en) | 2016-11-09 | 2016-11-09 | A kind of cloud host creation method, device and cloud service system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN108076078A true CN108076078A (en) | 2018-05-25 |
Family
ID=62154090
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610983593.7A Pending CN108076078A (en) | 2016-11-09 | 2016-11-09 | A kind of cloud host creation method, device and cloud service system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN108076078A (en) |
Cited By (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109379235A (en) * | 2018-11-27 | 2019-02-22 | 无锡华云数据技术服务有限公司 | Method for creating cloud host based on high concurrent request scenario |
| CN109407992A (en) * | 2018-11-01 | 2019-03-01 | 郑州云海信息技术有限公司 | A kind of method and apparatus for creating cloud hard disk |
| CN109492422A (en) * | 2018-09-04 | 2019-03-19 | 航天信息股份有限公司 | A kind of data processing method and system based on user behavior information |
| CN109495555A (en) * | 2018-11-01 | 2019-03-19 | 郑州云海信息技术有限公司 | A kind of method and apparatus based on cloud platform creation cloud host |
| CN111435936A (en) * | 2018-12-25 | 2020-07-21 | 北京嘀嘀无限科技发展有限公司 | Cloud host creation method and device, server and computer readable storage medium |
| CN111858156A (en) * | 2020-06-12 | 2020-10-30 | 北京金山云网络技术有限公司 | Image management method, device and electronic device |
| CN112181278A (en) * | 2019-07-04 | 2021-01-05 | 中移(苏州)软件技术有限公司 | Method, device, equipment and storage medium for creating system disk in cloud computing system |
| CN114064209A (en) * | 2021-11-14 | 2022-02-18 | 郑州云海信息技术有限公司 | Method, device and equipment for creating cloud host through mirror image and readable medium |
| CN114168262A (en) * | 2021-12-03 | 2022-03-11 | 中国人寿保险股份有限公司上海数据中心 | Cloud platform mirror image cache management method based on LRU replacement algorithm |
| CN116192870A (en) * | 2023-04-21 | 2023-05-30 | 中国科学技术大学 | P2P (peer-to-peer) download mirroring method based on mirror-level metadata management and load perception |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102307206A (en) * | 2010-09-25 | 2012-01-04 | 广东电子工业研究院有限公司 | Cache system and method for quickly accessing virtual machine image based on cloud storage |
| CN102594858A (en) * | 2010-11-19 | 2012-07-18 | 马维尔国际贸易有限公司 | Mirroring solution in cloud storage environment |
| CN102629941A (en) * | 2012-03-20 | 2012-08-08 | 武汉邮电科学研究院 | Caching method of a virtual machine mirror image in cloud computing system |
| CN103513938A (en) * | 2013-09-16 | 2014-01-15 | 华为技术有限公司 | System expansion method and device of redundant array of independent disks (RAID) |
| CN103905537A (en) * | 2014-03-20 | 2014-07-02 | 冶金自动化研究设计院 | System for managing industry real-time data storage in distributed environment |
| CN104361030A (en) * | 2014-10-24 | 2015-02-18 | 西安未来国际信息股份有限公司 | Distributed cache architecture with task distribution function and cache method |
| US20150212847A1 (en) * | 2014-01-28 | 2015-07-30 | Electronics And Telecommunications Research Institute | Apparatus and method for managing cache of virtual machine image file |
-
2016
- 2016-11-09 CN CN201610983593.7A patent/CN108076078A/en active Pending
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102307206A (en) * | 2010-09-25 | 2012-01-04 | 广东电子工业研究院有限公司 | Cache system and method for quickly accessing virtual machine image based on cloud storage |
| CN102594858A (en) * | 2010-11-19 | 2012-07-18 | 马维尔国际贸易有限公司 | Mirroring solution in cloud storage environment |
| CN102629941A (en) * | 2012-03-20 | 2012-08-08 | 武汉邮电科学研究院 | Caching method of a virtual machine mirror image in cloud computing system |
| CN103513938A (en) * | 2013-09-16 | 2014-01-15 | 华为技术有限公司 | System expansion method and device of redundant array of independent disks (RAID) |
| US20150212847A1 (en) * | 2014-01-28 | 2015-07-30 | Electronics And Telecommunications Research Institute | Apparatus and method for managing cache of virtual machine image file |
| CN103905537A (en) * | 2014-03-20 | 2014-07-02 | 冶金自动化研究设计院 | System for managing industry real-time data storage in distributed environment |
| CN104361030A (en) * | 2014-10-24 | 2015-02-18 | 西安未来国际信息股份有限公司 | Distributed cache architecture with task distribution function and cache method |
Non-Patent Citations (2)
| Title |
|---|
| 周正达.: "信息存储系统中重复数据删除技术的研究.", 《中国博士学位论文全文数据库信息科技辑2013年》 * |
| 李思阳 等.: "基于多级索引的云平台镜像管理系统Milance的设计与实现.", 《计算机工程与科学》 * |
Cited By (16)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109492422A (en) * | 2018-09-04 | 2019-03-19 | 航天信息股份有限公司 | A kind of data processing method and system based on user behavior information |
| CN109407992A (en) * | 2018-11-01 | 2019-03-01 | 郑州云海信息技术有限公司 | A kind of method and apparatus for creating cloud hard disk |
| CN109495555A (en) * | 2018-11-01 | 2019-03-19 | 郑州云海信息技术有限公司 | A kind of method and apparatus based on cloud platform creation cloud host |
| CN109379235B (en) * | 2018-11-27 | 2019-08-30 | 无锡华云数据技术服务有限公司 | Method for creating cloud hosts based on high concurrent request scenarios |
| CN109379235A (en) * | 2018-11-27 | 2019-02-22 | 无锡华云数据技术服务有限公司 | Method for creating cloud host based on high concurrent request scenario |
| CN111435936A (en) * | 2018-12-25 | 2020-07-21 | 北京嘀嘀无限科技发展有限公司 | Cloud host creation method and device, server and computer readable storage medium |
| CN111435936B (en) * | 2018-12-25 | 2023-06-02 | 北京嘀嘀无限科技发展有限公司 | Cloud host creation method, cloud host creation device, server and computer readable storage medium |
| CN112181278B (en) * | 2019-07-04 | 2023-04-07 | 中移(苏州)软件技术有限公司 | Method, device, equipment and storage medium for creating system disk in cloud computing system |
| CN112181278A (en) * | 2019-07-04 | 2021-01-05 | 中移(苏州)软件技术有限公司 | Method, device, equipment and storage medium for creating system disk in cloud computing system |
| CN111858156A (en) * | 2020-06-12 | 2020-10-30 | 北京金山云网络技术有限公司 | Image management method, device and electronic device |
| CN114064209A (en) * | 2021-11-14 | 2022-02-18 | 郑州云海信息技术有限公司 | Method, device and equipment for creating cloud host through mirror image and readable medium |
| CN114064209B (en) * | 2021-11-14 | 2025-11-28 | 郑州云海信息技术有限公司 | Method, device, equipment and readable medium for creating cloud host through mirror image |
| CN114168262B (en) * | 2021-12-03 | 2022-09-23 | 中国人寿保险股份有限公司上海数据中心 | Cloud platform mirror image cache management method based on LRU replacement algorithm |
| CN114168262A (en) * | 2021-12-03 | 2022-03-11 | 中国人寿保险股份有限公司上海数据中心 | Cloud platform mirror image cache management method based on LRU replacement algorithm |
| CN116192870A (en) * | 2023-04-21 | 2023-05-30 | 中国科学技术大学 | P2P (peer-to-peer) download mirroring method based on mirror-level metadata management and load perception |
| CN116192870B (en) * | 2023-04-21 | 2023-07-11 | 中国科学技术大学 | P2P download mirror method based on mirror-level metadata management and load perception |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108076078A (en) | A kind of cloud host creation method, device and cloud service system | |
| US10782880B2 (en) | Apparatus and method for providing storage for providing cloud services | |
| US10459649B2 (en) | Host side deduplication | |
| US9251160B1 (en) | Data transfer between dissimilar deduplication systems | |
| US7587471B2 (en) | System and method for virtualizing network storages into a single file system view | |
| US10210191B2 (en) | Accelerated access to objects in an object store implemented utilizing a file storage system | |
| WO2021082157A1 (en) | Methods, systems and devices for data sharing, and data and metadata storage | |
| CN110235118B (en) | Optimizing content storage through stubbing | |
| JP5886447B2 (en) | Location independent files | |
| CN106506587A (en) | A Docker image download method based on distributed storage | |
| EP4087212B1 (en) | Method and apparatus for cloning file system | |
| CN106934048A (en) | Online data moving method, agent node | |
| EP3739440A1 (en) | Distributed storage system, data processing method and storage node | |
| CN110019004A (en) | A kind of data processing method, apparatus and system | |
| US20180124210A1 (en) | System and method for process migration in a content centric network | |
| US9122689B1 (en) | Recovering performance of a file system post-migration | |
| WO2019137321A1 (en) | Data processing method and apparatus, and computing device | |
| CN105446794A (en) | Disc operation method, apparatus and system based on virtual machine | |
| CN110324406A (en) | A kind of method and cloud service system obtaining business datum | |
| CN108540510B (en) | A cloud host creation method, device and cloud service system | |
| CN107181773A (en) | Data storage and data managing method, the equipment of distributed memory system | |
| CN112583760A (en) | Object storage access method, device, equipment and computer storage medium | |
| US20180107404A1 (en) | Garbage collection system and process | |
| CN110347656A (en) | The management method and device requested in document storage system | |
| CN114610680A (en) | Method, device and equipment for managing metadata of distributed file system and storage medium |
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 | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180525 |