CN109729177B - Method and apparatus for generating information - Google Patents

Method and apparatus for generating information Download PDF

Info

Publication number
CN109729177B
CN109729177B CN201910098616.XA CN201910098616A CN109729177B CN 109729177 B CN109729177 B CN 109729177B CN 201910098616 A CN201910098616 A CN 201910098616A CN 109729177 B CN109729177 B CN 109729177B
Authority
CN
China
Prior art keywords
task
service
client
information
distribution request
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
Application number
CN201910098616.XA
Other languages
Chinese (zh)
Other versions
CN109729177A (en
Inventor
周双全
孟圣智
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910098616.XA priority Critical patent/CN109729177B/en
Publication of CN109729177A publication Critical patent/CN109729177A/en
Application granted granted Critical
Publication of CN109729177B publication Critical patent/CN109729177B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the disclosure discloses a method and a device for generating information. One embodiment of the method comprises: first, a task distribution request is received. The task distribution request may include parameter information required to complete the task indicated by the task distribution request. And then, generating at least one piece of task description information corresponding to the task distribution request according to the parameter information included in the received task distribution request. The task description information may include identification information of a client in the cluster, which is used to execute the task indicated by the task distribution request. And then, storing the generated at least one piece of task description information into a task description information set. According to the implementation method, the client sides in the cluster are managed and controlled through interaction of the user sides and the execution main body, and labor cost for independently managing each client side in the cluster is saved.

Description

Method and apparatus for generating information
Technical Field
Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method and an apparatus for generating information.
Background
With the continuous development of cloud computing technology, the demand for cluster management based on cloud services is increasing. The related methods may be generally, for example, Puppet (a centralized configuration management system for Linux, Unix, and windows platforms), ansile (automated operation and maintenance tool developed based on Python), SaltStack (a centralized management platform for server infrastructure), etc., where the change to the service is performed by installing a proxy self-established channel in SSH (Secure Shell) or in a managed node, and obtaining configuration and files from a central controller in a pull or push manner; relationships between services may also be allowed to be added, deleted or changed at service runtime, such as Juju (a service orchestration tool offered by Canonical, Inc.) that supports dynamically configured services; in addition, a complete IAAS (Infrastructure as a Service) or PAAS (Platform as a Service) processing scheme, such as OpenStack (an open source cloud computing management Platform project), k8s (kubernets, an open source application for managing containerization on multiple hosts in a cloud Platform), which supports an isolation environment, may be used to select independent computing instances, such as virtual machines and containers, to execute services.
Disclosure of Invention
Embodiments of the present disclosure propose methods and apparatuses for generating information.
In a first aspect, an embodiment of the present disclosure provides a method for generating information, the method including: receiving a task distribution request, wherein the task distribution request comprises parameter information required for completing a task indicated by the task distribution request; generating at least one piece of task description information corresponding to the task distribution request according to the parameter information, wherein the task description information comprises identification information of a client used for executing the task indicated by the task distribution request; and storing at least one piece of task description information into the task description information set so that the client for executing the task indicated by the task distribution request pulls the corresponding task description information from the task description information set.
In some embodiments, the task distribution request includes a service deployment request, and the parameter information included in the service deployment request includes identification information of a code of the service to be deployed and the number of copies of the service to be deployed; and the generating of the at least one piece of task description information corresponding to the task distribution request includes: determining storage position information of the code of the service to be deployed according to the identification information of the code of the service to be deployed; in response to receiving running state information sent by a client connected with communication, determining a service deployment client from the client connected with communication according to the number of the services to be deployed and the running state information, wherein the service deployment client is a client which is characterized and used for executing a task indicated by a service deployment request; and generating task description information comprising storage location information and identification information of the service deployment client as deployment task description information.
In some embodiments, the task distribution request includes a service dependency relationship maintenance request, and the parameter information included in the service dependency relationship maintenance request includes identification information of a service to be maintained, identification information of a service having a dependency relationship with the service to be maintained, and a corresponding dependency relationship; and the method further comprises: and generating a directed acyclic graph representing the dependency relationship among the services to be maintained according to the parameter information included in the service dependency relationship maintenance request.
In some embodiments, the method further comprises: and responding to the fact that the service to be maintained with the dependency relationship is updated, and sending the dependency relationship change information representing the update to the service dependent client so that the service dependent client updates the service to be maintained with the dependency relationship according to the dependency relationship change information, wherein the service dependent client is a client running an instance to which the service to be maintained with the dependency relationship belongs.
In some embodiments, the method further comprises: receiving task feedback information sent by a client side in communication connection, wherein the task feedback information is used for representing the execution result of a task indicated by a task distribution request; and sending the task feedback information to a client sending the task distribution request.
In a second aspect, an embodiment of the present disclosure provides an apparatus for generating information, the apparatus including: the task distributing method comprises a first receiving unit, a second receiving unit and a task distributing unit, wherein the first receiving unit is configured to receive a task distributing request, and the task distributing request comprises parameter information required for completing a task indicated by the task distributing request; the first generating unit is configured to generate at least one piece of task description information corresponding to the task distribution request according to the parameter information, wherein the task description information comprises identification information of a client used for executing the task indicated by the task distribution request; and the storing unit is configured to store at least one piece of task description information into the task description information set so that the client for executing the task indicated by the task distribution request can pull the corresponding task description information from the task description information set.
In some embodiments, the task distribution request includes a service deployment request, and the parameter information included in the service deployment request includes identification information of a code of the service to be deployed and the number of copies of the service to be deployed; the first generation unit includes: a first determining module configured to determine storage location information of a code of a service to be deployed according to identification information of the code of the service to be deployed; the second determining module is configured to determine a service deployment client from the clients of the communication connection according to the number of the services to be deployed and the running state information in response to the running state information sent by the clients of the communication connection, wherein the service deployment client is a client which is characterized for executing the task indicated by the service deployment request; a first generation module configured to generate task description information including storage location information and identification information of the service deployment client as deployment task description information.
In some embodiments, the task distribution request includes a service dependency relationship maintenance request, and the parameter information included in the service dependency relationship maintenance request includes identification information of a service to be maintained, identification information of a service having a dependency relationship with the service to be maintained, and a corresponding dependency relationship; the device also includes: and the second generation unit is configured to generate a directed acyclic graph representing the dependency relationship between the services to be maintained according to the parameter information included in the service dependency relationship maintenance request.
In some embodiments, the apparatus further comprises: the first sending unit is configured to send dependency change information representing updating to a service dependent client in response to determining that the service to be maintained with dependency is updated, so that the service dependent client updates the service to be maintained with dependency according to the dependency change information, wherein the service dependent client is a client running an affiliated instance of the service to be maintained with dependency.
In some embodiments, the apparatus further comprises: the second receiving unit is configured to receive task feedback information sent by a client side in communication connection, wherein the task feedback information is used for representing an execution result of a task indicated by the task distribution request; and the second sending unit is configured to send the task feedback information to the client sending the task distribution request.
In a third aspect, an embodiment of the present disclosure provides a system for managing a service, where the system includes: the system comprises a server and a client in communication connection with the server; a server, configured to implement the method described in any implementation manner of the first aspect; the client is used for pulling the task description information related to the client from the task description information set of the server in the heartbeat report; and executing the task indicated by the pulled task description information.
In some embodiments, a two-process keep-alive mechanism is used for the communication connection between the server and the client.
In a fourth aspect, an embodiment of the present disclosure provides a server, including: one or more processors; a storage device having one or more programs stored thereon; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any implementation of the first aspect.
In a fifth aspect, embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, which when executed by a processor implements the method as described in any of the implementations of the first aspect.
The method and the device for generating information provided by the embodiment of the disclosure firstly receive a task distribution request. The task distribution request may include parameter information required to complete the task indicated by the task distribution request. And then, generating at least one piece of task description information corresponding to the task distribution request according to the parameter information included in the received task distribution request. The task description information may include identification information of a client in the cluster, which is used to execute the task indicated by the task distribution request. And then, storing the generated at least one piece of task description information into a task description information set. Therefore, the client in the cluster can be managed and controlled through interaction between the client and the execution main body, and labor cost for independently managing each client in the cluster is saved.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram for one embodiment of a method for generating information, according to the present disclosure;
FIG. 3 is a schematic diagram of one application scenario of a method for generating information in accordance with an embodiment of the present disclosure;
FIG. 4 is a flow diagram of yet another embodiment of a method for generating information according to the present disclosure;
FIG. 5 is a schematic block diagram illustrating one embodiment of an apparatus for generating information according to the present disclosure;
FIG. 6 is a timing diagram of interactions between various devices in one embodiment of a system for governing a service according to the present disclosure.
FIG. 7 is a schematic structural diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary architecture 100 to which the method for generating information or the apparatus for generating information of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include a server 101, a network 102, and clients 103, 104, 105. Network 102 serves as a medium for providing communication links between server 101 and clients 103, 104, 105. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
Clients 103, 104, 105 may interact with server 101 through network 102 to receive or send messages, etc. The clients 103, 104, 105 may be electronic devices, such as servers or terminal devices, in which a cluster management type client program is installed. Various other applications may also be installed on the clients 103, 104, 105, such as container applications, search-class applications, instant messaging tools, etc. for supporting isolated environments.
The clients 103, 104, 105 may be hardware or software. When the clients 103, 104, 105 are hardware, they may be various electronic devices including, but not limited to, laptop portable computers, desktop computers, etc. that support performing the tasks indicated by the task distribution request. When the clients 103, 104, 105 are software, they can be installed in the electronic devices listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 101 may be a server providing various services, such as a background server provided with a cluster management server program and supporting the cluster management client program installed on the clients 103, 104, and 105. The background server may generate at least one piece of task description information according to the received task distribution request, so that the client device executing the task indicated by the task distribution request pulls the corresponding task description information.
It should be noted that the server may be hardware or software. When the server is hardware, the server can be implemented as a distributed server cluster formed by a plurality of servers, or can be implemented as a single server. When the server is software, it may be implemented as a plurality of software or software modules (for example, to provide distributed services), or may be implemented as a single software or software module. And is not particularly limited herein.
It should be noted that the method for generating information provided by the embodiment of the present disclosure is generally executed by the server 101, and accordingly, the apparatus for generating information is generally disposed in the server 101.
It should be understood that the number of clients, networks, and servers in fig. 1 is merely illustrative. There may be any number of clients, networks, and servers, as desired for an implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for generating information in accordance with the present disclosure is shown. The method for generating information comprises the following steps:
step 201, receiving a task distribution request.
In the present embodiment, the execution subject of the method for generating information (such as the server 101 shown in fig. 1) may receive the task distribution request by a wired connection manner or a wireless connection manner. The task distribution request may be a request based on various network protocols, such as an HTTP (Hyper Text Transfer Protocol) request. The task distribution request may include parameter information required to complete the task indicated by the task distribution request. The above tasks may include, but are not limited to, at least one of: and packaging the codes, isolating the environment and keeping the state alive. The environment may generally include a database (e.g., mysql, sqlserver), middleware (middleware) required for running, an operating system environment, and the like. The environment isolation generally refers to isolating the computing instances in different computing environments without affecting each other. The state keep-alive is generally a state in which the task indicated by the task distribution request is always executed. Optionally, the task needing keep-alive can be restarted in response to detecting that the task stops executing. Accordingly, the parameter information may correspond to the task. As an example, the parameter information included in the task distribution request indicating the code packaging task may be identification information of the code, such as a code name or a URL (Uniform Resource Locator). As yet another example, the parameter information included in the task distribution request indicating the environment isolation task may be identification information of the compute instance and required resource environment information (e.g., bandwidth, memory capacity, etc.). The above-mentioned calculation example may include, for example, a code to be executed.
One or more parameter information may be provided. The number of the above parameter information may be determined according to the task indicated by the above task distribution request.
In this embodiment, the task distribution request may be directly sent to the execution main body by a user terminal; or may be first sent to a relay device (e.g., a router or a relay server) in the network by the user terminal, and then forwarded to the execution main body via the relay device.
In some optional implementations of this embodiment, the task distribution request may include a service deployment request. The parameter information included in the service deployment request may include identification information of a code of the service to be deployed and the number of copies of the service to be deployed. The service (service) generally refers to an out-of-process component, and the internal function may be used through a mechanism such as a web service request (web service request) or a remote function call. In practical applications, the service may be part of an Application (APP), which may be independently extended and deployed. In general, a service may implement a set of different features or functions, such as order management, customer management, and the like. At runtime, each service instance may be a cloud Virtual Machine (VM) or a Docker container. The above identification information may be various kinds of information for uniquely identifying a code of a service to be deployed. For example, the name of the code may be used, or the URL of the code may be used.
In some optional implementations of this embodiment, the task distribution request may include a service dependency maintenance request. The parameter information included in the service dependency relationship maintenance request may include identification information of a service to be maintained, identification information of a service having a dependency relationship with the service to be maintained, and a corresponding dependency relationship. The service dependency relationship is used for representing the relationship between service execution sequences as preconditions for service execution. For example, a service dependency may include a need to ensure that service B has executed before service A executes.
Step 202, generating at least one piece of task description information corresponding to the task distribution request according to the parameter information.
In this embodiment, the execution main body may generate at least one piece of task description information corresponding to the task distribution request according to the parameter information included in the task distribution request received in step 201. In practice, the execution main body may generally generate the task description information according to a preset network transmission Protocol (Communications Protocol). The preset network transport protocol may be complied with by the execution main body and the client for executing the task indicated by the task distribution request. By way of example, the task distribution request indicating the environment isolation task may include identification information of the compute instance and required resource environment information (e.g., bandwidth, memory capacity, etc.). The execution subject may generate two pieces of task description information, which may be, for example, first task description information and second task description information. Wherein, the first task description information can be used for characterizing and creating a container with the environment indicated by the resource environment information; the second task description information may be used to characterize that the computing instance indicated by the above identification information is placed in the container created by the above first task description information to run.
In this embodiment, the task description information may include identification information of a client that is used to execute the task indicated by the task distribution request. The client for executing the task indicated by the task distribution request may be determined in various ways. As an example, the identification information may be a numerical label. The execution main body for determining the client for executing the task may determine the client for executing the task indicated by the task distribution request in order from small to large according to the numerical label; then, the identification information of the client determined above may be acquired. As another example, the execution agent for determining the client that executes the task may determine the client that executes the task indicated by the task distribution request according to a preset load balancing algorithm; then, the identification information of the client determined above may be acquired. Wherein, the load balancing algorithm may include, but is not limited to, at least one of the following: round Robin (Round Robin), Random, source address hashing, weighted Round Robin (weighted Round Robin), weighted Random (weighted Random).
It should be noted that the execution subject for determining the client executing the task may be the same as or different from the execution subject of the method for generating the information. If the client side identification information is the same as the client side identification information, the execution main body of the method for generating the information can acquire the identification information of the determined client side after determining the client side executing the task; if not, the execution subject of the method for determining the client to execute the task may send the acquired identification information of the determined client to the execution subject of the method for generating information after determining the client to execute the task.
In some optional implementation manners of this embodiment, the execution main body may generate at least one piece of task description information corresponding to the task distribution request according to the following steps:
the method comprises the first step of determining storage position information of a code of a service to be deployed according to identification information of the code of the service to be deployed.
In these implementations, the execution subject may determine, according to the identification information of the code of the service to be deployed, storage location information of the code of the service to be deployed. As an example, if the identification information is a code name, the execution subject may obtain storage location information of the code of the service to be deployed from a database server storing the code according to the code name. As still another example, if the identification information is a URL of a code, the execution subject may directly determine the URL as storage location information of the code of the service to be deployed.
And secondly, responding to the received running state information sent by the client side in communication connection, and determining a service deployment client side from the client side in communication connection according to the number of copies of the service to be deployed and the running state information.
In these implementations, in response to receiving the running state information sent by the at least one communicatively connected client, the execution main body may determine, according to the number of copies of the service to be deployed included in the service deployment request and the received at least one running state information, at least one service deployment client from among the at least one communicatively connected client by using a preset scheduling policy. The operating state may include a load state. The service deployment client may be a client that characterizes a task for performing the task indicated by the service deployment request. The scheduling policy may include, but is not limited to, various load balancing algorithms, which are not described herein. Optionally, the execution subject may further determine, from the determined at least one service deployment client, the same number of isolation environments as the number of copies of the service to be deployed.
And thirdly, generating task description information comprising the storage position information and the identification information of the service deployment client as deployment task description information.
In these implementation manners, the execution subject may use the storage location information determined in the first step and the identification information of the service deployment client determined in the third step as data to be transmitted, and generate deployment task description information according to a network transmission protocol agreed with the determined service deployment client.
Step 203, storing at least one piece of task description information into a task description information set.
In this embodiment, the executing entity may store the task description information generated in step 202 into a preset task description information set, so that a client for executing the task indicated by the task distribution request pulls the corresponding task description information from the task description information set. It should be noted that, the elements in the task description information set may be updated according to the generated task description information.
In some optional implementation manners of this embodiment, the execution main body may further generate, by using various methods, a Directed Acyclic Graph (DAG) representing a dependency relationship between services to be maintained according to parameter information, such as identification information of the service to be maintained, identification information of a service having a dependency relationship with the service to be maintained, and a corresponding dependency relationship, included in the service dependency relationship maintenance request. As an example, for a service in the at least one service characterized by the identification information of the at least one service included in the service dependency relationship maintenance request, the execution subject may first construct a service dependency graph and a reverse service dependency graph of the service according to other services having a dependency relationship with the service; then, a JSON (JSON Object Notation) structure having information representing descriptions of points and edges in the graph can be constructed as the directed acyclic graph by using the obtained service dependency graph and the inverse service dependency graph of the at least one service. Optionally, the execution body may also render the JSON structure using a force directed graph (D3 force).
In some optional implementation manners of this embodiment, the execution subject may further send, in response to determining that the service to be maintained having the dependency relationship is updated, dependency relationship change information representing the update to the service dependent client. And the service dependent client updates the service to be maintained with the dependency relationship according to the dependency relationship change information. The service dependent client may be a client running an instance of a service to be maintained with a dependency relationship. In these implementations, the service occurrence update to be maintained may include, but is not limited to, at least one of: changes in dependencies, additions of dependencies, deletions of dependencies. Accordingly, the client running the service instance sending the update can update the service instance running at the client accordingly. Optionally, the client may restart the updated service.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of a method for generating information according to an embodiment of the present disclosure. In the application scenario of fig. 3, a user 301 first enters information on a terminal device 302 characterizing the need for a server cluster 304 to complete an environment isolation task. The servers 3041, 3042, and 3043 in the server cluster 304 are all installed with cluster management client applications. After that, the terminal apparatus 302 generates an environment isolation task distribution request 305 included in the task distribution request based on the above information. Then, the terminal device 302 transmits the generated environment isolation task distribution request 305 to the backend server 303 in which the server application corresponding to the client application is installed. The environment isolation task distribution request 305 includes "URL: www.xxx.com resource Environment: CPU2 core, memory 1G, 2M bps public network bandwidth and other parameter information. Next, the background server 303 generates first task information representing and creating a container a supporting "CPU 2 core, memory 1G, 2M bps public network bandwidth" according to the parameter information; second task information characterizing the computing instance running position www.xxx.com in container a is generated. Then, the background server 303 determines, according to the number of each server in the server cluster 304, that the server 3041 executes the task indicated by the first task information; the task indicated by the above-described second task information is executed by the server 3042. Then, the background server 303 generates first task description information 3061 including "create container a < <3041> > supporting the CPU2 core, memory 1G, 2M bps public network bandwidth" and second task description information 3062 including "run calculation instance < <3042> > at www.xxx.com in container a". Then, the background server 303 stores the first task description information 3061 and the second task description information 3062 into a preset task description information set 307.
Optionally, the server 3041 in the server cluster 304 may further pull the first task description information 3071 from the task description set 307 according to that the first task description information 3071 in the task description information set 307 of the backend server 303 includes the identification information "3041" of the server 3041. Accordingly, the server 3042 in the server cluster 304 may also pull the second task description information 3072 from the task description set 307.
At present, in the aspects of machine clustering and service management and control, one of the prior art generally needs to manually perform differentiated configuration on machines in a cluster, which causes a great amount of labor cost input. In the method provided by the above embodiment of the present disclosure, at least one piece of task description information is generated according to the received task distribution request, so that a function to be implemented by a client in the cluster is indicated through information included in the task distribution request. And the generated task description information is stored in the designated set so that the clients in the cluster can pull the corresponding task description information, so that the task description information indicating the functions required to be realized by the clients in the cluster is automatically generated by the server, and the labor cost for performing differential configuration and management on each client in the cluster is saved. In addition, in the prior art, a technical scheme that a server side of a management cluster actively pushes task description information often exists, so that the load of a server is increased, and the operation and maintenance cost is increased. In the method provided by the embodiment of the disclosure, the client actively pulls the information from the task description information set of the server, so that the resources of the server can be saved, and the operation and maintenance cost of the server is reduced. In addition, the client actively pulls the information, and network congestion possibly caused by the centralized information pushing of the server is avoided.
With further reference to fig. 4, a flow 400 of yet another embodiment of a method for generating information is shown. The flow 400 of the method for generating information comprises the steps of:
step 401, receiving a task distribution request.
Step 402, generating at least one piece of task description information corresponding to the task distribution request according to the parameter information.
Step 403, storing at least one piece of task description information into the task description information set.
Step 401, step 402, and step 403 are respectively the same as step 201, step 202, and step 203 in the foregoing embodiment, and the above description for step 201, step 202, and step 203 also applies to step 401, step 402, and step 403, which is not described herein again.
Step 404, receiving task feedback information sent by the communicatively connected client.
In this embodiment, an execution subject of the method for generating information (e.g., the server 101 shown in fig. 1) may receive the task feedback information sent by the client through a wired connection manner or a wireless connection manner. The client may be an electronic device in which a client application corresponding to the cluster management server application installed by the execution agent is installed, and may be a server that provides support for other applications, for example. The task feedback information may be used to characterize the execution result of the task indicated by the task distribution request. As an example, the task indicated by the task distribution request may be environment isolation, and the task feedback information may be information that characterizes completion of creation of the isolation environment indicated by the task and is sent by a client performing the task. As another example, the task indicated by the task distribution request may be a state keep-alive, and the task feedback information may be information that is sent by a client that executes the task and characterizes whether the task indicated by the task is in an execution state.
Step 405, sending the task feedback information to the client sending the task distribution request.
In this embodiment, the execution main body may send the task feedback information received in step 404 to the sending end of the task distribution request received in step 401. The sender generally refers to a client that sends a task distribution request.
As can be seen from fig. 4, compared with the embodiment corresponding to fig. 2, the flow 400 of the method for generating information in the present embodiment embodies a step of sending the received task feedback information sent by the communicatively connected client to the client sending the task distribution request. Therefore, the solution described in this embodiment can learn, by receiving the task feedback information, the result of the client in the cluster completing the task indicated by the task description information. And by forwarding the task feedback information to the client sending the task distribution request, the execution condition of the client in the cluster on the task indicated by the task distribution request is fed back to the client sending the task distribution request, and the task execution condition can be presented to the user. Therefore, technicians can know the state of the clients in the cluster and the execution condition of tasks required to be executed in time by the clients sending the task distribution requests, and the management efficiency of computer resources in the cluster is improved.
With further reference to fig. 5, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an apparatus for generating information, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable in various electronic devices.
As shown in fig. 5, the apparatus 500 for generating information provided by the present embodiment includes a first receiving unit 501, a first generating unit 502, and a storing unit 503. Wherein, the first receiving unit 501 is configured to receive a task distribution request. The task distribution request comprises parameter information required for completing the task indicated by the task distribution request. A first generating unit 502 configured to generate at least one piece of task description information corresponding to the task distribution request according to the parameter information. The task description information includes identification information of a client for executing the task indicated by the task distribution request. A storing unit 503 configured to store at least one piece of task description information into the task description information set, so that the client for executing the task indicated by the task distribution request pulls the corresponding task description information from the task description information set.
In the present embodiment, in the apparatus 500 for generating information: the detailed processing of the first receiving unit 501, the first generating unit 502, and the storing unit 503 and the technical effects thereof can refer to the related descriptions of step 201, step 202, and step 203 in the corresponding embodiment of fig. 2, which are not repeated herein.
In some optional implementation manners of this embodiment, the task distribution request may include a service deployment request, and the parameter information included in the service deployment request includes identification information of a code of the service to be deployed and the number of copies of the service to be deployed. The first generating unit 502 may include: a first determining module (not shown), a second determining module (not shown), and a first generating module (not shown). The first determining module may be configured to determine, according to the identification information of the code of the service to be deployed, storage location information of the code of the service to be deployed. The second determining module may be configured to determine, in response to receiving the running state information sent by the client of the communication connection, a service deployment client from the clients of the communication connection according to the number of copies of the service to be deployed and the running state information. Wherein the service deployment client may be a client that characterizes a task for performing the task indicated by the service deployment request. The first generating module may be configured to generate task description information including storage location information and identification information of the service deployment client as the deployment task description information.
In some optional implementation manners of this embodiment, the task distribution request may include a service dependency relationship maintenance request, and the parameter information included in the service dependency relationship maintenance request may include identification information of a service to be maintained, identification information of a service having a dependency relationship with the service to be maintained, and a corresponding dependency relationship. The apparatus 500 for generating information may further include: and a second generating unit (not shown in the figure) configured to generate a directed acyclic graph representing the dependency relationship between the services to be maintained according to the parameter information included in the service dependency relationship maintenance request.
In some optional implementations of this embodiment, the apparatus 500 for generating information may further include: the first sending unit (not shown in the figure) may be configured to, in response to determining that the service to be maintained having the dependency relationship is updated, send dependency relationship change information representing the update to the service dependent client, so that the service dependent client updates the service to be maintained having the dependency relationship according to the dependency relationship change information. The service dependent client may be a client running a belonging instance of a service to be maintained with a dependency relationship.
In some optional implementations of this embodiment, the apparatus 500 for generating information may further include: a second receiving unit (not shown), a second transmitting unit (not shown). The second receiving unit may be configured to receive task feedback information sent by a client of the communication connection. The task feedback information is used for representing the execution result of the task indicated by the task distribution request included in the task feedback information. The second sending unit may be configured to send the task feedback information to the client that sends the task distribution request.
The apparatus provided by the above embodiment of the present disclosure receives the task distribution request through the first receiving unit 501. The task distribution request may include parameter information required to complete the task indicated by the task distribution request. Then, the first generating unit 502 generates at least one piece of task description information corresponding to the received task distribution request, based on the parameter information included in the task distribution request. The task description information may include identification information of a client in the cluster, which is used to execute the task indicated by the task distribution request. Then, the storing unit 503 stores the generated at least one piece of task description information into the task description information set. Therefore, the client in the cluster can be managed and controlled through interaction between the client and the execution main body, and labor cost for independently managing each client in the cluster is saved.
With further reference to FIG. 6, a timing sequence 600 of interactions between various devices in one embodiment of a system for governing a service is illustrated. The system for governing a service may include: a server (e.g., server 101 shown in fig. 1), and a client (e.g., servers 103, 104, and 105 shown in fig. 1). The server may be configured to implement the method for generating information according to the foregoing embodiment. The client may be configured to pull the task description information related to the client from the task description information set of the server in the heartbeat report. The client may also be configured to perform the task indicated by the pulled task description information. The client and the server can be in communication connection by adopting a heartbeat mechanism.
In some optional implementation manners of this embodiment, a two-process keep-alive mechanism may be used for performing communication connection between the server and the client. Therefore, the client can be prevented from being separated from the management of the server due to communication interruption caused by accidental quitting of the process.
As shown in fig. 6, in step 601, the server receives a task distribution request.
In step 602, the server generates at least one piece of task description information corresponding to the task distribution request according to the parameter information included in the task distribution request.
In step 603, the server stores at least one piece of task description information into the task description information set.
Step 601, step 602, and step 603 are respectively the same as step 201, step 202, and step 203 in the foregoing embodiment, and the above description for step 201, step 202, and step 203 also applies to step 601, step 602, and step 603, and is not repeated here.
In step 604, the client 1 pulls the task description information related to the client from the task description information set of the server in each heartbeat report. As an example, in response to determining that the task description information including the identification information of the client 1 exists in the task description information set, the client 1 may pull the task description information including the identification information of the client 1 to the local of the client 1.
In step 605, in a similar manner to step 604, the client 2 may pull the task description information related to the client 2 from the task description information set of the server in each heartbeat report.
In step 606, the client 1 may perform the task indicated by the task description information pulled in step 604 above.
In step 607, the client 2 may execute the task indicated by the task description information pulled in step 605.
It should be noted that the execution sequence of the above steps 604 to 607 may be determined according to the actual situation. As an example, the above-mentioned steps 604 and 605 may be performed in reverse order. As a further example, the above steps 606 and 607 may also be performed in the reverse order. And is not limited herein.
In some optional implementations of this embodiment, the task indicated by the task description information may include environmental isolation. In response to the pulling of the task description information representing the environmental isolation, the client may implement resource isolation by using a namespace (namespace) according to parameter information included in the task description information, and implement control over environmental resources by using a control group (Cgroup). By adopting the container technology based on the kernel characteristic, the client can execute the environment isolation task without depending on specific computer hardware resources, so that the applicability of service management and control is improved.
The system for managing and controlling the service provided by the above embodiment of the present application first receives a task distribution request through a server. And then, the server generates at least one piece of task description information corresponding to the task distribution request and comprising the identification information of the clients in the cluster according to the parameter information included in the received task distribution request. And then, the server stores the generated at least one piece of task description information into a task description information set. Next, the client in the cluster pulls the task description information related to the client from the task description information set of the server in the heartbeat report. Further, the client may execute the task indicated by the pulled task description information. Therefore, through the interaction between the server and the client, the task indicated by the task distribution request is automatically completed, and the labor cost for independently managing each client in the cluster is saved.
Referring now to FIG. 7, and referring now to FIG. 7, a block diagram of an electronic device (e.g., server in FIG. 1) 700 suitable for use in implementing embodiments of the present disclosure is shown. The server shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, electronic device 700 may include a processing means (e.g., central processing unit, graphics processor, etc.) 701 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from storage 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the electronic apparatus 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Generally, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, etc.; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 illustrates an electronic device 700 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 7 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communication means 709, or may be installed from the storage means 708, or may be installed from the ROM 702. The computer program, when executed by the processing device 701, performs the above-described functions defined in the methods of embodiments of the present disclosure.
It should be noted that the computer readable medium described in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the server; or may exist separately and not be assembled into the server. The computer readable medium carries one or more programs which, when executed by the server, cause the server to: receiving a task distribution request, wherein the task distribution request comprises parameter information required for completing a task indicated by the task distribution request; generating at least one piece of task description information corresponding to the task distribution request according to the parameter information, wherein the task description information comprises identification information of a client used for executing the task indicated by the task distribution request; and storing at least one piece of task description information into the task description information set so that the client for executing the task indicated by the task distribution request pulls the corresponding task description information from the task description information set.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a first receiving unit, a first generating unit, and a storing unit. Where the names of these units do not in some cases constitute a limitation on the unit itself, for example, the first receiving unit may also be described as a "unit that receives a task distribution request".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (12)

1. A method for generating information, comprising:
receiving a task distribution request, wherein the task distribution request comprises parameter information required for completing a task indicated by the task distribution request;
generating at least one piece of task description information corresponding to the task distribution request according to the parameter information, wherein the task description information comprises identification information of a client side used for executing a task indicated by the task distribution request;
storing the at least one piece of task description information into a task description information set so that the client for executing the task indicated by the task distribution request pulls the corresponding task description information from the task description information set;
the task distribution request comprises a service deployment request, wherein the parameter information included in the service deployment request comprises identification information of a code of a service to be deployed and the number of copies of the service to be deployed; and
the generating at least one piece of task description information corresponding to the task distribution request includes:
determining storage position information of the code of the service to be deployed according to the identification information of the code of the service to be deployed;
responding to running state information sent by a client connected with communication, and determining a service deployment client from the client connected with communication according to the number of the services to be deployed and the running state information, wherein the service deployment client is a client characterized by being used for executing a task indicated by the service deployment request;
generating task description information including the storage location information and identification information of the service deployment client as deployment task description information.
2. The method according to claim 1, wherein the task distribution request includes a service dependency maintenance request, and the parameter information included in the service dependency maintenance request includes identification information of a service to be maintained, identification information of a service having a dependency relationship with the service to be maintained, and a corresponding dependency relationship; and
the method further comprises the following steps:
and generating a directed acyclic graph representing the dependency relationship among the services to be maintained according to the parameter information included in the service dependency relationship maintenance request.
3. The method of claim 2, wherein the method further comprises:
and in response to the fact that the service to be maintained with the dependency relationship is determined to be updated, sending the dependency relationship change information representing the update to a service dependency client so that the service dependency client updates the service to be maintained with the dependency relationship according to the dependency relationship change information, wherein the service dependency client is a client running an instance to which the service to be maintained with the dependency relationship belongs.
4. The method according to one of claims 1-3, wherein the method further comprises:
receiving task feedback information sent by a client side in communication connection, wherein the task feedback information is used for representing an execution result of a task indicated by a task distribution request;
and sending the task feedback information to a client side sending the task distribution request.
5. An apparatus for generating information, comprising:
the task distribution processing unit is configured to receive a task distribution request, wherein the task distribution request comprises parameter information required for completing a task indicated by the task distribution request;
a first generating unit configured to generate at least one piece of task description information corresponding to the task distribution request according to the parameter information, wherein the task description information includes identification information of a client used for executing a task indicated by the task distribution request;
a logging unit configured to log the at least one piece of task description information into a task description information set, so that the client for executing the task indicated by the task distribution request pulls the corresponding task description information from the task description information set; the task distribution request comprises a service deployment request, wherein the parameter information included in the service deployment request comprises identification information of a code of a service to be deployed and the number of copies of the service to be deployed; the first generation unit includes:
a first determining module configured to determine storage location information of the code of the service to be deployed according to the identification information of the code of the service to be deployed;
a second determining module, configured to determine, in response to receiving running state information sent by a client of a communication connection, a service deployment client from the clients of the communication connection according to the number of copies of the service to be deployed and the running state information, wherein the service deployment client is a client characterized for executing a task indicated by the service deployment request;
a first generation module configured to generate task description information including the storage location information and identification information of the service deployment client as deployment task description information.
6. The apparatus according to claim 5, wherein the task distribution request includes a service dependency maintenance request, and the parameter information included in the service dependency maintenance request includes identification information of a service to be maintained, identification information of a service having a dependency relationship with the service to be maintained, and a corresponding dependency relationship; the device further comprises:
and the second generation unit is configured to generate a directed acyclic graph representing the dependency relationship between the services to be maintained according to the parameter information included in the service dependency relationship maintenance request.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the first sending unit is configured to send dependency change information representing the update to a service dependent client in response to determining that the service to be maintained with the dependency is updated, so that the service dependent client updates the service to be maintained with the dependency according to the dependency change information, wherein the service dependent client is a client running an instance to which the service to be maintained with the dependency belongs.
8. The apparatus according to one of claims 5-7, wherein the apparatus further comprises:
the second receiving unit is configured to receive task feedback information sent by a client side in communication connection, wherein the task feedback information is used for representing an execution result of a task indicated by the task distribution request;
a second sending unit configured to send the task feedback information to a client that sends the task distribution request.
9. A system for managing and controlling services comprises a server and a client in communication connection with the server;
the server side is used for realizing the method of any one of claims 1 to 4;
the client is used for pulling the task description information related to the client from the task description information set of the server in heartbeat report; and executing the task indicated by the pulled task description information.
10. The system of claim 9, wherein a two-process keep-alive mechanism is adopted for communication connection between the server and the client.
11. A server, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
12. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN201910098616.XA 2019-01-31 2019-01-31 Method and apparatus for generating information Active CN109729177B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910098616.XA CN109729177B (en) 2019-01-31 2019-01-31 Method and apparatus for generating information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910098616.XA CN109729177B (en) 2019-01-31 2019-01-31 Method and apparatus for generating information

Publications (2)

Publication Number Publication Date
CN109729177A CN109729177A (en) 2019-05-07
CN109729177B true CN109729177B (en) 2021-11-16

Family

ID=66301272

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910098616.XA Active CN109729177B (en) 2019-01-31 2019-01-31 Method and apparatus for generating information

Country Status (1)

Country Link
CN (1) CN109729177B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111324470B (en) * 2020-01-20 2023-11-07 北京百度网讯科技有限公司 Method and device for generating information
CN113298343B (en) * 2021-03-31 2023-11-14 阿里巴巴新加坡控股有限公司 Task generation method, task execution method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8799992B2 (en) * 2012-10-24 2014-08-05 Watchguard Technologies, Inc. Systems and methods for the rapid deployment of network security devices
CN105100200A (en) * 2015-06-02 2015-11-25 北京京东尚科信息技术有限公司 Method and system for distributed deployment, unified configuration and automatic adaptation
CN106161049A (en) * 2015-03-27 2016-11-23 中兴通讯股份有限公司 A kind of method and device realizing that Web Service Deployment specification configures
CN108259209A (en) * 2017-02-28 2018-07-06 新华三技术有限公司 Method for configuring network equipment and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2663954B1 (en) * 2011-01-10 2019-05-01 International Business Machines Corporation System and method for extending cloud services into the customer premise
US9729668B2 (en) * 2014-12-04 2017-08-08 Sap Se Automatic service extensibility
US20180082228A1 (en) * 2016-09-20 2018-03-22 Accenture Global Solutions Limited Digital project management office
CN107566366B (en) * 2017-08-31 2019-02-05 Oppo广东移动通信有限公司 Selection obtains method, terminal and the system of configuration information

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8799992B2 (en) * 2012-10-24 2014-08-05 Watchguard Technologies, Inc. Systems and methods for the rapid deployment of network security devices
CN106161049A (en) * 2015-03-27 2016-11-23 中兴通讯股份有限公司 A kind of method and device realizing that Web Service Deployment specification configures
CN105100200A (en) * 2015-06-02 2015-11-25 北京京东尚科信息技术有限公司 Method and system for distributed deployment, unified configuration and automatic adaptation
CN108259209A (en) * 2017-02-28 2018-07-06 新华三技术有限公司 Method for configuring network equipment and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"一种高可用性集群的部署方法";孙晓林等;《数字技术与应用》;20140531;全文 *

Also Published As

Publication number Publication date
CN109729177A (en) 2019-05-07

Similar Documents

Publication Publication Date Title
CN107590001B (en) Load balancing method and device, storage medium and electronic equipment
US10735345B2 (en) Orchestrating computing resources between different computing environments
CN108737270B (en) Resource management method and device for server cluster
WO2018103521A1 (en) Monitoring method for server, device, and storage medium
US10884727B2 (en) Rolling upgrade of a distributed application
CN108681777B (en) Method and device for running machine learning program based on distributed system
CN109729040B (en) Method, apparatus and computer readable medium for selection of a protocol
US8914804B2 (en) Handling queues associated with web services of business processes
US9329858B2 (en) Managing access to resource versions in shared computing environments
US9432449B2 (en) Managing connection failover in a load balancer
CN108833251B (en) Method and apparatus for controlling network interconnection
CN111857733B (en) Construction method, device and system of service environment and readable storage medium
CN109104368B (en) Connection request method, device, server and computer readable storage medium
CN109729177B (en) Method and apparatus for generating information
CN112346926A (en) Resource state monitoring method and device and electronic equipment
CN113067865A (en) Real-time interaction method and device for space flight measurement and control data
CN112104679B (en) Method, apparatus, device and medium for processing hypertext transfer protocol request
US9893936B2 (en) Dynamic management of restful endpoints
CN111831503B (en) Monitoring method based on monitoring agent and monitoring agent device
CN113760278A (en) Page management method and device
US11886861B2 (en) Propagating application properties to multiple instances
CN113472638B (en) Edge gateway control method, system, device, electronic equipment and storage medium
CN112559001B (en) Method and device for updating application
US9244741B2 (en) System and method for service mobility
CN113760319B (en) Method and system for updating application

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