CN112579165A - Batch operation execution method and device, readable medium and electronic equipment - Google Patents

Batch operation execution method and device, readable medium and electronic equipment Download PDF

Info

Publication number
CN112579165A
CN112579165A CN202011457904.9A CN202011457904A CN112579165A CN 112579165 A CN112579165 A CN 112579165A CN 202011457904 A CN202011457904 A CN 202011457904A CN 112579165 A CN112579165 A CN 112579165A
Authority
CN
China
Prior art keywords
batch operation
operation execution
execution command
command
host
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011457904.9A
Other languages
Chinese (zh)
Inventor
许恒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011457904.9A priority Critical patent/CN112579165A/en
Publication of CN112579165A publication Critical patent/CN112579165A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30076Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions

Abstract

The embodiment of the application provides a batch operation execution method, a batch operation execution device, a readable medium and electronic equipment. The batch operation execution method comprises the following steps: receiving a batch operation execution command sent by a client; according to the batch operation execution command, acquiring a plurality of 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 a configuration execution command line script, and the black and white list contains host information required to be executed by the batch operation; sending the batch operation execution command to each target host to enable each target host to execute the batch operation execution command; and receiving the result of executing the batch operation execution command fed back by each target host. The technical scheme of the embodiment of the application can greatly improve the efficiency of resource management.

Description

Batch operation execution method and device, readable medium and electronic equipment
Technical Field
The present application relates to the field of computer and communication technologies, and in particular, to a batch operation execution method and apparatus, a readable medium, and an electronic device.
Background
In various information technology-related works, the scenes of batch execution of command lines are very common, and particularly in operation and maintenance-related works, operation and maintenance personnel often need to operate hundreds of thousands of machine nodes, data tables or other resource objects.
In order to complete the work quickly, some operation and maintenance tools such as ansable, xshell, mobaxterm and the like are usually used, the ansable is open source software executed by a command line, and supports batch commands and playbooks; xshell and mobaxterm are batch command execution software under the interface system. However, at present, these operation tools still have defects such as low operation efficiency, and unretraceable execution results.
Disclosure of Invention
Embodiments of the present application provide a batch operation execution method, apparatus, readable medium, and electronic device, so that efficiency of resource management can be greatly improved at least to a certain extent.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of an embodiment of the present application, there is provided a batch operation execution method, including: receiving a batch operation execution command sent by a client; according to the batch operation execution command, acquiring a plurality of 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 a configuration execution command line script, and the black and white list contains host information required to be executed by the batch operation; sending the batch operation execution command to each target host to enable each target host to execute the batch operation execution command; and receiving the result of executing the batch operation execution command fed back by each target host.
According to an aspect of an embodiment of the present application, there is provided a batch operation execution apparatus including: the system comprises a first receiving unit, a second receiving unit and a control unit, wherein the first receiving unit is configured to receive a batch operation execution command sent by a client; the acquisition unit is configured to acquire a plurality of target hosts corresponding to the batch operation execution command from a pre-configured black and white list according to the batch operation execution command, wherein the black and white list is read from a database by the client through a configuration execution command line script, and the black and white list contains host information required to be executed by the batch operation; 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 the second receiving unit is configured to receive the result of executing the batch operation execution command fed back by each target host.
In some embodiments of the present application, based on the foregoing scheme, the sending unit is configured to: if the batch operation execution command contains a first parameter for indicating connection of a jump server, connecting 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; and if the batch operation execution command does not contain the first parameter, directly sending the batch operation execution command to each target host.
In some embodiments of the present application, based on the foregoing solution, the host information stored in the database is obtained by at least one of the following methods: obtained by analyzing the configuration command; the method comprises the steps that the method is obtained by analyzing an imported file, and the file comprises host information needing to be managed; and screening and acquiring host information matched with the specified field information from other databases according to the specified field information.
In some embodiments of the present application, based on the foregoing solution, the apparatus further includes: the detection unit is configured to detect the batch operation execution command so as to determine whether the batch operation execution command is a high-risk command; and the alarm unit is configured to send an alarm prompt if the batch operation execution command is a high-risk command, wherein the alarm prompt is used for prompting whether to send the batch operation execution command to each target host.
In some embodiments of the present application, based on the foregoing solution, the apparatus further includes: a first display unit, configured to display, if the batch operation execution command includes a second parameter for indicating an execution progress of the batch operation execution command executed by each target host, the execution progress of the batch operation execution command executed by each target host according to the second parameter; and the non-display unit is configured to not display the execution progress of the batch operation execution command executed by each target host if the batch operation execution command does not include the second parameter.
In some embodiments of the present application, based on the foregoing solution, before the sending unit is configured to send the batch operation execution command to each target host, the apparatus further includes: and the login unit is configured to log in to each target host through an account password login mode or a key login mode.
In some embodiments of the present application, based on the foregoing solution, the apparatus further includes: a third receiving unit configured to receive a job command sent by the client; and the second display unit is configured to display a batch operation execution list according to the job command, and historical batch operations and operation results corresponding to the historical batch operations are recorded in the batch operation execution list.
According to an aspect of an embodiment of the present application, there is provided a computer-readable medium on which a computer program is stored, the computer program, when executed by a processor, implementing a batch operation execution method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the batch operation execution method as described in the above embodiments.
According to an aspect of embodiments herein, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the batch operation execution method provided in the various alternative embodiments described above.
In the technical solutions provided in some embodiments of the present application, a batch operation execution command sent by a client is received, and then a plurality of target hosts corresponding to the batch operation execution command are obtained from a pre-configured black-and-white list, which is read from a database by a configuration execution command line script by the client, where the black-and-white list includes host information that needs to be executed by the batch operation. According to the technical scheme of the embodiment of the application, the client can read the pre-configured black and white list from the database, then the target hosts for executing the batch operation can be quickly determined according to the black and white list, and then the batch operation can be executed on the target hosts.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 shows a schematic diagram of an exemplary system architecture to which aspects of embodiments of the present application may be applied;
FIG. 2 schematically illustrates a flow diagram of a method of bulk operation execution according to one embodiment of the present application;
FIG. 3 schematically illustrates a flow diagram for detecting a bulk operation execution command according to one embodiment of the present application;
FIG. 4 schematically illustrates a flow diagram showing a list of batch operation executions according to one embodiment of the present application;
FIG. 5 schematically illustrates a logical implementation of a batch operation execution method according to one embodiment of the present application;
FIG. 6 schematically illustrates a logic implementation diagram of a batch operation execution method on an execution device side according to one embodiment of the present application;
FIG. 7 is a schematic diagram illustrating a logical implementation of a bulk operation execution method on a client side according to an embodiment of the present application;
FIG. 8 schematically illustrates a flow diagram of a method of bulk operation execution according to one embodiment of the present application;
FIG. 9 schematically illustrates a block diagram of a batch operation execution apparatus according to one embodiment of the present application;
FIG. 10 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
It is to be noted that the terms used in the specification and claims of the present application and the above-described drawings are only for describing the embodiments and are not intended to limit the scope of the present application. It will be understood that the terms "comprises," "comprising," "includes," "including," "has," "having," and the like, when used herein, specify the presence of stated features, integers, steps, operations, elements, components, and/or groups thereof, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
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, a first element could be termed a second element without departing from the scope of the present invention. Similarly, a second element may be termed a first element. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It should be noted that: reference herein to "a plurality" means two or more. "and/or" describe the association relationship of the associated objects, meaning that there may be three relationships, e.g., A and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied.
As shown in fig. 1, the system architecture 100 may include a client 101, an execution device 102, and a host 103.
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) having a communication function and operating in the terminal devices.
And the execution device 102 is used for forwarding the received batch operation execution command sent by the client 101 to the corresponding host 103. The execution device 102 has data storage and transmission capabilities, has an independent database, can independently store host information, and can receive the batch operation execution command from the client 101 and forward the batch operation execution command. The execution device 102 may be a computing device, such as a server device or a terminal device, and may execute the batch operation execution method provided in any example of the present application.
Here, since the client 101 and the execution apparatus 102 are physically located in different local area networks, they are not directly communicable through a conventional communication link. In this example, the communication connection between the client 101 and the execution device 102 may be a Virtual Private Network (VPN) connection. The VPN technology is to establish a private network on a public network to perform encrypted communication. The VPN technology is a technology for constructing a virtual local area network basic connection. That is, in the present example, a point-to-point bidirectional communication connection may be established between the lan to which the client 101 belongs and the lan to which the execution device 102 belongs through the VPN technology, so that the client 101 and the execution device 102 are logically within the same virtual lan.
The host computer 103 is used for executing the batch operation execution command input from the client 101 and transmitting the result of executing the batch operation execution command back to the execution device 102.
In an embodiment of the present application, the client 101 may send a batch operation execution command to the execution device 102, after receiving the batch operation execution command, the execution device 102 may obtain, according to the batch operation execution command, a plurality of target hosts 103 corresponding to batch operation execution from a pre-configured black and white list, and then send the batch operation execution command to each target host 103, after receiving the batch operation execution command, each target host 103 may execute the batch operation execution command, and return a result of executing the batch operation execution command to the execution device 102.
In an embodiment of the present application, the system architecture 100 may further include a jump server 104, where the jump server 104 may receive a 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, and in this embodiment, the execution device 102 may determine whether to send the batch operation execution command to the jump server 104 according to whether a first parameter indicating connection to the jump server 104 is included in the batch operation execution command, and if the batch operation execution command includes the first parameter, the execution device 102 may 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 include the first parameter, the execution device 102 may directly send the batch operation execution command to each target host 103.
It should be understood that the number of clients, execution devices, hosts, and jump servers in FIG. 1 are merely illustrative. There may be any number of clients, execution devices, hosts, and jump servers, as desired for implementation. For example, the jump server may be a server cluster composed of a plurality of servers.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
FIG. 2 illustrates a flow diagram of a batch operation execution method according to one embodiment of the present application, which may be performed by an execution device, which may be the execution device 102 shown in FIG. 1. Referring to fig. 2, the method includes:
step S210, receiving a batch operation execution command sent by a client;
step S220, according to the batch operation execution command, obtaining a plurality of 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 configuring an execution command line script, and the black and white list contains host information required to be executed by the batch operation;
step S230, sending the batch operation execution command to each target host, so that each target host executes the batch operation execution command;
and step S240, receiving the result of executing the batch operation execution command fed back by each target host.
These steps are described in detail below.
In step S210, a batch operation execution command sent by the client is received.
The batch operation execution method of the embodiment can be used for making batch execution commands on thousands of hosts based on the batch operation execution commands of the client, so that the user requirements are met.
In one embodiment, the batch operation execution command includes, but is not limited to, any one or more of: the system comprises 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.
Specifically, the host control command includes any one or more of: host initialization command, host software installation command, and batch information processing command. The host information query command is used to query all host information, including but not limited to: host IP (Internet Protocol), host configuration, and host type. The application information query command comprises any one or more of the following: an application log query command and an application configuration query command; the application control commands include any one or more of: an application rollback command, an application restart command, and an application monitor command. The deployment information query command includes, but is not limited to, any one or more of the following: applying a configuration query command, a deployment history query command and a domain name query command; the deployment control command may be an application deployment application command.
In practical application, a user may directly input a batch operation execution command at a client, and then the client sends the batch operation execution command to an execution device, and of course, in other embodiments, the received batch operation execution command may also be obtained by parsing a custom script of the client, and the client may send the batch operation execution command obtained by 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. The custom script can be in a TXT text format, the content of the custom script is a command line, and the custom script can be written according to actual batch operation execution requirements and a custom keyword use case so as to realize batch operation execution on different hosts.
In one possible implementation, the batch operation execution command may be written based on an extension of the grammar rules of the jinja2 template engine in view of practicality, and accordingly, the received batch operation execution command satisfies the grammar rules of the jinja2 template engine. The jinjia2 template engine is prior art and will not be described in detail herein.
In one possible implementation, the custom script includes a batch operation execution command, the batch operation execution command includes a batch operation execution command start (e.g., "&") and a custom key, the batch operation execution command end sets a separator (e.g., "" separator "") and the custom script end sets an end (e.g., "& end").
When the command line comprises a batch operation execution command initial symbol, judging whether the character after the batch operation execution command initial symbol belongs to the user-defined keyword, if not, judging that the command line is wrong, ending the analysis, for example, automatically exiting the program, and prompting the language error of the line. When the analysis content is the terminator, the analysis is ended. By setting the separator and the terminator, the custom script can be analyzed by command lines by using the separator as a mark when the custom script is analyzed, and the analysis is finished when the analysis content is the terminator.
In 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 black and white list, where the black and white list is read from a database by the client through a configuration execution command line script, and the black and white list includes host information that needs to be executed by the batch operation.
It should be noted that the execution device as the execution main body has data storage and transmission capability, and it has an independent database, and can independently store host information, where the host information includes, but is not limited to, host IP, host configuration, host type, host MAC (Media Access Control Address), host SN (Serial Number), host brand, host model, and the like.
In an embodiment, the host information stored in the database is acquired by the execution device through at least one of the following manners: obtained by analyzing the configuration command; the method comprises the steps that the method is obtained by analyzing an imported file, and the file comprises host information needing to be managed; and screening and acquiring host information matched with the specified field information from other databases according to the specified field information.
Specifically, the execution device may directly obtain the host information by parsing the configuration command, may also obtain the host information by parsing the imported file, and may write the host information that needs to be managed into the file before importing the file into the execution device. In addition to the above two manners, in this embodiment, the method may further include obtaining the host information by filtering from other databases, specifically, the other databases may be CMDBs (Configuration Management databases), which are databases used to store and manage various Configuration information of the devices in the IT architecture of the enterprise, and are closely associated with all service support and service delivery flows, support the operation of these flows, exert the value of the Configuration information, and ensure the accuracy of the data depending on the relevant flows. The designated field information may be field information determined according to actual requirements, for example, the designated field information may include host IP information, product line information, product information, environment information, module information, and the like.
It can be understood that the database does not distinguish when acquiring the host information, but may acquire and store the host information in various ways, and then the execution device has to judge each stored host information after receiving the batch operation execution command to determine the host information that needs to execute the batch operation, which is not only inefficient, but also prone to errors.
Therefore, the embodiment adopts a mode of passing through the pre-configured black and white list, so that the execution device can quickly acquire a plurality of target hosts corresponding to the batch operation execution command according to the pre-configured black and white list. Specifically, the black-and-white list may include host information that requires the batch operation to be performed and host information that does not require the batch operation to be performed. In some embodiments, the executing device may directly use the hosts that need to execute the batch operations included in the black-and-white list as the target hosts corresponding to the batch operation execution command, for example, if the host information that needs to execute the batch operations in the black-and-white list includes the host a, the host B, and the host C, the host a, the host B, and the host C may all be the target hosts. In other embodiments, the executing device may also select multiple hosts from hosts that require batch operation execution and are included in the black-and-white list as multiple target hosts corresponding to the batch operation execution command, and the selection mode may be selected from hosts that require batch operation execution according to actually required field information, for example, the host information that requires batch operation execution in the black-and-white list includes host a, host B, and host C, and the executing device may select host a and host B as the target hosts. Compared with the method for judging the host information one by one, the target host can be quickly obtained through the pre-configured black and white list, and the efficiency of executing batch operations is improved.
In some embodiments, the executing device may further determine a plurality of target hosts according to the host information that requires batch operation execution and the host information that does not require batch operation execution, for example, the executing device may filter the host information that does not require batch operation execution from the host information in the database, and then use the filtered host information as the plurality of target hosts, in other embodiments, the executing device may also first filter the host information that does not require batch operation execution from the host information in the database, then further confirm the host information that is not the host information that requires batch operation execution in the black-and-white list in the filtered host information, confirm whether the host information is the host information that requires batch operation execution, according to the further confirmed result and the host information that requires batch operation execution in the black-and-white list, a plurality of host information is obtained. The further confirmation mode may be to send a confirmation request message to the client, and the client confirms according to actual needs.
For example, it is assumed that the host information stored in the database of the execution device includes a host a, a host B, a host C, a host D, and a host E, the host information that needs to be executed by the batch operation in the black-and-white list includes the host a and the host B, and the host information that does not need to be executed by the batch operation includes the host D, the host D may be filtered, the filtered host information includes the host a, the host B, the host C, and the host E, and then, the host C and the host E are further confirmed, and it is assumed that the result obtained by the confirmation is that the host C needs to be executed by the batch operation, and the host E does not need to be executed by the batch operation, and finally, the obtained pieces of host information are the host a, the host.
In this embodiment, a plurality of target hosts are obtained by combining host information that needs to be executed in a batch operation and host information that does not need to be executed in a black-and-white list, that is, a plurality of target hosts are obtained by combining a white list and a black list, compared with a method that only the white list or only the black list is used, the method has the advantages that all hosts that need to be executed in a batch operation cannot be considered when setting the white list, if only the white list is considered, it is assumed that the host a is the host that needs to be executed in a batch operation, but the host a is not considered when setting the white list and is not set in the white list, and then the execution device does not use the host as the target host at this time; similarly, if only the blacklist is set, it is possible that the host B is a host that does not require batch operation execution, but the execution device may set the blacklist as a target host without setting it into the blacklist in consideration of the host B. The embodiment considers the host information which is not set, configures the black and white list, and has higher accuracy and stronger flexibility for determining the target host.
It should be further noted that the execution device has no access right to the black-and-white list, the black-and-white list can only be read from the database by the client through configuring the execution command line script, and the client can send the batch operation execution command to the execution device and simultaneously send the black-and-white list read from the database to the execution device, so that the execution device can obtain the target hosts corresponding to the batch operation execution command from the black-and-white list.
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.
After the plurality of target hosts are acquired, the batch operation execution command can be sent to each target host, and after each target host receives the batch operation execution command, the batch operation execution command is started to be executed.
In an embodiment of the present application, before sending the batch operation execution command to each target host, the execution device needs to log in to each target host to obtain the management authority of each target host. The login mode can be an account password login mode or a key login mode.
In fact, the execution device does not necessarily have the administrative authority of the target host, in which case the bulk operation execution command may instruct the execution device to connect to the jump server and then the jump server sends the bulk operation execution command to the respective target host.
In one embodiment of the present application, it is possible to indicate whether the execution device needs to connect to the jump server by setting a first parameter in the batch operation execution command. Specifically, if the batch operation execution command includes a first parameter indicating that the jump server is connected, that is, the execution device does not have the management authority of each target host, the execution device may first connect the jump server, send the batch operation execution command to the jump server, and then send the batch operation execution command to each target host by the jump server.
In this embodiment, considering that the executing device does not have a login right to log in to the target host, in the process of implementing interaction between the executing device and each target host, the batch operation execution command is forwarded to the jump server in an indication manner of the first parameter, and then the jump server forwards the batch execution command, so that the problem that the executing device does not have a right to connect to the target host and cannot send the batch operation execution command is solved, and the batch execution operation is further ensured to be executed.
In step S240, the result of executing the batch operation execution command fed back by each target host is received.
Specifically, after executing the batch operation execution command, each target host may feed back a result 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, the target hosts may feed back host information of the target hosts to the execution device, including but not limited to: host IP (Internet Protocol), host configuration, and host type.
In an embodiment, after receiving the execution result of the batch operation execution command fed back, the execution device may store the execution result in a database, or may directly feed back the execution result to the client synchronously, so that a relevant person may know the execution result.
Based on the technical scheme of the embodiment, the client can read out the pre-configured black and white list from the database, then the target hosts for executing the batch operation can be quickly determined according to the black and white list, and then the batch operation can be executed on the target hosts.
In an embodiment of the present application, after receiving the 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, and in this embodiment, as shown in fig. 3, the execution device specifically includes steps S310 to S320, which are described in detail as follows:
step S310, detecting the batch operation execution command to determine whether the batch operation execution command is a high-risk command.
The high-risk command is a command causing a misoperation, the misoperation includes but is not limited to deletion, emptying, leakage, tampering, stealing and the like which can damage the host system, for example, a command rm-rf for forcibly deleting a file or a directory belongs to the high-risk command.
Step S320, if the batch operation execution command is a high-risk command, sending an alarm prompt, where the alarm prompt is used to prompt whether to send the batch operation execution command to each target host.
If the batch operation execution command is detected to be a high-risk command, an alarm prompt can be sent to inform relevant personnel, the alarm prompt is used for prompting 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, and if not, the batch operation execution command is not sent.
According to the technical scheme, the batch operation execution command is detected before the batch operation execution command is sent, high-risk command operation can be managed and controlled fundamentally, centralized management and control can be realized, and the problem of unnecessary data loss caused by the high-risk command is solved.
In an embodiment of the application, the execution device may display, according to the instruction of the batch operation execution command, an execution progress of each target host executing the batch operation execution command, specifically, if the batch operation execution command includes a second parameter for indicating that the execution progress of the batch operation execution command executed by each target host is displayed, the execution device may display the execution progress of the batch operation execution command executed by each target host, and otherwise, if the batch operation execution command does not include the second parameter, the execution progress of the batch operation execution command executed by each target host may not be displayed on the execution device.
In an embodiment of the present application, as shown in fig. 4, the batch operation execution method may further specifically include steps S410 to S420, which are described in detail as follows:
and step S410, receiving a job command sent by the client.
After the batch operation execution command is executed, the client may send a job command to the execution device, where the job command may be used to view historical batch operation conditions of the execution device.
And step S420, displaying a batch operation execution list according to the job command, wherein historical batch operations and operation results corresponding to the historical batch operations are recorded in the batch operation execution list.
After receiving the job command, the execution device may display a batch operation execution list according to the job command, where the batch operation execution list records a historical batch operation and an operation result corresponding to the historical batch operation, the historical batch operation refers to an executed batch execution operation, and the operation result may include a result of execution of the corresponding command, a detailed output, and error information.
FIG. 5 is a schematic diagram illustrating a logic implementation of a batch operation execution method performed by an execution device according to an embodiment of the present application, where the batch operation execution method may include:
the first step is as follows: a plurality of target hosts is obtained.
Specifically, the execution device may obtain a plurality of target hosts from a pre-configured black-and-white list, where the black-and-white list is configured according to host information stored in a database of the execution device, and the target hosts are hosts for executing the batch operation execution command sent by the client.
The host information in the database can be obtained by at least one of the following methods: obtained by analyzing the configuration command; the method comprises the steps that the files obtained by analyzing the imported files contain host information needing to be managed; and screening and acquiring host information matched with the specified field information from other databases according to the specified field information.
The second step is that: and executing the batch operation execution command.
The process of executing the batch operation execution command mainly involves three parts, and the detailed description is as follows:
(1) detection and alarm prompt: before the execution device sends the batch operation execution command to each target host for execution, the execution device may first detect the batch operation execution command to determine whether the batch operation execution command is a high-risk command, and send an alarm prompt if the batch operation execution command is a high-risk command, where the alarm prompt is used to prompt whether to send the batch operation execution command to each target host.
(2) And (3) result feedback: after determining to send the batch operation execution command to each target host, each target host may then execute the batch operation execution command and feed back a result of executing the batch operation execution command to the execution device.
(3) And (3) displaying the progress: in the process that each target host executes the batch operation execution command, the execution progress of the batch operation execution command executed by each target host can be displayed on the execution device.
The third step: and viewing and backtracking results.
After the batch operation execution command is executed, result viewing and backtracking may be performed on the execution device, which may specifically include viewing a batch operation execution list, batch operation execution details, and a batch operation execution result on the execution device. The batch operation execution list can record historical batch operations and operation results corresponding to the historical batch operations, and the historical batch operations can be traced back by checking the batch operation execution list.
FIG. 6 is a schematic diagram illustrating a logic implementation of a batch operation execution method on an execution device side according to an embodiment of the present application. As shown in fig. 6, the execution device may include a storage module 610, a processing module 620, and a display module 630.
The storage module 610 may store host information, a batch operation execution result, batch operation execution details, and a batch operation execution list. The host information may be obtained by at least one of parsing the configuration command, parsing the imported file, and filtering from other databases. The batch operation execution list can record historical batch operations and operation results corresponding to the historical batch operations.
The processing module 620 is mainly used for sending the batch operation execution command and detecting the batch operation execution command. Specifically, the sending of the batch operation execution command by the processing module 620 mainly includes two ways: the first way is that the processing module 620 can directly send the batch operation execution command to each target host; the second way is that the processing module 620 may first connect to the jump server, send the batch operation execution command to the jump server, and then send the batch operation execution command to each target host by the jump server. In addition, the processing module 620 is further configured to detect the batch operation execution command to determine whether the batch operation execution command is a high-risk command, and send an alarm prompt if the batch operation execution command is a high-risk command, where the alarm prompt is used to prompt whether to send the batch operation execution command to each target host.
The display module 630 is used for displaying the execution progress of the batch operation execution command executed by each target host on the execution device.
FIG. 7 is a schematic diagram illustrating a logical implementation of a batch operation execution method on a client side according to an embodiment of the present application. As shown in fig. 7, the client may include a read module 710 and a command module 720.
The client may configure the execution command line script through the reading module 710 to read the black and white list from the database of the execution device, where the host information stored in the database of the execution device may be obtained by analyzing the configuration command, or obtained by analyzing an imported file, where the file includes host information to be managed; or screening and acquiring host information matched with the specified field information from other databases according to the specified field information.
In addition, the client may further send a job command to the execution device through the command module 720, and the execution device may display a batch operation execution list according to the job command, where the batch operation execution list records a historical batch operation and an operation result corresponding to the historical batch operation, and the batch operation execution list is stored in a database of the execution device.
Fig. 8 schematically shows a flowchart of a batch operation execution method according to an embodiment of the present application, and as shown in fig. 8, the batch operation execution method may specifically include the following steps:
step S810, the client sends a batch operation execution command to the execution device.
Specifically, the user may directly input the batch operation execution command at the client, and then the client sends the batch operation execution command to the execution device, but in other embodiments, the received batch operation execution command may also be obtained by parsing a custom script of the client, and the client may send the batch operation execution command obtained by 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.
And step S820, the execution equipment detects a batch operation execution command.
In particular, 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 detected not to be a high-risk command, the execution equipment determines that the batch operation execution command can be sent to each target host; if the batch operation execution command is detected to be a high-risk command, the execution equipment can send an alarm prompt, the alarm prompt is used for prompting whether to send the batch operation execution command to each target host, if yes, the batch operation execution command can be sent to each target host, and if not, the batch operation execution command is not sent.
Step S830, the executing device obtains a plurality of target hosts corresponding to the batch operation executing command from a pre-configured black and white list.
Step 840, judging whether a jump server needs to be connected according to whether a first parameter for indicating the connection of the jump server is contained in the batch operation execution command, and if not, executing step 850; if yes, go to step S860.
Step S850, the execution device sends a batch operation execution command to each target host.
And step S860, the execution equipment sends the batch operation execution command to the jump server, and the jump server forwards the batch operation execution command to each target host.
Step S870, the execution device obtains the result of executing the batch operation execution command fed back by each target host, and stores the obtained result in the database.
And step S880, the execution equipment displays the execution progress of the batch operation execution command executed by each target host.
Embodiments of the apparatus of the present application are described below, which may be used to perform the batch operation execution method in the above embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the batch operation execution method described above in the present application.
Fig. 9 is a block diagram illustrating a batch operation execution apparatus according to an embodiment of the present application, and referring to fig. 9, a batch operation execution apparatus 900 according to an embodiment of the present application includes: a first receiving unit 902, an obtaining unit 904, a transmitting unit 906 and a second receiving unit 908.
The first receiving unit 902 is configured to receive a batch operation execution command sent by a client; the obtaining unit 904 is configured to obtain, 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, where the black and white list is read from a database by the client through a configuration execution command line script, and the black and white list includes host information that needs to be executed by the batch operation; 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 the result of executing the batch operation execution command fed back by each target host.
In some embodiments of the present application, the sending unit 906 is configured to: if the batch operation execution command contains a first parameter for indicating connection of a jump server, connecting 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; and if the batch operation execution command does not contain the first parameter, directly sending the batch operation execution command to each target host.
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 analyzing the configuration command; the method comprises the steps that the method is obtained by analyzing an imported file, and the file comprises host information needing to be managed; and screening and acquiring host information matched with the specified field information from other databases according to the specified field information.
In some embodiments of the present application, the apparatus further comprises: the detection unit is configured to detect the batch operation execution command so as to determine whether the batch operation execution command is a high-risk command; and the alarm unit is configured to send an alarm prompt if the batch operation execution command is a high-risk command, wherein the alarm prompt is used for prompting whether to send the batch operation execution command to each target host.
In some embodiments of the present application, the apparatus further comprises: a first display unit, configured to display, if the batch operation execution command includes a second parameter for indicating an execution progress of the batch operation execution command executed by each target host, the execution progress of the batch operation execution command executed by each target host according to the second parameter; and the non-display unit is configured to not display the execution progress of the batch operation execution command executed by each target host if the batch operation execution command does not include the second parameter.
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 apparatus further includes: and the login unit is configured to log in to each target host through an account password login mode or a key login mode.
In some embodiments of the present application, the apparatus further comprises: a third receiving unit configured to receive a job command sent by the client; and the second display unit is configured to display a batch operation execution list according to the job command, and historical batch operations and operation results corresponding to the historical batch operations are recorded in the batch operation execution list.
FIG. 10 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 1000 of the electronic device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 10, the computer system 1000 includes a Central Processing Unit (CPU)1001 that can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 1002 or a program loaded from a storage portion 1008 into a Random Access Memory (RAM) 1003. In the RAM 1003, various programs and data necessary for system operation are also stored. 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.
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 a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 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, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The driver 1010 is also connected to the I/O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is mounted into the storage section 1008 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication part 1009 and/or installed from the removable medium 1011. When the computer program is executed by a Central Processing Unit (CPU)1001, various functions defined in the system of the present application are executed.
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. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with a computer program embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination 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 disk, a removable 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.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements 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 application is limited only by the appended claims.

Claims (10)

1. A method for batch operation execution, the method comprising:
receiving a batch operation execution command sent by a client;
according to the batch operation execution command, acquiring a plurality of 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 a configuration execution command line script, and the black and white list contains host information required to be executed by the batch operation;
sending the batch operation execution command to each target host to enable each target host to execute the batch operation execution command;
and receiving the result of executing the batch operation execution command fed back by each target host.
2. The method of claim 1, wherein sending the batch operation execution command to each target host comprises:
if the batch operation execution command contains a first parameter for indicating connection of a jump server, connecting 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;
and if the batch operation execution command does not contain the first parameter, directly sending the batch operation execution command to each target host.
3. The method of claim 1, wherein the host information stored in the database is obtained by at least one of:
obtained by analyzing the configuration command;
the method comprises the steps that the method is obtained by analyzing an imported file, and the file comprises host information needing to be managed;
and screening and acquiring host information matched with the specified field information from other databases according to the specified field information.
4. The method of claim 1, further comprising:
detecting the batch operation execution command to determine whether the batch operation execution command is a high-risk command;
and if the batch operation execution command is a high-risk command, sending an alarm prompt, wherein the alarm prompt is used for prompting whether to send the batch operation execution command to each target host.
5. The method of claim 1, further comprising:
if the batch operation execution command contains a second parameter for indicating the execution progress of the batch operation execution command executed by each target host, displaying the execution progress of the batch operation execution command executed by each target host according to the second parameter;
and if the batch operation execution command does not contain the second parameter, not displaying the execution progress of each target host for executing the batch operation execution command.
6. The method of claim 1, further comprising:
and before the batch operation execution command is sent to each target host, logging in each target host in an account and password login mode or a key login mode.
7. The method of claim 1, further comprising:
receiving a job command sent by the client;
and displaying a batch operation execution list according to the job command, wherein historical batch operations and operation results corresponding to the historical batch operations are recorded in the batch operation execution list.
8. A batch operation execution apparatus, comprising:
the system comprises a first receiving unit, a second receiving unit and a control unit, wherein the first receiving unit is configured to receive a batch operation execution command sent by a client;
the acquisition unit is configured to acquire a plurality of target hosts corresponding to the batch operation execution command from a pre-configured black and white list according to the batch operation execution command, wherein the black and white list is read from a database by the client through a configuration execution command line script, and the black and white list contains host information required to be executed by the batch operation;
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 the second receiving unit is configured to receive the result of executing the batch operation execution command fed back by each target host.
9. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the batch operation execution method according to any one of claims 1 to 7.
10. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the batch operation execution method of any one of claims 1 to 7.
CN202011457904.9A 2020-12-10 2020-12-10 Batch operation execution method and device, readable medium and electronic equipment Pending CN112579165A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011457904.9A CN112579165A (en) 2020-12-10 2020-12-10 Batch operation execution method and device, readable medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011457904.9A CN112579165A (en) 2020-12-10 2020-12-10 Batch operation execution method and device, readable medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN112579165A true CN112579165A (en) 2021-03-30

Family

ID=75132102

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011457904.9A Pending CN112579165A (en) 2020-12-10 2020-12-10 Batch operation execution method and device, readable medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112579165A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114301971A (en) * 2021-12-28 2022-04-08 北京天融信网络安全技术有限公司 Operation and maintenance method and device based on batch sending of instructions, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114301971A (en) * 2021-12-28 2022-04-08 北京天融信网络安全技术有限公司 Operation and maintenance method and device based on batch sending of instructions, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US9734005B2 (en) Log analytics for problem diagnosis
WO2014193441A1 (en) Driver installation for targeted and not-connected devices
CN111177112A (en) Database blocking method and device based on operation and maintenance management system and electronic equipment
CN104765621A (en) Method and system for deploying program on cluster node
CN111580869A (en) Data communication method and system based on OPC UA
CN110580244A (en) file processing method and device, server and storage medium
JP2016143423A (en) Computer program, apparatus, and method for providing multifunctional peripheral device with access to external web services
CN110428319B (en) Data comparison platform, method, equipment and storage medium
US20230161738A1 (en) Building collaborative data processing flows
CN110708366A (en) Plug-in process management method, related method and related device
CN111782651A (en) Visual editing method, device and equipment for data association relation and storage medium
CN111078424A (en) Information interaction method and device, computer equipment and storage medium
CN114489954A (en) Tenant creation method based on virtualization platform, tenant access method and equipment
US20220337668A1 (en) Systems and methods for real-time repository management for universal service deployment
CN112579165A (en) Batch operation execution method and device, readable medium and electronic equipment
CN111522617B (en) Method and device for maintaining system and electronic equipment
CN112204527A (en) Method and system for processing engineering data in a multi-engineering system environment
CN113886093B (en) Cloud resource management system based on multi-cloud architecture and electronic equipment
US20220345517A1 (en) Unified application management for heterogeneous application delivery
US11330053B1 (en) Making eventual consistency cache updates deterministic
CN112559233B (en) Method, device, equipment and computer readable medium for identifying fault type
CN115904527A (en) Data processing method, device, equipment and medium
CN111092765B (en) Intelligent driving method, system, electronic device and readable storage medium
CN110221910B (en) Method and apparatus for performing MPI jobs
JP2018120256A (en) Setting operation input support apparatus and setting operation input support system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40040476

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination