Task execution method and device, computer equipment and storage medium
Automatically executing container service management operations through management nodes solves the problem of low container service management efficiency, achieves efficient automated management and accurate alarm prompts, and improves the management efficiency and flexibility of container services.
Patent Information
- Application Number
- CN202410850670.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-10
AI Technical Summary
In virtualized operating systems, the management efficiency of container services is low and commands need to be entered on each node, resulting in a cumbersome and inefficient process.
Provide a task execution method that automatically performs container service management operations through management nodes and manages container service nodes according to the client's selection, including receiving requests, obtaining task execution information, determining node types, and executing subtasks in sequence, supporting initialization , uninstall, pause and resume service types, monitor node status in a timely manner and push alarms.
It improves the management efficiency and convenience of container services, reduces manual operations, realizes automated task execution and accurate alarm prompts, and improves the flexibility and accuracy of management.
Smart Images

Figure CN118626210A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of container service technology, and in particular to a task execution method, device, computer equipment and storage medium. Background Art
[0002] In a virtualized operating system, container services are deployed on some or all nodes in a server cluster. When managing container services, management commands need to be entered into each node to implement related management operations. For example, to initialize a container service in a dual-machine hot standby environment, you need to first execute commands on the primary node host, then on the standby node host, and finally on other node hosts. The execution process is cumbersome and inefficient. Summary of the invention
[0003] In view of this, the present invention provides a task execution method, apparatus, computer equipment, storage medium and program product to solve the problem of low efficiency of container service management.
[0004] In a first aspect, the present invention provides a task execution method, which is applied to a container service system, wherein the container service system includes a client and a server, wherein the server includes multiple computing nodes, wherein one computing node among the multiple computing nodes is a management node, and the method is executed by the management node, and the method includes:
[0005] receiving a container service request sent by the client, wherein the container service request includes identification information and a service type respectively corresponding to at least one container service node, the container service node is at least one computing node selected by the target object from the plurality of computing nodes on the management page of the client, and at least one of the container service nodes includes the management node, and the service type is selected by the target object on the management page;
[0006] According to the service type, acquiring task execution information corresponding to the service type, wherein the task execution information includes at least one subtask information and an execution order corresponding to each subtask information;
[0007] Determine, according to the identification information of each of the container service nodes, a node type corresponding to each of the container service nodes;
[0008] The subtask corresponding to each item of the subtask information is executed according to each item of the subtask information, the execution order corresponding to each item of the subtask information, and the node type corresponding to each container service node.
[0009] The task execution method provided by the present invention has the following advantages:
[0010] This solution provides a management page for container services. The target object can perform simple selection operations on the management page, so that the management node on the server can automatically perform related container service management operations based on the content selected by the target object, which is more convenient. Compared with the related technology that requires inputting execution commands for nodes configured with container services separately, this solution automatically manages container services for nodes configured with container services (container service nodes) through management nodes, which is more efficient.
[0011] In an optional implementation, the subtask information includes a node type and an execution command;
[0012] The executing the subtask corresponding to each item of the subtask information according to each item of the subtask information, the execution order corresponding to each item of the subtask information, and the node type corresponding to each container service node includes:
[0013] When determining the execution order of the target subtask corresponding to the target subtask information according to the execution order of the subtasks corresponding to each item of the subtask information, selecting a container service node of the same node type as that included in the target subtask information from at least one of the container service nodes as the first container service node according to the node type included in the target subtask information, wherein the target subtask information is any one item of the at least one item of the subtask information;
[0014] Sending an execution command included in the target subtask information to the first container service node, so that the first container service node executes the target subtask according to the execution command included in the target subtask information;
[0015] Obtaining the execution result of the target subtask;
[0016] If the execution result of the target subtask is successful, executing the next subtask corresponding to the target subtask;
[0017] or,
[0018] When the execution result of the target subtask is failure, a rollback operation is performed according to the node type included in the target subtask information and the execution order of the target subtask.
[0019] Specifically, the management node is configured with task execution information, and can automatically execute related tasks for each container service node based on the task execution information. There is no need to control the target object step by step. Instead, the entire task execution process is completed automatically, which can improve the management convenience of the container service and further improve the management efficiency of the container service.
[0020] In an optional implementation, the service type is one of initializing container system service, uninstalling container system service, pausing container system service, and resuming container system service.
[0021] Specifically, by classifying the service types, the management node can automatically control the tasks corresponding to the service types according to the service types.
[0022] In an optional implementation, when the service type is the initialization container system service, the container service request also includes storage device information corresponding to each of the container service nodes, so that the management node executes the subtask corresponding to each of the subtask information according to the storage device information, the execution order corresponding to each of the subtask information, and the node type corresponding to each of the container service nodes.
[0023] Specifically, by adding storage device information, the target object can input corresponding storage device information according to actual needs, thereby improving the flexibility of container service management.
[0024] In an optional embodiment, the method further includes:
[0025] Monitoring the status of the container service corresponding to each of the container service nodes;
[0026] When it is monitored that the state of the container service of the second container service node changes from a normal running state to a stopped running state, and the mechanism by which the state of the container service changes is non-actively triggered, according to the node type of the second container service node, an alarm prompt information corresponding to the node type of the second container service node is pushed to the client, wherein the second container service node is any container service node of at least one of the container service nodes, and the active trigger is receiving a state switching instruction sent by the client.
[0027] Specifically, this solution can automatically monitor the status of all container service nodes and detect service interruptions or abnormalities in a timely manner. In addition, this solution can distinguish whether the status change is caused by external instructions (such as maintenance operations) or unexpected downtime caused by software errors, hardware failures, etc. This helps to filter out alarms caused by normal operations, reduce false alarms, and make alarms more accurate and reliable.
[0028] In an optional implementation, the node type is one of a master node, a standby node, and a slave node;
[0029] When it is monitored that the state of the container service of the second container service node changes from a normal running state to a stopped running state, and the mechanism by which the state of the container service changes is non-actively triggered, according to the node type of the second container service node, pushing alarm prompt information corresponding to the node type of the second container service node to the client includes:
[0030] When the type of the second container service node is a master node, push a first level of alarm prompt information to the client;
[0031] or,
[0032] When the type of the second container service node is a standby node, push a second level of alarm prompt information to the client, wherein the first level of alarm prompt information is higher than the second level of alarm prompt information;
[0033] or,
[0034] When the type of the second container service node is a slave node, a third level of alarm prompt information is pushed to the client, wherein the second level of alarm prompt information is higher than the third level of alarm prompt information.
[0035] Specifically, by setting alarms of different levels, the severity and urgency of the problem can be intuitively reflected, ensuring that key issues are dealt with first.
[0036] In an optional embodiment, the method further includes:
[0037] Receive a service details acquisition request sent by the client, wherein the service details acquisition request includes node identification information and a service details type, the service details type is one of a network plug-in, a storage plug-in, a service monitoring, a container engine, a network controller, a storage controller, and performance collection, and the node identification information and the service details type are selected by the target object in the management page;
[0038] According to the node identification information, determine a third container service node corresponding to the node identification information in at least one of the container service nodes;
[0039] According to the service detail type, service information corresponding to the service detail type is acquired from the third container service node.
[0040] Specifically, through the management page, the target object can easily initiate a service details query request without logging into each node to manually retrieve information, which greatly simplifies management operations and improves management efficiency.
[0041] In a second aspect, the present invention provides a task execution device, which is applied to a container service system, wherein the container service system includes a client and a server, wherein the server includes multiple computing nodes, wherein one computing node among the multiple computing nodes is a management node, and the device includes:
[0042] a receiving module, configured to receive a container service request sent by the client, wherein the container service request includes identification information and a service type respectively corresponding to at least one container service node, the container service node is at least one computing node selected by the target object from the plurality of computing nodes on the management page of the client, and at least one of the container service nodes includes the management node, and the service type is selected by the target object on the management page;
[0043] An acquisition module, configured to acquire task execution information corresponding to the service type according to the service type, wherein the task execution information includes at least one subtask information and an execution order corresponding to each subtask information;
[0044] A determination module, configured to determine a node type corresponding to each of the container service nodes according to identification information of each of the container service nodes;
[0045] An execution module is used to execute the subtask corresponding to each item of the subtask information according to each item of the subtask information, the execution order corresponding to each item of the subtask information, and the node type corresponding to each container service node.
[0046] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the task execution method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0047] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the task execution method of the first aspect or any corresponding embodiment thereof.
[0048] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the task execution method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are 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.
[0050] Figure 1 is a schematic diagram of the structure of a container service system according to an embodiment of the present invention;
[0051] Figure 2 is a flowchart of a task execution method according to an embodiment of the present invention;
[0052] Figure 3 is a flowchart of a container service monitoring method according to an embodiment of the present invention;
[0053] Figure 4 is a flow chart of a method for obtaining service information according to an embodiment of the present invention;
[0054] Figure 5 is a schematic diagram of a process for initializing a container system service according to an embodiment of the present invention;
[0055] Figure 6 is a schematic diagram of a process of unloading a container service according to an embodiment of the present invention;
[0056] Figure 7 is a schematic diagram of a process of pausing a container service according to an embodiment of the present invention;
[0057] Figure 8 is a schematic diagram of a process of restoring a container service according to an embodiment of the present invention;
[0058] Fig. 9 is a schematic diagram of the life cycle of a container service according to an embodiment of the present invention;
[0059] Fig.10 is a structural block diagram of a task execution device according to an embodiment of the present invention;
[0060] Fig.11 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0062] The embodiment of the present invention provides a container service system, such as Figure 1 As shown, the container service system includes a client and a server, the server includes multiple computing nodes, and one computing node among the multiple computing nodes serves as a management node. The client can be a terminal, such as a desktop computer, a laptop computer, etc. The computing node can be a server.
[0063] In a virtualized operating system, you can use K3s to manage container services. K3s is a lightweight distribution of Kubernetes software. When you need to manage container services, the target object can perform related operations on the client.
[0064] The embodiment of the present invention provides a task execution method, which provides a management page for a container service so that a target object can complete the management operation of the container service by performing simple operations in the management page, which is more convenient.
[0065] According to an embodiment of the present invention, a task execution method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0066] In this embodiment, a task execution method is provided, which can be used in the above-mentioned container service system and is executed by a management node in the container service system. Figure 2 is a flowchart of a task execution method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0067] Step S201: receiving a container service request sent by a client.
[0068] The container service request may include identification information and service types corresponding to at least one container service node. The container service node may be at least one computing node selected by the target object from multiple computing nodes on the management page of the client, and the at least one container service node includes a management node. The service type is selected by the target object on the management page, and the target object may be a user. The service type may be one of initializing container service, uninstalling container service, pausing container service, and resuming container service.
[0069] Specifically, the target object can select the service type and container service node in the management page of the client according to the container service management it needs to perform. For example, the management page displays a computing node list, and the target object can directly select the computing node list.
[0070] In some optional implementations, the container service request may also include identification information of the target object. When the service type is to initialize the container service, after receiving the container service request from the target object, the management node may generate node management information corresponding to the target object based on the identification information of the target object included in the container service request and the identification information corresponding to at least one container service node. In this way, when a container service request is subsequently received again, and the service type is one of uninstalling the container service, pausing the container service, and resuming the container service, the management node may determine the node management information corresponding to the target object based on the identification information of the target object included in the container service request, and perform corresponding tasks based on the identification information of the container service node and the service type included in the node management information.
[0071] In this way, for some service types, there is no need to select container service nodes, which can improve the operational simplicity of service management and improve management efficiency.
[0072] Step S202: According to the service type, task execution information corresponding to the service type is obtained.
[0073] The task execution information includes at least one subtask information and an execution order corresponding to each subtask information.
[0074] Specifically, the management node may store a first correspondence between the service type and the task execution information. After the management node extracts the service type from the container service request, the management node may obtain the corresponding task execution information according to the extracted service type and the first correspondence.
[0075] Step S203: Determine the node type corresponding to each container service node according to the identification information of each container service node.
[0076] The node type is one of a master node, a backup node, and a slave node.
[0077] Specifically, the management node may store a second correspondence between the node identification information and the node type. For each container service node, after the management node obtains the identification information of the container service node from the container service request, the node type of the container service node may be determined according to the identification information of the container service node and the second correspondence.
[0078] Step S204: Execute the subtask corresponding to each item of subtask information according to each item of subtask information, the execution order corresponding to each item of subtask information, and the node type corresponding to each container service node.
[0079] The subtask information may include the node type and the execution command.
[0080] Specifically, step S204 may include:
[0081] Step 1: When determining the execution order of the target subtask corresponding to the target subtask information according to the execution order of the subtasks corresponding to each subtask information, select a container service node with the same node type as that included in the target subtask information from at least one container service node as the first container service node according to the node type included in the target subtask information.
[0082] The target subtask information is any subtask information among at least one subtask information.
[0083] Step 2: Send the execution command included in the target subtask information to the first container service node, so that the first container service node executes the target subtask according to the execution command included in the target subtask information.
[0084] Step 3: Get the execution result of the target subtask.
[0085] Specifically, the management node can adopt an asynchronous method to cyclically check the execution result, that is, while waiting for the target subtask to be executed, the management node can execute other related management tasks that it needs to execute, and query whether the target subtask is executed after each preset interval. If so, it can be determined that the execution result of the target subtask is successful. If not, it can be re-queried after the preset interval to see whether the target subtask is executed. In addition, the management node can start timing at the beginning of the execution of the target subtask. When the timing reaches the preset duration threshold, if the result of the target subtask execution completion has not been queried, it can be determined that the execution result of the target subtask is a failure.
[0086] Step 4: When the execution result of the target subtask is successful, execute the next subtask corresponding to the target subtask.
[0087] Step 5: When the execution result of the target subtask is failure, a rollback operation is performed according to the node type included in the target subtask information and the execution order of the target subtask.
[0088] In some optional implementations, the target object can perform an input operation of storage device information in the management node. In this way, when the service type is to initialize the container service, the container service request can also include storage device information corresponding to each container service node, so that the management node can execute the subtask corresponding to each subtask information according to the storage device information, the execution order corresponding to each subtask information, and the node type corresponding to each container service node.
[0089] In some optional implementations, when the service type is initializing a container service, the container service request may also include indication information for initializing the image library. In this way, after extracting the indication information for initializing the image library from the container service request, the management node may perform the operation of initializing the image library on the storage device corresponding to the storage device information according to the storage device information.
[0090] The task execution method provided in this embodiment provides a management page for container services. The target object can perform simple selection operations on the management page, so that the management node of the server can automatically perform management operations on related container services according to the content selected by the target object, which is more convenient. Compared with the related art that requires inputting execution commands for nodes configured with container services separately, this solution automatically manages container services for nodes configured with container services (container service nodes) through management nodes, which is more efficient.
[0091] In this embodiment, a task execution method is provided, which can be used in the above-mentioned container service system and is executed by a management node in the container service system. Figure 3 is a flow chart of a container service monitoring method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0092] Step S301: monitor the status of the container service corresponding to each container service node.
[0093] Step S302: When it is monitored that the state of the container service of the second container service node changes from a normal operating state to a stopped operating state, and the mechanism for the change in the state of the container service is non-actively triggered, according to the node type of the second container service node, an alarm prompt information corresponding to the node type of the second container service node is pushed to the client.
[0094] The second container service node is any container service node among the at least one container service node, and is actively triggered by receiving a state switching instruction sent by the client. The node type is one of a master node, a standby node, and a slave node.
[0095] Specifically, the target object can perform a state switching operation (including selecting a container service node and target state information) on the client. After detecting the state switching operation of the target object, the client can generate a state switching instruction according to the state switching operation of the target object. After receiving the state switching instruction, the management node can determine the corresponding container service node according to the identification information of the container service node included in the state switching instruction, and switch the state of the corresponding container service node according to the target state information.
[0096] In this way, when the state indicated by the target state information is a stopped state, and the current state of the corresponding container service node is a normal running state, an event will occur in the container service node that changes from a normal running state to a stopped state.
[0097] Therefore, when the management node detects that the state of the container service of the second container service node changes from the normal running state to the stopped running state, it can check whether there is a state switching instruction corresponding to the state switching event. If yes, it can be determined that the state switching event is actively triggered and no attention is needed. If not, it can be determined that the state switching event is non-actively triggered, that is, triggered by an abnormal event, and an alarm needs to be issued in a timely manner.
[0098] Depending on the node type, push alert information can include the following three processing methods:
[0099] First, when the type of the second container service node is a master node, a first level alarm prompt information is pushed to the client.
[0100] Second, when the type of the second container service node is a standby node, a second level of alarm prompt information is pushed to the client, wherein the first level of alarm prompt information is higher than the second level of alarm prompt information.
[0101] Third, when the type of the second container service node is a slave node, a third level of alarm prompt information is pushed to the client, wherein the second level of alarm prompt information is higher than the third level of alarm prompt information.
[0102] In some optional implementations, the client may periodically obtain the latest status information of each container service node from the management node, and after determining that the status of the container service node has changed based on the latest status information, update and display the status process of the container service node.
[0103] The task execution method provided in this embodiment, first, by continuously monitoring the status of each container service node, the status changes, especially the unexpected shutdown status, can be captured in real time. This instant feedback mechanism greatly shortens the problem discovery time. Second, by distinguishing whether the status change is triggered actively or passively, the accuracy of the alarm can be ensured. Third, according to the different node types (master node, backup node, slave node), different levels of alarm prompt information are adopted to help the target object quickly judge the urgency of the problem and make priority sorting. Fourth, combined with the alarm prompt information, the target object can quickly locate the node type where the abnormality occurs, which is crucial for quickly diagnosing the cause of the problem and formulating repair measures, which greatly improves the efficiency of troubleshooting.
[0104] In this embodiment, a task execution method is provided, which can be used in the above-mentioned container service system and is executed by a management node in the container service system. Figure 4 is a flow chart of a method for obtaining service information according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:
[0105] Step S401: receiving a service details acquisition request sent by a client.
[0106] The service details acquisition request includes node identification information and service details type. The service details type is one of network plug-in, storage plug-in, service monitoring, container engine, network controller, storage controller, and performance collection. The node identification information and service details type are selected by the target object in the management page. When the node type is a master node or a backup node, the service details type is one of network plug-in, storage plug-in, service monitoring, container engine, network controller, storage controller, and performance collection. When the node type is a slave node, the service details type is one of network plug-in, storage plug-in, service monitoring, and container engine.
[0107] Specifically, the target object can select the service details type and the container service node on the client. In this way, the client can generate a service details acquisition request according to the target object's selection operation and send it to the management node in the server. In this way, the management node can obtain the service details acquisition request.
[0108] Step S402: Determine, according to the node identification information, a third container service node corresponding to the node identification information in at least one container service node.
[0109] Step S403: According to the service detail type, service information corresponding to the service detail type is obtained from the third container service node.
[0110] Among them, when the service details type is one of network plug-in, storage plug-in, container engine, network controller, storage controller, the service information may include software name, version information, function information, operating environment information, etc. When the service details type is service monitoring, the service information may include the status of the container service. When the service details type is performance collection, the service information may include the real-time status of the container's computing resources, memory resources, IO performance, network resources, etc.
[0111] Specifically, the management node may parse the service details acquisition request to obtain the node identification information and the service details type. Then, the management node may determine the third container service node corresponding to the node identification information based on the node identification information, and obtain the service information corresponding to the service details type from the third container service node based on the service details type.
[0112] In the task execution method provided in this embodiment, the target object can select the service detail type and container service node according to actual needs on the client side, which can improve the flexibility and convenience of container service management.
[0113] The following describes in detail the task execution methods corresponding to container services according to different service types.
[0114] First, initialize the container service.
[0115] like Figure 5 As shown, the target object can perform the following operations in sequence on the client's management page:
[0116] a. Select a container service node. If there is only one management node, only that management node is automatically selected. If there are multiple management nodes, all management nodes are automatically selected. In addition, in addition to the management node, the target object can also select other computing nodes as container service nodes.
[0117] b. Select storage devices. When the container service node is selected, the client can automatically select the storage device corresponding to the container service node as available storage to create a container service. Alternatively, the target object can manually change and select the storage device it needs as available storage to create a container service.
[0118] c. Select Execute Initialize Image Library. This operation is optional.
[0119] d. Start initialization. Start initialization and real-time printing process.
[0120] After completing the above operations, the client can generate a corresponding container service request based on the target object selection operation and send it to the management node. The management node will perform the following operations based on the container service request:
[0121] e. Clean up the remaining container service information. The management node can detect whether there are files related to the container service in each container service node. If yes, a cleanup operation can be performed, that is, the files related to the container service can be deleted. If no, the next step can be performed.
[0122] f. Initialize the container running directory. The management node can initialize the container running directory for the storage device corresponding to the storage device information as available storage based on the storage device information, that is, convert the available storage into the container running directory, and set the storage space corresponding to the storage device to be provided only for container services.
[0123] g. Initialize the master node. Perform initialization operations on the master node, obtain and record the token value (a verification code). If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state before the container running directory was initialized in step f.
[0124] h. Initialize the standby node. Get the token value of the master node, and perform the operation of initializing the standby node according to the token value of the master node. If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state before the master node initialized the container running directory.
[0125] i. Initialize the slave node. Get the token value of the master node, and perform the operation of initializing the standby node according to the token value of the master node. If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state before the current slave node initialized the container running directory.
[0126] j. Initialize the container image library. If step c is performed on the client, the operation of initializing the container image library is performed on each container service node.
[0127] k. Log printing execution process, waiting for initialization to complete.
[0128] It should be noted that the above steps are all controlled by the management node. Steps e, f, g, h, i, j, and k can all be considered as a subtask in the initialization container service.
[0129] Second, suspend the container service.
[0130] like Figure 6 As shown, the target object can click to pause the successfully initialized container service on the client's management page. In this way, the client can generate a corresponding container service request based on the target object's operation and send it to the management node. The management node will perform the following operations based on the container service request:
[0131] l. Pause the container service of the slave node. Check whether each slave node supports pause, and pause the container service of all slave nodes concurrently. For each slave node, when this step is executed successfully, you can proceed to the next step. When this step fails, you can roll back to the unpaused state.
[0132] m. Pause the container service of the standby node. If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state where the standby node is not paused.
[0133] n. Pause the container service of the master node. If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state where both the master node and the standby node are not paused.
[0134] It should be noted that the above steps are all controlled by the management node. Steps 1, m, and n can all be considered as a subtask in pausing the container service.
[0135] Third, restore container services.
[0136] like Figure 7 As shown, the target object can click to resume the suspended container service on the client's management page. In this way, the client can generate a corresponding container service request based on the target object's operation and send it to the management node. The management node will perform the following operations based on the container service request:
[0137] o. Restore the container service of the master node. If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state where the master node has not been restored.
[0138] p. Restore the container service of the standby node. If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state where the standby node has not been restored.
[0139] q. Restore the container service of the slave node. Concurrently restore the container service of all slave nodes. For each slave node, if this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the unrestored state.
[0140] It should be noted that the above steps are all controlled by the management node. Steps o, p, and q can all be considered as a subtask in restoring the container service.
[0141] Fourth, uninstall the container service.
[0142] like Figure 8 As shown, the target object can click to uninstall the suspended or successfully initialized container service on the client's management page. In this way, the client can generate a corresponding container service request based on the target object's operation and send it to the management node. The management node will perform the following operations based on the container service request:
[0143] r. Clean up container resources. Get the status of each container service node. When the status of all container service nodes is stopped, you can clean up the remaining container resources first.
[0144] s. Uninstall the container service of the slave node. Concurrently uninstall the container service of all slave nodes. For each slave node, when this step is successfully executed, you can proceed to the next step. When this step fails, you can roll back to the end state of the previous step.
[0145] t. Uninstall the container service of the standby node. If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state where the standby node is not uninstalled.
[0146] u. Uninstall the container service of the master node. If this step is executed successfully, you can proceed to the next step. If this step fails, you can roll back to the state where both the master node and the standby node are uninstalled.
[0147] It should be noted that the above steps are all controlled by the management node. Steps r, s, t, and u can all be considered as a subtask in the unloading container service.
[0148] like Fig. 9 As shown, under the management operations of the above four container services, the state of the container service can be switched between the three states of initialized, uninitialized and paused.
[0149] In this embodiment, a task execution device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0150] This embodiment provides a task execution device, such as Fig.10 As shown, including:
[0151] A receiving module 1001 is configured to receive a container service request sent by a client, wherein the container service request includes identification information and a service type respectively corresponding to at least one container service node, the container service node is at least one computing node selected by the target object from multiple computing nodes on a management page of the client, and the at least one container service node includes a management node, and the service type is selected by the target object on the management page;
[0152] The acquisition module 1002 is used to acquire task execution information corresponding to the service type according to the service type, wherein the task execution information includes at least one subtask information and an execution order corresponding to each subtask information;
[0153] A determination module 1003 is used to determine a node type corresponding to each container service node according to the identification information of each container service node;
[0154] The execution module 1004 is used to execute the subtask corresponding to each subtask information according to each subtask information, the execution order corresponding to each subtask information, and the node type corresponding to each container service node.
[0155] In some optional implementations, the subtask information includes a node type and an execution command;
[0156] The execution module 1004 is specifically used for:
[0157] When determining the execution order of the target subtask corresponding to the target subtask information according to the execution order of the subtasks corresponding to each subtask information, selecting a container service node of the same node type as that included in the target subtask information from at least one container service node as the first container service node according to the node type included in the target subtask information, wherein the target subtask information is any one of the at least one subtask information;
[0158] Sending the execution command included in the target subtask information to the first container service node, so that the first container service node executes the target subtask according to the execution command included in the target subtask information;
[0159] Get the execution result of the target subtask;
[0160] When the execution result of the target subtask is successful, the next subtask corresponding to the target subtask is executed;
[0161] or,
[0162] When the execution result of the target subtask is failure, a rollback operation is performed according to the node type included in the target subtask information and the execution order of the target subtask.
[0163] In some optional implementations, the service type is one of initializing a container service, uninstalling a container service, pausing a container service, and resuming a container service.
[0164] In some optional embodiments, when the service type is to initialize a container service, the container service request also includes storage device information corresponding to each container service node, so that the management node executes the subtask corresponding to each subtask information according to the storage device information, the execution order corresponding to each subtask information, and the node type corresponding to each container service node.
[0165] In some optional implementations, the device further includes a monitoring module 1005, which is used to:
[0166] Monitor the status of the container service corresponding to each container service node;
[0167] When it is monitored that the state of the container service of the second container service node changes from a normal operating state to a stopped operating state, and the mechanism for the change in the state of the container service is non-actively triggered, according to the node type of the second container service node, an alarm prompt information corresponding to the node type of the second container service node is pushed to the client, wherein the second container service node is any container service node among the at least one container service node, and the active trigger is receiving a state switching instruction sent by the client.
[0168] In some optional implementations, the node type is one of a master node, a standby node, and a slave node;
[0169] The monitoring module 1005 is specifically used for:
[0170] When the type of the second container service node is a master node, a first-level alarm prompt information is pushed to the client;
[0171] or,
[0172] When the type of the second container service node is a standby node, push the second level of alarm prompt information to the client, wherein the first level of alarm prompt information is higher than the second level of alarm prompt information;
[0173] or,
[0174] When the type of the second container service node is a slave node, the third level of alarm prompt information is pushed to the client, wherein the second level of alarm prompt information is higher than the third level of alarm prompt information.
[0175] In some optional implementations, the receiving module 1001 is further used to receive a service details acquisition request sent by a client, wherein the service details acquisition request includes node identification information and a service details type, the service details type is one of a network plug-in, a storage plug-in, a service monitoring, a container engine, a network controller, a storage controller, and performance collection, and the node identification information and the service details type are selected by the target object in the management page;
[0176] The determination module 1003 is further configured to determine, according to the node identification information, a third container service node corresponding to the node identification information in at least one container service node;
[0177] The acquisition module 1002 is further configured to acquire, according to the service detail type, service information corresponding to the service detail type from the third container service node.
[0178] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0179] The task execution device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0180] The embodiment of the present invention also provides a computer device having the above Fig.10 The task execution device shown.
[0181] See also Fig.11 , Fig.11 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.11 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.11 A processor 10 is taken as an example.
[0182] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0183] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0184] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0185] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0186] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0187] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0188] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0189] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A task execution method, characterized in that: The method is applied to a container service system, the container service system includes a client and a server, the server includes multiple computing nodes, one of the multiple computing nodes is a management node, the method is executed by the management node, and the method includes: receiving a container service request sent by the client, wherein the container service request includes identification information and a service type respectively corresponding to at least one container service node, the container service node is at least one computing node selected by the target object from the plurality of computing nodes on the management page of the client, and at least one of the container service nodes includes the management node, and the service type is selected by the target object on the management page; According to the service type, acquiring task execution information corresponding to the service type, wherein the task execution information includes at least one subtask information and an execution order corresponding to each subtask information; Determine, according to the identification information of each of the container service nodes, a node type corresponding to each of the container service nodes; The subtask corresponding to each item of the subtask information is executed according to each item of the subtask information, the execution order corresponding to each item of the subtask information, and the node type corresponding to each container service node.
2. The method according to claim 1, characterized in that The subtask information includes node type and execution command; The executing the subtask corresponding to each item of the subtask information according to each item of the subtask information, the execution order corresponding to each item of the subtask information, and the node type corresponding to each container service node includes: When determining the execution order of the target subtask corresponding to the target subtask information according to the execution order of the subtasks corresponding to each item of the subtask information, selecting a container service node of the same node type as that included in the target subtask information from at least one of the container service nodes as the first container service node according to the node type included in the target subtask information, wherein the target subtask information is any one item of the at least one item of the subtask information; Sending an execution command included in the target subtask information to the first container service node, so that the first container service node executes the target subtask according to the execution command included in the target subtask information; Obtaining the execution result of the target subtask; If the execution result of the target subtask is successful, executing the next subtask corresponding to the target subtask; or, When the execution result of the target subtask is failure, a rollback operation is performed according to the node type included in the target subtask information and the execution order of the target subtask.
3. The method according to claim 1 or 2, characterized in that: The service type is one of initializing container system service, uninstalling container system service, pausing container system service, and resuming container system service.
4. The method according to claim 3, characterized in that When the service type is the initialization container system service, the container service request also includes storage device information corresponding to each of the container service nodes, so that the management node executes the subtask corresponding to each item of the subtask information according to the storage device information, the execution order corresponding to each item of the subtask information, and the node type corresponding to each of the container service nodes.
5. The method according to claim 1 or 2, characterized in that: The method further comprises: Monitoring the status of the container service corresponding to each of the container service nodes; When it is monitored that the state of the container service of the second container service node changes from a normal running state to a stopped running state, and the mechanism by which the state of the container service changes is non-actively triggered, according to the node type of the second container service node, an alarm prompt information corresponding to the node type of the second container service node is pushed to the client, wherein the second container service node is any container service node of at least one of the container service nodes, and the active trigger is receiving a state switching instruction sent by the client.
6. The method according to claim 5, characterized in that The node type is one of a master node, a standby node and a slave node; When it is monitored that the state of the container service of the second container service node changes from a normal running state to a stopped running state, and the mechanism by which the state of the container service changes is non-actively triggered, according to the node type of the second container service node, pushing alarm prompt information corresponding to the node type of the second container service node to the client includes: When the type of the second container service node is a master node, push a first level of alarm prompt information to the client; or, When the type of the second container service node is a standby node, push a second level of alarm prompt information to the client, wherein the first level of alarm prompt information is higher than the second level of alarm prompt information; or, When the type of the second container service node is a slave node, a third level of alarm prompt information is pushed to the client, wherein the second level of alarm prompt information is higher than the third level of alarm prompt information.
7. The method according to claim 1 or 2, characterized in that: The method further comprises: Receive a service details acquisition request sent by the client, wherein the service details acquisition request includes node identification information and a service details type, the service details type is one of a network plug-in, a storage plug-in, a service monitoring, a container engine, a network controller, a storage controller, and performance collection, and the node identification information and the service details type are selected by the target object in the management page; According to the node identification information, determine a third container service node corresponding to the node identification information in at least one of the container service nodes; According to the service detail type, service information corresponding to the service detail type is acquired from the third container service node.
8. A task execution device, characterized in that: The device is applied to a container service system, the container service system includes a client and a server, the server includes multiple computing nodes, one of the multiple computing nodes is a management node, and the device includes: a receiving module, configured to receive a container service request sent by the client, wherein the container service request includes identification information and a service type respectively corresponding to at least one container service node, the container service node is at least one computing node selected by the target object from the plurality of computing nodes on the management page of the client, and at least one of the container service nodes includes the management node, and the service type is selected by the target object on the management page; An acquisition module, configured to acquire task execution information corresponding to the service type according to the service type, wherein the task execution information includes at least one subtask information and an execution order corresponding to each subtask information; A determination module, configured to determine a node type corresponding to each of the container service nodes according to identification information of each of the container service nodes; An execution module is used to execute the subtask corresponding to each item of the subtask information according to each item of the subtask information, the execution order corresponding to each item of the subtask information, and the node type corresponding to each container service node.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the task execution method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the task execution method according to any one of claims 1 to 7.
