WO2015196844A1 - 任务分配方法、装置、系统和服务器 - Google Patents

任务分配方法、装置、系统和服务器 Download PDF

Info

Publication number
WO2015196844A1
WO2015196844A1 PCT/CN2015/076117 CN2015076117W WO2015196844A1 WO 2015196844 A1 WO2015196844 A1 WO 2015196844A1 CN 2015076117 W CN2015076117 W CN 2015076117W WO 2015196844 A1 WO2015196844 A1 WO 2015196844A1
Authority
WO
WIPO (PCT)
Prior art keywords
server
task
tag
label
stored
Prior art date
Application number
PCT/CN2015/076117
Other languages
English (en)
French (fr)
Inventor
王哲
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2015196844A1 publication Critical patent/WO2015196844A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a task allocation method and apparatus, a method and server for sensing task assignment, and a task assignment system.
  • the servers are usually grouped for convenient management. For example, 100 servers, 20 of which are used for website navigation, and the rest are used for storage and other services. Generally, servers with the same service have the same configuration mode. Task assignments are also often grouped.
  • the traditional multi-server task allocation method to specify a certain group of servers to perform specific tasks, for example, to specify the web service server, first to find out which server the web service corresponds to from the database, and then, the server host name or IP address Take out, and then issue the corresponding commands to these servers based on the results of the search. Since each server may belong to more than one business or role dimension, and the server's business, the role may change. Each task release needs to be searched, and the operation and maintenance complexity is high.
  • the present invention has been made in order to provide a task assignment method and apparatus, a method and server for perceiving task assignment, and a task assignment system, which overcome the above problems or at least partially solve the above problems.
  • a method for task assignment comprising: adding a first tag including one or more fields in a task message, wherein one or more fields correspond to a task assignment object in one or more The feature information of the preset dimension; sending the task message carrying the first tag to all servers, so that each server matches the pre-stored second tag with the first tag, and the successfully matched server responds to the task message,
  • the second label includes one or more fields corresponding to the characteristic information of the server in one or more preset dimensions.
  • a method for perceiving task assignment comprising:
  • a task distribution apparatus comprising: an adding module, adapted to add a first label including one or more fields in a task message, and one or more fields corresponding to the task assignment object in one Or a plurality of preset dimension feature information; the sending module is configured to send the task message carrying the first tag to all servers, so that each server matches the pre-stored second tag with the first tag, and the matching is successful.
  • the server responds to the task message, wherein the second tag includes one or more fields corresponding to the feature information of the server within one or more preset dimensions.
  • a server which is applicable to a perceptual task allocation, and includes: a receiving module, configured to receive a task message carrying a first tag, where the first tag includes one or more fields, corresponding tasks Assigning feature information of the object in one or more preset dimensions; the matching module is adapted to match the pre-stored second tag with the first tag, wherein the second tag includes one or more fields, and the corresponding server is at one or more The feature information of the preset dimension; the response module is adapted to respond to the task message if the matching module matches successfully.
  • a task distribution system comprising: the task distribution device and the server described above.
  • a computer program comprising computer readable code, when the computer readable code is run on a computing device, causing the computing device to perform according to any of the above A method of task assignment and/or a method of perceiving task assignment.
  • a computer readable medium wherein the computer program described above is stored.
  • a first tag including one or more fields is added to the task message; a task message carrying the first tag is sent to all servers, and each server receives the task message After that, the pre-stored second tag is matched with the first tag, and the successfully matched server makes a response to the task message.
  • the server responds to the task message according to the label matching result, thereby reducing operation and maintenance. Complexity makes the task assignment process standardized and consistent.
  • FIG. 1 shows a flow chart of a task assignment method in accordance with one embodiment of the present invention
  • FIG. 2 shows a flow chart of a method of perceiving task assignments in accordance with one embodiment of the present invention
  • FIG. 3 is a block diagram showing the structure of a task distribution apparatus according to an embodiment of the present invention.
  • FIG. 4 is a block diagram showing the structure of a server according to an embodiment of the present invention.
  • FIG. 5 is a block diagram showing the structure of a task distribution system according to an embodiment of the present invention.
  • Figure 6 is a schematic block diagram of a computing device for performing a method of task assignment and/or perceptual task assignment in accordance with the present invention
  • Fig. 7 schematically shows a storage unit for holding or carrying program code implementing a method of task assignment according to the invention and/or a method of perceptual task assignment.
  • FIG. 1 is a flow chart showing a task assignment method according to an embodiment of the present invention. As shown in FIG. 1, the method includes the following steps:
  • Step S110 adding a first tag including one or more fields to the task message.
  • the one or more fields in the first label correspond to the feature information of the task assignment object in one or more preset dimensions, and the task assignment object is the target server that performs the task.
  • the task message includes a task to be executed and a first tag, wherein the task may be deleting a file, restarting a service, and the like.
  • the one or more preset dimensions include: a service dimension, and/or a role dimension, and/or a location dimension.
  • the present invention is also applicable to a situation in which the number of servers required for website operations, data processing, and the like is increasing.
  • website operations it may involve multiple services such as data storage, URL navigation, and each service corresponds to one or more servers.
  • a group of servers corresponding to the same service usually have a unified configuration, and the same task is performed, and when the task is assigned, it can be performed in a predetermined grouping.
  • the server is grouped according to the service dimension and the role dimension, and the service dimension includes a storage service, a web service, and the like, and the role dimension includes a mysql server, a redis server, an apache server, and an nginx server.
  • Some servers are used to store services, such as deploying mysql, redis databases, and some for web services, such as deploying apache databases, nginx databases, and so on.
  • the servers are grouped according to the preset dimensions described above, and the group information is pre-stored on the server in the form of a second tag.
  • the group information is pre-stored on the server in the form of a second tag.
  • it can be identified by one dimension or a combination of two dimensions, for example, an nginx server for navigating services, a mysql server for storing services, and the like.
  • One or more fields of the second tag pre-stored on the server correspond to preset dimensions used by the server to group, each field including a field name and a field value.
  • the field name can be set to the name of the preset dimension, and the field value indicates the characteristic information of the server in this dimension.
  • the second tag may include two fields, which respectively represent feature information of the server in the service and role dimensions.
  • the field names may be respectively set to service, role, and the field values are respectively navigation, nginx. .
  • the first tag is set in the same manner, and the first tag is used to specify the target server to which the task is assigned, and specifically, the feature information of the target server in the above dimension is represented by one or more fields.
  • the appropriate field value is selected for the first tag based on the object assigned by the task. If the task assignment object is a set of nginx servers for navigation, the first label can contain two fields, and the field values are navigation, nginx.
  • the first tag contains only one field, for example, a field containing only the service dimension, and the field value is storage, indicating that the task of the task is all servers for storing services including the redis server and the mysql server.
  • the server may also be added with other dimensions, such as the location of the computer room.
  • the second label further includes a field indicating the location information of the equipment room.
  • the field name is idc
  • the corresponding field The field value is Beijing, indicating that the server is located in Beijing.
  • the method further comprises storing one or more second tags of each server in a database.
  • the host name, ip address, etc. of each server are stored in the database in association with one or more second tags of the server itself.
  • the service and the role of the same server may change.
  • the method in this embodiment further includes: periodically updating the second label of each server stored in the database.
  • the second label is stored in the database, and the correspondence between the second label and the server is used as a reference for setting the second label on the server side.
  • the method further includes: each server stored in the database
  • One or more second tags are synchronized to the corresponding server. Specifically, the synchronization process can be performed immediately after the update to ensure the accuracy of the task assignment.
  • Step S120 Send a task message carrying the first label to all servers.
  • all servers are managed by one central machine, and task messages are sent to the server.
  • the server and the central machine talk through a secure protocol on the application layer.
  • task messages are sent to the server by configuring ssh (Secure Shell Protocol) remote login.
  • ssh Secure Shell Protocol
  • Task messages can be sent by broadcast, and all servers communicating with the central machine can receive each task message. Therefore, the steps of searching for the IP address of the task assignment object, the host name, and the like in the database are omitted, which simplifies the complexity of task assignment.
  • the server After receiving the task message, the server obtains the first tag carried from the task message. Each server matches its own second tag with the first tag in the task message, and the successfully matched server responds to the task message.
  • the same server may belong to different business or role dimensions, and there may be more than one second label on each server.
  • the server can be pre-stored with two.
  • the second tag, the field values of the corresponding service dimensions in the two second tags are storage and web respectively.
  • the second label includes two fields, a first field and a second field, indicating that the server is in the service dimension and the role dimension.
  • Characteristic information of degree For example, the names of the first and second fields are service and role, and the field values are navigation and mysql, respectively.
  • the second label further includes a third field indicating the location information of the equipment room, the field name is idc, and the corresponding field value is Beijing, indicating that the server is located in Beijing.
  • the server parses the field information in the first tag, matches the field information with one or more second tags of the device, and the matching succeeds, and the server performs the task carried in the task message.
  • the tag matching on the server and the setting of the field information when sending the task message are performed according to predetermined rules.
  • the rules are various.
  • the format of the first label and the second label described above and the matching manner are only examples, and are used to explain the implementation process. In practice, you can choose other server grouping methods, dimensions and corresponding matching rules.
  • a first label including one or more fields is added to the task message; a task message carrying the first label is sent to all servers, and each server will be pre-stored after receiving the task message.
  • the second tag is matched with the first tag, and the successfully matched server responds to the task message.
  • the host name and IP of the server need not be searched, and the task message is sent to each
  • the server responds to the task message by the server according to the label matching result, which reduces the complexity of the operation and maintenance, and makes the task allocation process standardized and consistent.
  • FIG. 2 is a flowchart of a method for perceiving task allocation according to an embodiment of the present invention. This embodiment describes the execution process of the method of the present invention on the server side. As shown in FIG. 2, the method includes the following steps:
  • Step S210 Receive a task message carrying the first label.
  • the first tag includes one or more fields corresponding to the feature information of the task assignment object in one or more preset dimensions.
  • the server receives the task message broadcast sent by the central machine, and all servers communicating with the central machine can receive each task message. Therefore, the steps of searching for the IP address of the task assignment object, the host name, and the like in the database are omitted, which simplifies the complexity of task assignment.
  • step S220 the pre-stored second tag is matched with the first tag. If the matching is successful, step S230 is performed, otherwise step S240 is performed.
  • the second tag includes one or more fields corresponding to the feature information of the server in one or more preset dimensions.
  • Step S230 executing a task included in the task message.
  • Tasks can be to delete files, restart a service, and so on.
  • step S240 the task message is ignored.
  • FIG. 3 is a structural block diagram of a task distribution apparatus according to an embodiment of the present invention. As shown in FIG. 3, the apparatus includes:
  • the adding module 310 is adapted to add a first tag comprising one or more fields in the task message.
  • the one or more fields correspond to the feature information of the task assignment object in one or more preset dimensions; the task may be deleting a file, restarting a service, and the like.
  • the one or more preset dimensions include: a service dimension, and/or a role dimension, and/or a location dimension.
  • Each field in the first tag includes a field name and a field value.
  • the field name can be the name of the preset dimension, and the field value indicates the feature information of the task assignment object in this dimension.
  • the first tag added by the adding module 310 in the task message may include two fields respectively indicating a service dimension and a role dimension to which the server belongs, for example, the field names are service, role respectively.
  • the add module 310 when adding the first tag to the task message, selects an appropriate field value based on the object assigned by the task. For example, if the object assigned by the task is a redis server for storage, the values of the two fields are storage, redis. Or, the service tag field information only includes some fields, for example, a field containing only the service dimension. If the field value is storage, the target of the task is all servers for storing services, and the package Includes redis server and mysql server.
  • the first tag further includes a third field indicating the location information of the room, the field name can be set to idc, and the corresponding field value is Beijing, indicating that the server is located in Beijing.
  • the sending module 320 is adapted to send the task message carrying the first label to all servers.
  • the server and the apparatus described in this embodiment can conduct a session through a security protocol on the application layer.
  • the task message is sent to the server through the sending module 320 by configuring ssh (secure shell protocol) remote login or the like.
  • ssh secure shell protocol
  • a low-privileged account can be used and the task-storing device to the server's ssh (secure shell protocol) trust can be configured.
  • the sending module 320 sends the task message by means of broadcast, and all servers communicating with the device can receive each task message. Therefore, the steps of searching for the IP address of the task assignment object, the host name, and the like in the database are omitted, which simplifies the complexity of task assignment.
  • the server After receiving the task message, the server matches one or more second tags of the server with the first tag in the task message, and responds to the task message by the server that successfully matches.
  • the apparatus further comprises: a database 330 adapted to store one or more second tags of each server.
  • the second label stored in the database 330 and the corresponding relationship between the second label and the server can be used as a record and reference for setting the second label on the server side.
  • the device further includes: an update module 340, configured to periodically update one or more second tags of each server stored in the database 330.
  • the apparatus further includes: a first synchronization module 350 adapted to synchronize one or more second tags of each server stored in the database 330 to the corresponding server.
  • the synchronization process can be performed after the update, which ensures the accuracy of the task assignment.
  • FIG. 4 is a structural block diagram of a server according to an embodiment of the present invention. As shown in FIG. 4, the server includes:
  • the receiving module 410 is adapted to receive a task message carrying the first label.
  • the first tag includes one or more fields corresponding to the feature information of the task assignment object in one or more preset dimensions.
  • the matching module 420 is adapted to match the pre-stored second tag with the first tag.
  • the second label includes one or more fields corresponding to the characteristic information of the server in one or more preset dimensions.
  • the response module 440 is adapted to respond to the task message if the matching module matches successfully.
  • the server further includes: a second synchronization module 430, configured to synchronize the pre-stored one or more second tags according to the second tag stored in the database.
  • a second synchronization module 430 configured to synchronize the pre-stored one or more second tags according to the second tag stored in the database.
  • FIG. 5 is a structural block diagram of a task distribution system according to an embodiment of the present invention. As shown in FIG. 5, the system includes: the above task distribution device, and a server.
  • the task distribution apparatus, the server and the task assignment system do not need to perform a lookup operation, but send a task message to each server, and the server senses its own service or role and responds to the task message.
  • modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
  • Modules or units or components in an embodiment may be combined into one module or unit Or components, and in addition, they can be divided into multiple sub-modules or sub-units or sub-components.
  • any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined.
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some or all of the functionality of some or all of the components of the task-dispensing apparatus, system, and server in accordance with embodiments of the present invention.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Figure 6 illustrates a computing device that can implement a method of transferring data between intelligent terminals.
  • the computing device conventionally includes a processor 610 and a computer program product or computer readable medium in the form of a memory 620.
  • the memory 620 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
  • Memory 620 has a memory space 630 for program code 631 for performing any of the method steps described above.
  • storage space 630 for program code may include various program code 631 for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products.
  • the computer program product includes program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks.
  • the computer program product is typically a portable or fixed storage unit as described with reference to FIG.
  • the storage unit may have storage segments, storage spaces, and the like that are similarly arranged to memory 620 in the computing device of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit includes computer readable code 631', ie, code readable by a processor, such as 610, that when executed by a computing device causes the computing device to perform each of the methods described above step.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种任务分配方法和装置,一种感知任务分配的方法和服务器,以及一种任务分配系统,其中,任务分配方法包括:在任务消息中添加包括一个或多个字段的第一标签;将携带有第一标签的任务消息发送至所有服务器,每个服务器接收任务消息后,将预存的第二标签与第一标签进行匹配,由匹配成功的服务器对所述任务消息作出响应,根据该方案,任务分配时,不需要查找服务器的主机名、IP,而将任务消息发送给每个服务器,由服务器根据标签匹配结果响应任务消息,这样减少了运维的复杂度,使任务分配过程规范、一致。

Description

任务分配方法、装置、系统和服务器 技术领域
本发明涉及计算机技术领域,具体涉及一种任务分配方法和装置,一种感知任务分配的方法和服务器,以及一种任务分配系统。
背景技术
服务器数量众多时,为方便管理,通常对服务器进行分组,例如,100台服务器,其中20台用于网址导航,其余的用于存储等其他业务,通常,业务相同的服务器具有相同的配置方式,则任务分配也经常分组进行。
传统的多服务器间的任务分配方法,要指定某一组服务器执行特定任务,例如,指定web业务的服务器,首先要从数据库中查找web业务对应于哪些服务器,然后,将服务器主机名称或IP地址取出,再根据查找的结果,发布相应的命令到这些服务器上。由于每台服务器可能属于一个以上的业务或角色维度,并且服务器的业务,角色可能变化。每次任务发布都需要经过查找,运维的复杂度较高。
发明内容
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的一种任务分配方法和装置,一种感知任务分配的方法和服务器,以及一种任务分配系统。
根据本发明的一方面,提供了一种任务分配的方法,包括:在任务消息中添加包括一个或多个字段的第一标签,其中,一个或多个字段对应任务分配对象在一个或多个预设维度的特征信息;将携带有第一标签的任务消息发送至所有服务器,以供每个服务器将预存的第二标签与第一标签进行匹配,由匹配成功的服务器对任务消息作出响应,其中,第二标签包括一个或多个字段,对应服务器在一个或多个预设维度的特征信息。
根据本发明的另一个方面,提供了一种感知任务分配的方法,包括:
接收携带第一标签的任务消息,第一标签中包括一个或多个字段,对应任务分配对象在一个或多个预设维度的特征信息;将预存的第二标签与第一标签进行匹配,其中,第二标签包括一个或多个字段,对应该服务器在一个或多个预设维度的特征信息;若匹配成功,服务器对任务消息作出响应。
根据本发明的另一个方面,提供了一种任务分配装置,包括:添加模块,适于在任务消息中添加包括一个或多个字段的第一标签,一个或多个字段对应任务分配对象在一个或多个预设维度的特征信息;发送模块,适于将携带有第一标签的任务消息发送至所有服务器,以供每个服务器将预存的第二标签与第一标签进行匹配,由匹配成功的服务器对任务消息作出响应,其中,第二标签包括一个或多个字段,对应服务器在一个或多个预设维度内的特征信息。
根据本发明的另一个方面,提供了一种服务器,适用于感知任务分配,包括:接收模块,适于接收携带第一标签的任务消息,所述第一标签包括一个或多个字段,对应任务分配对象在一个或多个预设维度的特征信息;匹配模块,适于将预存的第二标签与第一标签进行匹配,其中,第二标签包括一个或多个字段,对应服务器在一个或多个预设维度的特征信息;响应模块,适于在匹配模块匹配成功的情况下,对任务消息作出响应。
根据本发明的另一个方面,提供了一种任务分配系统,包括:上述的任务分配装置及服务器。
根据本发明的又一个方面,提供了一种计算机程序,其包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据上文任一个所述的任务分配方法和/或感知任务分配的方法。
根据本发明的再一个方面,提供了一种计算机可读介质,其中存储了上述的计算机程序。
本发明的有益效果为:
根据本发明的任务分配方法、系统、装置和服务器,在任务消息中添加包括一个或多个字段的第一标签;将携带有第一标签的任务消息发送至所有服务器,每个服务器接收任务消息后,将预存的第二标签与第一标签进行匹配,由匹配成功的服务器对所述任务消息作出响 应,根据该方案,向多台服务器分配任务时,不需要查找服务器的主机名、IP,而将任务消息发送给每个服务器,由服务器根据标签匹配结果响应任务消息,这样减少了运维的复杂度,使任务分配过程规范、一致。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1示出了根据本发明一个实施例的任务分配方法的流程图;
图2示出了根据本发明一个实施例的感知任务分配的方法的流程图;
图3示出了根据本发明一个实施例的任务分配装置的结构框图;
图4示出了根据本发明一个实施例的服务器的结构框图;
图5示出了根据本发明一个实施例的任务分配系统的结构框图;
图6示意性地示出了用于执行根据本发明的任务分配方法和/或感知任务分配的方法的计算设备的框图;以及
图7示意性地示出了用于保持或者携带实现根据本发明的任务分配方法和/或感知任务分配的方法的程序代码的存储单元。
具体实施方式
下面结合附图和具体的实施方式对本发明作进一步的描述。
图1示出了根据本发明一个实施例的任务分配方法的流程图,如图1所述,该方法包括如下步骤:
步骤S110,在任务消息中添加包括一个或多个字段的第一标签。
其中,第一标签中的一个或多个字段对应任务分配对象在一个或多个预设维度的特征信息,任务分配对象即为执行任务的目标服务器。
按上述方式,任务消息中包含了待执行任务和第一标签,其中,任务可以是删除文件,重启某项服务等。
在本发明实施例中,一个或多个预设维度包括:业务维度,和/或角色维度,和/或位置维度。
本发明还适用于这样一种情况,网站运营,数据处理等所需的服务器数量不断增加。例如,对于网站运营,可能涉及数据存储,网址导航等多种业务,每项业务对应于一个或多个服务器。对应于同一业务的一组服务器通常具有统一的配置,执行相同的任务,则在进行任务分配时,可以按预定的分组进行。
具体地,在本发明实施例中,按业务维度及角色维度对服务器进行分组,业务维度包括存储业务、web业务等,角色维度包括mysql服务器、redis服务器、apache服务器、nginx服务器等。一部分服务器用于存储业务,如部署mysql,redis数据库,一部分用于web业务,如部署apache数据库,nginx数据库等。
在本实施例方法执行之前,按上述的预设维度对服务器进行分组,并将分组信息以第二标签的形式预存在服务器上。对任一组服务器,可通过一个维度,或两个维度的组合进行标识,例如,用于导航业务的nginx服务器,用于存储业务的mysql服务器等。
服务器上预存的第二标签的一个或多个字段对应服务器分组时所用的预设维度,每个字段包括字段名和字段值。字段名可以设为预设维度的名称,字段值表明该服务器在这一维度的特征信息。
具体地,对于导航的nginx服务器,第二标签可以包括两个字段,分别表示该服务器在业务和角色维度的特征信息,例如,字段名可分别设为service,role,字段值分别为navigation,nginx。
按相同的方式设置第一标签,第一标签用于指定任务分配的目标服务器,具体地,通过一个或多个字段表示目标服务器在上述维度内的特征信息。在向任务消息中添加第一标签时,根据任务分配的对象为第一标签选择合适的字段值。若任务分配对象是一组导航的nginx服务器,则第一标签可包含两个字段,字段值分别为navigation,nginx。
或者,第一标签只包含一个字段,例如,只包含业务维度的字段,字段值为storage,则表示任务的分配对象为包括redis服务器和mysql服务器在内的所有用于存储业务的服务器。
当然,也可以添加其他维度对服务器进行分组,如机房位置等,则对于上述的用于导航的nginx服务器,第二标签进一步包括表示机房位置信息的字段,例如,该字段名为idc,相应的字段值为Beijing,表示该服务器位于北京。
依据本发明的一个实施例,该方法还包括,在数据库中存储每个服务器的一个或多个第二标签。将每台服务器的主机名称、ip地址等与该服务器自身的一个或多个第二标签相关联地存储在数据库中。
同一服务器所属的业务、角色可能发生变化,本实施例的方法还包括:定时更新数据库中存储的每个服务器的第二标签。
数据库中存储第二标签,及第二标签与服务器的对应关系,可作为服务器端设置第二标签的参照,则依据本发明的一个实施例,该方法还包括:将数据库中存储的每个服务器的一个或多个第二标签同步给对应的服务器。具体地,同步过程可在更新后立即进行,以保证任务分配的准确性。
步骤S120,将携带有所述第一标签的任务消息发送至所有服务器。
在本发明实施例中,通过一台中心机管理全部的服务器,向服务器发送任务消息。服务器和中心机通过应用层上的安全协议进行会话。例如,通过配置ssh(安全Shell协议)远程登录等方式将任务消息发送到服务器上。具体地,考虑到安全问题,可以使用一个低权限的账号,并配置中心机到服务器的ssh(安全Shell协议)信任。
任务消息可以通过广播的方式发送,所有与中心机通信的服务器都能够接收每一条任务消息。从而省略了在数据库中查找任务分配对象的IP地址,主机名称等步骤,简化了任务分配的复杂度。
服务器接收任务消息后,从任务消息中获取携带的第一标签。每个服务器将自身的第二标签与任务消息中的第一标签进行匹配,由匹配成功的服务器对任务消息作出响应。
同一服务器可能属于不同的业务维度或角色维度,则每个服务器上的第二标签可能多于一个,例如,一台服务器即用于存储,也用于web业务,则该服务器可预存有两个第二标签,这两个第二标签中对应业务维度的字段值分别为storage和web。
具体地,以导航的的mysql服务器为例,其第二标签包括两个字段,分别为第一字段和第二字段,表示该服务器在业务维度和角色维 度的特征信息。例如,第一、第二字段的名称分别为service和role,字段值分别为navigation和mysql。
还可以添加其他的字段,如机房位置。例如,对于上述的mysql服务器,第二标签还包括表示机房位置信息的第三个字段,该字段名为idc,相应的字段值为Beijing,表示该服务器位于北京。
具体地,服务器接收任务消息后,解析出第一标签中的字段信息,将字段信息与自身的一个或多个第二标签匹配,匹配成功,该服务器就执行任务消息中携带的任务。
服务器上的标签匹配,以及发送任务消息时字段信息的设置均按预定的规则进行。规则是多样的,例如,任务消息中的第一标签的字段信息为“service=storage,role=mysql”,该字段信息指定了所有用于存储的mysql服务器,若服务器自身的标签也为“service=storage,role=mysql”,则认为匹配成功,若服务器自身的标签为“service=storage,role=mysql,idc=beijing”,匹配结果也为成功。又例如,任务消息中的携带的第二标签的字段信息为“service=storage,role=all,idc=all”,该字段信息指定所有的存储服务器,则所有第二标签中带有“service=storage”字段,如“service=storage,role=mysql,idc=beijing”,“service=storage,role=redis,idc=shanghai”等也判断为匹配成功。
上述的第一标签,第二标签的格式及匹配方式只作为示例,用于说明实施过程。实际中,可以选择其他的服务器分组方式,维度及相应的匹配规则。
根据本发明上述实施例提供的方法,在任务消息中添加包括一个或多个字段的第一标签;将携带有第一标签的任务消息发送至所有服务器,每个服务器接收任务消息后,将预存的第二标签与第一标签进行匹配,由匹配成功的服务器对所述任务消息作出响应,根据该方案,任务分配时,不需要查找服务器的主机名、IP,而将任务消息发送给每个服务器,由服务器根据标签匹配结果响应任务消息,这样减少了运维的复杂度,使任务分配过程规范、一致。
图2示出了根据本发明一个实施例的感知任务分配的方法的流程图,本实施例描述了本发明的方法在服务器侧的执行过程,如图2所示,方法包括如下步骤:
步骤S210,接收携带第一标签的任务消息。
第一标签包括一个或多个字段,对应任务分配对象在一个或多个预设维度的特征信息。
可选地,服务器接收中心机发送的任务消息广播,所有与中心机通信的服务器都能够接收每一条任务消息。从而省略了在数据库中查找任务分配对象的IP地址,主机名称等步骤,简化了任务分配的复杂度。
步骤S220,将预存的第二标签与所述第一标签进行匹配,若匹配成功,执行步骤S230,否则执行步骤S240。
第二标签包括一个或多个字段,对应服务器在一个或多个预设维度的特征信息。
步骤S230,执行任务消息中包含的任务。
任务可以是删除文件,重启某项服务等。
步骤S240,忽略该任务消息。
步骤S210-S240的具体实现方式可参见上一实施例,此处不再赘述。
图3示出了根据本发明一个实施例的任务分配装置的结构框图,如图3所示,装置包括:
添加模块310,适于在任务消息中添加包括一个或多个字段的第一标签。
其中,一个或多个字段对应任务分配对象在一个或多个预设维度的特征信息;任务可以是删除文件,重启某项服务等。
在本发明实施例中,一个或多个预设维度包括:业务维度,和/或角色维度,和/或位置维度。第一标签中的每个字段包括字段名和字段值。字段名可以为预设维度的名称,字段值表明任务分配对象在这一维度的特征信息。
添加模块310在任务消息中添加的第一标签可以包括两个字段,分别表示该服务器所属的业务维度和角色维度,例如,字段名分别为service,role。添加模块310在向任务消息中添加第一标签时,根据任务分配的对象选择合适的字段值。例如,若任务分配的对象是多个存储用的redis服务器,则两个字段的值分别为storage,redis。或者,业务标签字段信息只包含部分字段,例如,只包含业务维度的字段,字段值为storage,则表示任务的目标为所有用于存储业务的服务器,包 括redis服务器和mysql服务器。
当然,也可以添加其他预设维度对服务器进行分组,如机房位置。例如,对于导航的mysql服务器,第一标签还包括表示机房位置信息的第三个字段,该字段名可设为idc,相应的字段值为Beijing,表示该服务器位于北京。
发送模块320,适于将携带有所述第一标签的任务消息发送至所有服务器。
服务器和本实施例所述的装置可通过应用层上的安全协议进行会话。例如,通过配置ssh(安全shell协议)远程登录等方式将任务消息通过发送模块320发送到服务器上。具体地,考虑到安全问题,可以使用一个低权限的账号,并配置任务分配装置到服务器的ssh(安全shell协议)信任。
发送模块320通过广播的方式发送任务消息,则所有与装置通信的服务器都能够接收每一条任务消息。从而省略了在数据库中查找任务分配对象的IP地址,主机名称等步骤,简化了任务分配的复杂度。
服务器接收任务消息后,将自身的一个或多个第二标签与任务消息中的第一标签进行匹配,由匹配成功的服务器对任务消息作出响应。
可选地,装置还包括:数据库330,适于存储每个服务器的一个或多个第二标签。
数据库330存储的第二标签,及第二标签与服务器的对应关系,可作为服务器端设置第二标签的记录和参照。
同一服务器所属的业务、角色可能发生变化,可选地,装置还包括:更新模块340,适于定时更新数据库330中存储的每个服务器的一个或多个第二标签。
可选地,装置还包括:第一同步模块350,适于将数据库330中存储的每个服务器的一个或多个第二标签同步给对应的服务器。具体地,同步过程可在更新后进行,这保证了任务分配的准确性。
图4示出了根据本发明一个实施例的服务器的结构框图,如图4所示,该服务器包括:
接收模块410,适于接收携带第一标签的任务消息。
第一标签包括一个或多个字段,对应任务分配对象在一个或多个预设维度的特征信息。
匹配模块420,适于将预存的第二标签与第一标签进行匹配。
其中,第二标签包括一个或多个字段,对应服务器在一个或多个预设维度的特征信息。
响应模块440,适于在匹配模块匹配成功的情况下,对任务消息作出响应。
可选地,服务器进一步包括:第二同步模块430,适于根据数据库中存储的第二标签,对预存的一个或多个第二标签进行同步。
图5示出了根据本发明一个实施例的任务分配系统的结构框图,如图5所示,系统包括:上述的任务分配装置,以及服务器。
根据本发明上述实施例提供的任务分配装置,服务器和任务分配系统,不需要进行查找操作,而将任务消息发送给每个服务器,由服务器感知自身的业务或角色,对任务消息做出响应。这减少了运维的复杂度,使任务分配过程规范、一致,并且通过第一同步模块和第二同步模块对业务服务器的业务标签进行同步,保证了任务分配的准确性。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元 或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的任务分配装置、系统和服务器中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
例如,图6示出了可以实现在智能终端之间传输数据的方法的计算设备。该计算设备传统上包括处理器610和以存储器620形式的计算机程序产品或者计算机可读介质。存储器620可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器620具有用于执行上述方法中的任何方法步骤的程序代码631的存储空间630。例如,用于程序代码的存储空间630可以包括分别用于实现上面的方法中的各种步骤的各个程序代码631。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样 的计算机程序产品通常为如参考图7所述的便携式或者固定存储单元。该存储单元可以具有与图6的计算设备中的存储器620类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括计算机可读代码631’,即可以由例如诸如610之类的处理器读取的代码,这些代码当由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”或“包括”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明的范围,对本发明所做的公开是说明性的,而非限制性的,本发明的范围由所附权利要求书限定。

Claims (18)

  1. 一种任务分配方法,所述方法包括:
    在任务消息中添加包括一个或多个字段的第一标签,所述一个或多个字段对应任务分配对象在一个或多个预设维度的特征信息;
    将携带有所述第一标签的任务消息发送至所有服务器,以供每个服务器将预存的第二标签与所述第一标签进行匹配,由匹配成功的服务器对所述任务消息作出响应,其中,所述第二标签包括一个或多个字段,对应服务器在所述一个或多个预设维度的特征信息。
  2. 根据权利要求1所述的方法,其中,所述一个或多个预设维度包括:业务维度,和/或角色维度,和/或位置维度。
  3. 根据权利要求1所述的方法,其中,所述方法还包括:在数据库中存储所述每个服务器的第二标签。
  4. 根据权利要求3所述的方法,其中,所述方法还包括:定时更新所述数据库中存储的所述每个服务器的第二标签。
  5. 根据权利要求3或4所述的方法,其中,所述方法还包括:将所述数据库中存储的所述每个服务器的第二标签同步给对应的服务器。
  6. 一种服务器感知任务分配的方法,包括:
    接收携带第一标签的任务消息,所述第一标签包括一个或多个字段,对应任务分配对象在一个或多个预设维度的特征信息;
    将预存的第二标签与所述第一标签进行匹配,其中,所述第二标签包括一个或多个字段,对应服务器在所述一个或多个预设维度的特征信息;
    若匹配成功,对所述任务消息作出响应。
  7. 根据权利要求6所述的方法,其中,所述一个或多个预设维度包括:业务维度,和/或角色维度,和/或位置维度。
  8. 根据权利要求6所述的方法,其中,所述方法还包括:
    根据数据库中存储的第二标签,对所述预存的第二标签进行同步。
  9. 一种任务分配装置,所述装置包括:
    添加模块,适于在任务消息中添加包括一个或多个字段的第一标签,所述一个或多个字段对应任务分配对象在一个或多个预设维度的 特征信息;
    发送模块,适于将携带有所述第一标签的任务消息发送至所有服务器,以供每个服务器将预存的第二标签与所述第一标签进行匹配,由匹配成功的服务器对所述任务消息作出响应,其中,所述第二标签包括一个或多个字段,对应服务器在所述一个或多个预设维度内的特征信息。
  10. 根据权利要求9所述的装置,其中,所述一个或多个预设维度包括:业务维度,和/或角色维度,和/或位置维度。
  11. 根据权利要求9所述的装置,其中,所述装置还包括:数据库,适于存储所述每个服务器的第二标签。
  12. 根据权利要求11所述的装置,其中,所述装置还包括:更新模块,适于定时更新所述数据库中存储的所述每个服务器的第二标签。
  13. 根据权利要求11或12所述的装置,其中,其中所述装置还包括:第一同步模块,适于将所述数据库中存储的所述每个服务器的第二标签同步给对应的服务器。
  14. 一种服务器,包括:
    接收模块,适于接收携带第一标签的任务消息,所述第一标签包括一个或多个字段,对应任务分配对象在一个或多个预设维度的特征信息;
    匹配模块,适于将预存的第二标签与所述第一标签进行匹配,其中,所述第二标签包括一个或多个字段,对应服务器在所述一个或多个预设维度的特征信息;
    响应模块,适于在匹配模块匹配成功的情况下,对所述任务消息作出响应。
  15. 根据权利要求14所述的服务器,其中,所述服务器进一步包括:第二同步模块,适于根据数据库中存储的第二标签,对所述预存的一个或多个第二标签进行同步。
  16. 一种任务分配系统,包括:权利要求9-13任一项所述的任务分配装置,以及权利要求14-15任一项所述的服务器。
  17. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行下列至少之一:
    根据权利要求1至5任一项所述的任务分配方法;
    根据权利要求6至8任一项所述的服务器感知任务分配的方法。
  18. 一种计算机可读介质,其中存储了如权利要求17所述的计算机程序。
PCT/CN2015/076117 2014-06-25 2015-04-08 任务分配方法、装置、系统和服务器 WO2015196844A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410291298.6 2014-06-25
CN201410291298.6A CN105204921B (zh) 2014-06-25 2014-06-25 任务分配方法、装置、系统和服务器

Publications (1)

Publication Number Publication Date
WO2015196844A1 true WO2015196844A1 (zh) 2015-12-30

Family

ID=54936717

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/076117 WO2015196844A1 (zh) 2014-06-25 2015-04-08 任务分配方法、装置、系统和服务器

Country Status (2)

Country Link
CN (1) CN105204921B (zh)
WO (1) WO2015196844A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783631A (zh) * 2021-02-03 2021-05-11 中国工商银行股份有限公司 调度任务的方法、系统、计算设备和介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107423131B (zh) * 2017-03-29 2021-01-15 努比亚技术有限公司 一种共享方法及服务器

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692208A (zh) * 2009-10-15 2010-04-07 北京交通大学 实时交通信息处理的任务调度方法与系统
CN102868551A (zh) * 2012-08-20 2013-01-09 华为技术有限公司 外线资源的处理方法及装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8789058B2 (en) * 2011-03-25 2014-07-22 Oracle International Corporation System and method for supporting batch job management in a distributed transaction system
CN103383653B (zh) * 2012-05-02 2017-07-04 中国科学院计算技术研究所 云资源管理和调度方法及系统
CN103347055B (zh) * 2013-06-19 2016-04-20 北京奇虎科技有限公司 云计算平台中的任务处理系统、设备及方法
CN103686207A (zh) * 2013-12-04 2014-03-26 乐视网信息技术(北京)股份有限公司 转码任务的调度方法和系统
CN103731844B (zh) * 2014-01-03 2015-05-13 苏州大学 一种地理位置相关的移动感知系统任务分配方法

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692208A (zh) * 2009-10-15 2010-04-07 北京交通大学 实时交通信息处理的任务调度方法与系统
CN102868551A (zh) * 2012-08-20 2013-01-09 华为技术有限公司 外线资源的处理方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783631A (zh) * 2021-02-03 2021-05-11 中国工商银行股份有限公司 调度任务的方法、系统、计算设备和介质

Also Published As

Publication number Publication date
CN105204921B (zh) 2019-03-01
CN105204921A (zh) 2015-12-30

Similar Documents

Publication Publication Date Title
US11012505B2 (en) Application information sharing method and apparatus
WO2016155379A1 (zh) 动态获取app界面控件数据的方法、设备以及系统
CN106790549B (zh) 一种数据更新方法及装置
US11310066B2 (en) Method and apparatus for pushing information
TWI734744B (zh) 路由表的同步方法、裝置及系統
WO2017113694A1 (zh) 文件同步方法、装置及系统
WO2022116425A1 (zh) 数据血缘关系解析方法、系统、计算机设备及存储介质
WO2016000507A1 (zh) 省流量模式搜索服务的方法、服务器、客户端和系统
WO2015139539A1 (zh) 一种视频信息推送方法及装置
WO2017101642A1 (zh) 分布式系统的数据节点升级方法及装置
EP3188051B1 (en) Systems and methods for search template generation
WO2017076052A1 (zh) 一种代码处理方法及装置
CN110012049B (zh) 信息推送方法. 系统. 服务器及计算机可读存储介质
CN114610951A (zh) 数据处理方法、装置、电子设备及可读存储介质
CN105592083B (zh) 终端利用令牌访问服务器的方法和装置
CN104426868A (zh) 请求的处理方法和处理装置
WO2015196844A1 (zh) 任务分配方法、装置、系统和服务器
WO2021169811A1 (zh) 特效生成方法、装置、系统、设备和存储介质
WO2016095644A1 (zh) 数据库的高可用解决方法和装置
WO2014190700A1 (zh) 一种内存访问的方法、缓冲调度器和内存模块
CN112559913B (zh) 一种数据处理方法、装置、计算设备及可读存储介质
CN112269588B (zh) 算法的升级方法、装置、终端和计算机可读存储介质
WO2016078326A1 (zh) 一种虚拟机名称展示的方法、装置及系统
CN105610596B (zh) 一种资源目录管理方法和网络终端
WO2016155384A1 (zh) 一种搜索优化方法、装置和系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15811174

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15811174

Country of ref document: EP

Kind code of ref document: A1