Batch operation execution method and apparatus, readable medium, and electronic device

By receiving batch operation execution commands from the client, using the pre-configured black and white lists to obtain the target host from the database, sending commands and feeding back the results, the problem of low efficiency of operation and maintenance tools in the existing technology is solved, and efficient batch operation execution and result tracing are achieved.

CN112579165BActive Publication Date: 2025-10-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011457904.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-10
Publication Date
2025-10-21
Estimated Expiration
2041-01-09

AI Technical Summary

Technical Problem

Existing operation and maintenance tools are inefficient in executing batch operations and the execution results cannot be traced, resulting in inefficient resource management.

Method used

By receiving batch operation execution commands from the client, using pre-configured black and white lists to obtain target hosts from the database, sending commands and feeding back results, it supports high-risk command detection and progress display.

Benefits of technology

It improves resource management efficiency, avoids repeated manual operations, and realizes efficient batch operation execution and result traceability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112579165B_ABST
    Figure CN112579165B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a batch operation execution method, device, readable medium and electronic equipment. The batch operation execution method comprises: receiving a batch operation execution command sent by a client; obtaining, according to the batch operation execution command, a plurality of target hosts corresponding to the batch operation execution command from a pre-configured black and white list, the black and white list being read out from a database by the client through a configuration execution command line script, and the black and white list containing host information requiring batch operation execution; sending the batch operation execution command to each target host, so that each target host executes the batch operation execution command; and receiving a result of executing the batch operation execution command fed back by each target host. The technical solution of the embodiments of the present application can greatly improve the efficiency of resource management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer and communication technology, and in particular to a batch operation execution method, device, readable medium and electronic device. Background Art

[0002] In various information technology-related work, the scenario of batch execution of command lines is very common, especially in operation and maintenance-related work, where operation and maintenance personnel often need to operate hundreds or thousands of machine nodes, data tables or other resource objects.

[0003] To quickly complete tasks, operations and maintenance tools such as Ansible, Xshell, and MobaXterm are often used. Ansible is open-source command-line execution software that supports batch commands and playbooks. Xshell and MobaXterm are batch command execution software for user interfaces. However, these tools still suffer from drawbacks such as low efficiency and the inability to trace execution results. Summary of the Invention

[0004] The embodiments of the present application provide a batch operation execution method, apparatus, readable medium, and electronic device, which can greatly improve the efficiency of resource management, at least to a certain extent.

[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by practice of the present application.

[0006] According to one aspect of an embodiment of the present application, a batch operation execution method is provided, including: receiving a batch operation execution command sent by a client; obtaining multiple target hosts corresponding to the batch operation execution command from a pre-configured black and white list according to the batch operation execution command, the black and white list being read from a database by the client through configuration to execute a command line script, and the black and white list containing host information requiring batch operation execution; sending the batch operation execution command to each target host so that each target host executes the batch operation execution command; and receiving feedback from each target host on the results of executing the batch operation execution command.

[0007] According to one aspect of an embodiment of the present application, a batch operation execution device is provided, including: a first receiving unit, configured to receive a batch operation execution command sent by a client; an acquisition unit, configured to obtain, according to the batch operation execution command, multiple target hosts corresponding to the batch operation execution command from a pre-configured black and white list, wherein the black and white list is read from a database by the client through configuration to execute a command line script, and the black and white list contains host information that requires batch operation execution; a sending unit, configured to send the batch operation execution command to each target host, so that each target host executes the batch operation execution command; and a second receiving unit, configured to receive feedback from each target host on the result of executing the batch operation execution command.

[0008] In some embodiments of the present application, based on the aforementioned scheme, the sending unit is configured as follows: if the batch operation execution command contains a first parameter for indicating connection to a jump server, then the jump server is connected according to the first parameter and the batch operation execution command is sent to the jump server, so that the jump server sends the batch operation execution command to each target host; if the batch operation execution command does not contain the first parameter, then the batch operation execution command is sent directly to each target host.

[0009] In some embodiments of the present application, based on the aforementioned scheme, the host information stored in the database is obtained by at least one of the following methods: obtained by parsing configuration commands; obtained by parsing imported files, which contain host information that needs to be managed; according to specified field information, screening and obtaining host information that matches the specified field information from other databases.

[0010] In some embodiments of the present application, based on the aforementioned scheme, the device also includes: a detection unit, configured to detect the batch operation execution command to determine whether the batch operation execution command is a high-risk command; an alarm unit, configured to issue an alarm prompt if the batch operation execution command is a high-risk command, and the alarm prompt is used to prompt whether to send the batch operation execution command to each target host.

[0011] In some embodiments of the present application, based on the aforementioned scheme, the device also includes: a first display unit, configured to display the execution progress of the batch operation execution command on each target host according to the second parameter if the batch operation execution command contains a second parameter for indicating the execution progress of the batch operation execution command on each target host; and a non-display unit, configured to not display the execution progress of the batch operation execution command on each target host if the batch operation execution command does not contain the second parameter.

[0012] In some embodiments of the present application, based on the aforementioned scheme, before the sending unit is configured to send the batch operation execution command to each target host, the device also includes: a login unit, configured to log in to each target host through an account and password login method or a key login method.

[0013] In some embodiments of the present application, based on the aforementioned scheme, the device also includes: a third receiving unit, configured to receive a job command sent by the client; a second display unit, configured to display a batch operation execution list according to the job command, wherein the batch operation execution list records historical batch operations and operation results corresponding to the historical batch operations.

[0014] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the batch operation execution method as described in the above embodiment is implemented.

[0015] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the batch operation execution method described in the above embodiments.

[0016] According to one aspect of an embodiment of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the batch operation execution method provided in the various optional embodiments described above.

[0017] In the technical solutions provided by some embodiments of the present application, a batch operation execution command sent by a client is received, and then multiple target hosts corresponding to the batch operation execution command are obtained from a pre-configured black and white list. The black and white list is read from a database by the client through the configuration execution command line script. The black and white list contains the host information that needs to be executed in batch operation. After obtaining multiple target hosts, a batch operation execution command can be sent to each target host to enable each target host to execute the batch operation execution command and feedback the execution result. The technical solution of the embodiment of the present application can read the pre-configured black and white list from the database by the client, and then quickly determine the multiple target hosts for batch operation execution based on the black and white list, and then execute the batch operation on multiple target hosts. Compared with repeating the execution of commands on each host separately, the technical solution of the embodiment of the present application greatly improves the efficiency of resource management and avoids manual repetitive operations.

[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings are incorporated into and constitute a part of the specification, illustrating embodiments consistent with the present application and, together with the specification, explaining the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can derive other drawings based on these drawings without inventive effort. In the drawings:

[0020] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solutions of the embodiments of the present application can be applied;

[0021] Figure 2 The following schematically shows a flow chart of a method for executing batch operations according to an embodiment of the present application;

[0022] Figure 3 The following schematically illustrates a flow chart of detecting batch operation execution commands according to an embodiment of the present application;

[0023] Figure 4 The following schematically shows a flow chart of displaying a batch operation execution list according to an embodiment of the present application;

[0024] Figure 5 The following schematically shows a logic implementation diagram of a batch operation execution method according to an embodiment of the present application;

[0025] Figure 6The following schematically shows a logical implementation diagram of a batch operation execution method on an execution device side according to an embodiment of the present application;

[0026] Figure 7 The following schematically shows a logical implementation diagram of a batch operation execution method on the client side according to an embodiment of the present application;

[0027] Figure 8 The following schematically shows a flow chart of a method for executing batch operations according to an embodiment of the present application;

[0028] Figure 9 A block diagram schematically shows a batch operation execution device according to an embodiment of the present application;

[0029] Figure 10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.

[0031] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner.In the following description, many specific details are provided so as to provide a full understanding of the embodiments of the present application. However, it will be appreciated by those skilled in the art that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps etc. can be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0032] It should be noted that the terms used in the specification and claims of this application and the above-mentioned drawings are only used to describe the embodiments and are not intended to limit the scope of this application. It should be understood that the terms "comprise", "include", "have", etc., when used in this document, specify the presence of the stated features, wholes, steps, operations, elements, components and / or groups thereof, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof.

[0033] It will be further understood that, although the terms "first," "second," "third," etc., may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of the present invention, a first element may be referred to as a second element. Similarly, a second element may be referred to as a first element. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0035] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.

[0036] It should be noted that the term "plurality" used in this document refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. The character " / " generally indicates an "or" relationship between the associated objects.

[0037] Figure 1 A schematic diagram shows an exemplary system architecture to which the technical solutions of the embodiments of the present application can be applied.

[0038] like Figure 1 As shown, the system architecture 100 may include a client 101 , an execution device 102 and a host 103 .

[0039] In this embodiment, the client 101 may include but is not limited to: terminal devices such as smart phones, tablet computers, laptop computers, and desktop computers, or APPs (applications) with communication functions running in the terminal devices.

[0040] Execution device 102 is configured to forward received batch operation execution commands sent by client 101 to the corresponding host 103. Execution device 102 has data storage and transmission capabilities, possesses an independent database, and can independently store host information. It can also receive batch operation execution commands from client 101 and forward them. Execution device 102 can be a computing device, such as a server or terminal device, and can execute the batch operation execution method provided in any of the examples of this application.

[0041] Here, since the client 101 and the execution device 102 are physically located in different local area networks, the two cannot communicate directly through traditional communication links. In the present application example, the communication connection between the client 101 and the execution device 102 can be a virtual private network (VPN) connection. Among them, VPN technology refers to establishing a private network on a public network for encrypted communication. VPN technology is a technology for building a virtual local area network basic connection. That is to say, in the present application example, a point-to-point two-way communication connection can be established between the local area network to which the client 101 belongs and the local area network to which the execution device 102 belongs through VPN technology, so that the client 101 and the execution device 102 are logically in the same virtual local area network.

[0042] The host 103 is configured to execute the batch operation execution command input from the client 101 and transmit the result of executing the batch operation execution command back to the execution device 102 .

[0043] In one embodiment of the present application, the client 101 can send a batch operation execution command to the execution device 102. After receiving the batch operation execution command, the execution device 102 can obtain multiple target hosts 103 corresponding to the batch operation execution from a pre-configured black and white list according to the batch operation execution command, and then send the batch operation execution command to each target host 103. After receiving the batch operation execution command, each target host 103 can execute the batch operation execution command and return the result of executing the batch operation execution command to the execution device 102.

[0044] In one embodiment of the present application, the system architecture 100 may further include a jump server 104, wherein the jump server 104 can receive the batch operation execution command sent by the execution device 102 from the client 101, and then forward the batch operation execution command to each target host 103. In this embodiment, the execution device 102 can determine whether to send the batch operation execution command to the jump server 104 based on whether the batch operation execution command contains a first parameter for indicating connection to the jump server 104. If the batch operation execution command contains the first parameter, the execution device 102 can send the batch operation execution command to the jump server 104, and then the jump server 104 sends the batch operation execution command to each target host 103; if the batch operation execution command does not contain the first parameter, the execution device 102 can directly send the batch operation execution command to each target host 103.

[0045] It should be understood that Figure 1 The number of clients, execution devices, hosts, and jump servers in the embodiment is merely illustrative. Any number of clients, execution devices, hosts, and jump servers may be provided as needed. For example, a jump server may be a server cluster consisting of multiple servers.

[0046] The following is a detailed description of the implementation details of the technical solution of the embodiment of the present application:

[0047] Figure 2 A flow chart of a method for executing batch operations according to an embodiment of the present application is shown. The method for executing batch operations can be executed by an execution device, which can be Figure 1 The execution device 102 shown in FIG. Figure 2 As shown, the method includes:

[0048] Step S210: receiving a batch operation execution command sent by the client;

[0049] Step S220: According to the batch operation execution command, a plurality of target hosts corresponding to the batch operation execution command are obtained from a pre-configured blacklist and whitelist, wherein the blacklist and whitelist are read from a database by the client through a configuration and execution command line script, and the blacklist and whitelist contain information of hosts requiring batch operation execution;

[0050] Step S230: Send the batch operation execution command to each target host, so that each target host executes the batch operation execution command;

[0051] Step S240: Receive feedback from each target host regarding the results of executing the batch operation execution command.

[0052] These steps are described in detail below.

[0053] In step S210, a batch operation execution command sent by the client is received.

[0054] The batch operation execution method of this embodiment can execute commands in batches on thousands of hosts based on the batch operation execution commands of the client, thus meeting user needs.

[0055] In one embodiment, the batch operation execution command includes but is not limited to any one or more of the following: a host information query command, a host control command, an application information query command, an application control command, a deployment information query command, and a deployment control command.

[0056] Specifically, host control commands include any one or more of the following: host initialization commands, host software installation commands, and batch information processing commands. Host information query commands are used to query all host information, including but not limited to: host IP (Internet Protocol, a protocol for interconnection between networks), host configuration, and host type. Application information query commands include any one or more of the following: application log query commands and application configuration query commands; application control commands include any one or more of the following: application rollback commands, application restart commands, and application monitoring commands. Deployment information query commands include but are not limited to any one or more of the following: application configuration query commands, deployment history query commands, and domain name query commands; deployment control commands can be application deployment application commands.

[0057] In actual applications, users can directly enter batch execution commands on the client, which then sends the commands to the execution device. Of course, in other implementations, the received batch execution commands can also be obtained by parsing a custom script on the client. The client can then send the resulting batch execution commands to the execution device, or it can send the custom script to the execution device, which then parses the custom script to obtain the batch execution commands. The custom script can be in TXT text format, containing command lines. It can be written based on actual batch execution requirements and custom keyword use cases to implement batch execution on different hosts.

[0058] In one possible implementation, considering practicality, the batch operation execution command can be written based on the extension of the grammatical rules of the Jinja2 template engine. Accordingly, the received batch operation execution command satisfies the grammatical rules of the Jinja2 template engine. The Jinja2 template engine is a prior art and will not be further described here.

[0059] In one possible implementation, the custom script includes a batch operation execution command, which includes a batch operation execution command start character (such as "&") and a custom keyword. A separator is set at the end of the batch operation execution command (such as the separator is ";") and an end character is set at the end of the custom script (such as the end character is "&end").

[0060] When a command line includes a batch execution command start character, the system checks whether the characters following the batch execution command start character are custom keywords. If not, the system determines that the command line is incorrect and terminates parsing, for example, by automatically exiting the program and notifying the user of a syntax error. Parsing ends when the parsed content reaches the end character. By specifying delimiters and end characters, you can parse custom scripts line by line, using the delimiters as markers. Parsing ends when the parsed content reaches the end character.

[0061] In step S220, according to the batch operation execution command, multiple target hosts corresponding to the batch operation execution command are obtained from a pre-configured black and white list, and the black and white list is read from the database by the client through the configuration execution command line script, and the black and white list contains the host information that requires batch operation execution.

[0062] It should be noted that the execution device as the execution subject has data storage and transmission capabilities. It has an independent database and can independently store host information. The host information includes but is not limited to the host IP, host configuration, host type, host MAC (Media Access Control Address), host SN (Serial Number), host brand, host model, etc.

[0063] In one embodiment, the host information stored in the database is obtained by the executing device through at least one of the following methods: obtained by parsing a configuration command; obtained by parsing an imported file, wherein the file contains host information that needs to be managed; based on specified field information, filtering and obtaining host information that matches the specified field information from other databases.

[0064] Specifically, the execution device can obtain host information directly by parsing configuration commands, or by parsing imported files. Before importing the file into the execution device, the host information to be managed can be written into the file. In addition to the above two methods, in this embodiment, host information can also be obtained by filtering from other databases. Specifically, the other database can be a CMDB (Configuration Management Database). The CMDB is a database used to store and manage various configuration information of devices in the enterprise IT architecture. It is closely linked to all service support and service delivery processes, supports the operation of these processes, maximizes the value of configuration information, and relies on related processes to ensure data accuracy. Among them, the designated field information can be field information determined according to actual needs. For example, the designated field information can include host IP information, product line information, product information, environment information, module information, etc.

[0065] It is understandable that the database does not distinguish when obtaining host information, but can obtain and store it in multiple ways. After receiving the batch operation execution command, the execution device must judge each stored host information to determine the host information that needs to perform the batch operation. This is not only inefficient but also prone to errors.

[0066] To this end, this embodiment utilizes a preconfigured blacklist and whitelist approach, allowing the execution device to quickly obtain multiple target hosts corresponding to a batch operation execution command based on the preconfigured blacklist and whitelist. Specifically, the blacklist and whitelist may include information about hosts requiring batch operation execution and information about hosts not requiring batch operation execution. In some embodiments, the execution device may directly use the hosts requiring batch operation execution included in the blacklist and whitelist as the multiple target hosts corresponding to the batch operation execution command. For example, if the hosts requiring batch operation execution in the blacklist and whitelist include host A, host B, and host C, then host A, host B, and host C may all be selected as target hosts. In other embodiments, the execution device may also select multiple hosts from the hosts requiring batch operation execution included in the blacklist and whitelist as the multiple target hosts corresponding to the batch operation execution command. The selection method may be based on the actual required field information from the hosts requiring batch operation execution. For example, if the hosts requiring batch operation execution in the blacklist and whitelist include host A, host B, and host C, then the execution device may select host A and host B as target hosts. Compared to determining host information one by one, this embodiment uses the preconfigured blacklist and whitelist to quickly obtain target hosts, thereby improving the efficiency of batch operation execution.

[0067] In some embodiments, the execution device may further determine multiple target hosts based on host information that requires batch operation execution and host information that does not require batch operation execution. For example, the execution device may filter out host information that does not require batch operation execution from host information in a database, and then use the filtered host information as multiple target hosts. In other embodiments, the execution device may first filter out host information that does not require batch operation execution from host information in a database, and then further confirm host information in the filtered host information that is not host information that requires batch operation execution in a blacklist or whitelist to confirm whether it is host information that requires batch operation execution, and obtain multiple host information based on the result of the further confirmation and the host information of the host information that requires batch operation execution in a blacklist or whitelist. The further confirmation may be carried out by sending a confirmation request message to the client, and the client confirms according to actual needs.

[0068] For example, assuming that the database of the execution device stores host information including host A, host B, host C, host D, and host E, and the host information in the black and white lists that require batch operation execution includes host A and host B, and the host information that does not require batch operation execution includes host D, then host D can be filtered out first, and the filtered host information includes host A, host B, host C, and host E. Then, host C and host E are further confirmed. Assuming that the result of the confirmation is that host C requires batch operation execution, and host E does not need batch operation execution, the multiple host information that can be obtained in the end are host A, host B, and host C.

[0069] In this embodiment, multiple target hosts are obtained by combining the host information of the blacklist and whitelist that requires batch operations and the host information that does not require batch operations, that is, combining the whitelist and blacklist to obtain multiple target hosts. Compared with the method of only using the whitelist or only using the blacklist, the advantage is that, since it is impossible to take into account all hosts that require batch operations when setting the whitelist, if only the whitelist is considered, then assuming that host A is a host that requires batch operations, but host A is not considered when setting the whitelist and is not set to the whitelist, then the execution device will not use it as the target host; similarly, if only the blacklist is set, it is possible that host B is a host that does not require batch operations, but host B is not considered when setting the blacklist and is not set to the blacklist, then the execution device will use it as the target host. This embodiment takes into account the unset host information and configures the blacklist and whitelist, which has higher accuracy and greater flexibility in determining the target host.

[0070] It should also be noted that the execution device has no access to the black and white lists. The black and white lists can only be read from the database by the client through the configuration and execution of the command line script. The client can send batch operation execution commands to the execution device and send the black and white lists read from the database to the execution device at the same time, so that the execution device can obtain multiple target hosts corresponding to the batch operation execution commands from the black and white lists.

[0071] In step S230, the batch operation execution command is sent to each target host, so that each target host executes the batch operation execution command.

[0072] After obtaining multiple target hosts, a batch operation execution command may be sent to each target host. After receiving the batch operation execution command, each target host begins to execute the batch operation execution command.

[0073] In one embodiment of the present application, before sending batch operation execution commands to each target host, the execution device needs to log in to each target host to obtain management rights for each target host. The login method can be account password login method or key login method.

[0074] In fact, the execution device does not necessarily have management authority over the target host. In this case, the batch operation execution command can instruct the execution device to connect to the jump server, and then the jump server sends the batch operation execution command to each target host.

[0075] In one embodiment of the present application, a first parameter can be set in the batch operation execution command to indicate whether the execution device needs to connect to the jump server. Specifically, if the batch operation execution command includes the first parameter for indicating connection to the jump server, that is, the execution device does not have management authority over each target host, then the execution device can first connect to the jump server and send the batch operation execution command to the jump server, and then the jump server can send the batch operation execution command to each target host. Conversely, if the batch operation execution command does not include the first parameter, it means that the execution device has management authority over each target host, and then the execution device can directly send the batch operation execution command to each target host after logging into each target host.

[0076] In this embodiment, taking into account the problem that the execution device does not have the login permission to log in to the target host, therefore, in the process of implementing the interaction between the execution device and each target host, the batch operation execution command is forwarded to the jump server in the form of the indication of the first parameter, and then the jump server forwards the batch execution command, which solves the problem that the execution device does not have the permission to connect to the target host and thus cannot send the batch operation execution command, thereby further ensuring that the batch execution operation can be executed.

[0077] In step S240, the results of executing the batch operation execution command fed back by each target host are received.

[0078] Specifically, after executing the batch operation execution command, each target host can feedback the results of executing the batch operation execution command to the execution device. For example, if the batch operation execution command is a host information query command, each target host can feedback the host information of each target host to the execution device, including but not limited to: host IP (Internet Protocol, a protocol for interconnecting networks), host configuration, and host type.

[0079] In one embodiment, after receiving the feedback of the execution result of the batch operation execution command, the execution device can store the execution result in a database, or directly and synchronously feed back the execution result to the client so that relevant personnel can know the execution result.

[0080] Based on the technical solution of the above embodiment, the pre-configured black and white lists can be read from the database through the client, and then multiple target hosts for batch operation execution can be quickly determined based on the black and white lists, and then batch operations can be executed on multiple target hosts. Compared with repeatedly executing commands on each target host separately, the technical solution of the embodiment of the present application greatly improves the efficiency of resource management and avoids manual repetitive operations.

[0081] In one embodiment of the present application, after receiving a batch operation execution command, the execution device may detect the batch operation execution command to determine whether the batch operation execution command is a high-risk command. In this embodiment, if Figure 3 As shown, it specifically includes steps S310 to S320, which are detailed as follows:

[0082] Step S310: Detect the batch operation execution command to determine whether the batch operation execution command is a high-risk command.

[0083] Among them, high-risk commands are commands that cause misoperations, including but not limited to deletion, clearing, leakage, tampering, theft, and other operations that may cause damage to the host system. For example, the command rm-rf, which forcibly deletes files or directories, is a high-risk command.

[0084] Step S320: If the batch operation execution command is a high-risk command, an alarm prompt is issued, and the alarm prompt is used to prompt whether to send the batch operation execution command to each target host.

[0085] If a batch operation execution command is detected as a high-risk command, an alarm prompt may be issued to notify relevant personnel. The alarm prompt is used to prompt whether to send the batch operation execution command to each target host. If so, the batch operation execution command is sent to each target host. If not, the batch operation execution command is not sent.

[0086] The technical solution of this embodiment detects batch operation execution commands before sending them, which can control high-risk command operations from the root and realize centralized control, thus avoiding unnecessary data loss caused by high-risk commands.

[0087] In one embodiment of the present application, the execution device can display the execution progress of the batch operation execution command on each target host according to the instructions of the batch operation execution command. Specifically, if the batch operation execution command contains a second parameter for indicating the display of the execution progress of the batch operation execution command on each target host, the execution device can display the execution progress of the batch operation execution command on each target host. Conversely, if the batch operation execution command does not contain the second parameter, the execution progress of the batch operation execution command on each target host may not be displayed on the execution device.

[0088] In one embodiment of the present application, Figure 4 As shown, the batch operation execution method may further specifically include steps S410 to S420, which are described in detail as follows:

[0089] Step S410: Receive the job command sent by the client.

[0090] After the batch operation execution command is executed, the client can send a job command to the execution device, where the job command can be used to view the historical batch operation status of the execution device.

[0091] Step S420: Display a batch operation execution list according to the job command, wherein the batch operation execution list records historical batch operations and operation results corresponding to the historical batch operations.

[0092] After receiving the job command, the execution device can display a batch operation execution list based on the job command. The batch operation execution list records historical batch operations and the corresponding operation results of the historical batch operations. Historical batch operations refer to batch execution operations that have been executed. The operation results may include the results of the corresponding command execution, detailed output, and error information.

[0093] Figure 5 The following schematically shows a logical implementation diagram of a batch operation execution method according to an embodiment of the present application. The batch operation execution method is executed by an execution device, such as Figure 5 As shown, the batch operation execution method may include:

[0094] Step 1: Get multiple target hosts.

[0095] Specifically, the execution device can obtain multiple target hosts from a pre-configured blacklist and whitelist, which is configured based on host information stored in a database of the execution device. The multiple target hosts are hosts used to execute batch operation execution commands sent by the client.

[0096] The host information in the database can be obtained by at least one of the following methods: obtaining it by parsing configuration commands; obtaining it by parsing an imported file, which contains the host information to be managed; and filtering and obtaining host information that matches the specified field information from other databases based on the specified field information.

[0097] Step 2: Execute batch operation execution commands.

[0098] The process of executing batch operation commands mainly involves three parts, which are detailed as follows:

[0099] (1) Detection and alarm prompts: Before the execution device sends the batch operation execution command to each target host for execution, the execution device can first detect the batch operation execution command to determine whether the batch operation execution command is a high-risk command. If the batch operation execution command is a high-risk command, an alarm prompt is issued. The alarm prompt is used to prompt whether to send the batch operation execution command to each target host.

[0100] (2) Result feedback: After determining to send the batch operation execution command to each target host, each target host can execute the batch operation execution command and feedback the result of executing the batch operation execution command to the execution device.

[0101] (3) Progress display: During the process of each target host executing the batch operation execution command, the execution progress of each target host executing the batch operation execution command can be displayed on the execution device.

[0102] Step 3: View and review the results.

[0103] After a batch operation command is executed, the results can be viewed and reviewed on the executing device. This includes viewing the batch operation execution list, batch operation execution details, and batch operation execution results. The batch operation execution list can record historical batch operations and their corresponding results, allowing you to review historical batch operations.

[0104] Figure 6 The following schematically shows a logical implementation diagram of a batch operation execution method on the execution device side according to an embodiment of the present application. Figure 6 As shown, the execution device may include a storage module 610 , a processing module 620 and a display module 630 .

[0105] The storage module 610 may store host information, batch operation execution results, batch operation execution details, and a batch operation execution list. The host information may be obtained by at least one of parsing configuration commands, parsing imported files, and filtering from other databases. The batch operation execution list may record historical batch operations and the corresponding operation results.

[0106] The processing module 620 is mainly used to send batch operation execution commands and detect batch operation execution commands. Specifically, the processing module 620 can send batch operation execution commands in two main ways: the first way is that the processing module 620 can directly send the batch operation execution commands to each target host; the second way is that the processing module 620 can first connect to the jump server, send the batch operation execution commands to the jump server, and then the jump server sends the batch operation execution commands to each target host. In addition, the processing module 620 is also used to detect the batch operation execution commands to determine whether the batch operation execution commands are high-risk commands. If the batch operation execution commands are high-risk commands, an alarm prompt is issued, which is used to prompt whether to send the batch operation execution commands to each target host.

[0107] The display module 630 is used to display the execution progress of the batch operation execution command executed by each target host on the execution device.

[0108] Figure 7 The following schematically shows a logical implementation diagram of a batch operation execution method on the client side according to an embodiment of the present application. Figure 7 As shown, the client may include a reading module 710 and a command module 720 .

[0109] Among them, the client can read the black and white list from the database of the execution device by reading the command line script configured by the reading module 710, wherein the host information stored in the database of the execution device can be obtained by parsing the configuration command, or obtained by parsing the imported file, and the file contains the host information that needs to be managed; or according to the specified field information, filter and obtain the host information that matches the specified field information from other databases.

[0110] In addition, the client can also send job commands to the execution device through the command module 720. The execution device can display a batch operation execution list based on the job command. The batch operation execution list records historical batch operations and the operation results corresponding to the historical batch operations. The batch operation execution list is stored in the database of the execution device.

[0111] Figure 8 The following schematically shows a flow chart of a method for executing batch operations according to an embodiment of the present application. Figure 8 As shown, the batch operation execution method may specifically include the following steps:

[0112] Step S810: The client sends a batch operation execution command to the execution device.

[0113] Specifically, the user can directly input the batch operation execution command on the client, and then the client sends the batch operation execution command to the execution device. Of course, in other implementations, the received batch operation execution command can also be obtained by parsing the client's custom script. The client can send the batch operation execution command obtained after parsing the custom script to the execution device, or send the custom script to the execution device, and the execution device parses the custom script to obtain the batch operation execution command.

[0114] Step S820: Execute the device detection batch operation execution command.

[0115] Specifically, the execution device may detect the batch operation execution command to determine whether the batch operation execution command is a high-risk command. If the batch operation execution command is not a high-risk command, the execution device may determine that the batch operation execution command can be sent to each target host. If the batch operation execution command is a high-risk command, the execution device may issue an alarm prompting whether to send the batch operation execution command to each target host. If so, the batch operation execution command is determined to be sent to each target host; if not, the batch operation execution command is not sent.

[0116] Step S830: The execution device obtains multiple target hosts corresponding to the batch operation execution command from the pre-configured blacklist and whitelist.

[0117] Step S840: Determine whether to connect to the jump server based on whether the batch operation execution command contains the first parameter for instructing to connect to the jump server. If not, execute step S850; if yes, execute step S860.

[0118] Step S850: The execution device sends a batch operation execution command to each target host.

[0119] Step S860: The execution device sends a batch operation execution command to the jump server, and the jump server forwards the batch operation execution command to each target host.

[0120] Step S870: The execution device obtains the results of executing the batch operation command fed back by each target host, and stores the obtained results in a database.

[0121] Step S880: The execution device displays the execution progress of the batch operation execution command on each target host.

[0122] The following describes an embodiment of the device of the present application, which can be used to execute the batch operation execution method in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the batch operation execution method in the above embodiment of the present application.

[0123] Figure 9 A block diagram of a batch operation execution device according to an embodiment of the present application is shown. Figure 9 As shown, a batch operation execution device 900 according to an embodiment of the present application includes: a first receiving unit 902 , an acquiring unit 904 , a sending unit 906 and a second receiving unit 908 .

[0124] Among them, the first receiving unit 902 is configured to receive a batch operation execution command sent by the client; the obtaining unit 904 is configured to obtain multiple target hosts corresponding to the batch operation execution command from a pre-configured black and white list according to the batch operation execution command, and the black and white list is read from a database by the client through the configuration execution command line script, and the black and white list contains host information that requires batch operation execution; the sending unit 906 is configured to send the batch operation execution command to each target host, so that each target host executes the batch operation execution command; the second receiving unit 908 is configured to receive feedback from each target host on the results of executing the batch operation execution command.

[0125] In some embodiments of the present application, the sending unit 906 is configured as follows: if the batch operation execution command contains a first parameter for indicating connection to a jump server, then the jump server is connected according to the first parameter and the batch operation execution command is sent to the jump server, so that the jump server sends the batch operation execution command to each target host; if the batch operation execution command does not contain the first parameter, then the batch operation execution command is sent directly to each target host.

[0126] In some embodiments of the present application, the host information stored in the database is obtained by at least one of the following methods: obtained by parsing configuration commands; obtained by parsing imported files, which contain host information that needs to be managed; based on specified field information, screening and obtaining host information that matches the specified field information from other databases.

[0127] In some embodiments of the present application, the device further includes: a detection unit, configured to detect the batch operation execution command to determine whether the batch operation execution command is a high-risk command; an alarm unit, configured to issue an alarm prompt if the batch operation execution command is a high-risk command, and the alarm prompt is used to prompt whether to send the batch operation execution command to each target host.

[0128] In some embodiments of the present application, the device also includes: a first display unit, configured to display the execution progress of the batch operation execution command on each target host according to the second parameter if the batch operation execution command contains a second parameter for indicating the execution progress of the batch operation execution command on each target host; and a non-display unit, configured to not display the execution progress of the batch operation execution command on each target host if the batch operation execution command does not contain the second parameter.

[0129] In some embodiments of the present application, before the sending unit 906 is configured to send the batch operation execution command to each target host, the device also includes: a login unit, configured to log in to each target host through an account and password login method or a key login method.

[0130] In some embodiments of the present application, the device also includes: a third receiving unit, configured to receive a job command sent by the client; a second display unit, configured to display a batch operation execution list according to the job command, wherein the batch operation execution list records historical batch operations and operation results corresponding to the historical batch operations.

[0131] Figure 10A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown.

[0132] It should be noted that Figure 10 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0133] like Figure 10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage part 1008 into the random access memory (RAM) 1003, such as executing the method described in the above embodiment. Various programs and data required for system operation are also stored in the RAM 1003. The CPU 1001, ROM 1002 and RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0134] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 1008 including a hard disk and the like; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. Removable media 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1010 as needed, so that computer programs read therefrom can be installed into the storage section 1008 as needed.

[0135] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1009, and / or installed from a removable medium 1011. When the computer program is executed by the central processing unit (CPU) 1001, the various functions defined in the system of the present application are executed.

[0136] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable computer program. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0137] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0138] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.

[0139] As another aspect, the present application further provides a computer-readable medium, which may be included in the electronic device described in the above embodiments, or may exist independently without being incorporated into the electronic device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device implements the method described in the above embodiments.

[0140] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0141] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.

[0142] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed herein.

[0143] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A batch operation execution method, characterized in that: The method comprises: The execution device receives the batch operation execution command sent by the client; According to the batch operation execution command, host information that does not require batch operation execution in the pre-configured black and white lists is filtered out from the host information in the database, and a confirmation request message is sent to the client. The client further confirms the host information in the filtered host information that is not the host information that requires batch operation execution in the black and white lists, and confirms whether it is the host information that requires batch operation execution. According to the result of the further confirmation and the host information that requires batch operation execution in the black and white lists, multiple target hosts corresponding to the batch operation execution command are obtained; the black and white lists are read from the database by the client through the configuration execution command line script, the client sends the batch operation execution command to the execution device, and sends the black and white lists read from the database to the execution device, so that the execution device obtains multiple target hosts corresponding to the batch operation execution command from the black and white lists; the host information stored in the database is obtained by at least one of the following methods: obtained by parsing the configuration command; obtained by parsing the imported file, the file containing the host information that needs to be managed; according to the specified field information, the host information matching the specified field information is screened and obtained from other databases; Sending the batch operation execution command to each target host, so that each target host executes the batch operation execution command; Receive feedback from each target host regarding the results of executing the batch operation command, and store the execution results in a database; receiving a job command sent by the client; A batch operation execution list is displayed according to the job command, wherein the batch operation execution list records historical batch operations and operation results corresponding to the historical batch operations, wherein the historical batch operations refer to batch execution operations that have been executed.

2. The method according to claim 1, characterized in that The sending of the batch operation execution command to each target host includes: If the batch operation execution command includes a first parameter for instructing to connect to a jump server, connecting to the jump server according to the first parameter and sending the batch operation execution command to the jump server, so that the jump server sends the batch operation execution command to each target host; If the batch operation execution command does not include the first parameter, the batch operation execution command is directly sent to each target host.

3. The method according to claim 1, characterized in that The method further comprises: detecting the batch operation execution command to determine whether the batch operation execution command is a high-risk command; If the batch operation execution command is a high-risk command, an alarm prompt is issued, and the alarm prompt is used to prompt whether to send the batch operation execution command to each target host.

4. The method according to claim 1, wherein The method further comprises: If the batch operation execution command includes a second parameter for instructing to display the execution progress of the batch operation execution command on each target host, displaying the execution progress of the batch operation execution command on each target host according to the second parameter; If the batch operation execution command does not include the second parameter, the execution progress of the batch operation execution command by each target host will not be displayed.

5. The method according to claim 1, wherein The method further comprises: Before sending the batch operation execution command to each target host, log in to each target host through an account and password login method or a key login method.

6. A batch operation execution device, characterized in that: The device comprises: A first receiving unit, configured to receive, as an execution device, a batch operation execution command sent by a client; An acquisition unit is configured to filter out host information that does not require batch operation execution in a pre-configured black and white list from host information in a database according to the batch operation execution command, and send a confirmation request message to a client, whereby the client further confirms host information in the filtered host information that is not host information that requires batch operation execution in the black and white list, and confirms whether it is host information that requires batch operation execution, and obtains multiple target hosts corresponding to the batch operation execution command based on the further confirmation result and the host information that requires batch operation execution in the black and white list; the black and white list is read from a database by the client through the configuration execution command line script, the client sends a batch operation execution command to an execution device, and sends the black and white list read from the database to the execution device, so that the execution device obtains multiple target hosts corresponding to the batch operation execution command from the black and white list; the host information stored in the database is obtained by at least one of the following methods: obtained by parsing a configuration command; obtained by parsing an imported file, the file containing host information that needs to be managed; based on specified field information, screening and obtaining host information that matches the specified field information from other databases; a sending unit configured to send the batch operation execution command to each target host, so that each target host executes the batch operation execution command; A second receiving unit is configured to receive the results of executing the batch operation execution command fed back by each target host, and store the execution results in a database; a third receiving unit, configured to receive a job command sent by the client; The second display unit is configured to display a batch operation execution list according to the job command, wherein the batch operation execution list records historical batch operations and operation results corresponding to the historical batch operations, wherein the historical batch operations refer to batch execution operations that have been executed.

7. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the batch operation execution method according to any one of claims 1 to 5 is implemented.

8. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the batch operation execution method according to any one of claims 1 to 5.

9. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the batch operation execution method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Efficiently executing commands against a large set of servers with near real time feedback of execution and presentation of the output of the commands

    US20060212422A1