Atomic service scheduling method and device

Through the method of automatically obtaining and running atomic services, the problem of low atomic service scheduling efficiency in private cloud data centers is solved, efficient and secure management of atomic services is achieved, and the cost and risk of manual participation is reduced.

CN111427634BActive Publication Date: 2025-01-07WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010238530.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-30
Publication Date
2025-01-07
Estimated Expiration
2040-03-30

AI Technical Summary

Technical Problem

In the prior art, more manpower is required to participate in the triggering of atomic services in the host management process of private cloud data centers, resulting in low management efficiency, insufficient security and quality.

Method used

By obtaining task execution requests, determining the permissions of the requesting party and obtaining the call address of the target atomic service, automatically running atomic service on the target host, and using a distributed scheduling center to realize cross-process, cross-host, and cross-network atomic service calls, reducing manual labor Participate to improve security and management efficiency.

Benefits of technology

Automatic scheduling of atomic services can be achieved without manual participation, reducing maintenance costs, improving the security and quality of atomic services, and improving management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111427634B_ABST
    Figure CN111427634B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for scheduling atomic services, the method comprising: obtaining a task execution request, determining whether the requester has the authority to call a target atomic service according to the requester information carried in the task execution request, determining the calling address where the target atomic service is located after determining that the requester has the authority to call the target atomic service, obtaining the target atomic service through the calling address, and running the target atomic service on the target host. The present invention reduces the maintenance cost of atomic services and improves the security and quality of atomic services by determining the calling address where the target atomic service is located after determining that the requested party has the authority to call the target atomic service, and then obtaining the target atomic service through the calling address and running the target atomic service on the target host without manual participation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for atomic service scheduling. Background Art

[0002] With the rapid development of business, private cloud data centers (Internet Data Center, IDC) have also expanded rapidly. This means that the number of hosts in private cloud data centers has also become very large. In order to improve the efficiency of automated management of hosts in private cloud environments, many atomic services (the most fine-grained services) have been formed to cope with scenarios such as host management, operation and maintenance, and service requests.

[0003] Host management and operation scenarios refer to scenarios such as host initialization and host inspection. In the existing technology, developers manage them by developing atomic services and creating scheduled tasks.

[0004] Service request scenarios refer to scenarios such as creating users and modifying system configurations. After receiving execution requests for such tasks, developers manually trigger the corresponding atomic services to complete the tasks.

[0005] It can be seen from the above description that although the existing technology uses atomic services to manage hosts in a private cloud data center, a lot of manpower is required to trigger the atomic services during the management process. Summary of the invention

[0006] The present application provides a method and device for atomic service scheduling, which are used to solve the problem of how to improve the efficiency of atomic service scheduling.

[0007] In a first aspect, an embodiment of the present application provides a method for scheduling an atomic service, including:

[0008] Obtaining a task execution request; the task execution request is used to instruct execution of a target atomic service on a target host;

[0009] Determining, based on the requester information carried in the task execution request, whether the requester has the authority to call the target atomic service;

[0010] After determining that the requesting party has the authority to call the target atomic service, determining the calling address of the target atomic service; the calling address of each atomic service is determined when each atomic service is registered;

[0011] The target atomic service is acquired through the calling address and the target atomic service is run on the target host.

[0012] The above scheme, after determining that the requesting party has the authority to call the target atomic service, determines the calling address of the target atomic service, and then obtains the target atomic service through the calling address and runs the target atomic service on the target host. It does not require human intervention, reduces the atomic service maintenance cost, and improves the security and quality of the atomic service.

[0013] Optionally, obtaining the task execution request includes:

[0014] The task execution request is obtained from the interface of the target atomic service; wherein the interface of each atomic service is set when each atomic service is registered.

[0015] The above solution designs a corresponding interface for each atomic service, so that the atomic services have a certain degree of independence and are decoupled from each other, thereby making the management of atomic services more efficient and convenient.

[0016] Optionally, before obtaining the task execution request, the method further includes:

[0017] Receiving a registration request for the target atomic service;

[0018] After determining that the code of the target atomic service meets the security requirements, an interface of the target atomic service is generated and a calling address of the target atomic service is determined.

[0019] The above solution improves the security of the atomic service by performing security scanning on the atomic service.

[0020] Optionally, before obtaining the task execution request, the method further includes:

[0021] Receiving a registration request from a user, wherein the registration request includes a user identifier and an atomic service to be called;

[0022] Generate a user key according to the user identifier and the user's IP;

[0023] The user identification and the user secret key are stored correspondingly in the permission record of the called atomic service.

[0024] The above solution improves the security of atomic services and the efficiency of atomic service scheduling by generating a user key based on the user identification and the user's IP.

[0025] Optionally, the requester information includes a requester identifier and a requester secret key;

[0026] The determining, according to the requester information carried in the task execution request, whether the requester has the authority to call the target atomic service includes:

[0027] Determine whether the permission record of the target atomic service includes the corresponding relationship between the requester identifier and the requester secret key, so as to determine whether the requester has the permission to call the target atomic service.

[0028] The above scheme improves the security of atomic services and the efficiency of atomic service scheduling by determining whether the authority record of the target atomic service includes the corresponding relationship between the requester identifier and the requester secret key to determine whether the authority exists.

[0029] Optionally, obtaining the task execution request includes:

[0030] The task execution request is obtained from the atomic service calling interface, wherein the task execution request includes an identifier of a target atomic service.

[0031] The above solution makes the scheduling of atomic services more convenient and efficient by providing a unified interface for atomic services to the outside world.

[0032] Optional. The acquiring the target atomic service through the calling address and running the target atomic service on the target host includes:

[0033] Determine, through a distributed scheduling center, each scheduling node that executes the task execution request;

[0034] Each scheduling node obtains the target atomic service from the calling address and runs the target atomic service on the target host.

[0035] The above solution realizes atomic service calls across processes, hosts, and networks through a distributed scheduling center, and achieves load balancing by calculating the amount of tasks or busyness of each scheduling node.

[0036] In a second aspect, an embodiment of the present application provides a device for atomic service scheduling, the device comprising:

[0037] An acquisition module, used for acquiring a task execution request; the task execution request is used for instructing to execute a target atomic service on a target host;

[0038] A processing module, configured to determine whether the requester has the authority to call the target atomic service according to the requester information carried in the task execution request;

[0039] After determining that the requesting party has the authority to call the target atomic service, determining the calling address of the target atomic service; the calling address of each atomic service is determined when each atomic service is registered;

[0040] The target atomic service is acquired through the calling address and the target atomic service is run on the target host.

[0041] Optionally, the acquisition module is specifically used for:

[0042] The task execution request is obtained from the interface of the target atomic service; wherein the interface of each atomic service is set when each atomic service is registered.

[0043] Optionally, the acquisition module is further used for:

[0044] Before obtaining the task execution request, receiving a registration request for the target atomic service;

[0045] After determining that the code of the target atomic service meets the security requirements, an interface of the target atomic service is generated and a calling address of the target atomic service is determined.

[0046] Optionally, the acquisition module is further used for:

[0047] Before obtaining the task execution request, receiving a registration request from a user, wherein the registration request from the user includes a user identifier and an atomic service to be called;

[0048] Generate a user key according to the user identifier and the user's IP;

[0049] The user identification and the user secret key are stored correspondingly in the permission record of the called atomic service.

[0050] Optionally, the requester information includes a requester identifier and a requester secret key;

[0051] The processing module is specifically used for:

[0052] Determine whether the permission record of the target atomic service includes the corresponding relationship between the requester identifier and the requester secret key, so as to determine whether the requester has the permission to call the target atomic service.

[0053] Optionally, the acquisition module is specifically used for:

[0054] The task execution request is obtained from the atomic service calling interface, wherein the task execution request includes an identifier of a target atomic service.

[0055] Optionally, the processing module is specifically used for:

[0056] Determine, through a distributed scheduling center, each scheduling node that executes the task execution request;

[0057] Each scheduling node obtains the target atomic service from the calling address and runs the target atomic service on the target host.

[0058] Accordingly, an embodiment of the present invention further provides a computing device, including:

[0059] A memory for storing program instructions;

[0060] The processor is used to call the program instructions stored in the memory and execute the above-mentioned atomic service scheduling method according to the obtained program.

[0061] Correspondingly, an embodiment of the present invention further provides a computer-readable non-volatile storage medium, including computer-readable instructions. When a computer reads and executes the computer-readable instructions, the computer executes the above-mentioned atomic service scheduling method. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0063] Figure 1 A system framework of an atomic service scheduling method provided by an embodiment of the present invention;

[0064] Figure 2 A schematic diagram of a flow chart of a method for scheduling atomic services provided by an embodiment of the present invention;

[0065] Figure 3 A schematic diagram of a flow chart of a method for scheduling atomic services provided by an embodiment of the present invention;

[0066] Figure 4 A schematic diagram of a method for scheduling atomic services provided by an embodiment of the present invention;

[0067] Figure 5 A schematic diagram of a flow chart of a method for scheduling atomic services provided by an embodiment of the present invention;

[0068] Figure 6 A schematic diagram of the structure of an atomic service scheduling device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0069] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0070] First, some terms in the present application are explained so as to be understood by those skilled in the art.

[0071] IaaS: Infrastructure as a Service (IaaS) is the bottom layer of cloud services and mainly provides some basic resources.

[0072] ITSM: IT Service Management (ITService Management), generally refers to the ITSM management platform.

[0073] Ansible: Ansible is an automated operation and maintenance tool that combines the advantages of many operation and maintenance tools (puppet, chef, func, fabric), and realizes batch system configuration, batch program deployment, batch command execution and other functions. It includes command, script, shell, playbool and other modules.

[0074] As the business develops, the technical systems of various departments will become less and less relevant, which will bring great challenges to the stability and maintainability of the server-side system. There is a need for a unified atomic service architecture practice to uniformly solve current architectural problems, prevent architectural corruption, and improve system stability.

[0075] Based on this, the embodiment of the present invention provides a method for atomic service scheduling. The method for atomic service scheduling provided by the embodiment of the present invention can be applied to Figure 1 In the system architecture shown, the system architecture includes a distributed scheduling center 100 and a scheduling node 200 .

[0076] The distributed scheduling center 100 obtains a task execution request, and after determining that the requester has the authority to call the target atomic service, determines the calling address of the target atomic service.

[0077] The scheduling node 200 is divided into a scheduling node 1, a scheduling node 2, a scheduling node 3, ..., a scheduling node N. The scheduling node 200 obtains a target atomic service by calling an address and runs the target atomic service on a target host.

[0078] Specifically, the distributed scheduling center 100 determines each scheduling node that executes the task execution request;

[0079] The scheduling node 200 obtains the target atomic service from the calling address and runs the target atomic service on the target host.

[0080] It should be noted that the distributed scheduling center 100 monitors the task execution status of each scheduling node 200 in real time. The task execution status may be the number of target hosts of the target atomic service to be currently executed by the scheduling node 200.

[0081] For example, the task execution request obtained by the distributed scheduling center 100 indicates that the atomic service 1 is called to be executed on 600 target hosts. The distributed scheduling center 100 monitors in real time that none of the 6 scheduling nodes has a target host to execute the target atomic service. Then the distributed scheduling center 100 evenly distributes the tasks of executing the target atomic service on the 600 target hosts to each scheduling node. In other words, the number of target hosts to execute the target atomic service on each scheduling node after being allocated by the distributed scheduling center is 100.

[0082] In the embodiment of the present application, in a possible implementation manner, the distributed scheduling center 100 is deployed separately on a server.

[0083] In another possible implementation, the distributed scheduling center 100 and one of the N scheduling nodes are deployed together on a server. For example, there are five scheduling nodes, namely, scheduling node 1, scheduling node 2, scheduling node 3, scheduling node 4, and scheduling node 5. At this time, the distributed scheduling center is deployed on the server of scheduling node 1, that is, the relationship between scheduling node 1 and the servers where scheduling node 2, scheduling node 3, scheduling node 4, and scheduling node 5 are located is a master-slave relationship.

[0084] It should be noted that Figure 1 This is only an example of the system architecture of the embodiment of the present application, and the present application does not make any specific limitation to this.

[0085] Based on the system architecture shown above, Figure 2 A flowchart corresponding to a method for scheduling atomic services provided in an embodiment of the present invention is shown in FIG. Figure 2 As shown, the method includes:

[0086] Step 201: Obtain a task execution request.

[0087] It should be noted that the task execution request is used to instruct execution of the target atomic service on the target host.

[0088] Step 202: Determine whether the requester has the authority to call the target atomic service based on the requester information carried in the task execution request.

[0089] Step 203: after determining that the requesting party has the authority to call the target atomic service, determine the calling address of the target atomic service.

[0090] It should be noted that the calling address of each atomic service is determined when each atomic service is registered.

[0091] Step 204, obtain the target atomic service by calling the address and run the target atomic service on the target host.

[0092] In the embodiment of the present application, the atomic service has the following characteristics:

[0093] 1. Independence of each other: Since it is an independent service with its own complete set of operating mechanisms, it must be a complete autonomous system that can provide services without relying on external things.

[0094] 2. Atomization: This means that the service can no longer be divided into smaller services.

[0095] 3. Combination and Reconstruction: Atomic services can be quickly combined and reconstructed. They are combined into a system. All entities in the system are conceptually equivalent. Therefore, its structure is relatively simple and is a loosely coupled structure. Such a system often has stronger scalability and robustness.

[0096] In step 201, a task execution request is obtained from the interface of the target atomic service.

[0097] It should be noted that the interface of each atomic service is set when each atomic service is registered.

[0098] In the embodiment of the present application, in a possible implementation, each atomic service corresponds to an atomic service interface, that is, each atomic service interface is unique to an atomic service, based on which, when obtaining a task execution request, the atomic service to be scheduled can be determined by the interface address of the task execution request. For example, the interface address is http: / / xxx.domain.com / apimntinvokeapi / systemctl, where http: / / xxx.domain.com is the domain name, apimnt invokeapi / is the category to which the interface belongs, and systemctl is the atomic service name, which corresponds to a specific atomic service.

[0099] The above solution designs a corresponding interface for each atomic service, so that the atomic services have a certain degree of independence and are decoupled from each other, thereby making the management of atomic services more efficient and convenient.

[0100] In another possible implementation, a task execution request is obtained from the atomic service call interface, and the task execution request includes the identifier of the target atomic service. It can be seen that multiple different atomic services have a unified interface to the outside. For example, the unified interface address is http: / / xxx.domain.com / apimntinvokeapi. At this time, since the task execution requests for scheduling different atomic services all use the same interface, the task execution request must include the identifier of the target atomic service so that the task execution request corresponds to a specific atomic service. For example, the identifier of the target atomic service can be the name of the target atomic service, and this application does not make specific limitations on this.

[0101] The above solution makes the scheduling of atomic services more convenient and efficient by providing a unified interface for atomic services to the outside world.

[0102] It can be seen from the above content that the interface of each atomic service is set when each atomic service is registered, that is, before the atomic service is scheduled, that is, before step 201, the atomic service to be scheduled needs to be registered. The registration process of the atomic service is specifically introduced below.

[0103] First, a registration request for the target atomic service is received; then, after determining that the code of the target atomic service meets the security requirements, the interface of the target atomic service is generated and the calling address of the target atomic service is determined. The interface of the target atomic service can also be called the atomic service calling interface, which here refers to the interface just generated for the target atomic service.

[0104] It should be noted that atomic services are divided into three types: executable scripts, Ansible playbook / shell / cmd / script modules, and Linux commands.

[0105] Specifically, determine whether the code of the target atomic service meets the security requirements: after obtaining the script or executable file corresponding to the atomic service to be registered, perform a security scan, and introduce a rule base. If the atomic service meets the preset rule base, it will not be registered. It should be noted that the rule base can be dynamically configured according to business needs.

[0106] Furthermore, for example, if the rule base contains system high-risk commands, if the atomic service is found to have such system high-risk commands, it will not be registered:

[0107] For example, rm -rf means forced deletion of files or directories; :(){:||:&} means defining a function and continuously recursing to create background tasks; > / dev / sda means clearing a partition in a targeted manner; ^foo^bar or s / old / new / means forced replacement of characters.

[0108] The above solution improves the security of the atomic service by performing security scanning on the atomic service.

[0109] For generating atomic service interfaces, standard interfaces can be generated based on the atomic service parameter passing format.

[0110] It should be noted that the parameter passing format can support pre-set parameter formats, including positional parameters and regular JSON parameters.

[0111] Specifically, the corresponding URL routing interface path is generated according to the atomic service name corresponding to the registered atomic service, and the parameter transmission format is recorded in the database. In other words, when the task execution request is obtained during the scheduling of the atomic service, the format of the task execution request will be checked first, and if the format does not match, it will not be passed.

[0112] For example, the name of the atomic service is systemctl, and the interface API of the generated atomic service is http: / / xxx.domain.com / apimnt / invokeapi / systemctl .

[0113] In a possible implementation, the parameter passing format uses positional parameters, such as systemctl[start|status|restart|stop][any].

[0114] It should be noted that positional parameters are referenced with "[]". If you need to restrict the incoming parameters, you can use "|" to separate them; if you do not want to restrict the parameters, use the "any" tag.

[0115] Based on this, the generated API is:

[0116] Interface address: http: / / xxx.domain.com / apimnt / invokeapi / systemctl

[0117] Furthermore, the parameter passing format is as follows:

[0118]

[0119] Among them, "systemctl" is the atomic service name, "appId" is the requester identifier, "key" is the key, "async": "True / False" is whether it is asynchronous. If it is asynchronous, the distributed scheduling center adopts the asynchronous task execution mode. "hosts": "[10.0.0.1,10.0.0.2]" is the target host, and "args": "['start|stop|restart|status']['mariadb]" is the atomic service called.

[0120] In a possible implementation, the parameter passing format uses a JSON parameter: python app_service.py[json].

[0121] It should be noted that the json parameter is marked with "[json]".

[0122] Based on this, the generated API is:

[0123] Interface address: http: / / xxx.domain.com / apimnt / invokeapi / appImpl

[0124] The parameter passing format is as follows:

[0125]

[0126] Specifically, the present application provides Figure 3 The method flow of the registration method using atomic service is shown.

[0127] like Figure 3 As shown:

[0128] Step 301, receiving a registration request from a user.

[0129] It should be noted that the user's registration request includes the user's identification and the atomic service to be called.

[0130] Step 302, generating a user key according to the user identification and the user's IP;

[0131] Step 303: Store the user identification and the user secret key in correspondence in the permission record of the called atomic service.

[0132] From the above content, it can be seen that in order to ensure the security of atomic services, users need to register user identification, such as user ID.

[0133] Furthermore, the permission record of the called atomic service may adopt a whitelist, and the user identifier and the user secret key may be added to the whitelist of the called atomic service.

[0134] Specifically, in the embodiment of the present application, a user key can be generated by a hash algorithm based on the user identifier and the user's IP.

[0135] It should be noted that, based on the above example, the user key can also be generated through a hash algorithm according to the user identifier, the user's IP address and the name of the called atomic service.

[0136] The above solution improves the security of atomic services and the efficiency of atomic service scheduling by generating a user key based on the user identification and the user's IP.

[0137] In step 202 of the present application embodiment, the requesting party information includes a requesting party identifier and a requesting party secret key;

[0138] It should be noted that as the business scale continues to expand, the complexity of business logic continues to escalate, and the requester can be a company or a subsystem of a company.

[0139] Based on this, even if the same source IP address is used, different subsystems may send task execution requests. The requester identifier may be a subsystem ID, which is not specifically limited in this application.

[0140] It should be noted that the requester's secret key corresponds to the requester's identifier one by one.

[0141] Specifically, according to the requester information carried in the task execution request, it is determined whether the requester has the authority to call the target atomic service in the following way:

[0142] Determine whether the permission record of the target atomic service includes the correspondence between the requester identifier and the requester secret key, so as to determine whether the requester has the permission to call the target atomic service.

[0143] For example, the permission record of atomic service 2 records subsystem 24 and the corresponding key huschagusbu. The requester information carried by the task execution request includes the requester identification subsystem 24 and the requester key jiadhudg. After comparison, the keys are inconsistent, so the task execution request does not have the permission to call the target atomic service.

[0144] The above scheme improves the security of atomic services and the efficiency of atomic service scheduling by determining whether the authority record of the target atomic service includes the corresponding relationship between the requester identifier and the requester secret key to determine whether the authority exists.

[0145] Further, in step 204, the target atomic service is obtained by calling the address and the target atomic service is run on the target host, including:

[0146] Determine each scheduling node for executing the task execution request through the distributed scheduling center;

[0147] Each scheduling node obtains the target atomic service from the calling address and runs the marked atomic service on the target host.

[0148] It should be noted that the distributed scheduling center monitors the task execution status of each scheduling node in real time. The task execution status may be the number of target hosts of the target atomic service to be currently executed by the scheduling node.

[0149] For example, the distributed scheduling center obtains a task execution request indicating that the atomic service systemctl is called to execute on 100 target hosts. The distributed scheduling center monitors in real time that none of the five scheduling nodes has a target host to execute the target atomic service. Then the distributed scheduling center evenly distributes the task of executing the target atomic service on the 100 target hosts to each scheduling node. In other words, each scheduling node has 20 target hosts to execute the target atomic service after being allocated by the distributed scheduling center.

[0150] The above solution realizes atomic service calls across processes, hosts, and networks through a distributed scheduling center, and achieves load balancing by calculating the amount of tasks or busyness of each scheduling node.

[0151] In the embodiment of the present application, in a possible implementation manner, the distributed scheduling center is deployed separately on a server.

[0152] In another possible implementation, the distributed scheduling center and one of the five scheduling nodes are deployed together on a server.

[0153] For example, in the above example, there are 5 scheduling nodes, namely, scheduling node 1, scheduling node 2, scheduling node 3, scheduling node 4, and scheduling node 5. At this time, the distributed scheduling center is deployed on the server of scheduling node 1, that is, the relationship between scheduling node 1 and the servers where scheduling node 2, scheduling node 3, scheduling node 4, and scheduling node 5 are located is a master-slave relationship. In other words, while scheduling node 1 obtains the task execution request, it also obtains the target atomic service through the determined call address and runs the target atomic service on the target host.

[0154] Based on the above content, in the embodiment of the present application, when the user sending the registration request is inconsistent with the requester sending the task execution request, the method of atomic service scheduling provided by the present application can be implemented in the following way. Take the following example that A registers atomic service 3 and B needs to schedule atomic service 3:

[0155] 1. After the atomic service is successfully registered, the source IP address of B is added. When B sends a task execution request, it can be determined whether B has the authority through the permission record of atomic service 3.

[0156] It should be noted that the above two methods are just two possible examples, and this application does not make any specific limitations on them.

[0157] The above scheme, after determining that the requesting party has the authority to call the target atomic service, determines the calling address of the target atomic service, and then obtains the target atomic service through the calling address and runs the target atomic service on the target host. It does not require human intervention, reduces the atomic service maintenance cost, and improves the security and quality of the atomic service.

[0158] In order to better explain the present invention, Figure 4 The present invention specifically introduces a method for scheduling atomic services.

[0159] First, some of the terms in the figure are explained.

[0160] Nginx: A high-performance server.

[0161] ZooKeeper: ZooKeeper is a distributed application coordination service that provides functions including configuration maintenance, domain name services, distributed synchronization, group services, etc.

[0162] Producer: Asynchronous task production module, initiates asynchronous tasks.

[0163] Celery Beat: Scheduled task module. The Beat process reads the contents of the configuration file and periodically sends the tasks that need to be executed in the configuration to the task queue.

[0164] Broker: message middleware module.

[0165] Worker: Task execution unit module. Worker is the task execution unit provided by Celery.

[0166] Result Backend: Task result storage module, used to store the results of tasks executed by Workers. Celery supports storing task results in different ways, including AMQP, redis, etc.

[0167] MySQL:MySQL is a relational database management system.

[0168] based on Figure 4 The architecture shown, Figure 5 A flowchart corresponding to a method for scheduling atomic services provided in an embodiment of the present invention.

[0169] Step 501, NGINX forwards the task execution request to the API management module.

[0170] It should be noted that NGINX obtains task execution requests from external systems such as ITSM.

[0171] Step 502: The API authentication module in the API management module sends the task execution request to the zookeeper cluster after passing the request.

[0172] It should be noted that if Figure 4 As shown, the API management module includes an API authentication module, an atomic service management module, an atomic service security scanning module, and a call record query module.

[0173] Specifically, when registering an atomic service, the atomic service is first registered in the atomic service management module, and then the atomic service security scan is performed in the atomic service security scanning module. After the scan passes, an API is generated.

[0174] Furthermore, the API authentication management module authenticates the registered atomic services.

[0175] Step 503: When the asynchronous task module Producer or the scheduled task module Celery Beat initiates an asynchronous task, the asynchronous task is sent to the message middleware Broker.

[0176] Step 504, Broker stores the task in a queue.

[0177] Step 505: The atomic service execution unit Worker monitors the task execution queue in real time, obtains the scheduled tasks in the queue and executes them.

[0178] Step 506: Backend stores the execution result of the task.

[0179] In a possible implementation, Redis is used as the message middleware, 10 concurrent workers are used as execution units, and Ansible related modules are called to execute tasks. Backend uses MySQL to store the execution results of atomic services, and stores the execution process in file format for query.

[0180] In an embodiment of the present application, zookeeper, as a distributed scheduling center, can allocate the target hosts involved in the task execution request according to the number of tasks in the current Broker queue of each scheduling node, such as distributing the task execution request evenly to each scheduling node to achieve load balancing.

[0181] For example, the task execution request is an inspection task involving 1,000 target hosts. The Zookeeper distributed scheduling center calculates the number of broker queue tasks for each scheduling node, divides the 1,000 target hosts into multiple task sets, distributes them to each scheduling node, and then calls the atomic service for processing through the worker.

[0182] The embodiment of the present invention is applicable to a distributed architecture cluster. After determining that the requesting party has the authority to call the target atomic service, the calling address of the target atomic service is determined, and then the target atomic service is obtained through the calling address and the target atomic service is run on the target host. Even if the current monolithic architecture evolves into a distributed architecture, the scheduling problem that the current technology cannot cross processes, hosts, and network scenarios after evolution can be solved. Even if the present invention crosses processes, hosts, and network scenarios, the entire process can realize atomic scheduling services without human participation, thereby reducing the maintenance cost of atomic services and improving the security and quality of atomic services.

[0183] Based on the same inventive concept, Figure 6 An atomic service scheduling device provided by an embodiment of the present invention is exemplarily shown, and the device may be a process of an atomic service scheduling method.

[0184] The atomic service scheduling device includes:

[0185] The acquisition module 601 is used to acquire a task execution request; the task execution request is used to instruct to execute a target atomic service on a target host;

[0186] Processing module 602, used to determine whether the requester has the authority to call the target atomic service according to the requester information carried in the task execution request;

[0187] After determining that the requesting party has the authority to call the target atomic service, determining the calling address of the target atomic service; the calling address of each atomic service is determined when each atomic service is registered;

[0188] The target atomic service is acquired through the calling address and the target atomic service is run on the target host.

[0189] Optionally, the acquisition module 601 is specifically used for:

[0190] The task execution request is obtained from the interface of the target atomic service; wherein the interface of each atomic service is set when each atomic service is registered.

[0191] Optionally, the acquisition module 601 is further used for:

[0192] Before obtaining the task execution request, receiving a registration request for the target atomic service;

[0193] After determining that the code of the target atomic service meets the security requirements, an interface of the target atomic service is generated and a calling address of the target atomic service is determined.

[0194] Optionally, the acquisition module 601 is further used for:

[0195] Before obtaining the task execution request, receiving a registration request from a user, wherein the registration request from the user includes a user identifier and an atomic service to be called;

[0196] Generate a user key according to the user identifier and the user's IP;

[0197] The user identification and the user secret key are stored correspondingly in the permission record of the called atomic service.

[0198] Optionally, the requester information includes a requester identifier and a requester secret key;

[0199] The processing module 602 is specifically used for:

[0200] Determine whether the permission record of the target atomic service includes the corresponding relationship between the requester identifier and the requester secret key, so as to determine whether the requester has the permission to call the target atomic service.

[0201] Optionally, the acquisition module 601 is specifically used for:

[0202] The task execution request is obtained from the atomic service calling interface, wherein the task execution request includes an identifier of a target atomic service.

[0203] Optionally, the processing module 602 is specifically used for:

[0204] Determine, through a distributed scheduling center, each scheduling node that executes the task execution request;

[0205] Each scheduling node obtains the target atomic service from the calling address and runs the target atomic service on the target host.

[0206] Based on the same inventive concept, an embodiment of the present invention further provides a computing device, including:

[0207] A memory for storing program instructions;

[0208] The processor is used to call the program instructions stored in the memory and execute the above-mentioned atomic service scheduling method according to the obtained program.

[0209] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable non-volatile storage medium, including computer-readable instructions. When a computer reads and executes the computer-readable instructions, the computer executes the above-mentioned atomic service scheduling method.

[0210] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0211] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0212] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0213] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0214] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for atomic service scheduling, characterized in that: The method comprises: Obtaining a task execution request; the task execution request is used to instruct execution of a target atomic service on a target host; Determine whether the requester has the authority to call the target atomic service according to the requester information carried in the task execution request; after determining that the requester has the authority to call the target atomic service, determine the calling address of the target atomic service; the calling address of each atomic service is determined when each atomic service is registered; Acquire the target atomic service through the calling address and run the target atomic service on the target host; The requester information includes the requester ID and the requester secret key; The determining, according to the requester information carried in the task execution request, whether the requester has the authority to call the target atomic service includes: Determine whether the permission record of the target atomic service includes the corresponding relationship between the requester identifier and the requester key, so as to determine whether the requester has the permission to call the target atomic service; The acquiring the target atomic service through the calling address and running the target atomic service on the target host comprises: Determine, through a distributed scheduling center, each scheduling node that executes the task execution request; Each scheduling node obtains the target atomic service from the calling address and runs the target atomic service on the target host.

2. The method according to claim 1, characterized in that The obtaining of the task execution request includes: The task execution request is obtained from the interface of the target atomic service; wherein the interface of each atomic service is set when each atomic service is registered.

3. The method according to claim 1, characterized in that Before obtaining the task execution request, the method further includes: Receiving a registration request for the target atomic service; After determining that the code of the target atomic service meets the security requirements, an interface of the target atomic service is generated and a calling address of the target atomic service is determined.

4. The method according to claim 1, characterized in that Before obtaining the task execution request, the method further includes: Receiving a registration request from a user, wherein the registration request includes a user identifier and an atomic service to be called; Generate a user key according to the user identifier and the user's IP; The user identification and the user secret key are stored correspondingly in the permission record of the called atomic service.

5. The method according to claim 1, characterized in that The obtaining of the task execution request includes: The task execution request is obtained from the atomic service calling interface, wherein the task execution request includes an identifier of a target atomic service.

6. An atomic service scheduling device, characterized in that: include: An acquisition module is used to obtain a task execution request; The task execution request is used to instruct execution of a target atomic service on a target host; A processing module, configured to determine whether the requester has the authority to call the target atomic service according to the requester information carried in the task execution request; The processing module is further used to determine the calling address of the target atomic service after determining that the requesting party has the authority to call the target atomic service; the calling address of each atomic service is determined when each atomic service is registered; The processing module is further used to obtain the target atomic service through the calling address and run the target atomic service on the target host; The processing module is specifically used to determine whether the permission record of the target atomic service includes the corresponding relationship between the requester identifier and the requester secret key, so as to determine whether the requester has the permission to call the target atomic service; wherein the requester information includes the requester identifier and the requester secret key; The processing module is specifically used to determine each scheduling node that executes the task execution request through a distributed scheduling center; Each scheduling node obtains the target atomic service from the calling address and runs the target atomic service on the target host.

7. A computing device, characterized in that include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 5 according to the obtained program.

8. A computer-readable non-volatile storage medium, characterized in that: The method comprises computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the computer is caused to execute the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and system for invoking service of user terminal, and user terminal

    CN102571328A

  • Service method, device and system, and electronic apparatus

    CN109002362A