CN110704382B - File deployment method, device, server and storage medium - Google Patents
File deployment method, device, server and storage medium Download PDFInfo
- Publication number
- CN110704382B CN110704382B CN201910913988.3A CN201910913988A CN110704382B CN 110704382 B CN110704382 B CN 110704382B CN 201910913988 A CN201910913988 A CN 201910913988A CN 110704382 B CN110704382 B CN 110704382B
- Authority
- CN
- China
- Prior art keywords
- computer room
- deployment
- file
- target
- preset
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/1727—Details of free space management performed by the file system
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种文件部署方法,所述方法包括:当接收到文件部署指令时,从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点;若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房;判断所述目标机房的数量是否大于或等于预设机房数量阈值;若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房;通过内部网络,将所述目标文件部署至所述部署机房的设备节点。本发明还提供一种文件部署装置、服务器及存储介质。本发明能降低网络开销、提高文件部署的成功率。
A file deployment method, the method comprising: when receiving a file deployment instruction, judging whether there is a first device node storing a target file indicated by the file deployment instruction from a plurality of device nodes included in all computer rooms; If there is a first device node that stores the target file indicated by the file deployment instruction, determine the target computer room where the first device node is located; determine whether the number of the target computer rooms is greater than or equal to a preset computer room number threshold; if the The number of the target computer rooms is greater than or equal to the preset computer room number threshold, and the deployment computer room is determined from the target computer room according to the available space capacity of the target computer room; and the target file is deployed to the deployment computer room through the internal network device node. The invention also provides a file deployment device, a server and a storage medium. The invention can reduce network overhead and improve the success rate of file deployment.
Description
技术领域technical field
本发明涉及数据存储技术领域,尤其涉及一种文件部署方法、装置、服务器及存储介质。The present invention relates to the technical field of data storage, in particular to a file deployment method, device, server and storage medium.
背景技术Background technique
随着互联网技术的发展,网上在线存储文件(云存储)由于其便利性而越来越受欢迎。With the development of Internet technology, storing files online (cloud storage) is becoming more and more popular due to its convenience.
目前,云存储系统在进行文件部署时会在不同的机房选取设备节点进行部署,但在实践中发现,文件在部署的过程中,会消耗外网带宽,从而增加了网络开销,而且安全性、稳定性不够高,从而降低文件部署的成功率。At present, when deploying files, the cloud storage system selects device nodes in different computer rooms for deployment. However, in practice, it is found that during the file deployment process, the bandwidth of the external network will be consumed, thereby increasing network overhead, and security, The stability is not high enough, which reduces the success rate of file deployment.
因此,如何降低网络开销、提高文件部署的成功率是一个亟需解决的技术问题。Therefore, how to reduce network overhead and improve the success rate of file deployment is a technical problem that needs to be solved urgently.
发明内容Contents of the invention
鉴于以上内容,有必要提供一种文件部署方法、装置、服务器及存储介质,能够降低网络开销、提高文件部署的成功率。In view of the above, it is necessary to provide a file deployment method, device, server and storage medium, which can reduce network overhead and improve the success rate of file deployment.
本发明的第一方面提供一种文件部署方法,所述方法包括:A first aspect of the present invention provides a file deployment method, the method comprising:
当接收到文件部署指令时,从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点;When the file deployment instruction is received, it is judged from the plurality of device nodes included in all the computer rooms whether there is a first device node storing the target file indicated by the file deployment instruction;
若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房;If there is a first device node storing the target file indicated by the file deployment instruction, determine the target computer room where the first device node is located;
判断所述目标机房的数量是否大于或等于预设机房数量阈值;judging whether the number of the target computer rooms is greater than or equal to a preset number threshold of computer rooms;
若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房;If the number of the target computer rooms is greater than or equal to the preset computer room quantity threshold, determine the deployment computer room from the target computer rooms according to the available space capacity of the target computer rooms;
通过内部网络,将所述目标文件部署至所述部署机房的设备节点。Deploy the target file to the device node in the deployment computer room through the internal network.
在一种可能的实现方式中,所述根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房之后,所述方法还包括:In a possible implementation manner, after determining the deployment computer room from the target computer room according to the available space capacity of the target computer room, the method further includes:
获取所述部署机房中每个设备节点的调度分数;Obtain the scheduling score of each device node in the deployment computer room;
根据所述每个设备节点的调度分数以及预设分数阈值,从所述部署机房中确定部署设备节点;Determining a deployment device node from the deployment computer room according to the scheduling score of each device node and a preset score threshold;
所述通过内部网络,将所述目标文件部署至所述部署机房的设备节点包括:Deploying the target file to the device node in the deployment computer room through the internal network includes:
通过内部网络,将所述部署机房的第一设备节点存储的所述目标文件复制至所述部署机房的所述部署设备节点。Copying the target file stored in the first device node of the deployment computer room to the deployment device node of the deployment computer room through an internal network.
在一种可能的实现方式中,所述预设分数阈值有多个,多个所述预设分数阈值从大到小排序,所述根据所述每个设备节点的调度分数以及预设分数阈值,从所述部署机房中确定部署设备节点包括:In a possible implementation manner, there are multiple preset score thresholds, and the multiple preset score thresholds are sorted from large to small, and the scheduling score and preset score thresholds according to each device node , determining the deployment device node from the deployment computer room includes:
针对多个所述预设分数阈值中的最大预设分数阈值,统计所述部署机房中调度分数大于所述最大预设分数阈值的第二设备节点的第一数量;For a maximum preset score threshold among the plurality of preset score thresholds, counting a first number of second device nodes whose scheduling scores are greater than the maximum preset score threshold in the deployment computer room;
判断所述第一数量是否大于或等于预设节点数量阈值;judging whether the first number is greater than or equal to a preset node number threshold;
若所述第一数量大于或等于预设节点数量阈值,从所述第二设备节点中,选取所述文件部署指令指示的数量的部署设备节点。If the first number is greater than or equal to the preset node number threshold, select deployment device nodes of the number indicated by the file deployment instruction from the second device nodes.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
若所述第一数量小于预设节点数量阈值,按照多个所述预设分数阈值从大到小的排列顺序,提取除所述最大预设分数阈值之外的第一预设分数阈值;If the first number is less than the preset node number threshold, according to the arrangement order of the preset score thresholds from large to small, extract a first preset score threshold other than the maximum preset score threshold;
统计所述部署机房中调度分数大于所述第一预设分数阈值的第三设备节点的第二数量;Counting the second number of third device nodes whose scheduling score is greater than the first preset score threshold in the deployment computer room;
判断所述第二数量是否大于或等于所述预设节点数量阈值;judging whether the second number is greater than or equal to the preset node number threshold;
若所述第二数量大于或等于所述预设节点数量阈值,从所述第三设备节点中,选取所述文件部署指令指示的数量的部署设备节点。If the second number is greater than or equal to the preset node number threshold, select deployment device nodes of the number indicated by the file deployment instruction from the third device nodes.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
若所述目标机房的数量小于预设机房数量阈值,判断配置文件是否携带有需要进行机房容灾的指示信息;If the number of the target computer rooms is less than the preset number threshold of computer rooms, it is judged whether the configuration file carries indication information that needs to perform computer room disaster recovery;
若配置文件携带有需要进行机房容灾的指示信息,从除了所述目标机房之外的所有机房中,将可用空间容量最大的机房确定为第一机房;If the configuration file carries the instruction information that requires computer room disaster recovery, from all the computer rooms except the target computer room, determine the computer room with the largest available space capacity as the first computer room;
判断所述目标机房的可用空间容量是否大于或等于所述第一机房的可用空间容量;judging whether the available space capacity of the target computer room is greater than or equal to the available space capacity of the first computer room;
若所述目标机房的可用空间容量大于或等于所述第一机房的可用空间容量,通过内部网络,将所述目标文件部署至所述目标机房的设备节点,以及通过外部网络,将所述目标文件备份至所述第一机房的设备节点。If the available space capacity of the target computer room is greater than or equal to the available space capacity of the first computer room, deploy the target file to the device node of the target computer room through the internal network, and deploy the target file through the external network The files are backed up to the device nodes in the first computer room.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
若不存在存储有所述文件部署指令指示的目标文件的第一设备节点,根据所有机房的可用空间容量,从所有机房中确定第二机房;If there is no first device node storing the target file indicated by the file deployment instruction, determine the second computer room from all computer rooms according to the available space capacity of all computer rooms;
将所述目标文件部署至所述第二机房。Deploy the target file to the second computer room.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
针对每个机房,每隔预设时间间隔,获取所述机房中每个设备节点的节点信息;For each computer room, obtain node information of each device node in the computer room at preset time intervals;
根据所述节点信息,确定所述设备节点的多个权重值;determining multiple weight values of the device node according to the node information;
根据所述多个权重值,计算所述设备节点的调度分数;calculating a scheduling score of the device node according to the plurality of weight values;
将所述调度分数进行存储。The scheduling score is stored.
本发明的第二方面提供一种文件部署装置,所述装置包括:A second aspect of the present invention provides a file deployment device, the device comprising:
判断模块,用于当接收到文件部署指令时,从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点;A judging module, configured to, when receiving a file deployment instruction, judge whether there is a first device node storing the target file indicated by the file deployment instruction from a plurality of device nodes included in all computer rooms;
确定模块,用于若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房;A determining module, configured to determine the target computer room where the first device node is located if there is a first device node storing the target file indicated by the file deployment instruction;
所述判断模块,还用于判断所述目标机房的数量是否大于或等于预设机房数量阈值;The judging module is also used to judge whether the number of the target computer rooms is greater than or equal to the preset number threshold of computer rooms;
所述确定模块,还用于若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房;The determining module is further configured to determine the deployment computer room from the target computer room according to the available space capacity of the target computer room if the number of the target computer room is greater than or equal to the preset computer room number threshold;
部署模块,用于通过内部网络,将所述目标文件部署至所述部署机房的设备节点。The deployment module is configured to deploy the target file to the device nodes in the deployment computer room through the internal network.
本发明的第三方面提供一种服务器,所述服务器包括处理器和存储器,所述处理器用于执行所述存储器中存储的计算机程序时实现所述的文件部署方法。A third aspect of the present invention provides a server, where the server includes a processor and a memory, and the processor is configured to implement the file deployment method when executing a computer program stored in the memory.
本发明的第四方面提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现所述的文件部署方法。A fourth aspect of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the above-mentioned file deployment method is realized.
由以上技术方案,本发明中,当接收到文件部署指令时,可以从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点;若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房;判断所述目标机房的数量是否大于或等于预设机房数量阈值;若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房;通过内部网络,将所述目标文件部署至所述部署机房的设备节点。可见,本发明中,可以通过内部网络将文件部署至设备节点中,从而不消耗外网带宽,降低了网络开销,因为内网比外网稳定、安全,因此也提高了文件部署的成功率。Based on the above technical solution, in the present invention, when the file deployment instruction is received, it can be judged from the plurality of device nodes included in all computer rooms whether there is a first device node storing the target file indicated by the file deployment instruction; if There is a first device node storing the target file indicated by the file deployment instruction, determining the target computer room where the first device node is located; judging whether the number of the target computer rooms is greater than or equal to a preset computer room number threshold; if the The number of target computer rooms is greater than or equal to the preset computer room number threshold, according to the available space capacity of the target computer room, determine the deployment computer room from the target computer room; deploy the target file to the equipment in the deployment computer room through the internal network node. It can be seen that in the present invention, files can be deployed to device nodes through the internal network, thereby not consuming external network bandwidth and reducing network overhead. Because the internal network is more stable and secure than the external network, the success rate of file deployment is also improved.
附图说明Description of drawings
图1是本发明公开的一种文件部署方法的较佳实施例的流程图。Fig. 1 is a flowchart of a preferred embodiment of a file deployment method disclosed in the present invention.
图2是本发明公开的一种文件部署装置的较佳实施例的功能模块图。Fig. 2 is a functional block diagram of a preferred embodiment of a file deployment device disclosed in the present invention.
图3是本发明实现文件部署方法的较佳实施例的服务器的结构示意图。Fig. 3 is a schematic structural diagram of a server implementing a preferred embodiment of a file deployment method in the present invention.
具体实施方式detailed description
为了能够更清楚地理解本发明的上述目的、特征和优点,下面结合附图和具体实施例对本发明进行详细描述。需要说明的是,在不冲突的情况下,本发明的实施例及实施例中的特征可以相互组合。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the case of no conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. 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.
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field of the invention. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention.
本发明实施例的文件部署方法应用在服务器中,也可以应用在服务器和通过网络与所述服务器进行连接的电子设备所构成的硬件环境中,由服务器和电子设备共同执行。网络包括但不限于:广域网、城域网或局域网。The file deployment method in the embodiment of the present invention is applied in a server, and may also be applied in a hardware environment composed of a server and an electronic device connected to the server through a network, and is jointly executed by the server and the electronic device. Networks include, but are not limited to: Wide Area Networks, Metropolitan Area Networks, or Local Area Networks.
其中,服务器可以是指能对网络中其它设备(如电子设备)提供服务的计算机系统。如果一个个人电脑能够对外提供文件传输协议(File Transfer Protocol,简称FTP)服务,也可以叫服务器。从狭义范围上讲,服务器专指某些高性能计算机,能通过网络,对外提供服务,其相对于普通的个人电脑来说,稳定性、安全性、性能等方面都要求更高,因此在CPU、芯片组、内存、磁盘系统、网络等硬件和普通的个人电脑有所不同。Wherein, the server may refer to a computer system capable of providing services to other devices (such as electronic devices) in the network. If a personal computer can provide a file transfer protocol (File Transfer Protocol, referred to as FTP) service, it can also be called a server. In a narrow sense, a server specifically refers to certain high-performance computers that can provide external services through the network. Compared with ordinary personal computers, it has higher requirements for stability, security, and performance. , chipset, memory, disk system, network and other hardware are different from ordinary personal computers.
所述电子设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(ASIC)、可编程门阵列(FPGA)、数字处理器(DSP)、嵌入式设备等。所述电子设备还可包括网络设备和/或用户设备。其中,所述网络设备包括但不限于单个网络服务器、多个网络服务器组成的服务器组或基于云计算(Cloud Computing)的由大量主机或网络服务器构成的云,其中,云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。所述用户设备包括但不限于任何一种可与用户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理PDA等。The electronic device is a device that can automatically perform numerical calculations and/or information processing according to preset or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), programmable gate arrays (FPGA), digital processor (DSP), embedded devices, etc. The electronic equipment may also include network equipment and/or user equipment. Wherein, the network device includes but is not limited to a single network server, a server group composed of multiple network servers, or a cloud based on cloud computing (Cloud Computing) composed of a large number of hosts or network servers, wherein cloud computing is distributed computing A super virtual computer consisting of a group of loosely coupled computer sets. The user equipment includes but is not limited to any electronic product that can interact with the user through keyboards, mice, remote controls, touch pads, or voice-activated devices, such as personal computers, tablet computers, smart phones, personal digital Assistant PDA etc.
请参见图1,图1是本发明公开的一种文件部署方法的较佳实施例的流程图。其中,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。Please refer to FIG. 1 . FIG. 1 is a flowchart of a preferred embodiment of a file deployment method disclosed in the present invention. Wherein, according to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
S11、当接收到文件部署指令时,服务器从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点,若是,执行步骤S12,若否,结束本流程。S11. When receiving the file deployment instruction, the server judges whether there is a first device node storing the target file indicated by the file deployment instruction from among the multiple device nodes included in all the computer rooms. If yes, perform step S12, if not , to end this process.
其中,所述设备节点可以包括服务器以及智能硬件设备等。Wherein, the device node may include a server, an intelligent hardware device, and the like.
本发明实施例中,当接收到文件部署指令时,因为该文件部署指令指示的目标文件可能在之前已经被部署多份至多个设备节点,可能由于某些原因(比如机房故障)而丢失了其中几份或全部目标文件。需要判断是否存在存储有所述文件部署指令指示的目标文件的设备节点(第一设备节点)。In the embodiment of the present invention, when a file deployment instruction is received, because the target file indicated by the file deployment instruction may have been deployed to multiple device nodes before, it may be lost due to some reasons (such as a computer room failure). Several or all object files. It is necessary to determine whether there is a device node (first device node) storing the target file indicated by the file deployment instruction.
作为一种可选的实施方式,所述方法还包括:As an optional implementation, the method also includes:
若不存在存储有所述文件部署指令指示的目标文件的第一设备节点,根据所有机房的可用空间容量,从所有机房中确定第二机房;If there is no first device node storing the target file indicated by the file deployment instruction, determine the second computer room from all computer rooms according to the available space capacity of all computer rooms;
将所述目标文件部署至所述第二机房。Deploy the target file to the second computer room.
在该可选的实施方式中,若不存在存储有所述文件部署指令指示的目标文件的第一设备节点,则需要确定所有机房的可用空间容量,并可以从所有机房中将可用空间容量最大的机房确定为用于文件部署的部署机房,若配置文件中的参数指示不需要进行机房容灾,可以将目标文件部署至部署机房的满足预设要求的设备节点。In this optional implementation, if there is no first device node storing the target file indicated by the file deployment instruction, it is necessary to determine the available space capacity of all computer rooms, and maximize the available space capacity from all computer rooms The computer room is determined as the deployment computer room for file deployment. If the parameters in the configuration file indicate that disaster recovery is not required for the computer room, the target file can be deployed to the device node in the deployment computer room that meets the preset requirements.
可选的,若配置文件中的参数指示需要进行机房容灾,则还需要从除了部署机房之外的所有机房中选取可用空间容量最大的机房,用于文件备份的容灾机房。除了将目标文件部署至部署机房的满足预设要求的设备节点,还需要将目标文件部署一份至容灾机房的满足预设要求的设备节点。Optionally, if the parameters in the configuration file indicate that computer room disaster recovery is required, it is also necessary to select the computer room with the largest available space capacity from all computer rooms except the deployment computer room, and use it as the disaster recovery computer room for file backup. In addition to deploying the target file to the device node meeting the preset requirements in the deployment computer room, it is also necessary to deploy a copy of the target file to the device node meeting the preset requirements in the disaster recovery computer room.
可选的,若部署机房中不存在满足预设要求的设备节点,或,容灾机房中不存在满足预设要求的设备节点,生成警告信息,并发送至用户终端。Optionally, if there is no device node meeting the preset requirements in the deployment computer room, or there is no device node meeting the preset requirements in the disaster recovery computer room, a warning message is generated and sent to the user terminal.
其中,所述机房容灾是指在另一个机房中备份文件,防止一个机房因故障从而导致文件丢失或停止提供该文件的服务。Wherein, the computer room disaster recovery refers to backing up files in another computer room, so as to prevent a computer room from losing files or stopping providing services for the files due to a failure in one computer room.
其中,所述预设要求可以为调度分数大于预设分数阈值的设备节点的数量大于预设节点数量阈值。Wherein, the preset requirement may be that the number of device nodes whose scheduling scores are greater than the preset score threshold is greater than the preset node quantity threshold.
其中,所述第二机房可以包括部署机房以及容灾机房。Wherein, the second computer room may include a deployment computer room and a disaster recovery computer room.
S12、服务器确定所述第一设备节点所在的目标机房。S12. The server determines the target computer room where the first device node is located.
在该可选的实施方式中,因为在某个机房中部署文件时,若该机房的设备节点中存在需要部署的文件,则可以将通过内网将该文件部署至同机房的其他设备节点中,不消耗外网带宽,可以降低网络开销,也更安全可靠,可以提高文件部署的成功率。所以需要确定存储有文件部署指令指示的目标文件的第一设备节点所在的目标机房。In this optional implementation, because when deploying a file in a computer room, if there is a file to be deployed in the device node of the computer room, the file can be deployed to other device nodes in the same computer room through the intranet , does not consume external network bandwidth, can reduce network overhead, is also more secure and reliable, and can improve the success rate of file deployment. Therefore, it is necessary to determine the target computer room where the first device node storing the target file indicated by the file deployment instruction is located.
S13、服务器判断所述目标机房的数量是否大于或等于预设机房数量阈值,若是,执行步骤S14,若否,结束本流程。S13. The server judges whether the number of the target computer rooms is greater than or equal to the preset number threshold of computer rooms. If yes, execute step S14. If not, end the process.
本发明实施例中,可以预先设置一个机房数量阈值,因为一般情况下,文件在本发明实施例中可以部署至两个机房中的设备节点(目的是做机房容灾),本发明实施例设置的机房数量阈值可以为2。In the embodiment of the present invention, a threshold for the number of computer rooms can be set in advance, because in general, files can be deployed to equipment nodes in two computer rooms in the embodiment of the present invention (the purpose is to do disaster recovery for the computer room), and the embodiment of the present invention sets The threshold for the number of computer rooms can be 2.
作为一种可选的实施方式,所述方法还包括:As an optional implementation, the method also includes:
若所述目标机房的数量小于预设机房数量阈值,判断配置文件是否携带有需要进行机房容灾的指示信息;If the number of the target computer rooms is less than the preset number threshold of computer rooms, it is judged whether the configuration file carries indication information that needs to perform computer room disaster recovery;
若配置文件携带有需要进行机房容灾的指示信息,从除了所述目标机房之外的所有机房中,将可用空间容量最大的机房确定为第一机房;If the configuration file carries the instruction information that requires computer room disaster recovery, from all the computer rooms except the target computer room, determine the computer room with the largest available space capacity as the first computer room;
判断所述目标机房的可用空间容量是否大于或等于所述第一机房的可用空间容量;judging whether the available space capacity of the target computer room is greater than or equal to the available space capacity of the first computer room;
若所述目标机房的可用空间容量大于或等于所述第一机房的可用空间容量,通过内部网络,将所述目标文件部署至所述目标机房的设备节点,以及通过外部网络,将所述目标文件备份至所述第一机房的设备节点。If the available space capacity of the target computer room is greater than or equal to the available space capacity of the first computer room, deploy the target file to the device node of the target computer room through the internal network, and deploy the target file through the external network The files are backed up to the device nodes in the first computer room.
在该可选的实施方式中,如果目标机房的数量小于预设机房数量,则可以确定没有进行机房容灾,需要判断配置文件中是否携带有需要进行机房容灾的指示信息,如果配置文件中携带有需要进行机房容灾的指示信息,则需要从除了目标机房之外的所有机房中,将可用空间容量最大的机房确定为第一机房。并从目标机房以及第一机房中选取可用空间容量最大的机房作为部署机房,即若目标机房的可用空间容量大于或等于第一机房的可用空间容量,通过内部网络,将目标文件部署至目标机房的设备节点,以及通过外部网络,部署一份目标文件至第一机房的设备节点(机房容灾);或,若目标机房的空间容量小于第一机房的可用空间容量,通过外部网络,将目标文件部署一份至第一机房的设备节点,然后通过内部网络,将目标文件复制至第一机房的其他设备节点,直至目标文件部署的份数满足文件部署指令指示的数量。In this optional implementation, if the number of target computer rooms is less than the preset number of computer rooms, it can be determined that disaster recovery of computer rooms has not been performed, and it is necessary to determine whether the configuration file contains information indicating that disaster recovery of computer rooms is required. Carrying the instruction information that disaster recovery needs to be carried out for the computer room, it is necessary to determine the computer room with the largest available space capacity as the first computer room from all the computer rooms except the target computer room. And select the computer room with the largest available space capacity from the target computer room and the first computer room as the deployment computer room, that is, if the available space capacity of the target computer room is greater than or equal to the available space capacity of the first computer room, deploy the target file to the target computer room through the internal network , and deploy a target file to the device node of the first computer room through the external network (computer room disaster recovery); or, if the space capacity of the target computer room is less than the available space capacity of the first computer room, through the external network, the target One copy of the file is deployed to the device node in the first computer room, and then the target file is copied to other device nodes in the first computer room through the internal network until the number of copies of the target file deployed meets the number indicated by the file deployment instruction.
S14、服务器根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房。S14. The server determines a deployment computer room from the target computer room according to the available space capacity of the target computer room.
本发明实施例中,可以从多个目标机房中将可用空间容量最大的机房确定为部署机房,确保有足够的空间容量进行文件部署。In the embodiment of the present invention, the computer room with the largest available space capacity may be determined as the deployment computer room among multiple target computer rooms, so as to ensure sufficient space capacity for file deployment.
S15、服务器通过内部网络,将所述目标文件部署至所述部署机房的设备节点。S15. The server deploys the target file to the device node in the deployment computer room through the internal network.
本发明实施例中,因为部署机房中存在存储有目标文件的第一设备节点,而且同一个机房的所有设备节点属于一个内部网络,因此,可用通过内部网络,将目标文件部署至部署机房中的设备节点。In the embodiment of the present invention, since there is a first device node storing the target file in the deployment computer room, and all device nodes in the same computer room belong to an internal network, the target file can be deployed to the deployment computer room through the internal network. device node.
作为一种可选的实施方式,所述根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房之后,所述方法还包括:As an optional implementation manner, after determining the deployment computer room from the target computer room according to the available space capacity of the target computer room, the method further includes:
获取所述部署机房中每个设备节点的调度分数;Obtain the scheduling score of each device node in the deployment computer room;
根据所述每个设备节点的调度分数以及预设分数阈值,从所述部署机房中确定部署设备节点;Determining a deployment device node from the deployment computer room according to the scheduling score of each device node and a preset score threshold;
所述通过内部网络,将所述目标文件部署至所述部署机房的设备节点包括:Deploying the target file to the device node in the deployment computer room through the internal network includes:
通过内部网络,将所述部署机房的第一设备节点存储的所述目标文件复制至所述部署机房的所述部署设备节点。Copying the target file stored in the first device node of the deployment computer room to the deployment device node of the deployment computer room through an internal network.
在该可选的实施方式中,所有设备节点的调度分数被预先存储起来并定时更新,可以获取部署机房中每个设备节点的调度分数,并根据每个设备节点的调度分数以及预设分数阈值盲从部署机房中确定部署设备节点。然后通过内部网络,将部署机房中的第一设备节点存储的目标文件复制至部署机房的部署设备节点。In this optional implementation, the scheduling scores of all equipment nodes are pre-stored and regularly updated, and the scheduling scores of each equipment node in the deployment computer room can be obtained, and based on the scheduling scores of each equipment node and the preset score threshold Determine the deployment device node blindly from the deployment computer room. Then copy the target file stored in the first device node in the deployment computer room to the deployment device node in the deployment computer room through the internal network.
具体的,所述预设分数阈值有多个,多个所述预设分数阈值从大到小排序,所述根据所述每个设备节点的调度分数以及预设分数阈值,从所述部署机房中确定部署设备节点包括:Specifically, there are multiple preset score thresholds, and the multiple preset score thresholds are sorted from large to small, and according to the scheduling score of each device node and the preset score threshold, from the deployment computer room Determining the deployment device nodes in include:
针对多个所述预设分数阈值中的最大预设分数阈值,统计所述部署机房中调度分数大于所述最大预设分数阈值的第二设备节点的第一数量;For a maximum preset score threshold among the plurality of preset score thresholds, counting a first number of second device nodes whose scheduling scores are greater than the maximum preset score threshold in the deployment computer room;
判断所述第一数量是否大于或等于预设节点数量阈值;judging whether the first number is greater than or equal to a preset node number threshold;
若所述第一数量大于或等于预设节点数量阈值,从所述第二设备节点中,选取所述文件部署指令指示的数量的部署设备节点。If the first number is greater than or equal to the preset node number threshold, select deployment device nodes of the number indicated by the file deployment instruction from the second device nodes.
其中,所述预设节点数量阈值对应机房中需要部署的文件份数,假设部署一份文件对应的适合被调度的设备节点数量为125,若机房中需要部署的文件份数为1,则预设节点数量阈值为125,若文件份数为2,则预设节点数量阈值为250。因为一个机房或一个设备节点可以有多个正在部署的任务,为了保证多任务可以并行处理,需要确保部署一份文件时,有多个设备节点可以被调度。Wherein, the preset node number threshold corresponds to the number of files to be deployed in the computer room, assuming that the number of device nodes suitable for scheduling corresponding to deploying a file is 125, and if the number of files to be deployed in the computer room is 1, the pre-set Set the node number threshold to 125, and if the number of file copies is 2, the preset node number threshold is 250. Because a computer room or a device node can have multiple tasks being deployed, in order to ensure that multiple tasks can be processed in parallel, it is necessary to ensure that when a file is deployed, multiple device nodes can be scheduled.
在该可选的实施方式中,所述预设分数阈值可以根据业务需求确定,本发明实施例中选取的预设分数阈值为75、50、25以及0。最大预设分数阈值为75,可以判断调度分数大于75的设备节点的数量(第一数量)是否大于或等于预设节点数量阈值,若第一数量大于或等于预设节点数量阈值,则从第二设备节点中,选取文件部署指令指示的数量的部署设备节点。In this optional implementation manner, the preset score thresholds may be determined according to business requirements, and the preset score thresholds selected in the embodiment of the present invention are 75, 50, 25, and 0. The maximum preset score threshold is 75, and it can be judged whether the number (first number) of device nodes with a scheduling score greater than 75 is greater than or equal to the preset node number threshold, if the first number is greater than or equal to the preset node number threshold, then from the first In the second device node, select the number of deployment device nodes indicated by the file deployment instruction.
作为一种可选的实施方式,所述方法还包括:As an optional implementation, the method also includes:
若所述第一数量小于预设节点数量阈值,按照多个所述预设分数阈值从大到小的排列顺序,提取除所述最大预设分数阈值之外的第一预设分数阈值;If the first number is less than the preset node number threshold, according to the arrangement order of the preset score thresholds from large to small, extract a first preset score threshold other than the maximum preset score threshold;
统计所述部署机房中调度分数大于所述第一预设分数阈值的第三设备节点的第二数量;Counting the second number of third device nodes whose scheduling score is greater than the first preset score threshold in the deployment computer room;
判断所述第二数量是否大于或等于所述预设节点数量阈值;judging whether the second number is greater than or equal to the preset node number threshold;
若所述第二数量大于或等于所述预设节点数量阈值,从所述第三设备节点中,选取所述文件部署指令指示的数量的部署设备节点。If the second number is greater than or equal to the preset node number threshold, select deployment device nodes of the number indicated by the file deployment instruction from the third device nodes.
作为一种可选的实施方式,假设预设分数阈值为75、50、25以及0,若第一数量小于预设节点数量阈值,则将50确定为第一预设分数阈值,统计部署机房中调度分数大于50的设备节点(第三设备节点)的第二数量,并判断第二数量是否大于或等于预设节点数量阈值,若第二数量大于或等于预设节点数量阈值,从第三设备节点中,选取文件部署指令指示的数量的部署设备节点。若第二数量小于预设节点数量阈值,则统计部署机房中调度分数大于25的设备节点的第三数量,判断第三数量是否大于或等于预设数量阈值,若第三数量大于或等于预设数量阈值,则从部署机房中,选取文件部署指令指示的数量的部署设备节点。若第三数量小于预设数量阈值,则统计部署机房中调度分数大于0的设备节点的第四数量,判断第四数量是否大于或等于预设数量阈值,若第四数量大于或等于预设数量阈值,则从部署机房中,选取文件部署指令指示的数量的部署设备节点。可选的,若第四数量小于预设数量阈值,生成警告信息,并将所述警告信息发送至用户终端。As an optional implementation, assuming that the preset score thresholds are 75, 50, 25, and 0, if the first number is less than the preset node number threshold, 50 is determined as the first preset score threshold, and statistics are deployed in the computer room Scheduling the second number of device nodes (third device nodes) whose score is greater than 50, and judging whether the second number is greater than or equal to the preset node number threshold, if the second number is greater than or equal to the preset node number threshold, from the third device Among the nodes, select the number of deployment device nodes indicated by the file deployment instruction. If the second number is less than the preset node number threshold, count the third number of equipment nodes with a scheduling score greater than 25 in the deployment computer room, and determine whether the third number is greater than or equal to the preset number threshold, if the third number is greater than or equal to the preset If the quantity threshold is set, select the deployment device nodes of the number indicated by the file deployment instruction from the deployment computer room. If the third number is less than the preset number threshold, count the fourth number of equipment nodes with a scheduling score greater than 0 in the deployment computer room, and determine whether the fourth number is greater than or equal to the preset number threshold, if the fourth number is greater than or equal to the preset number threshold, select the number of deployment device nodes indicated by the file deployment instruction from the deployment computer room. Optionally, if the fourth quantity is less than the preset quantity threshold, a warning message is generated, and the warning message is sent to the user terminal.
作为一种可选的实施方式,所述方法还包括:As an optional implementation, the method also includes:
针对每个机房,每隔预设时间间隔,获取所述机房中每个设备节点的节点信息;For each computer room, obtain node information of each device node in the computer room at preset time intervals;
根据所述节点信息,确定所述设备节点的多个权重值;determining multiple weight values of the device node according to the node information;
根据所述多个权重值,计算所述设备节点的调度分数;calculating a scheduling score of the device node according to the plurality of weight values;
将所述调度分数进行存储。The scheduling score is stored.
其中,所述节点信息可以包括:节点状态、可用空间容量、节点负载、任务数量以及节点类型等。Wherein, the node information may include: node status, available space capacity, node load, task quantity, node type, and the like.
其中,所述节点类型可以包括:服务器以及智能硬件设备等。Wherein, the node type may include: a server, an intelligent hardware device, and the like.
在该可选的实施方式中,可以预先设置一个时间间隔(预设时间间隔),每隔预设时间间隔,获取每个机房内所有设备节点的节点信息,然后根据节点信息,可以确定设备节点的多个权重值,对于节点状态,在线时,权重值为1,不在线时,权重值为0;对于可用空间容量,大于50T时,权重值为5,大于10T并小于或等于50T时,权重值为4,大于3T并小于或等于10T时,权重值为3,大于500G并小于或等于3T时,权重值为2,大于100G并小于或等于500G时,权重值为1,小于100G时,权重值为0;节点负载可以为CPU(central processing unit,中央处理器)负载,及负载使用的CPU核数,对于节点类型为服务器的设备节点,负载小于1时,权重值为5,负载大于或等于1并小于CPU核数的1/4时,权重值为4,负载大于或等于CPU核数的1/4并小于CPU核数的1/2时,权重值为3,负载大于或等于CPU核数的1/2并小于CPU核数的3/4时,权重值为2,负载大于或等于CPU核数的3/4时,权重值为1。对于节点类型为智能硬件设备的设备节点,负载小于1时,权重值为5,负载大于或等于1并小于2,权重值为4,负载大于或等于2并小于3时,权重值为3,负载大于或等于3并小于4时,权重值为2,负载大于或等于4时,权重值为1。可以根据正在部署的任务数量确定权重值,对于节点类型为服务器的设备节点,任务数量小于2时,权重值为5,任务数量大于或等于2并小于4时,权重值为4,任务数量大于或等于4并小于6时,权重值为3,任务数量大于或等于6并小于8时,权重值为2,任务数量大于或等于8时,权重值为1。对于节点类型为智能硬件设备的设备节点,任务数量小于1时,权重值为5,任务数量大于或等于1并小于2时,权重值为4,任务数量大于或等于2并小于3时,权重值为3,任务数量大于或等于3并小于4时,权重值为2,任务数量大于或等于4时,权重值为1。其中,不同的节点信息对应的权重值的取值可以根据具体情况设定。最后,将节点状态的权重值、可用空间容量的权重值、节点负载的权重值以及任务数量的权重值相乘,得出设备节点的调度分数。可以将设备节点的调度分数存储至用于保存数据的服务器中,需要进行节点调度时,可以直接读取调度分数并做出调度策略,提高了调度效率。In this optional implementation, a time interval (preset time interval) can be preset, and the node information of all device nodes in each computer room can be obtained at every preset time interval, and then the device node can be determined according to the node information For the node status, when the node is online, the weight value is 1, when it is not online, the weight value is 0; for the available space capacity, when it is greater than 50T, the weight value is 5, when it is greater than 10T and less than or equal to 50T, The weight value is 4. When it is greater than 3T and less than or equal to 10T, the weight value is 3. When it is greater than 500G and less than or equal to 3T, the weight value is 2. When it is greater than 100G and less than or equal to 500G, the weight value is 1. When less than 100G , the weight value is 0; the node load can be the CPU (central processing unit, central processing unit) load, and the number of CPU cores used by the load. For the device node whose node type is server, when the load is less than 1, the weight value is 5, and the load When it is greater than or equal to 1 and less than 1/4 of the number of CPU cores, the weight value is 4; when the load is greater than or equal to 1/4 of the number of CPU cores and less than 1/2 of the number of CPU cores, the weight value is 3, and the load is greater than or When it is equal to 1/2 of the number of CPU cores and less than 3/4 of the number of CPU cores, the weight value is 2, and when the load is greater than or equal to 3/4 of the number of CPU cores, the weight value is 1. For a device node whose node type is an intelligent hardware device, when the load is less than 1, the weight value is 5; when the load is greater than or equal to 1 and less than 2, the weight value is 4; when the load is greater than or equal to 2 and less than 3, the weight value is 3. When the load is greater than or equal to 3 and less than 4, the weight value is 2, and when the load is greater than or equal to 4, the weight value is 1. The weight value can be determined according to the number of tasks being deployed. For a device node whose node type is a server, when the number of tasks is less than 2, the weight value is 5; when the number of tasks is greater than or equal to 2 and less than 4, the weight value is 4, and the number of tasks is greater than or equal to 4 and less than 6, the weight value is 3; when the number of tasks is greater than or equal to 6 and less than 8, the weight value is 2; when the number of tasks is greater than or equal to 8, the weight value is 1. For a device node whose node type is an intelligent hardware device, when the number of tasks is less than 1, the weight value is 5; when the number of tasks is greater than or equal to 1 and less than 2, the weight value is 4; when the number of tasks is greater than or equal to 2 and less than 3, the weight value The value is 3, when the number of tasks is greater than or equal to 3 and less than 4, the weight value is 2, and when the number of tasks is greater than or equal to 4, the weight value is 1. Wherein, the value of the weight value corresponding to different node information can be set according to specific situations. Finally, the weight value of the node state, the weight value of the available space capacity, the weight value of the node load and the weight value of the number of tasks are multiplied to obtain the scheduling score of the device node. The scheduling score of the device node can be stored in the server used to save the data. When node scheduling is required, the scheduling score can be directly read and a scheduling strategy can be made, which improves the scheduling efficiency.
在图1所描述的方法流程中,当接收到文件部署指令时,可以从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点;若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房;判断所述目标机房的数量是否大于或等于预设机房数量阈值;若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房;通过内部网络,将所述目标文件部署至所述部署机房的设备节点。可见,可以通过内部网络将文件部署至设备节点中,从而不消耗外网带宽,降低了网络开销,因为内网比外网稳定、安全,因此也提高了文件部署的成功率。In the method flow described in FIG. 1, when a file deployment instruction is received, it may be determined from a plurality of device nodes included in all computer rooms whether there is a first device node storing the target file indicated by the file deployment instruction; If there is a first device node that stores the target file indicated by the file deployment instruction, determine the target computer room where the first device node is located; determine whether the number of the target computer rooms is greater than or equal to a preset computer room number threshold; if the The number of the target computer rooms is greater than or equal to the preset computer room number threshold, and the deployment computer room is determined from the target computer room according to the available space capacity of the target computer room; and the target file is deployed to the deployment computer room through the internal network device node. It can be seen that files can be deployed to device nodes through the internal network, thereby not consuming external network bandwidth and reducing network overhead. Because the internal network is more stable and secure than the external network, the success rate of file deployment is also improved.
以上所述,仅是本发明的具体实施方式,但本发明的保护范围并不局限于此,对于本领域的普通技术人员来说,在不脱离本发明创造构思的前提下,还可以做出改进,但这些均属于本发明的保护范围。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. For those of ordinary skill in the art, without departing from the inventive concept of the present invention, it is also possible to make Improvements, but these all belong to the protection scope of the present invention.
请参见图2,图2是本发明公开的一种文件部署装置的较佳实施例的功能模块图。Please refer to FIG. 2 . FIG. 2 is a functional block diagram of a preferred embodiment of a file deployment device disclosed in the present invention.
在一些实施例中,所述文件部署装置运行于服务器中。所述文件部署装置可以包括多个由程序代码段所组成的功能模块。所述文件部署装置中的各个程序段的程序代码可以存储于存储器中,并由至少一个处理器所执行,以执行图1所描述的文件部署方法中的部分或全部步骤。In some embodiments, the file deployment device runs on a server. The file deployment device may include a plurality of functional modules composed of program code segments. The program codes of the various program segments in the file deployment device may be stored in a memory and executed by at least one processor to execute some or all of the steps in the file deployment method described in FIG. 1 .
本实施例中,所述文件部署装置根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:判断模块201、确定模块202及部署模块203。本发明所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机程序段,其存储在存储器中。在一些实施例中,关于各模块的功能将在后续的实施例中详述。In this embodiment, the file deployment device can be divided into multiple functional modules according to the functions it performs. The functional modules may include: a
判断模块201,用于当接收到文件部署指令时,从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点。The judging
其中,所述设备节点可以包括服务器以及智能硬件设备等。Wherein, the device node may include a server, an intelligent hardware device, and the like.
本发明实施例中,当接收到文件部署指令时,因为该文件部署指令指示的目标文件可能在之前已经被部署多份至多个设备节点,可能由于某些原因(比如机房故障)而丢失了其中几份或全部目标文件。需要判断是否存在存储有所述文件部署指令指示的目标文件的设备节点(第一设备节点)。In the embodiment of the present invention, when a file deployment instruction is received, because the target file indicated by the file deployment instruction may have been deployed to multiple device nodes before, it may be lost due to some reasons (such as a computer room failure). Several or all object files. It is necessary to determine whether there is a device node (first device node) storing the target file indicated by the file deployment instruction.
确定模块202,用于若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房。The determining
在该可选的实施方式中,因为在某个机房中部署文件时,若该机房的设备节点中存在需要部署的文件,则可以将通过内网将该文件部署至同机房的其他设备节点中,不消耗外网带宽,可以降低网络开销,也更安全可靠,可以提高文件部署的成功率。所以需要确定存储有文件部署指令指示的目标文件的第一设备节点所在的目标机房。In this optional implementation, because when deploying a file in a computer room, if there is a file to be deployed in the device node of the computer room, the file can be deployed to other device nodes in the same computer room through the intranet , does not consume external network bandwidth, can reduce network overhead, is also more secure and reliable, and can improve the success rate of file deployment. Therefore, it is necessary to determine the target computer room where the first device node storing the target file indicated by the file deployment instruction is located.
所述判断模块201,还用于判断所述目标机房的数量是否大于或等于预设机房数量阈值。The judging
本发明实施例中,可以预先设置一个机房数量阈值,因为一般情况下,文件在本发明实施例中可以部署至两个机房中的设备节点(目的是做机房容灾),本发明实施例设置的机房数量阈值可以为2。In the embodiment of the present invention, a threshold for the number of computer rooms can be set in advance, because in general, files can be deployed to equipment nodes in two computer rooms in the embodiment of the present invention (the purpose is to do disaster recovery for the computer room), and the embodiment of the present invention sets The threshold for the number of computer rooms can be 2.
所述确定模块202,还用于若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房。The determining
本发明实施例中,可以从多个目标机房中将可用空间容量最大的机房确定为部署机房,确保有足够的空间容量进行文件部署。In the embodiment of the present invention, the computer room with the largest available space capacity may be determined as the deployment computer room among multiple target computer rooms, so as to ensure sufficient space capacity for file deployment.
部署模块203,用于通过内部网络,将所述目标文件部署至所述部署机房的设备节点。The
本发明实施例中,因为部署机房中存在存储有目标文件的第一设备节点,而且同一个机房的所有设备节点属于一个内部网络,因此,可用通过内部网络,将目标文件部署至部署机房中的设备节点。In the embodiment of the present invention, since there is a first device node storing the target file in the deployment computer room, and all device nodes in the same computer room belong to an internal network, the target file can be deployed to the deployment computer room through the internal network. device node.
作为一种可选的实施方式,所述文件部署装置还可以包括:As an optional implementation manner, the file deployment device may also include:
第一获取模块,用于所述确定模块202根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房之后,获取所述部署机房中每个设备节点的调度分数;The first acquisition module is used for the
所述确定模块202,还用于根据所述每个设备节点的调度分数以及预设分数阈值,从所述部署机房中确定部署设备节点;The
所述部署模块203通过内部网络,将所述目标文件部署至所述部署机房的设备节点的方式具体为:The way in which the
通过内部网络,将所述部署机房的第一设备节点存储的所述目标文件复制至所述部署机房的所述部署设备节点。Copying the target file stored in the first device node of the deployment computer room to the deployment device node of the deployment computer room through an internal network.
在该可选的实施方式中,所有设备节点的调度分数被预先存储起来并定时更新,可以获取部署机房中每个设备节点的调度分数,并根据每个设备节点的调度分数以及预设分数阈值盲从部署机房中确定部署设备节点。然后通过内部网络,将部署机房中的第一设备节点存储的目标文件复制至部署机房的部署设备节点。In this optional implementation, the scheduling scores of all equipment nodes are pre-stored and regularly updated, and the scheduling scores of each equipment node in the deployment computer room can be obtained, and based on the scheduling scores of each equipment node and the preset score threshold Determine the deployment device node blindly from the deployment computer room. Then copy the target file stored in the first device node in the deployment computer room to the deployment device node in the deployment computer room through the internal network.
作为一种可选的实施方式,所述预设分数阈值有多个,多个所述预设分数阈值从大到小排序,所述确定模块202根据所述每个设备节点的调度分数以及预设分数阈值,从所述部署机房中确定部署设备节点的方式具体为:As an optional implementation manner, there are multiple preset score thresholds, and the multiple preset score thresholds are sorted from large to small, and the determining
针对多个所述预设分数阈值中的最大预设分数阈值,统计所述部署机房中调度分数大于所述最大预设分数阈值的第二设备节点的第一数量;For a maximum preset score threshold among the plurality of preset score thresholds, counting a first number of second device nodes whose scheduling scores are greater than the maximum preset score threshold in the deployment computer room;
判断所述第一数量是否大于或等于预设节点数量阈值;judging whether the first number is greater than or equal to a preset node number threshold;
若所述第一数量大于或等于预设节点数量阈值,从所述第二设备节点中,选取所述文件部署指令指示的数量的部署设备节点。If the first number is greater than or equal to the preset node number threshold, select deployment device nodes of the number indicated by the file deployment instruction from the second device nodes.
其中,所述预设节点数量阈值对应机房中需要部署的文件份数,假设部署一份文件对应的适合被调度的设备节点数量为125,若机房中需要部署的文件份数为1,则预设节点数量阈值为125,若文件份数为2,则预设节点数量阈值为250。因为一个机房或一个设备节点可以有多个正在部署的任务,为了保证多任务可以并行处理,需要确保部署一份文件时,有多个设备节点可以被调度。Wherein, the preset node number threshold corresponds to the number of files to be deployed in the computer room, assuming that the number of device nodes suitable for scheduling corresponding to deploying a file is 125, and if the number of files to be deployed in the computer room is 1, the pre-set Set the node number threshold to 125, and if the number of file copies is 2, the preset node number threshold is 250. Because a computer room or a device node can have multiple tasks being deployed, in order to ensure that multiple tasks can be processed in parallel, it is necessary to ensure that when a file is deployed, multiple device nodes can be scheduled.
在该可选的实施方式中,所述预设分数阈值可以根据业务需求确定,本发明实施例中选取的预设分数阈值为75、50、25以及0。最大预设分数阈值为75,可以判断调度分数大于75的设备节点的数量(第一数量)是否大于或等于预设节点数量阈值,若第一数量大于或等于预设节点数量阈值,则从第二设备节点中,选取文件部署指令指示的数量的部署设备节点。In this optional implementation manner, the preset score thresholds may be determined according to business requirements, and the preset score thresholds selected in the embodiment of the present invention are 75, 50, 25, and 0. The maximum preset score threshold is 75, and it can be judged whether the number (first number) of device nodes with a scheduling score greater than 75 is greater than or equal to the preset node number threshold, if the first number is greater than or equal to the preset node number threshold, then from the first In the second device node, select the number of deployment device nodes indicated by the file deployment instruction.
作为一种可选的实施方式,所述文件部署装置还可以包括:As an optional implementation manner, the file deployment device may also include:
提取模块,用于若所述第一数量小于预设节点数量阈值,按照多个所述预设分数阈值从大到小的排列顺序,提取除所述最大预设分数阈值之外的第一预设分数阈值;An extracting module, configured to extract a first predetermined score other than the maximum preset score threshold according to the arrangement order of the multiple preset score thresholds from large to small if the first number is less than the preset node number threshold. Set score threshold;
统计模块,用于统计所述部署机房中调度分数大于所述第一预设分数阈值的第三设备节点的第二数量;A statistical module, configured to count the second number of third device nodes whose scheduling score is greater than the first preset score threshold in the deployment computer room;
所述判断模块201,还用于判断所述第二数量是否大于或等于所述预设节点数量阈值;The judging
选取模块,用于若所述第二数量大于或等于所述预设节点数量阈值,从所述第三设备节点中,选取所述文件部署指令指示的数量的部署设备节点。A selecting module, configured to select, from the third device nodes, a number of deployment device nodes indicated by the file deployment instruction if the second number is greater than or equal to the preset node number threshold.
作为一种可选的实施方式,假设预设分数阈值为75、50、25以及0,若第一数量小于预设节点数量阈值,则将50确定为第一预设分数阈值,统计部署机房中调度分数大于50的设备节点(第三设备节点)的第二数量,并判断第二数量是否大于或等于预设节点数量阈值,若第二数量大于或等于预设节点数量阈值,从第三设备节点中,选取文件部署指令指示的数量的部署设备节点。若第二数量小于预设节点数量阈值,则统计部署机房中调度分数大于25的设备节点的第三数量,判断第三数量是否大于或等于预设数量阈值,若第三数量大于或等于预设数量阈值,则从部署机房中,选取文件部署指令指示的数量的部署设备节点。若第三数量小于预设数量阈值,则统计部署机房中调度分数大于0的设备节点的第四数量,判断第四数量是否大于或等于预设数量阈值,若第四数量大于或等于预设数量阈值,则从部署机房中,选取文件部署指令指示的数量的部署设备节点。可选的,若第四数量小于预设数量阈值,生成警告信息,并将所述警告信息发送至用户终端。As an optional implementation, assuming that the preset score thresholds are 75, 50, 25, and 0, if the first number is less than the preset node number threshold, 50 is determined as the first preset score threshold, and statistics are deployed in the computer room Scheduling the second number of device nodes (third device nodes) whose score is greater than 50, and judging whether the second number is greater than or equal to the preset node number threshold, if the second number is greater than or equal to the preset node number threshold, from the third device Among the nodes, select the number of deployment device nodes indicated by the file deployment instruction. If the second number is less than the preset node number threshold, count the third number of equipment nodes with a scheduling score greater than 25 in the deployment computer room, and determine whether the third number is greater than or equal to the preset number threshold, if the third number is greater than or equal to the preset If the quantity threshold is set, select the deployment device nodes of the number indicated by the file deployment instruction from the deployment computer room. If the third number is less than the preset number threshold, count the fourth number of equipment nodes with a scheduling score greater than 0 in the deployment computer room, and determine whether the fourth number is greater than or equal to the preset number threshold, if the fourth number is greater than or equal to the preset number threshold, select the number of deployment device nodes indicated by the file deployment instruction from the deployment computer room. Optionally, if the fourth quantity is less than the preset quantity threshold, a warning message is generated, and the warning message is sent to the user terminal.
作为一种可选的实施方式,所述判断模块201,还用于若所述目标机房的数量小于预设机房数量阈值,判断配置文件是否携带有需要进行机房容灾的指示信息;As an optional implementation manner, the judging
所述确定模块202,还用于若配置文件携带有需要进行机房容灾的指示信息,从除了所述目标机房之外的所有机房中,将可用空间容量最大的机房确定为第一机房;The
所述判断模块201,还用于判断所述目标机房的可用空间容量是否大于或等于所述第一机房的可用空间容量;The judging
所述部署模块203,还用于若所述目标机房的可用空间容量大于或等于所述第一机房的可用空间容量,通过内部网络,将所述目标文件部署至所述目标机房的设备节点,以及通过外部网络,将所述目标文件备份至所述第一机房的设备节点。The
在该可选的实施方式中,如果目标机房的数量小于预设机房数量,则可以确定没有进行机房容灾,需要判断配置文件中是否携带有需要进行机房容灾的指示信息,如果配置文件中携带有需要进行机房容灾的指示信息,则需要从除了目标机房之外的所有机房中,将可用空间容量最大的机房确定为第一机房。并从目标机房以及第一机房中选取可用空间容量最大的机房作为部署机房,即若目标机房的可用空间容量大于或等于第一机房的可用空间容量,通过内部网络,将目标文件部署至目标机房的设备节点,以及通过外部网络,部署一份目标文件至第一机房的设备节点(机房容灾);或,若目标机房的空间容量小于第一机房的可用空间容量,通过外部网络,将目标文件部署一份至第一机房的设备节点,然后通过内部网络,将目标文件复制至第一机房的其他设备节点,直至目标文件部署的份数满足文件部署指令指示的数量。In this optional implementation, if the number of target computer rooms is less than the preset number of computer rooms, it can be determined that disaster recovery of computer rooms has not been performed, and it is necessary to determine whether the configuration file contains information indicating that disaster recovery of computer rooms is required. Carrying the instruction information that disaster recovery needs to be carried out for the computer room, it is necessary to determine the computer room with the largest available space capacity as the first computer room from all the computer rooms except the target computer room. And select the computer room with the largest available space capacity from the target computer room and the first computer room as the deployment computer room, that is, if the available space capacity of the target computer room is greater than or equal to the available space capacity of the first computer room, deploy the target file to the target computer room through the internal network , and deploy a target file to the device node of the first computer room through the external network (computer room disaster recovery); or, if the space capacity of the target computer room is less than the available space capacity of the first computer room, through the external network, the target One copy of the file is deployed to the device node in the first computer room, and then the target file is copied to other device nodes in the first computer room through the internal network until the number of copies of the target file deployed meets the number indicated by the file deployment instruction.
作为一种可选的实施方式,所述确定模块202,还用于若不存在存储有所述文件部署指令指示的目标文件的第一设备节点,根据所有机房的可用空间容量,从所有机房中确定第二机房;As an optional implementation manner, the determining
所述部署模块203,还用于将所述目标文件部署至所述第二机房。The
在该可选的实施方式中,若不存在存储有所述文件部署指令指示的目标文件的第一设备节点,则需要确定所有机房的可用空间容量,并可以从所有机房中将可用空间容量最大的机房确定为用于文件部署的部署机房,若配置文件中的参数指示不需要进行机房容灾,可以将目标文件部署至部署机房的满足预设要求的设备节点。In this optional implementation, if there is no first device node storing the target file indicated by the file deployment instruction, it is necessary to determine the available space capacity of all computer rooms, and maximize the available space capacity from all computer rooms The computer room is determined as the deployment computer room for file deployment. If the parameters in the configuration file indicate that disaster recovery is not required for the computer room, the target file can be deployed to the device node in the deployment computer room that meets the preset requirements.
可选的,若配置文件中的参数指示需要进行机房容灾,则还需要从除了部署机房之外的所有机房中选取可用空间容量最大的机房,用于文件备份的容灾机房。除了将目标文件部署至部署机房的满足预设要求的设备节点,还需要将目标文件部署一份至容灾机房的满足预设要求的设备节点。Optionally, if the parameters in the configuration file indicate that computer room disaster recovery is required, it is also necessary to select the computer room with the largest available space capacity from all computer rooms except the deployment computer room, and use it as the disaster recovery computer room for file backup. In addition to deploying the target file to the device node meeting the preset requirements in the deployment computer room, it is also necessary to deploy a copy of the target file to the device node meeting the preset requirements in the disaster recovery computer room.
可选的,若部署机房中不存在满足预设要求的设备节点,或,容灾机房中不存在满足预设要求的设备节点,生成警告信息,并发送至用户终端。Optionally, if there is no device node meeting the preset requirements in the deployment computer room, or there is no device node meeting the preset requirements in the disaster recovery computer room, a warning message is generated and sent to the user terminal.
其中,所述机房容灾是指在另一个机房中备份文件,防止一个机房因故障从而导致文件丢失或停止提供该文件的服务。Wherein, the computer room disaster recovery refers to backing up files in another computer room, so as to prevent a computer room from losing files or stopping providing services for the files due to a failure in one computer room.
其中,所述预设要求可以为调度分数大于预设分数阈值的设备节点的数量大于预设节点数量阈值。Wherein, the preset requirement may be that the number of device nodes whose scheduling scores are greater than the preset score threshold is greater than the preset node quantity threshold.
其中,所述第二机房可以包括部署机房以及容灾机房。Wherein, the second computer room may include a deployment computer room and a disaster recovery computer room.
作为一种可选的实施方式,所述文件部署装置还可以包括:As an optional implementation manner, the file deployment device may also include:
第二获取模块,用于针对每个机房,每隔预设时间间隔,获取所述机房中每个设备节点的节点信息;The second obtaining module is used for obtaining the node information of each equipment node in the computer room at preset time intervals for each computer room;
所述确定模块202,还用于根据所述节点信息,确定所述设备节点的多个权重值;The determining
计算模块,用于根据所述多个权重值,计算所述设备节点的调度分数;a calculation module, configured to calculate the scheduling score of the device node according to the plurality of weight values;
存储模块,用于将所述调度分数进行存储。A storage module, configured to store the scheduling score.
其中,所述节点信息可以包括:节点状态、可用空间容量、节点负载、任务数量以及节点类型等。Wherein, the node information may include: node status, available space capacity, node load, task quantity, node type, and the like.
其中,所述节点类型可以包括:服务器以及智能硬件设备等。Wherein, the node type may include: a server, an intelligent hardware device, and the like.
在该可选的实施方式中,可以预先设置一个时间间隔(预设时间间隔),每隔预设时间间隔,获取每个机房内所有设备节点的节点信息,然后根据节点信息,可以确定设备节点的多个权重值,对于节点状态,在线时,权重值为1,不在线时,权重值为0;对于可用空间容量,大于50T时,权重值为5,大于10T并小于或等于50T时,权重值为4,大于3T并小于或等于10T时,权重值为3,大于500G并小于或等于3T时,权重值为2,大于100G并小于或等于500G时,权重值为1,小于100G时,权重值为0;节点负载可以为CPU(central processing unit,中央处理器)负载,及负载使用的CPU核数,对于节点类型为服务器的设备节点,负载小于1时,权重值为5,负载大于或等于1并小于CPU核数的1/4时,权重值为4,负载大于或等于CPU核数的1/4并小于CPU核数的1/2时,权重值为3,负载大于或等于CPU核数的1/2并小于CPU核数的3/4时,权重值为2,负载大于或等于CPU核数的3/4时,权重值为1。对于节点类型为智能硬件设备的设备节点,负载小于1时,权重值为5,负载大于或等于1并小于2,权重值为4,负载大于或等于2并小于3时,权重值为3,负载大于或等于3并小于4时,权重值为2,负载大于或等于4时,权重值为1。可以根据正在部署的任务数量确定权重值,对于节点类型为服务器的设备节点,任务数量小于2时,权重值为5,任务数量大于或等于2并小于4时,权重值为4,任务数量大于或等于4并小于6时,权重值为3,任务数量大于或等于6并小于8时,权重值为2,任务数量大于或等于8时,权重值为1。对于节点类型为智能硬件设备的设备节点,任务数量小于1时,权重值为5,任务数量大于或等于1并小于2时,权重值为4,任务数量大于或等于2并小于3时,权重值为3,任务数量大于或等于3并小于4时,权重值为2,任务数量大于或等于4时,权重值为1。其中,不同的节点信息对应的权重值的取值可以根据具体情况设定。最后,将节点状态的权重值、可用空间容量的权重值、节点负载的权重值以及任务数量的权重值相乘,得出设备节点的调度分数。可以将设备节点的调度分数存储至用于保存数据的服务器中,需要进行节点调度时,可以直接读取调度分数并做出调度策略,提高了调度效率。In this optional implementation, a time interval (preset time interval) can be preset, and the node information of all device nodes in each computer room can be obtained at every preset time interval, and then the device node can be determined according to the node information For the node status, when the node is online, the weight value is 1, when it is not online, the weight value is 0; for the available space capacity, when it is greater than 50T, the weight value is 5, when it is greater than 10T and less than or equal to 50T, The weight value is 4. When it is greater than 3T and less than or equal to 10T, the weight value is 3. When it is greater than 500G and less than or equal to 3T, the weight value is 2. When it is greater than 100G and less than or equal to 500G, the weight value is 1. When less than 100G , the weight value is 0; the node load can be the CPU (central processing unit, central processing unit) load, and the number of CPU cores used by the load. For the device node whose node type is server, when the load is less than 1, the weight value is 5, and the load When it is greater than or equal to 1 and less than 1/4 of the number of CPU cores, the weight value is 4; when the load is greater than or equal to 1/4 of the number of CPU cores and less than 1/2 of the number of CPU cores, the weight value is 3, and the load is greater than or When it is equal to 1/2 of the number of CPU cores and less than 3/4 of the number of CPU cores, the weight value is 2, and when the load is greater than or equal to 3/4 of the number of CPU cores, the weight value is 1. For a device node whose node type is an intelligent hardware device, when the load is less than 1, the weight value is 5; when the load is greater than or equal to 1 and less than 2, the weight value is 4; when the load is greater than or equal to 2 and less than 3, the weight value is 3. When the load is greater than or equal to 3 and less than 4, the weight value is 2, and when the load is greater than or equal to 4, the weight value is 1. The weight value can be determined according to the number of tasks being deployed. For a device node whose node type is a server, when the number of tasks is less than 2, the weight value is 5; when the number of tasks is greater than or equal to 2 and less than 4, the weight value is 4, and the number of tasks is greater than or equal to 4 and less than 6, the weight value is 3; when the number of tasks is greater than or equal to 6 and less than 8, the weight value is 2; when the number of tasks is greater than or equal to 8, the weight value is 1. For a device node whose node type is an intelligent hardware device, when the number of tasks is less than 1, the weight value is 5; when the number of tasks is greater than or equal to 1 and less than 2, the weight value is 4; when the number of tasks is greater than or equal to 2 and less than 3, the weight value The value is 3, when the number of tasks is greater than or equal to 3 and less than 4, the weight value is 2, and when the number of tasks is greater than or equal to 4, the weight value is 1. Wherein, the value of the weight value corresponding to different node information can be set according to specific situations. Finally, the weight value of the node state, the weight value of the available space capacity, the weight value of the node load and the weight value of the number of tasks are multiplied to obtain the scheduling score of the device node. The scheduling score of the device node can be stored in the server used to save the data. When node scheduling is required, the scheduling score can be directly read and a scheduling strategy can be made, which improves the scheduling efficiency.
在图2所描述的文件部署装置中,当接收到文件部署指令时,可以从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点;若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房;判断所述目标机房的数量是否大于或等于预设机房数量阈值;若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房;通过内部网络,将所述目标文件部署至所述部署机房的设备节点。可见,可以通过内部网络将文件部署至设备节点中,从而不消耗外网带宽,降低了网络开销,因为内网比外网稳定、安全,因此也提高了文件部署的成功率。In the file deployment device described in FIG. 2, when a file deployment instruction is received, it may be determined from among multiple device nodes included in all computer rooms whether there is a first device node that stores the target file indicated by the file deployment instruction ; If there is a first device node storing the target file indicated by the file deployment instruction, determine the target computer room where the first device node is located; determine whether the number of the target computer rooms is greater than or equal to the preset computer room number threshold; if The number of the target computer rooms is greater than or equal to the preset number threshold, and according to the available space capacity of the target computer rooms, the deployment computer room is determined from the target computer rooms; and the target file is deployed to the deployment computer room through the internal network device node. It can be seen that files can be deployed to device nodes through the internal network, thereby not consuming external network bandwidth and reducing network overhead. Because the internal network is more stable and secure than the external network, the success rate of file deployment is also improved.
如图3所示,图3是本发明实现文件部署方法的较佳实施例的服务器的结构示意图。所述服务器3包括存储器31、至少一个处理器32、存储在所述存储器31中并可在所述至少一个处理器32上运行的计算机程序33及至少一条通讯总线34。As shown in FIG. 3 , FIG. 3 is a schematic structural diagram of a server implementing a preferred embodiment of a file deployment method in the present invention. The
本领域技术人员可以理解,图3所示的示意图仅仅是所述服务器3的示例,并不构成对所述服务器3的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述服务器3还可以包括输入输出设备、网络接入设备等。Those skilled in the art can understand that the schematic diagram shown in FIG. 3 is only an example of the
所述服务器3所处的网络包括但不限于互联网、广域网、城域网、局域网、虚拟专用网络(Virtual Private Network,VPN)等。The network where the
所述至少一个处理器32可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、分立硬件组件等。该处理器32可以是微处理器或者该处理器32也可以是任何常规的处理器等,所述处理器32是所述服务器3的控制中心,利用各种接口和线路连接整个服务器3的各个部分。The at least one
所述存储器31可用于存储所述计算机程序33和/或模块/单元,所述处理器32通过运行或执行存储在所述存储器31内的计算机程序和/或模块/单元,以及调用存储在存储器31内的数据,实现所述服务器3的各种功能。所述存储器31可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据服务器3的使用所创建的数据(比如音频数据等)等。此外,存储器31可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件等。The
结合图1,所述服务器3中的所述存储器31存储多个指令以实现一种文件部署方法,所述处理器32可执行所述多个指令从而实现:Referring to FIG. 1, the
当接收到文件部署指令时,从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点;When the file deployment instruction is received, it is judged from the plurality of device nodes included in all the computer rooms whether there is a first device node storing the target file indicated by the file deployment instruction;
若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房;If there is a first device node storing the target file indicated by the file deployment instruction, determine the target computer room where the first device node is located;
判断所述目标机房的数量是否大于或等于预设机房数量阈值;judging whether the number of the target computer rooms is greater than or equal to a preset number threshold of computer rooms;
若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房;If the number of the target computer rooms is greater than or equal to the preset computer room quantity threshold, determine the deployment computer room from the target computer rooms according to the available space capacity of the target computer rooms;
通过内部网络,将所述目标文件部署至所述部署机房的设备节点。Deploy the target file to the device node in the deployment computer room through the internal network.
在一种可选的实施方式中,所述根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房之后,所述处理器32可执行所述多个指令从而实现:In an optional implementation manner, after the deployment of the computer room is determined from the target computer room according to the available space capacity of the target computer room, the
获取所述部署机房中每个设备节点的调度分数;Obtain the scheduling score of each device node in the deployment computer room;
根据所述每个设备节点的调度分数以及预设分数阈值,从所述部署机房中确定部署设备节点;Determining a deployment device node from the deployment computer room according to the scheduling score of each device node and a preset score threshold;
所述通过内部网络,将所述目标文件部署至所述部署机房的设备节点包括:Deploying the target file to the device node in the deployment computer room through the internal network includes:
通过内部网络,将所述部署机房的第一设备节点存储的所述目标文件复制至所述部署机房的所述部署设备节点。Copying the target file stored in the first device node of the deployment computer room to the deployment device node of the deployment computer room through an internal network.
在一种可选的实施方式中,所述预设分数阈值有多个,多个所述预设分数阈值从大到小排序,所述根据所述每个设备节点的调度分数以及预设分数阈值,从所述部署机房中确定部署设备节点包括:In an optional implementation manner, there are multiple preset score thresholds, and the multiple preset score thresholds are sorted from large to small, and the scheduling score and preset score according to each device node Threshold, determining the deployment device node from the deployment computer room includes:
针对多个所述预设分数阈值中的最大预设分数阈值,统计所述部署机房中调度分数大于所述最大预设分数阈值的第二设备节点的第一数量;For a maximum preset score threshold among the plurality of preset score thresholds, counting a first number of second device nodes whose scheduling scores are greater than the maximum preset score threshold in the deployment computer room;
判断所述第一数量是否大于或等于预设节点数量阈值;judging whether the first number is greater than or equal to a preset node number threshold;
若所述第一数量大于或等于预设节点数量阈值,从所述第二设备节点中,选取所述文件部署指令指示的数量的部署设备节点。If the first number is greater than or equal to the preset node number threshold, select deployment device nodes of the number indicated by the file deployment instruction from the second device nodes.
在一种可选的实施方式中,所述处理器32可执行所述多个指令从而实现:In an optional implementation manner, the
若所述第一数量小于预设节点数量阈值,按照多个所述预设分数阈值从大到小的排列顺序,提取除所述最大预设分数阈值之外的第一预设分数阈值;If the first number is less than the preset node number threshold, according to the arrangement order of the preset score thresholds from large to small, extract a first preset score threshold other than the maximum preset score threshold;
统计所述部署机房中调度分数大于所述第一预设分数阈值的第三设备节点的第二数量;Counting the second number of third device nodes whose scheduling score is greater than the first preset score threshold in the deployment computer room;
判断所述第二数量是否大于或等于所述预设节点数量阈值;judging whether the second number is greater than or equal to the preset node number threshold;
若所述第二数量大于或等于所述预设节点数量阈值,从所述第三设备节点中,选取所述文件部署指令指示的数量的部署设备节点。If the second number is greater than or equal to the preset node number threshold, select deployment device nodes of the number indicated by the file deployment instruction from the third device nodes.
在一种可选的实施方式中,所述处理器32可执行所述多个指令从而实现:In an optional implementation manner, the
若所述目标机房的数量小于预设机房数量阈值,判断配置文件是否携带有需要进行机房容灾的指示信息;If the number of the target computer rooms is less than the preset number threshold of computer rooms, it is judged whether the configuration file carries indication information that needs to perform computer room disaster recovery;
若配置文件携带有需要进行机房容灾的指示信息,从除了所述目标机房之外的所有机房中,将可用空间容量最大的机房确定为第一机房;If the configuration file carries the instruction information that requires computer room disaster recovery, from all the computer rooms except the target computer room, determine the computer room with the largest available space capacity as the first computer room;
判断所述目标机房的可用空间容量是否大于或等于所述第一机房的可用空间容量;judging whether the available space capacity of the target computer room is greater than or equal to the available space capacity of the first computer room;
若所述目标机房的可用空间容量大于或等于所述第一机房的可用空间容量,通过内部网络,将所述目标文件部署至所述目标机房的设备节点,以及通过外部网络,将所述目标文件备份至所述第一机房的设备节点。If the available space capacity of the target computer room is greater than or equal to the available space capacity of the first computer room, deploy the target file to the device node of the target computer room through the internal network, and deploy the target file through the external network The files are backed up to the device nodes in the first computer room.
在一种可选的实施方式中,所述处理器32可执行所述多个指令从而实现:In an optional implementation manner, the
若不存在存储有所述文件部署指令指示的目标文件的第一设备节点,根据所有机房的可用空间容量,从所有机房中确定第二机房;If there is no first device node storing the target file indicated by the file deployment instruction, determine the second computer room from all computer rooms according to the available space capacity of all computer rooms;
将所述目标文件部署至所述第二机房。Deploy the target file to the second computer room.
在一种可选的实施方式中,所述处理器32可执行所述多个指令从而实现:In an optional implementation manner, the
针对每个机房,每隔预设时间间隔,获取所述机房中每个设备节点的节点信息;For each computer room, obtain node information of each device node in the computer room at preset time intervals;
根据所述节点信息,确定所述设备节点的多个权重值;determining multiple weight values of the device node according to the node information;
根据所述多个权重值,计算所述设备节点的调度分数;calculating a scheduling score of the device node according to the plurality of weight values;
将所述调度分数进行存储。The scheduling score is stored.
具体地,所述处理器32对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。Specifically, for the specific implementation method of the above instruction by the
在图3所描述的服务器3中,当接收到文件部署指令时,可以从所有机房包括的多个设备节点中,判断是否存在存储有所述文件部署指令指示的目标文件的第一设备节点;若存在存储有所述文件部署指令指示的目标文件的第一设备节点,确定所述第一设备节点所在的目标机房;判断所述目标机房的数量是否大于或等于预设机房数量阈值;若所述目标机房的数量大于或等于预设机房数量阈值,根据所述目标机房的可用空间容量,从所述目标机房中确定部署机房;通过内部网络,将所述目标文件部署至所述部署机房的设备节点。可见,可以通过内部网络将文件部署至设备节点中,从而不消耗外网带宽,降低了网络开销,因为内网比外网稳定、安全,因此也提高了文件部署的成功率。In the
所述服务器3集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。If the integrated modules/units of the
在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may physically exist separately, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or in the form of hardware plus software function modules.
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。It will be apparent to those skilled in the art that the invention is not limited to the details of the above-described exemplary embodiments, but that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Accordingly, the embodiments should be regarded in all points of view as exemplary and not restrictive, the scope of the invention being defined by the appended claims rather than the foregoing description, and it is therefore intended that the scope of the invention be defined by the appended claims rather than by the foregoing description. All changes within the meaning and range of equivalents of the elements are embraced in the present invention. Any reference sign in a claim should not be construed as limiting the claim concerned. In addition, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or devices stated in the system claims may also be realized by one unit or device through software or hardware. Secondary terms are used to denote names without implying any particular order.
最后应说明的是,以上实施例仅用以说明本发明的技术方案而非限制,尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,可以对本发明的技术方案进行修改或等同替换,而不脱离本发明技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention without limitation, although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be Modifications or equivalent replacements can be made without departing from the spirit and scope of the technical solutions of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910913988.3A CN110704382B (en) | 2019-09-25 | 2019-09-25 | File deployment method, device, server and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910913988.3A CN110704382B (en) | 2019-09-25 | 2019-09-25 | File deployment method, device, server and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110704382A CN110704382A (en) | 2020-01-17 |
CN110704382B true CN110704382B (en) | 2022-12-13 |
Family
ID=69198052
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910913988.3A Active CN110704382B (en) | 2019-09-25 | 2019-09-25 | File deployment method, device, server and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110704382B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117742931A (en) * | 2022-09-15 | 2024-03-22 | 华为云计算技术有限公司 | Method and device for determining big data cluster deployment scheme, clusters and storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7895591B2 (en) * | 2004-10-21 | 2011-02-22 | Oracle International Corp. | File deployment system and method |
CN108920489B (en) * | 2018-05-14 | 2021-03-16 | 北京辰森世纪科技股份有限公司 | Method, device and equipment for deploying database |
CN109634915A (en) * | 2018-11-28 | 2019-04-16 | 深圳市网心科技有限公司 | File dispositions method, Cloud Server, system and storage medium |
-
2019
- 2019-09-25 CN CN201910913988.3A patent/CN110704382B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN110704382A (en) | 2020-01-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20200265009A1 (en) | Blockchain-based data migration method and apparatus | |
CN110708369B (en) | File deployment method, device, scheduling server and storage medium for device node | |
CN112261135B (en) | Node election method, system, device and equipment based on consistency protocol | |
KR101871383B1 (en) | Method and system for using a recursive event listener on a node in hierarchical data structure | |
CN110321226A (en) | Automatic scalable appearance method, apparatus, host and the storage medium of host | |
CN103049339A (en) | Resuming applications and/or exempting applications from suspension | |
WO2019232993A1 (en) | Adaptive data recovery flow control method and apparatus, electronic device and storage medium | |
CN109828960B (en) | Log library capacity expansion method, system, computer device and readable storage medium | |
CN106487911A (en) | A data synchronization method, device and system | |
CN106572153A (en) | Data storage method and device of cluster | |
CN110391873B (en) | Method, apparatus and computer program product for determining a data transfer mode | |
US20160044096A1 (en) | Scaling Up and Scaling Out of a Server Architecture for Large Scale Real-Time Applications | |
US9746900B2 (en) | System and method for redundant object storage | |
CN105630419B (en) | A kind of the subregion view sending method and management node of resource pool | |
CN113014608A (en) | Flow distribution control method and device, electronic equipment and storage medium | |
US10523508B2 (en) | Monitoring management systems and methods | |
CN110704382B (en) | File deployment method, device, server and storage medium | |
US20230097087A1 (en) | Image detection method based on neural network model, electronic device, and storage medium | |
CN109189327A (en) | The compression processing method and device of block chain data | |
CN109508261B (en) | Power grid data node backup method and system based on big data | |
CN117851391A (en) | Data filtering method and system, electronic device and storage medium | |
CN115883373A (en) | Elastic deployment method based on gateway | |
CN110286948A (en) | Process suspension method and related equipment based on reading and writing of virtual host storage device | |
CN110968257A (en) | Method, apparatus and computer program product for storage management | |
CN118626553A (en) | A data synchronization method, device and system |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |