Cluster operation and maintenance instruction execution method and device, electronic device and storage medium
By dismantling and distributing atomic instructions and optimizing the instruction queue with the instruction merging strategy, the problem of high resource consumption and low execution efficiency in cloud-native cluster operation and maintenance is solved, and efficient cluster operation and maintenance operations are achieved.
Patent Information
- Application Number
- CN202510978104.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2045-07-16
AI Technical Summary
In large-scale cluster operation and maintenance in the cloud native field, cluster resources are consumed and instruction execution is inefficient, resulting in system lag and slow response.
By receiving batch instruction information, the basic parameters and routing policies are extracted, broken down into atomic instructions, and distributed to the target instruction queue based on the index value, the target configuration items are generated and sent to the target device for execution, and the instruction merging strategy is combined with the instruction merging strategy to optimize the instruction queue.
It improves the operation efficiency and resource utilization rate of operation and maintenance in large-scale cluster environments, reduces cluster load and resource consumption, and ensures the efficiency and accuracy of instruction execution.
Smart Images

Figure CN120474915A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the cloud native field, and in particular to a cluster operation and maintenance instruction execution method, device, electronic device and storage medium. Background Art
[0002] In cloud-native cluster operations, as business scale continues to expand, clusters are also becoming increasingly large. Large-scale cluster operations involve numerous personnel, and batch execution of operations commands has become the norm. However, this can dramatically increase the load on cluster machines. Numerous commands are issued and executed simultaneously, and multiple operations functions may involve homogeneous atomic operations, severely consuming cluster resources and impacting overall cluster performance and stability. These issues can even lead to system freezes and slow responses, significantly reducing operation efficiency. Related technologies lack intelligent processing of operation commands, resulting in high cluster resource consumption and low command execution efficiency when faced with batch operation requirements for large-scale clusters.
[0003] Currently, no effective solution has been proposed for the problems of high cluster resource consumption and low instruction execution efficiency in cluster operation and maintenance operations in related technologies. Summary of the Invention
[0004] The embodiments of the present application provide a cluster operation and maintenance instruction execution method, device, electronic device and storage medium to at least solve the problem of low instruction execution efficiency in the related art when facing batch operation and maintenance requirements of large-scale clusters.
[0005] In a first aspect, an embodiment of the present application provides a cluster operation and maintenance instruction execution method, the method comprising:
[0006] Receiving batch instruction information generated according to a preset instruction metadata template; extracting parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, a target device group, and a routing policy; the target device group includes at least one target device in the cluster device;
[0007] Based on the basic parameters and the target device group, the batch instruction information is decomposed into an atomic instruction, where the atomic instruction carries a target device identifier;
[0008] Creating an initial command queue; wherein each of the cluster devices corresponds to a first index value of the initial command queue;
[0009] Calculating a second index value based on the routing policy and the target device identifier; retrieving a target instruction queue matching the second index value in the initial instruction queue based on the first index value, and distributing the atomic instruction to the target instruction queue;
[0010] A target configuration item is generated based on the atomic instruction in the target instruction queue, and the target configuration item is sent to the target device; the target device executes the atomic instruction based on the target configuration item.
[0011] In some embodiments, the batch instruction information further includes an instruction merging strategy; and generating a target configuration item based on the atomic instruction in the target instruction queue includes:
[0012] Based on the instruction merging strategy, the atomic instructions in the target instruction queue are compressed to generate target configuration items.
[0013] In some embodiments, the atomic instruction further includes an instruction category; and the compressing the atomic instructions in the target instruction queue based on the instruction merging strategy to generate a target configuration item includes:
[0014] Sequentially traverse the atomic instructions stored in the target instruction queue;
[0015] Detecting whether there is a target atomic instruction in the target instruction queue that has the same instruction category and target device identifier as the traversed current atomic instruction among the atomic instructions queued before the current atomic instruction;
[0016] If so, if the instruction merging strategy indicates instruction compression, setting the skip flag of the target atomic instruction to an enabled state until the atomic queue in the target instruction queue is completely traversed;
[0017] The skip flag of each of the atomic instructions in the target instruction queue is detected, and the target configuration item is generated based on the atomic instructions whose skip flags are in a non-enabled state.
[0018] In some embodiments, retrieving a target instruction queue matching the second index value in the initial instruction queue based on the first index value, and dispatching the atomic instruction to the target instruction queue includes:
[0019] In the case that retrieving the instruction queue matching the second index value fails, a new instruction queue is generated based on the second index value, and the atomic instruction is distributed to the new instruction queue.
[0020] In some embodiments, the batch instruction information also includes an execution result status; after the target configuration item is sent to the target device, the following steps are further included:
[0021] detecting an execution result of the target device; the execution result is obtained by the target device generating an executable instruction for the atomic instruction based on the target configuration item and executing the executable instruction;
[0022] In response to the detected execution result of the target device, the execution result status in the batch instruction information to which the atomic instruction belongs is updated.
[0023] In some embodiments, the atomic instruction further includes a parent instruction identifier; the parent instruction identifier refers to an identifier of the batch instruction information to which the atomic instruction belongs; and updating the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device includes:
[0024] When it is detected that the version identifier in the target configuration item is consistent with the version identifier of the configuration item currently running on the target device, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution success or execution failure.
[0025] In some embodiments, updating the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device further includes:
[0026] When it is detected that the version identifier in the target configuration item is inconsistent with the version identifier of the configuration item currently running on the target device, and the waiting time period exceeds the preset time period threshold, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution failure; the waiting time period is the time period between the time point when the target configuration item is sent to the target device and the current time point.
[0027] In a second aspect, an embodiment of the present application provides a cluster operation and maintenance instruction execution device, the device comprising:
[0028] An instruction receiving module is configured to receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, a target device group, and a routing policy; the target device group includes at least one target device in the cluster device;
[0029] An instruction disassembly module is used to disassemble the batch instruction information based on the basic parameters and the target device group to obtain atomic instructions, where the atomic instructions carry a target device identifier;
[0030] An instruction queue management module is configured to create an initial instruction queue, wherein each of the cluster devices corresponds to a first index value of the initial instruction queue;
[0031] an instruction routing distribution module, configured to calculate a second index value based on the routing policy and the target device identifier; retrieve a target instruction queue matching the second index value in the initial instruction queue based on the first index value, and distribute the atomic instruction to the target instruction queue;
[0032] A configuration generation module is used to generate a target configuration item based on the atomic instruction in the target instruction queue, and send the target configuration item to the target device; the target device executes the atomic instruction based on the target configuration item.
[0033] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the cluster operation and maintenance instruction execution method as described in the first aspect above is implemented.
[0034] In a fourth aspect, an embodiment of the present application provides a storage medium on which a computer program is stored. When the program is executed by a processor, the cluster operation and maintenance instruction execution method described in the first aspect above is implemented.
[0035] Compared with related technologies, the cluster operation and maintenance instruction execution method, device, electronic device and storage medium provided in the embodiments of the present application receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device group and routing strategy; the target device group includes at least one target device in the cluster device; based on the basic parameters and the target device group, the batch instruction information is decomposed into instructions to obtain atomic instructions, which carry the target device identifier; create an initial instruction queue; wherein each cluster device corresponds to a first index value of the initial instruction queue; calculate a second index value based on the routing strategy and the target device identifier; in the initial instruction queue, based on the first index value, retrieve the target instruction queue that matches the second index value and distribute the atomic instruction to the target instruction queue; generate a target configuration item based on the atomic instruction in the target instruction queue, and send the target configuration item to the target device; the target device executes the atomic instruction based on the target configuration item. This solves the problems of low instruction execution efficiency and excessive resource consumption in traditional cluster operation and maintenance, and achieves high efficiency of operation and maintenance operations in a large-scale cluster environment.
[0036] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0038] Figure 1 This is a hardware structure block diagram of a terminal according to a cluster operation and maintenance instruction execution method of an embodiment of the present application;
[0039] Figure 2 This is a flow chart of a cluster operation and maintenance instruction execution method according to an embodiment of the present application;
[0040] Figure 3 is a flow chart of the life cycle stages of batch instruction information according to an embodiment of the present application;
[0041] Figure 4 is a flowchart of the life cycle conversion of batch instruction information according to an embodiment of the present application;
[0042] Figure 5 is a flowchart of atomic instruction compression according to an embodiment of the present application;
[0043] Figure 6 is a schematic diagram of an instruction merging strategy according to an embodiment of the present application;
[0044] Figure 7 This is a flowchart of creating an instruction queue according to an embodiment of the present application;
[0045] Figure 8 This is a flowchart of instruction queue destruction according to an embodiment of the present application;
[0046] Figure 9 is a flowchart of instruction processing according to an embodiment of the present application;
[0047] Figure 10 This is a structural block diagram of a cluster operation and maintenance instruction execution device according to an embodiment of the present application;
[0048] Figure 11 is an overall schematic diagram of the system architecture according to an embodiment of the present application;
[0049] Figure 12 It is a structural block diagram of the system architecture according to an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means and should not be understood as the contents disclosed in the present application being insufficient.
[0051] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it refer to independent or alternative embodiments that are mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments unless there is a conflict.
[0052] Unless otherwise defined, technical or scientific terms used herein shall have the ordinary meaning as understood by persons of ordinary skill in the art to which this application belongs. The terms "a," "an," "an," "the," and similar expressions used herein do not denote limitations on quantity and may refer to either the singular or the plural. The terms "comprise," "include," "have," and any variations thereof, used herein, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or modules (units) is not limited to the listed steps or units but may also include steps or units not listed, or may include other steps or units inherent to the process, method, product, or apparatus. The terms "connected," "connected," "coupled," and similar expressions used herein are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. As used herein, "plurality" means greater than or equal to two. "And / or" describes an association between associated objects, indicating that three possible relationships exist. For example, "A and / or B" may mean: A exists alone; A and B exist simultaneously; or B exists alone. The terms "first", "second", "third" and the like involved in this application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.
[0053] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 1 This is a hardware structure diagram of a terminal according to a cluster operation and maintenance instruction execution method of an embodiment of the present application. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown) a processor 12 (the processor 12 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 14 for storing data. Optionally, the terminal may also include a transmission device 16 for communication functions and an input and output device 18. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0054] The memory 14 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the cluster operation and maintenance instruction execution method in the embodiment of the present application. The processor 12 executes various functional applications and data processing by running the computer program stored in the memory 14, that is, implementing the above method. The memory 14 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 14 may further include a memory remotely located relative to the processor 12, and these remote memories may be connected to the terminal 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.
[0055] Transmission device 16 is used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the terminal's communications provider. In one embodiment, transmission device 16 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 16 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0056] This embodiment provides a cluster operation and maintenance instruction execution method. Figure 2 is a flow chart of a cluster operation and maintenance instruction execution method according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0057] Step S201: receiving batch instruction information generated according to a preset instruction metadata template; extracting parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, a target device group and a routing policy; the target device group includes at least one target device in the cluster device.
[0058] Here, the instruction metadata template can also be named TraitDef. TraitDef defines the supported O&M instruction categories, including the instruction name, description, and parameter definitions. The O&M operation parameter definition primarily specifies the parsing rules for the instruction parameters. Batch instruction information can also be named Trait. Trait records user O&M instructions and their results, including the assigned TraitDef, basic parameters, instruction merging strategy, routing strategy, target device group, and other information.
[0059] Specifically, after receiving the user's input batch instruction trait, the system first matches the corresponding traitdef field to the corresponding traitdef to verify the structure's validity. It then extracts and verifies basic parameters, target device groups, and routing policies from the trait according to the traitdef's parameter parsing rules. The target device group is the list of devices for which execution is desired. Once verified, the system encapsulates the trait into a resource object that complies with Kubernetes (an open-source container orchestration platform). When trait resources are created or updated, a resource event queue based on the Kubernetes informer (a resource monitoring mode) monitors changes in real time using the list&watch mechanism (a query monitoring mechanism). This queue captures three types of events: add, update, and delete. Once generated, events are automatically queued, and queue elements are consumed by consumer processes, which are the components responsible for deleting events from the event queue and executing the corresponding processing logic. The consumer takes the event from the queue, parses the current state of the trait (such as the initialization phase), and executes the corresponding phase logic (such as parameter verification and instruction distribution) according to the trait lifecycle definition. After processing is completed, the status field of the trait is updated, triggering a new round of informer monitoring, forming a closed loop of state flow.
[0060] Figure 3 This is the life cycle stage of the batch instruction information Trait in the embodiment of the present application, such as Figure 3 As shown, the process includes the following steps:
[0061] Step S301, initialization phase; when the system receives the batch operation and maintenance instruction Trait input by the user, the Trait enters the initialization phase.
[0062] Step S302, parameter checking phase; after the Trait completes the initialization phase, it automatically enters the parameter checking phase.
[0063] Step S303, instruction distribution phase; after the parameter verification phase is successfully passed, Trait enters the instruction distribution phase.
[0064] Step S304, execution phase; after the instruction distribution phase is completed, Trait enters the execution phase.
[0065] Step S305, execution success stage; when all target devices have successfully completed the execution of the operation and maintenance instructions, and the system confirms that the execution results meet expectations, Trait enters the execution success stage.
[0066] Step S306, execution failure stage; in the execution stage, as long as the operation and maintenance instructions of a target device fail to achieve the expected results, such as an error prompt or the execution result does not meet the requirements, Trait enters the execution failure stage.
[0067] Figure 4 It is the life cycle conversion process of batch instruction information, such as Figure 4 As shown, the process includes the following steps:
[0068] Step S401, start the process; the starting point of the process marks the start of the batch instruction information status processing process, and the initial state of the batch instruction information is initialization.
[0069] Step S402, determine the status of the batch instruction information; determine the subsequent execution path according to the current status of the batch instruction information, corresponding to the initialization, configuration check, instruction distribution and execution status branches respectively.
[0070] Step S403, configuration verification phase; verify the parameters of the batch instruction information according to the configuration item description information of the TraitDef to which it belongs. If the verification is successful, change the status of the batch instruction information to instruction distribution; otherwise, add the failure reason and change the status to execution failure.
[0071] Step S404, instruction distribution phase: adding the batch instruction information to the batch instruction information receiving queue of the instruction batch processing module. If the addition is successful, the batch instruction information status is changed to execution, and the event is re-queued for the next re-processing of the event.
[0072] Step S405, in the execution phase, obtain the execution result record of the batch instruction information, and determine whether the sum of the failure records and the success records is equal to the target number of nodes. If they are equal and there are no failure records, the status of the batch instruction information is changed to execution success; if they are equal and there are failure records, the status of the batch instruction information is changed to execution failure, and no other conditions are processed.
[0073] Step S406, in the execution success phase, the batch instruction information element is dequeued without any processing.
[0074] Step S407, in the execution failure phase, the batch instruction information element is dequeued without any processing.
[0075] This mechanism uses the k8s standard resource monitoring mode to ensure that batch instruction information trait changes can be processed promptly and reliably. At the same time, it utilizes the deduplication and asynchronous characteristics of the queue to avoid resource competition in high-concurrency scenarios, making the entire life cycle of operation and maintenance instructions traceable and manageable.
[0076] Step S202 : Based on the basic parameters and the target device group, batch instruction information is decomposed into instructions to obtain atomic instructions, where the atomic instructions carry the target device identifier.
[0077] Specifically, after receiving the batch instruction information Trait input by the user, the batch instruction information is disassembled according to the extracted basic parameters and target device group information. According to the logic of the operation and maintenance operation and the actual situation of the target device, the original batch instruction is divided into a series of minimum executable atomic instructions for a single target device. Each atomic instruction carries the corresponding target device identifier so that the instruction can be accurately sent to the specific device for execution. Atomic instructions can also be named Command elements.
[0078] Step S203: Create an initial command queue; wherein each cluster device corresponds to the first index value of the initial command queue.
[0079] Specifically, an initial command queue is created. This queue is used to store atomic commands in an orderly manner. Based on specific rules, each cluster device is associated with the first index value of the initial command queue. The command queue can also be called a command queue. A command queue can correspond to one or more cluster devices.
[0080] Step S204, calculating a second index value based on the routing policy and the target device identifier; in the initial instruction queue, based on the first index value, retrieving a target instruction queue that matches the second index value, and distributing the atomic instruction to the target instruction queue.
[0081] Specifically, based on the user-defined routing strategy and the target device identifier carried by the atomic instruction, a second index value for locating the target instruction queue is calculated. Among them, the routing strategy refers to a set of rules used to determine how atomic instructions are accurately distributed from the instruction queue to the target device in cluster operation and maintenance. Its core is to group and match devices through preset conditions. For example, in a server cluster with multiple computer rooms, users can customize the routing strategy based on the geographical location of the device, set the servers in computer room A as one group, and the servers in computer room B as another group. After the subsequent instructions are disassembled, the atomic instructions carrying the identification of computer room A will be distributed to the instruction queue corresponding to computer room A according to the strategy, while the instructions with the identification of computer room B will be distributed to the queue of computer room B. Subsequently, in the initial instruction queue that has been created, the target instruction queue that matches the second index value is retrieved from the first index value, and the atomic instruction is accurately distributed to the queue. This process realizes intelligent routing of instructions through index value matching, ensures that instructions of devices with the same characteristics are processed centrally, optimizes queue resource allocation and instruction execution efficiency, and avoids uneven cluster load caused by disordered distribution. Here, the index value can also be named key value.
[0082] Step S205 : generating a target configuration item based on the atomic instruction in the target instruction queue, and sending the target configuration item to the target device; the target device executes the atomic instruction based on the target configuration item.
[0083] The processor command execution module is deployed on the target device. This module primarily relies on two configuration files on the target device: the configuration item list and the node configuration status list. Configuration items correspond to command types one by one. Each element in the configuration item list contains the configuration item name, value, and version number. The node configuration status list records the actual status of configuration items on the node, primarily including the configuration item name, value, version number, and execution result.
[0084] Specifically, after the atomic instruction is distributed to the target instruction queue, the consuming worker process in the target queue generates corresponding target configuration items based on the atomic instruction in the queue. These configuration items contain the complete parameter information required for the target device to execute the instruction. The target configuration items are then sent to the configuration list of the corresponding target device. After receiving the configuration items, the target device calls the local processor process to execute the atomic instruction according to the preset execution logic, realizing automated operation and maintenance of the device.
[0085] Through the above steps S201 to S205, the batch instruction information is decomposed and intelligently routed to the target device queue, and the target device executes the specific instructions, so that the master node can focus on policy formulation rather than specific execution, effectively reducing the pressure on the master node, improving the execution efficiency and resource utilization of large-scale cluster batch operation and maintenance, and combining with Trait lifecycle management to realize the full process tracking of instruction execution status, and realize the automated closed loop and final consistency of operation and maintenance instructions from issuance to execution.
[0086] In some embodiments, the batch instruction information Trait further includes an instruction merging strategy; generating a target configuration item based on the atomic instruction in the target instruction queue includes the following steps:
[0087] Based on the instruction merging strategy, the atomic instructions in the target instruction queue are compressed to generate target configuration items.
[0088] Specifically, when adding elements to the instruction queue, atomic instructions are compressed and optimized. If the queue is empty, the atomic instruction is directly enqueued; otherwise, based on the instruction merging strategy in the batch instruction information trait (such as overwrite, accumulation, or prohibition of merging), the atomic instructions in the target instruction queue are compressed.
[0089] Through the above steps, the atomic instructions in the target instruction queue are compressed using instruction merging strategies (overwrite, accumulation, and prohibition of merging), and redundant instructions are automatically identified and skipped to reduce invalid execution. By eliminating duplicate instructions, the processing load and resource consumption of cluster devices are reduced, the efficiency of instruction execution is improved, and the efficiency of cluster operation and maintenance is guaranteed.
[0090] In some embodiments, the atomic instruction further includes an instruction category; and based on the instruction merging strategy, compressing the atomic instructions in the target instruction queue to generate a target configuration item includes the following steps:
[0091] Sequentially traverse the atomic instructions stored in the target instruction queue;
[0092] Check whether there is a target atomic instruction in the target instruction queue that has the same instruction category and target device identifier as the traversed current atomic instruction among the atomic instructions queued before the current atomic instruction;
[0093] If so, if the instruction merging policy indicates instruction compression, setting the skip flag of the target atomic instruction to an enabled state until the atomic queue in the target instruction queue is traversed;
[0094] The skip flag of each atomic instruction in the target instruction queue is detected, and the target configuration item is generated based on the atomic instruction with the skip flag in a non-enabled state.
[0095] Specifically, the atomic instructions in the target instruction queue are sequentially traversed. For each atomic instruction, the queue checks whether there is a target atomic instruction with the same instruction category and target device identifier among the instructions that were enqueued before it. If a matching target atomic instruction exists and the instruction merging strategy allows compression (such as an overwrite or accumulation strategy), the skip flag of the target atomic instruction is enabled (skip=true), causing it to be skipped during execution. The parent instruction identifier of the target atomic instruction is then added to the newly enqueued atomic instruction, continuing until the entire queue is traversed. The parent instruction identifier refers to the identifier of the instruction batch information trait to which the atomic instruction belongs. Finally, all instructions with the skip flag enabled are filtered out, and target configuration items are generated only based on atomic instructions with the skip flag disabled. This can be understood as consuming Command elements in the Command queue, with each queue being consumed cyclically by the consumer thread started upon creation. If the skip attribute of the Command element is true, the instruction is skipped. Otherwise, the parameters in the Command instruction are parsed and the instruction is flushed to the configuration item list on the node to which the target device belongs. This process avoids repeated operations on the same device by forward merging redundant instructions, reduces the transmission and execution of invalid instructions, reduces cluster resource consumption, ensures that the target configuration items only contain necessary operations, and improves the efficiency and accuracy of operation and maintenance instruction execution.
[0096] Figure 5 This is a flowchart of atomic instruction compression according to an embodiment of the present application. Figure 5 As shown, the process includes the following steps:
[0097] Step S501, start the process; the start of the process marks the start of the atomic instruction processing process in the instruction queue.
[0098] Step S502 , matching the instruction queue to which the atomic instruction belongs; determining the target instruction queue to which the current atomic instruction should belong, and limiting the scope for subsequent operations.
[0099] Step S503: Determine whether the queue is empty; check whether the instruction queue has any elements. If it is empty, directly add the element to the queue; if not, continue with the subsequent steps.
[0100] Step S504: The pointer points to the head of the queue; the pointer is positioned at the head of the queue to prepare for traversing the queue elements in order.
[0101] Step S505: Determine whether there is a next element; check whether there are other queue elements after the current pointer position. If so, continue the process; if not, it means the traversal is complete and the process proceeds to add elements to the queue.
[0102] Step S506: Determine whether the instruction type and target device are consistent. Check whether the atomic instruction pointed to by the current pointer is the same as the instruction type and target device identifier of the previous element. If they are, proceed to determine whether there is an instruction compression strategy. If not, return to the step of determining whether the next element exists and continue traversal.
[0103] Step S507: Determine whether there is an instruction compression strategy. If the instruction category and target device identifier are the same, determine whether there is an instruction merging strategy (such as overwrite or accumulation strategy) that allows compression. If so, continue with the subsequent operations. If not, return to the step of determining whether there is the next element and continue traversal.
[0104] Step S508 , setting the skip flag of the old element to enabled; when there is an instruction compression strategy, setting the skip flag of the first matched target atomic instruction (old element) in the queue to enabled so that it is skipped during execution.
[0105] Step S509 , merging parent instruction identifiers; adding the parent instruction identifier of the target atomic instruction (old element) to the newly queued atomic instruction, and integrating relevant information.
[0106] Step S510, executing instruction compression; compressing instructions according to the instruction merging strategy to reduce redundant instructions.
[0107] Step S511, adding elements to the queue; when the queue is traversed or the queue is empty, adding the current atomic instruction to the target instruction queue.
[0108] Step S512, end; the process ends, and subsequently based on the queue after this processing, the instructions with the skip mark are filtered to generate the target configuration item.
[0109] Figure 6 Schematic diagram of the instruction merging strategy according to an embodiment of the present application. The figure shows three instruction queue element merging strategies:
[0110] Strategy 1: Coverage;
[0111] The diagram shows the enqueueing of elements in the "on" and "off" states. When a new element is enqueued, its value remains unchanged; it overwrites the existing element of the same type. For example, when an "off" element is enqueued, it replaces the previous element, maintaining its "off" state.
[0112] Strategy 2: Accumulation;
[0113] For example, in the diagram, elements are labeled with values like "1" and "2." When a new element is added to the queue, it is added to the values of all the instructions of the same type already in the queue. For example, when an element labeled "2" is added to the queue, it is added to the previous element of the same type labeled "1," bringing the value to "3."
[0114] Strategy 3: Prohibit mergers;
[0115] When a new element is added to the queue, it is not merged with any other elements in the queue. Each element in the queue maintains its original state and value without interfering with each other.
[0116] Through the above steps, the optimized processing of atomic instructions in the instruction queue is achieved. During the in-order traversal process, the instruction category and target device identifier are accurately compared. Combined with the instruction merging strategy, redundant instructions are effectively compressed, skip marks are set, and parent instruction identifiers are merged to avoid repeated execution of similar instructions on the same device. Finally, the target configuration items are generated based on the atomic instructions that are not skipped, which greatly reduces the transmission and execution of invalid instructions, reduces the unnecessary consumption of cluster resources, ensures that the configuration items only contain necessary operations, significantly improves the efficiency and accuracy of operation and maintenance instruction execution, and ensures the smoothness and stability of cluster operation and maintenance.
[0117] In some embodiments, in the initial instruction queue, based on the first index value, searching for a target instruction queue that matches the second index value, and dispatching the atomic instruction to the target instruction queue, further comprises the following steps:
[0118] In the case that retrieving the instruction queue matching the second index value fails, a new instruction queue is generated based on the second index value, and the atomic instruction is distributed to the new instruction queue.
[0119] Specifically, within the initial command queue, when searching for a target command queue that matches the second index value (the value used to locate the target command queue, calculated based on the routing policy and the target device identifier) based on the first index value (the index value of the initial command queue), if the search operation is unsuccessful (i.e., no existing command queue matching the second index value is found), a new command queue is created based on that second index value. Once the new queue is created, the atomic instructions are distributed to this newly generated command queue, ensuring that the atomic instructions are properly assigned to the corresponding queue according to the established routing policy and target device identifier.
[0120] It can be understood that when routing and distributing a newly added Command element, the queue identifier is first checked based on the calculated key value. If the corresponding queue exists and has not been recycled, the queue to which the Command element belongs is matched; otherwise, an empty queue is created, and the work thread is started to add the mapping relationship between the queue key value and the queue to the cache;
[0121] Figure 7 This is a flowchart of the instruction queue creation according to the embodiment of the present application, such as Figure 7 As shown, the process includes the following steps:
[0122] Step S701, start the process; the starting point of the process marks the start of the entire operation process.
[0123] Step S702 , executing a routing process for the newly added batch instruction information; executing a routing process for the newly added batch instruction information, calculating a related index value based on the routing strategy and target device identification information, and preparing for subsequent search or creation of an instruction queue.
[0124] Step S703 , determining whether the queue identifier exists; judging whether there is an instruction queue identifier that matches the calculated index value, thereby determining whether there is a corresponding existing instruction queue.
[0125] Step S704: Determine whether the queue is in a recycled state. If a queue identifier is present, further determine whether the queue is in a recycled state. If it is, the queue exists but is unavailable and needs to be reprocessed. If it is not, match the assigned instruction queue.
[0126] Step S705: Create an empty queue; if there is no corresponding queue identifier, or the queue is in a recycling state, create a new empty instruction queue.
[0127] Step S706, start the working thread; after the new queue is created, start the relevant working thread for subsequent processing and execution of the atomic instructions in the queue.
[0128] Step S707, adding the queue identifier to the cache; adding the identifier of the newly created queue to the cache facilitates subsequent rapid search and identification of the queue, and also facilitates management and maintenance of instruction queue related information.
[0129] Figure 8 This is a flowchart of the instruction queue destruction according to an embodiment of the present application. Figure 8 As shown, the process includes the following steps:
[0130] Step S801, start the process; the starting point of the process marks the start of the entire queue management process.
[0131] Step S802, performing queue health check in a regular loop; according to the set time period, the system automatically and repeatedly checks the health of the instruction queue to promptly detect any problems with the queue.
[0132] Step S803: Determine whether the queue is empty; check whether there is an atomic instruction in the instruction queue. If the queue has content, it means that the queue is in normal use; if the queue is empty, further determination of its vacancy is required.
[0133] Step S804 determines whether the idle time exceeds the maximum idle time. For queues that have been determined to be empty, the idle time is checked to see if it exceeds the preset maximum allowable idle time. This step is to distinguish between normal short-term idle queues and long-term idle queues for targeted processing.
[0134] Step S805: Queue destruction. When a queue's idle time exceeds the maximum idle time, the queue is deleted from the system, freeing up the resources it occupies (such as memory and storage). This operation optimizes system resource management, prevents inactive queues from occupying resources for a long time, and improves overall system efficiency.
[0135] Through the above steps, dynamic management and flexible adaptation of the command queue are achieved. When retrieval of the target command queue fails, a new queue can be generated based on the second index value and the atomic command can be distributed in a timely manner, avoiding the problem of command distribution failure due to queue matching failure. At the same time, this mechanism enables the system to flexibly create queues according to actual needs, enhancing the adaptability and scalability of command distribution, ensuring that atomic commands are always accurately queued according to routing strategies and target device identifiers, improving the reliability and efficiency of cluster operation and maintenance command distribution, and maintaining the stability and order of cluster operation and maintenance processes.
[0136] In some embodiments, the batch instruction information also includes an execution result status; after the target configuration item is sent to the target device, the following steps are also included:
[0137] Detecting the execution result of the target device; the execution result is obtained by the target device generating an executable instruction for the atomic instruction based on the target configuration item and executing the executable instruction;
[0138] In response to the detected execution result of the target device, the execution result status in the batch instruction information to which the atomic instruction belongs is updated.
[0139] Specifically, after the target configuration item is delivered to the target device's configuration item list, its execution status on the target device is checked. The target device's processor process loops through the following logic for each configuration item in the list: It compares the configuration item version with the device's actual configuration item version. If there are any inconsistencies, it executes the instruction program, updates the version number in the device's actual configuration item state to the configuration item version, and records the execution results. Once the system detects these execution results, it updates the execution result status in the batch instruction information (Trait) associated with the atomic instruction.
[0140] Through the above steps, we achieve precise monitoring of target device execution and dynamic updates of batch command information. After the target configuration items are issued, the system continuously monitors the device execution results. The target device executes commands and updates the status of only those with inconsistent versions, ensuring that the device configuration is consistent with the expected settings. Based on the detected execution results, the system updates the execution status of the batch command information in real time, enabling operations personnel to promptly understand the execution results of the commands and providing accurate information for subsequent decisions (such as troubleshooting and retrying operations). This ensures traceability, accuracy, and efficiency of the cluster operation and maintenance process, achieving a complete closed-loop management of operation and maintenance commands from issuance to feedback. Furthermore, by breaking down the complex execution scripts into individual target devices for execution, the system only needs to check whether the two configuration files are version-matched, reducing complexity. This can be considered asynchronous execution of cluster operation and maintenance commands, reducing the load on the master control node.
[0141] In some embodiments, the atomic instruction further includes a parent instruction identifier; the parent instruction identifier refers to an identifier of the batch instruction information to which the atomic instruction belongs; and in response to the detected execution result of the target device, updating the execution result status in the batch instruction information to which the atomic instruction belongs includes the following steps:
[0142] When it is detected that the version identifier in the target configuration item is consistent with the version identifier of the configuration item currently running on the target device, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution success or execution failure.
[0143] Specifically, when checking the execution result on the target device, the system compares the actual configuration item version of the instruction on the target device with the configuration item version in the configuration list. If the two are consistent, it means that the target device has successfully executed the atomic instruction and updated the configuration to the specified version. At this point, the system uses the parent instruction identifier in the atomic instruction (i.e., the identifier of the batch instruction information trait) to accurately locate the corresponding batch instruction information and update the execution result status to success or failure based on the actual execution result.
[0144] This mechanism ensures the accuracy of execution results through version comparison and uses parent-level identifiers to efficiently trace and update the status of batch instructions, allowing operation and maintenance personnel to grasp the effectiveness of instruction execution in real time and ensure the consistency and traceability of cluster configuration.
[0145] In some embodiments, in response to the detected execution result of the target device, updating the execution result status in the batch instruction information to which the atomic instruction belongs further includes the following steps:
[0146] When it is detected that the version identifier in the target configuration item is inconsistent with the version identifier of the configuration item currently running on the target device, and the waiting time period exceeds the preset time period threshold, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution failure; the waiting time period is the time period between the time point when the target configuration item is sent to the target device and the current time point.
[0147] Specifically, when detecting the execution result of the target device, the system will compare the configuration item version of the actual status of the instruction on the target device with the configuration item version in the configuration list. If the two are inconsistent, it means that the device has not successfully updated the configuration as required. At this time, if the waiting period from the issuance of the target configuration item to the current time point has exceeded the preset time period threshold, it means that the device has not completed the configuration update within a reasonable time, and execution problems are likely to occur. Based on this, the system locates the corresponding batch instruction information through the parent instruction identifier of the atomic instruction (the identifier of the batch instruction information Trait), and updates the execution result status to "execution failed".
[0148] Figure 9 is a flowchart of instruction processing according to an embodiment of the present application, such as Figure 9 As shown, the process includes the following steps:
[0149] Step S901, start the process; the starting point of the process marks the start of the instruction execution and result processing process.
[0150] Step S902: Check whether the instruction has a skip flag. If the instruction has a skip flag, skip the subsequent processing and end the process directly. If not, proceed to the next step. This step is used to identify instructions that do not need to be executed to avoid invalid operations.
[0151] Step S903, instruction parameter parsing: performing parameter parsing on instructions without skip marks to understand the specific requirements and configuration information of the instructions.
[0152] Step S904: Refresh the instruction to the configuration item list of the target device; update the parsed instruction to the configuration item list of the target device to ensure that the target device obtains the latest instruction information.
[0153] Step S905: Determine whether the version of the instruction status on the target device is consistent with the current instruction version. Compare the version of the instruction status on the target device with the current instruction version to determine if they are the same. If they are consistent, the instruction has been successfully issued or does not need to be executed again. If they are inconsistent, further waiting time is required.
[0154] Step S906: Determine whether the cycle time exceeds the maximum waiting time. If the instruction status version on the node is inconsistent with the current instruction version, check whether the cycle time from the instruction issuance to the current time exceeds the preset maximum waiting time. If it exceeds, it indicates that the instruction execution has failed. If not, continue to wait for the instruction execution to complete.
[0155] Step S907: Record the instruction result in the batch instruction information; record the result of execution success or execution failure in the batch instruction information.
[0156] Step S908 , notifying the parent instruction of successful execution; notifying the parent instruction of the instruction execution result (ie, the batch instruction information to which the atomic instruction belongs), indicating that the instruction has been processed.
[0157] Step S909, end the process.
[0158] This step uses version comparison and time threshold judgment to accurately identify execution anomalies and provide timely feedback on the execution result status, making it easier for operation and maintenance personnel to quickly discover and resolve problems, thereby ensuring the reliability and effectiveness of cluster operation and maintenance.
[0159] This embodiment also provides an operation and maintenance instruction execution device, which is used to implement the above-mentioned embodiments and preferred implementation methods. The details that have been described will not be repeated here. As used below, the terms "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and conceivable.
[0160] Figure 10 is a structural block diagram of a cluster operation and maintenance instruction execution device according to an embodiment of the present application, such as Figure 10As shown, the apparatus includes: an instruction receiving module 101, configured to receive batch instruction information generated according to a preset instruction metadata template; extracting parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, a target device group, and a routing policy; the target device group includes at least one target device in a cluster device; an instruction disassembly module 102, configured to disassemble the batch instruction information based on the basic parameters and the target device group to obtain atomic instructions, the atomic instructions carrying a target device identifier; an instruction queue management module 103, configured to create an initial instruction queue; wherein each cluster device corresponds to a first index value of the initial instruction queue; an instruction routing distribution module 104, configured to calculate a second index value based on the routing policy and the target device identifier; in the initial instruction queue, based on the first index value, retrieving a target instruction queue that matches the second index value and distributing the atomic instruction to the target instruction queue; a configuration generation module 105, configured to generate a target configuration item based on the atomic instruction in the target instruction queue, and distribute the target configuration item to the target device; the target device executes the atomic instruction based on the target configuration item.
[0161] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination. For specific examples in this embodiment, reference can be made to the examples described in the above embodiment and optional implementations, and will not be repeated in this embodiment.
[0162] The present application is described below with reference to specific embodiments. Figure 11 It is an overall schematic diagram of the system architecture of an embodiment of the present application. Figure 12 This is a structural block diagram of the system architecture, including:
[0163] The user operation and maintenance instruction module 121 is used to record the operation and maintenance instructions issued by users and cyclically update the execution status of the operation and maintenance instructions. This module mainly includes two types of resources: system instruction description resources (instruction metadata templates) TraitDef and user batch instruction information Trait. TraitDef: The operation and maintenance instruction categories supported by the system, defines the name, description, whether to enable the operation and maintenance instructions supported by the system, and the definition of the operation and maintenance instruction parameters. The definition of the operation and maintenance operation parameters mainly stipulates the parsing rules of the parameters of the operation and maintenance instructions. Trait: Records user operation and maintenance instructions and operation results, including the affiliated TraitDef, parameters, instruction merging strategy, retry strategy, routing strategy, and the list of devices expected to be executed. The core capabilities of this module include managing the life cycle of Trait. The life cycle of Trait includes: Initial (initialization stage), Checked (parameter checking stage), Distributed (instruction distribution stage), Invoking (execution stage), Success (successful execution stage), and Failed (failed execution stage). This module contains a resource monitoring queue based on k8s informer (a resource monitoring mode), which continuously monitors the changes of trait resources with the help of k8s list&watch (a query monitoring mechanism). For each resource change, a resource event is generated and added to the resource monitoring queue. The queue is continuously consumed by consumers, and consumers adopt different disposal measures for different life cycle stages of batch instruction information traits.
[0164] The instruction batch processing module 122 is a device for diffusing, converting, and compressing user operation and maintenance instructions. The core resource of this module is the command (atomic instruction), which is converted from traits. The relationship between traits and commands is one-to-many. This module includes two types of queue structures: an instruction router, and an execution consumption unit. The batch instruction information trait receiving queue receives trait instructions from the user operation and maintenance instruction module and is used to distribute trait instructions. The instruction router caches the mapping between queue index values and instruction queues. It is responsible for continuously consuming elements from the trait receiving queue, diffusing and converting them into atomic instructions with different target device addresses. It calculates the instruction queue index value that different atomic instructions should be added to based on the routing strategy, searches the cache for the instruction queue with that index value, and adds the atomic instruction to that queue. This module is also responsible for managing the creation and destruction of instruction queues. The instruction queue: This queue stores atomic instructions converted from batch instruction information traits. When an atomic instruction is added to the queue, each atomic instruction can execute a different instruction compression strategy based on the description of the instruction in the trait to which it belongs. Elements in the queue are consumed by the worker execution consumer unit. The creation and destruction of the queue is managed by the instruction router. The Worker Execution Consumer Unit: This module primarily loops through the atomic instructions in the instruction queue. Each atomic instruction contains a parent trait, instruction parameters, instruction type, whether to skip execution, and the target device. Based on the target device and instruction content defined in the atomic instruction, the worker updates the configuration item list on the specified target device node. The instruction type is equal to the name of the TraitDef recorded in the assigned trait.
[0165] The instruction execution module 123 is deployed on the node that needs to execute the command. This module mainly relies on two configuration files on the node: the configuration item list and the node configuration real status list. The configuration items correspond one-to-one to the instruction type of the atomic instruction. Each element in the configuration item list contains the configuration item name, configuration item value and version number. The node configuration real status list records the real status of the configuration items on the node, mainly including: configuration item name, configuration item value, version number, and execution result. The node performs the following operations in a loop based on the above two files: compare the version numbers of the same configuration items in the two files, execute the instruction function program for configuration items with inconsistent version numbers, and refresh the execution results and the version numbers of the configuration items to the node configuration real status list.
[0166] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0167] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0168] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0169] S1, receiving batch instruction information generated according to a preset instruction metadata template; extracting parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device groups and routing policies; the target device group includes at least one target device in the cluster device.
[0170] S2: Based on the basic parameters and the target device group, the batch instruction information is decomposed into instructions to obtain atomic instructions, where the atomic instructions carry the target device identifier.
[0171] S3: Create an initial command queue; wherein each cluster device corresponds to a first index value of the initial command queue.
[0172] S4, calculating a second index value based on the routing policy and the target device identifier; retrieving a target instruction queue matching the second index value in the initial instruction queue based on the first index value, and distributing the atomic instruction to the target instruction queue.
[0173] S5, generating a target configuration item based on the atomic instruction in the target instruction queue, and sending the target configuration item to the target device; the target device executes the atomic instruction based on the target configuration item.
[0174] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be repeated here.
[0175] In addition, in combination with the operation and maintenance instruction execution method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by the processor, it implements any of the operation and maintenance instruction execution methods in the above embodiment. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0176] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.
[0177] Those skilled in the art should understand that the various technical features of the above-described embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the various technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0178] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A cluster operation and maintenance instruction execution method, characterized in that: The method comprises: Receiving batch instruction information generated according to a preset instruction metadata template; extracting parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, a target device group, and a routing policy; the target device group includes at least one target device in the cluster device; Based on the basic parameters and the target device group, the batch instruction information is decomposed into an atomic instruction, where the atomic instruction carries a target device identifier; Creating an initial command queue; wherein each of the cluster devices corresponds to a first index value of the initial command queue; Calculating a second index value based on the routing policy and the target device identifier; retrieving a target instruction queue matching the second index value in the initial instruction queue based on the first index value, and distributing the atomic instruction to the target instruction queue; A target configuration item is generated based on the atomic instruction in the target instruction queue, and the target configuration item is sent to the target device; the target device executes the atomic instruction based on the target configuration item.
2. The cluster operation and maintenance instruction execution method according to claim 1, characterized in that: The batch instruction information also includes an instruction merging strategy; and generating a target configuration item based on the atomic instruction in the target instruction queue includes: Based on the instruction merging strategy, the atomic instructions in the target instruction queue are compressed to generate target configuration items.
3. The cluster operation and maintenance instruction execution method according to claim 2, characterized in that: The atomic instructions also include instruction categories; and based on the instruction merging strategy, compressing the atomic instructions in the target instruction queue to generate target configuration items includes: Sequentially traverse the atomic instructions stored in the target instruction queue; Detecting whether there is a target atomic instruction in the target instruction queue that has the same instruction category and target device identifier as the traversed current atomic instruction among the atomic instructions queued before the current atomic instruction; If so, if the instruction merging strategy indicates instruction compression, setting the skip flag of the target atomic instruction to an enabled state until the atomic queue in the target instruction queue is completely traversed; The skip flag of each of the atomic instructions in the target instruction queue is detected, and the target configuration item is generated based on the atomic instructions whose skip flags are in a non-enabled state.
4. The cluster operation and maintenance instruction execution method according to claim 1, characterized in that: The step of retrieving a target instruction queue matching the second index value in the initial instruction queue based on the first index value, and distributing the atomic instruction to the target instruction queue includes: In the case that retrieving the instruction queue matching the second index value fails, a new instruction queue is generated based on the second index value, and the atomic instruction is distributed to the new instruction queue.
5. The cluster operation and maintenance instruction execution method according to claim 1, characterized in that: The batch instruction information also includes an execution result status; after the target configuration item is sent to the target device, the method further includes: detecting an execution result of the target device; the execution result is obtained by the target device generating an executable instruction for the atomic instruction based on the target configuration item and executing the executable instruction; In response to the detected execution result of the target device, the execution result status in the batch instruction information to which the atomic instruction belongs is updated.
6. The cluster operation and maintenance instruction execution method according to claim 5, characterized in that: The atomic instruction also includes a parent instruction identifier; the parent instruction identifier refers to the identifier of the batch instruction information to which the atomic instruction belongs; The updating of the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device includes: When it is detected that the version identifier in the target configuration item is consistent with the version identifier of the configuration item currently running on the target device, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution success or execution failure.
7. The cluster operation and maintenance instruction execution method according to claim 6, characterized in that: The updating of the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device further includes: When it is detected that the version identifier in the target configuration item is inconsistent with the version identifier of the configuration item currently running on the target device, and the waiting time period exceeds the preset time period threshold, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution failure; the waiting time period is the time period between the time point when the target configuration item is sent to the target device and the current time point.
8. A cluster operation and maintenance instruction execution device, characterized in that: The device comprises: An instruction receiving module is configured to receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, a target device group, and a routing policy; the target device group includes at least one target device in the cluster device; An instruction disassembly module is used to disassemble the batch instruction information based on the basic parameters and the target device group to obtain atomic instructions, where the atomic instructions carry a target device identifier; An instruction queue management module is configured to create an initial instruction queue, wherein each of the cluster devices corresponds to a first index value of the initial instruction queue; an instruction routing distribution module, configured to calculate a second index value based on the routing policy and the target device identifier; retrieve a target instruction queue matching the second index value in the initial instruction queue based on the first index value, and distribute the atomic instruction to the target instruction queue; A configuration generation module is used to generate a target configuration item based on the atomic instruction in the target instruction queue, and send the target configuration item to the target device; the target device executes the atomic instruction based on the target configuration item.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the cluster operation and maintenance instruction execution method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the cluster operation and maintenance instruction execution method according to any one of claims 1 to 7 when running.
Citation Information
Patent Citations
Method for providing application construction service and application construction platform
CN111984269A
Substation auxiliary equipment control system and method and electronic equipment
CN116068936A
Universal building automation and dynamic environment monitoring system batch control algorithm
CN116430744A
Cloud native host command control method and system, electronic equipment and storage medium
CN117519833A
Centralized storage command line management method and device and readable storage medium
CN119718587A