A Zookeeper cluster maintenance method and device, electronic equipment and storage medium

By using the batch operation interface and verification mechanism of the ZooKeeper cluster control server, the problem of low operation and maintenance efficiency of Znode nodes in the ZooKeeper cluster is solved, and efficient batch operation and accuracy verification are achieved.

CN115701697BActive Publication Date: 2026-06-12NETSUNION CLEARING CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETSUNION CLEARING CORP
Filing Date
2021-08-02
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing technology requires users to log in to each server in the Zookeeper cluster to operate on individual Znode nodes, resulting in long maintenance times and low efficiency for Znode nodes.

Method used

The ZooKeeper cluster control server executes batch operation interfaces to receive batch operation requests for multiple Znode nodes, and verifies the request information to determine whether to execute the batch operation.

🎯Benefits of technology

It improves the operational efficiency of Zookeeper clusters, reduces the probability of human error, and ensures the accuracy and efficiency of batch operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115701697B_ABST
    Figure CN115701697B_ABST
Patent Text Reader

Abstract

The application discloses a Zookeeper cluster maintenance method and device, electronic equipment and a storage medium. The method is executed by a ZooKeeper cluster control server. The method comprises the following steps: receiving a batch operation request for a plurality of target Znode nodes through a batch operation interface, wherein the batch operation request comprises information of each target Znode node; checking the information of each target Znode node in the batch operation request; and determining whether to execute a batch operation corresponding to the batch operation request on each target Znode node according to a checking result. Compared with the existing mode in which a user needs to log in to each server in a Zookeeper cluster to respectively perform an operation on a single Znode node, the application meets the demand of the user for batch operations on Znode nodes through a batch operation interface set in advance, improves the operation and maintenance efficiency of the Zookeeper cluster, and further reduces the probability of human error operation through automatic parameter checking on the batch operation request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of distributed cluster technology, and in particular to a Zookeeper cluster maintenance method, apparatus, electronic device, and storage medium. Background Technology

[0002] ZooKeeper is an open-source distributed application coordination service that is typically deployed on multiple machines, forming a ZooKeeper cluster. Each server deploys a certain number of Znode nodes as the basic unit for providing services.

[0003] In real-world business scenarios, due to changes in various business requirements or the occurrence of node anomalies, it is necessary to perform various adaptive operations on the Znode nodes in the ZooKeeper cluster. For example, in order to cope with the increase in business volume, it is necessary to add a certain number of Znode nodes to provide more service capabilities, or to delete abnormal Znode nodes in a timely manner to avoid affecting the actual business.

[0004] However, the inventors discovered that existing technology requires users to log in to each server in the Zookeeper cluster to operate on individual Znode nodes, resulting in long Znode node operation and maintenance times and low efficiency. Summary of the Invention

[0005] This application provides a Zookeeper cluster maintenance method, apparatus, electronic device, and storage medium to improve the operation and maintenance efficiency of Zookeeper clusters.

[0006] The embodiments of this application adopt the following technical solutions:

[0007] In a first aspect, embodiments of this application provide a ZooKeeper cluster maintenance method, executed by a ZooKeeper cluster control server, wherein the method includes:

[0008] The batch operation interface receives batch operation requests for multiple target Znodes, and the batch operation requests for target Znodes include information about each target Znode.

[0009] Verify the information of each target Znode node in the batch operation request;

[0010] Based on the verification results, determine whether to execute the batch operation corresponding to the batch operation request on each target Znode node.

[0011] Optionally, the verification of the information of each target Znode node in the batch operation request includes:

[0012] The batch operation type is determined based on the batch operation request of the target Znode node;

[0013] Based on the batch operation type, the information of each target Znode node in the batch operation request is verified to obtain the verification result.

[0014] Optionally, the step of verifying the information of each target Znode node in the batch operation request according to the batch operation type includes:

[0015] Based on the information of each target Znode node, a match is performed in the Znode node information database to obtain the matching results;

[0016] Based on the matching results and the batch operation type, the verification results of the information of each target Znode node in the batch operation request are determined.

[0017] Optionally, the information of the target Znode includes the node identifier of the target Znode, and the matching process in the Znode information database based on the information of each target Znode to obtain the matching result includes:

[0018] Determine whether the node identifier of the target Znode can be found in the Znode information database;

[0019] If so, the matching result is determined to be a successful match;

[0020] If not, then the matching result is determined to be a matching failure.

[0021] Optionally, determining the verification result of the information of each target Znode node in the batch operation request based on the matching result and the batch operation type includes:

[0022] If the matching result is a successful match and the batch operation type is a batch deletion operation, or if the matching result is a failed match and the batch operation type is a batch addition operation, then the verification result is determined to be a successful verification.

[0023] Optionally, the step of verifying the information of each target Znode node in the batch operation request according to the batch operation type, and obtaining the verification result, includes:

[0024] The batch operation request of the target Znode node is converted into the first ZooKeeper four-word command;

[0025] The first ZooKeeper four-word command is used to establish a communication connection with the server where the ZooKeeper cluster is located, so as to obtain the result returned by the server.

[0026] Based on the results returned by the server and the batch operation type, determine the verification result of the information of each target Znode node in the batch operation request.

[0027] Optionally, receiving batch operation requests for multiple target Znode nodes through the batch operation interface includes:

[0028] Configure the batch operation interface according to the preset parameter format, wherein the preset parameter format includes the parameter format of the ZooKeeper four-word command.

[0029] Optionally, the verification result includes the verification result of the information of the current target Znode node, and the step of determining whether to perform the batch operation corresponding to the batch operation request on each target Znode node based on the verification result includes:

[0030] If the verification result of the information of the current target Znode node is successful, determine to perform the batch operation corresponding to the batch operation request on the current target Znode node and return the first prompt information;

[0031] If the verification result of the information of the current target Znode node is that the verification fails, the second prompt message will be returned directly.

[0032] The current target Znode node can be any one of multiple target Znode nodes.

[0033] Optionally, the method further includes:

[0034] Provide the front-end page;

[0035] The process of receiving batch operation requests for multiple target Znode nodes through the batch operation interface includes:

[0036] The batch operation interface is invoked through the front-end page to receive the batch operation request.

[0037] Optionally, the method further includes:

[0038] The front-end page receives query requests for Znode information.

[0039] The query request for Znode information is converted into a second ZooKeeper four-word command.

[0040] The second ZooKeeper four-word command is used to establish a communication connection with the server where the ZooKeeper cluster is located in order to obtain the query results returned by the server.

[0041] Receive the query results returned by the server.

[0042] Optionally, the Znode information database is obtained in the following way:

[0043] Receive information about the Znode nodes from the server through the preset Znode node information receiving interface;

[0044] The information of the Znode nodes on the server is formatted.

[0045] The formatted Znode information is stored in the Znode information database.

[0046] Optionally, the information of the Znode on the server side may also include at least one of the following: node creation time, node version number, parent node information, child node information, and node status information.

[0047] Secondly, embodiments of this application also provide a Zookeeper cluster maintenance device, applied to a ZooKeeper cluster control server, wherein the device is used to implement any of the methods described above.

[0048] Thirdly, embodiments of this application also provide an electronic device, including:

[0049] Processor; and

[0050] A memory configured to store computer-executable instructions, which, when executed, cause the processor to perform any of the methods described above.

[0051] Fourthly, embodiments of this application also provide a computer-readable storage medium that stores one or more programs, which, when executed by an electronic device including multiple applications, cause the electronic device to perform any of the methods described above.

[0052] The at least one technical solution adopted in this application embodiment can achieve the following beneficial effects: The Zookeeper cluster maintenance method of this application embodiment can be executed by a separately deployed ZooKeeper cluster control server. During the maintenance of the Zookeeper cluster, a batch operation request for multiple target Znode nodes is received through a pre-configured batch operation interface. The batch operation request for the target Znode nodes includes information about each target Znode node. Then, the information of each target Znode node in the batch operation request is verified. Finally, based on the verification result, it is determined whether to execute the batch operation corresponding to the batch operation request for each target Znode node. Compared with the existing method that requires users to log in to each server in the Zookeeper cluster to perform operations on individual Znode nodes, the Zookeeper cluster maintenance method of this application embodiment meets the user's need to perform batch operations on Znode nodes in the Zookeeper cluster through a pre-configured batch operation interface, greatly improving the operation and maintenance efficiency of the Zookeeper cluster. In addition, by automatically verifying the parameters of the batch operation requests, the probability of human error is greatly reduced. Attached Figure Description

[0053] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0054] Figure 1 This is a flowchart illustrating a Zookeeper cluster maintenance method according to an embodiment of this application;

[0055] Figure 2 This is a schematic diagram of a Zookeeper cluster maintenance process in an embodiment of this application;

[0056] Figure 3 This is a schematic diagram of the structure of a Zookeeper cluster maintenance device according to an embodiment of this application.

[0057] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0058] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0059] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0060] This application provides a ZooKeeper cluster maintenance method, executed by a ZooKeeper cluster control server, such as... Figure 1 The diagram illustrates a flowchart of a Zookeeper cluster maintenance method according to an embodiment of this application. The method includes at least the following steps S110 to S130:

[0061] Step S110: Receive batch operation requests for multiple target Znode nodes through the batch operation interface. The batch operation requests for target Znode nodes include information about each target Znode node.

[0062] The Zookeeper cluster maintenance method of this application embodiment can be executed by a separately deployed ZooKeeper cluster control server. Before maintaining the Zookeeper cluster, the batch operation request of the target Znode node is received through a pre-configured batch operation interface. That is, the batch operation interface of this application embodiment can realize the function of uniformly receiving user requests to perform batch operations on Znode nodes in the Zookeeper cluster. This avoids the need for users to log in to each server in the Zookeeper cluster to perform operations on individual Znode nodes, thereby improving the maintenance efficiency of Znode nodes.

[0063] Since each server in the Zookeeper cluster deploys a certain number of Znode nodes, the target Znode node here can be considered as any number of Znode nodes.

[0064] The batch operation request for the target Znode can include information about each target Znode, such as the node name of the target Znode.

[0065] Step S120: Verify the information of each target Znode node in the batch operation request.

[0066] After receiving a batch operation request for the target Znode, in order to ensure the accuracy of the batch operation, it is necessary to verify the information of each target Znode in the batch operation request. This verification can be considered from two dimensions: one is to verify the legality of the parameters carried in the batch operation request, and the other is to verify the feasibility of the batch operation request for the target Znode.

[0067] Of course, in addition to the two dimensions of verification mentioned above, those skilled in the art can also set other dimensions of verification according to actual needs to ensure the accuracy of subsequent batch operations on Znode nodes and improve the probability of successful batch operations.

[0068] Step S130: Determine whether to perform the batch operation corresponding to the batch operation request on each target Znode node based on the verification result.

[0069] Since there are multiple target Znodes in the batch operation scenario, after the batch operation request for the target Znode is verified, the verification result of each target Znode is obtained. Then, the corresponding batch operation can be performed on the target Znode based on the verification result of each target Znode.

[0070] It should be noted that the "batch operation" in this application embodiment is mainly for user operation. Compared with the existing method that requires users to log in to each server in the Zookeeper cluster to operate on a single Znode node, this application embodiment only requires users to input or select multiple Znode nodes to be operated on at once, which is more user-friendly. However, the specific batch operation process is still essentially executed on each Znode node separately.

[0071] The Zookeeper cluster maintenance method in this application meets the need for batch operations on Znode nodes in the Zookeeper cluster through a pre-configured batch operation interface, greatly improving the operation and maintenance efficiency of the Zookeeper cluster. In addition, by performing automated parameter verification on batch operation requests, the probability of human error is greatly reduced.

[0072] In one embodiment of this application, the verification of the information of each target Znode node in the batch operation request includes: determining the batch operation type based on the batch operation request of the target Znode node; and verifying the information of each target Znode node in the batch operation request based on the batch operation type to obtain the verification result.

[0073] As mentioned above, the batch operation request of the target Znode node in this embodiment of the application may also carry a batch operation type parameter, such as whether it is a batch add operation of Znode nodes or a batch delete operation of Znode nodes. Therefore, the batch operation type can be determined according to the batch operation request of the target Znode node.

[0074] Different types of batch operations affect the verification of batch operation requests for Znode nodes. Therefore, based on the determined batch operation type, the information of each target Znode node in the batch operation request can be verified to obtain the verification result.

[0075] In one embodiment of this application, the step of verifying the information of each target Znode node in the batch operation request according to the batch operation type and obtaining the verification result includes: matching the information of each target Znode node in the Znode node information database to obtain a matching result; and determining the verification result of the information of each target Znode node in the batch operation request according to the matching result and the batch operation type.

[0076] In this embodiment of the application, when verifying the information of each target Znode node in a batch operation request, the information of the target Znode node can be searched and matched in a pre-built Znode node information database to determine whether the information of the target Znode node can be found in the Znode node information database. Then, based on the search and matching results and the batch operation type carried in the batch operation request, the verification result of the batch operation request is determined, thereby determining the feasibility of the batch operation request.

[0077] The aforementioned Znode information database can be viewed as a database used to store and manage information about all Znode nodes in the entire ZooKeeper cluster. This Znode information database can be considered as part of the ZooKeeper cluster control server in this application embodiment, or it can exist independently of the ZooKeeper cluster control server.

[0078] In one embodiment of this application, the information of the target Znode node includes the node identifier of the target Znode node. The step of matching in the Znode node information database based on the information of each target Znode node to obtain the matching result includes: determining whether the node identifier of the target Znode node can be found in the Znode node information database; if it can, the matching result is determined to be a successful match; if it cannot, the matching result is determined to be a failed match.

[0079] In this embodiment of the application, when matching the Znode information database based on the information of each target Znode node, the main method used is to match the node identifier of the target Znode node, such as the node name. This node identifier is a unique identifier for each target Znode node, thus ensuring the accuracy of the matching results.

[0080] During the matching process, the node identifier of the target Znode node can be retrieved from the Znode node information database. If it can be retrieved, the match is considered successful; otherwise, the match is considered unsuccessful.

[0081] In real-world applications, the node identifier of the target Znode entered by the user may not be a complete identifier. For example, if the Znode the user wants to operate on is identified as "ABC", but the user only entered "AB", then fuzzy matching can be used to retrieve all target Znodes whose identifiers contain "AB" from the Znode information database and return them to the user for further selection.

[0082] In one embodiment of this application, determining the verification result of the information of each target Znode node in the batch operation request based on the matching result and the batch operation type includes: if the matching result is a successful match and the batch operation type is a batch deletion operation, or if the matching result is a failed match and the batch operation type is a batch addition operation, then the verification result is determined to be a successful verification.

[0083] In practical applications, batch operations on Znode nodes generally include two types: batch add operations and batch delete operations. Batch add operations involve adding multiple Znode nodes at once on the server side, while batch delete operations involve deleting multiple Znode nodes at once on the server side.

[0084] Specifically, since each Znode's name is unique, if a user wants to perform a batch add operation on Znodes, the name of the newly added Znode should not be matched in the existing data of the Znode information database. In other words, if the batch operation request carries a batch add operation type and the matching result is a failure, it means the user's request to add the Znode is feasible, and therefore the verification passes. Similarly, if a user wants to perform a batch delete operation on Znodes, the name of the Znode to be deleted should be matched in the existing data of the Znode information database. That is, if the batch operation request carries a batch delete operation type and the matching result is a success, it means the user's request to delete the Znode is feasible, and therefore the verification passes.

[0085] Conversely, if the batch operation type is a batch add operation, but the matching result is a successful match, it means that the node name the user wants to add already exists and cannot be added again. Therefore, the verification result is "verification failed." Similarly, if the batch operation type is a batch delete operation, but the matching result is a failed match, it means that the Znode node the user wants to delete cannot be found in the existing Znode node information database, and therefore the subsequent batch delete operation cannot be executed. Thus, the verification result is also "verification failed."

[0086] The above verification process ensures the accuracy of batch operations on Znode nodes, increases the probability of successful batch operations, reduces the risk of human error compared to manual methods, and greatly improves operational efficiency.

[0087] In one embodiment of this application, the step of verifying the information of each target Znode node in the batch operation request according to the batch operation type to obtain the verification result includes: converting the batch operation request of the target Znode node into a first ZooKeeper four-word command; establishing a communication connection with the server where the ZooKeeper cluster is located through the first ZooKeeper four-word command to obtain the result returned by the server; and determining the verification result of the information of each target Znode node in the batch operation request according to the result returned by the server and the batch operation type.

[0088] Because the data stored in the Znode information database in the above embodiments is typically refreshed periodically rather than updated in real time, there is a certain delay in the Znode information database's perception of changes in Znode information. In other words, when Znode information changes on the server side, the Znode information database cannot detect it in real time; therefore, the Znode information stored in the Znode information database is sometimes not the latest Znode information.

[0089] Considering the above issues, to further ensure the accuracy of the verification results, batch operation requests can also be verified by obtaining real-time Znode information. Specifically, the batch operation requests received from the target Znode can be converted into a first ZooKeeper four-letter command. ZooKeeper four-letter commands are commands in ZooKeeper used to support obtaining node service status and related information; these commands consist of four letters, hence the name "four-letter commands." Of course, besides using ZooKeeper four-letter commands to obtain node information, other communication commands can also be used; no specific limitations are made here.

[0090] Then, by using the first ZooKeeper command, a communication connection can be established with the server where the ZooKeeper cluster is located, and the real-time results returned by the server can be received. Specifically, this may include information about all Znode nodes currently existing in the server. Based on the real-time results returned by the server and the batch operation type carried in the batch operation request, the verification result of the batch operation request for the target Znode node can be determined. The specific determination method can refer to the verification method based on the Znode node information database in the above embodiment, which will not be elaborated here.

[0091] In one embodiment of this application, receiving batch operation requests for multiple target Znode nodes through the batch operation interface includes: configuring the batch operation interface according to a preset parameter format, wherein the preset parameter format includes the parameter format of the ZooKeeper four-word command.

[0092] In this embodiment of the application, a batch operation interface is configured in the ZooKeeper cluster control server. The function of this batch operation interface is to uniformly receive user requests to perform batch operations on Znode nodes in the ZooKeeper cluster, such as batch deletion of Znode nodes or batch addition of Znode nodes.

[0093] The batch operation interface can define various parameters related to batch operations, such as Znode name, Znode type, and batch operation type, so that the batch operation interface can determine which Znodes the user wants to perform which type of batch operation on by receiving batch operation requests.

[0094] In order to improve the conversion efficiency and accuracy of batch operation requests in the above embodiments, this application embodiment can also configure the batch operation interface based on the parameter format of ZooKeeper four-letter commands, so that the parameter format carried in the request received through the batch operation interface can conform to the parameter format of ZooKeeper four-letter commands as much as possible.

[0095] In one embodiment of this application, the matching result includes information about the matched Znode nodes. After matching in the Znode node information database based on the information of the target Znode nodes, the method further includes: obtaining the user's selection result for the information of the matched Znode nodes and displaying the selection result to the user; receiving the user's confirmation instruction for the selection result; and determining whether to perform the batch operation corresponding to the batch operation request on each target Znode node based on the verification result includes: performing the corresponding batch operation on the corresponding Znode node according to the confirmation instruction.

[0096] like Figure 2 As shown, a schematic diagram of a Zookeeper cluster maintenance process in an embodiment of this application is provided. Figure 2 The nodes mentioned refer to Znodes. In practical applications, users can trigger batch operation requests for target Znodes in two ways. One way is that after querying all Znode information, the user can make multiple selections, and then the selection results are displayed to the user. After the user confirms that everything is correct, the batch operation is executed. The other way is that the user can enter the complete or partial Znode name, and then search for all matching node names and display them to the user. After the user makes a selection, the selection results are displayed to the user, and the batch operation is executed after the user confirms that everything is correct, or the batch operation can be executed directly. Of course, how to use users to trigger batch operation requests and execute batch operations can be flexibly configured by those skilled in the art according to actual needs, and will not be listed here.

[0097] In one embodiment of this application, the verification result includes the verification result of the information of the current target Znode node. The step of determining whether to perform the batch operation corresponding to the batch operation request on each target Znode node based on the verification result includes: if the verification result of the information of the current target Znode node is a successful verification, determining to perform the batch operation corresponding to the batch operation request on the current target Znode node and returning a first prompt message; if the verification result of the information of the current target Znode node is a failed verification, then directly returning a second prompt message; wherein, the current target Znode node is any one of multiple target Znode nodes.

[0098] A batch operation request for a target Znode involves multiple target Znodes. During verification, the information of each target Znode is verified separately, resulting in a verification result for each target Znode. If the verification of the current target Znode passes, it means that the current target Znode meets the feasibility requirements for batch operations, and the batch operation can be performed on it, with a success message returned. If the verification of the current target Znode fails, it means that the current target Znode does not meet the feasibility requirements for batch operations, and the batch operation cannot be performed on it, thus a message indicating that the batch operation cannot be performed on that target Znode is returned.

[0099] It should be noted that since the above embodiments perform verification for each target Znode node separately, it is possible that some target Znode nodes meet the feasibility requirements and some do not in a batch operation request. However, this does not affect the execution of the "batch operation", because from the execution level, the "batch operation" itself is still an operation performed on each Znode node that meets the requirements. Whether it is a batch or not is only for user operation.

[0100] In one embodiment of this application, the method further includes: providing a front-end page; receiving batch operation requests for multiple target Znode nodes through a batch operation interface includes: calling the batch operation interface through the front-end page to receive the batch operation requests through the batch operation interface.

[0101] To provide information visualization capabilities, this application embodiment also provides a front-end page, which is based on the B / S mode (Browser / Server) to maintain Znode nodes in the Zookeeper cluster. Users can call the batch operation interface on the front-end page by inputting Znode node information or selecting Znode node information, thereby triggering batch operation requests for multiple target Znode nodes.

[0102] In addition, the results of batch operations on target Znodes can be displayed on the front-end page. For example, it can show which target Znodes were successfully operated, which failed, and which did not meet the operation requirements, so that users can perform subsequent processing in a timely manner.

[0103] In one embodiment of this application, the method further includes: receiving a query request for Znode node information through the front-end page; converting the query request for Znode node information into a second ZooKeeper four-word command; establishing a communication connection with the server where the ZooKeeper cluster is located through the second ZooKeeper four-word command to obtain the query results returned by the server; and receiving the query results returned by the server.

[0104] In addition to enabling batch operations on the target Znode nodes described in the above embodiments, this application also provides a Znode node information query function. First, the user can trigger a Znode node information query request on the front-end page by clicking a button or entering text. Then, the Znode node information query request is converted into a second ZooKeeper four-word command after parameter validation and other analysis. After that, the second ZooKeeper four-word command is used to interact with the server where the ZooKeeper cluster is located, thereby obtaining the query results returned by the server. Finally, the query results are returned to the front-end page for display.

[0105] In one embodiment of this application, the Znode information database is obtained by: receiving Znode information from the server through a preset Znode information receiving interface; formatting the Znode information from the server; and storing the formatted Znode information into the Znode information database.

[0106] In existing technologies, information about each server in the ZooKeeper cluster, such as running status, configuration information, and some service statistics such as latency, number of packets sent and received, and number of connections, is mainly obtained through the four-word command ZooKeeper. This information is then displayed to the user through the front-end page.

[0107] However, the information obtained in this way is only at the cluster level and cannot be obtained at the Znode level, such as node name, node creation time, node version number, parent node information, child node information, and node status information. This makes it impossible to rely on the existing cluster-level information when troubleshooting Znode nodes or performing batch operations on Znode nodes.

[0108] In view of the above problems, this application embodiment constructs a Znode information database, which is used to uniformly manage and maintain node-level information such as node name, node creation time, node version number, and parent / child node information.

[0109] Specifically, a Znode information receiving interface can be pre-configured. This interface can be seen as an interface for obtaining Znode information, and parameters for different dimensions of Znode information can be defined. Then, communication connections are established with each server in the ZooKeeper cluster. Through the aforementioned Znode information receiving interface, Znode information reported by the servers can be received. Since the format of information reported by different servers may differ, the Znode information can be formatted according to pre-defined data storage requirements. Finally, the formatted Znode information is stored in the Znode information database, thus completing the construction of the Znode information database.

[0110] Based on this constructed Znode information database, users can also be provided with a Znode information query function. A corresponding front-end page can also be provided for querying and displaying Znode information. After a user performs a query on the front-end page, a Znode information query request will be triggered. The database will then be searched and matched according to the query request, and the corresponding Znode query results will be displayed on the front-end page. This allows users to obtain Znode granularity information, facilitating the subsequent location of problematic Znodes and improving the efficiency of problem detection and resolution. It also facilitates subsequent batch operations on Znodes.

[0111] It should be noted that although the embodiments of this application are limited to performing batch operations on Znode nodes, depending on business needs, there may be situations where a user only needs to operate on a single Znode node. Therefore, in practical applications, the batch operation interface can be set to accept operation requests for a single Znode node, so that when a user only wants to operate on a certain Znode node, the technical solution in the above embodiments of this application can still be used, that is, the number of Znode nodes will not affect the application scope of this application.

[0112] This application also provides a ZooKeeper cluster maintenance device 300, applied to a ZooKeeper cluster control server, such as... Figure 3 The diagram shows a schematic representation of a Zookeeper cluster maintenance device according to an embodiment of this application. The device 300 includes: a first receiving unit 310, a verification unit 320, and an operation unit 330, wherein:

[0113] The first receiving unit 310 is configured to receive batch operation requests for multiple target Znode nodes through a batch operation interface, wherein the batch operation requests for target Znode nodes include information about each target Znode node.

[0114] Verification unit 320 is used to verify the information of each target Znode node in the batch operation request;

[0115] The operation unit 330 is used to determine whether to perform the batch operation corresponding to the batch operation request on each target Znode node based on the verification result.

[0116] In one embodiment of this application, the verification unit 320 is specifically used to: determine the batch operation type based on the batch operation request of the target Znode node; and verify the information of each target Znode node in the batch operation request based on the batch operation type to obtain the verification result.

[0117] In one embodiment of this application, the verification unit 320 is specifically used to: perform matching in the Znode information database according to the information of each target Znode node to obtain a matching result; and determine the verification result of the information of each target Znode node in the batch operation request according to the matching result and the batch operation type.

[0118] In one embodiment of this application, the information of the target Znode node includes the node identifier of the target Znode node, and the verification unit 320 is specifically used to: determine whether the node identifier of the target Znode node can be found in the Znode node information database; if it can, then determine that the matching result is a successful match; if it cannot, then determine that the matching result is a failed match.

[0119] In one embodiment of this application, the verification unit 320 is specifically used to: determine that the verification result is successful if the matching result is a successful match and the batch operation type is a batch deletion operation, or if the matching result is a failed match and the batch operation type is a batch addition operation.

[0120] In one embodiment of this application, the verification unit 320 is specifically used to: convert the batch operation request of the target Znode node into a first ZooKeeper four-word command; establish a communication connection with the server where the ZooKeeper cluster is located through the first ZooKeeper four-word command to obtain the result returned by the server; and determine the verification result of the information of each target Znode node in the batch operation request based on the result returned by the server and the batch operation type.

[0121] In one embodiment of this application, the first receiving unit 310 is specifically used to: configure a batch operation interface according to a preset parameter format, wherein the preset parameter format includes the parameter format of the ZooKeeper four-word command.

[0122] In one embodiment of this application, the verification result includes the verification result of the information of the current target Znode node. The operation unit 330 is specifically used to: if the verification result of the information of the current target Znode node is that the verification passes, determine to perform the batch operation corresponding to the batch operation request on the current target Znode node and return a first prompt message; if the verification result of the information of the current target Znode node is that the verification fails, then directly return a second prompt message; wherein, the current target Znode node is any one of a plurality of target Znode nodes.

[0123] In one embodiment of this application, the apparatus further includes: a providing unit for providing a front-end page; the first receiving unit 310 is specifically used for: calling the batch operation interface through the front-end page to receive the batch operation request through the batch operation interface.

[0124] In one embodiment of this application, the apparatus further includes: a second receiving unit, configured to receive a query request for Znode node information through the front-end page; a conversion unit, configured to convert the query request for Znode node information into a second ZooKeeper four-word command; a communication unit, configured to establish a communication connection with the server where the ZooKeeper cluster is located through the second ZooKeeper four-word command, so as to obtain the query results returned by the server; and a third receiving unit, configured to receive the query results returned by the server.

[0125] In one embodiment of this application, the Znode information database is obtained by: receiving Znode information from the server through a preset Znode information receiving interface; formatting the Znode information from the server; and storing the formatted Znode information into the Znode information database.

[0126] In one embodiment of this application, the information of the Znode on the server side also includes at least one of the following: node creation time, node version number, parent node information, child node information, and node status information.

[0127] It is understood that the above-described Zookeeper cluster maintenance device can implement all the steps of the Zookeeper cluster maintenance method executed by the ZooKeeper cluster control server provided in the foregoing embodiments. The relevant explanations of the Zookeeper cluster maintenance method are applicable to the Zookeeper cluster maintenance device and will not be repeated here.

[0128] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Please refer to it. Figure 4 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for other business operations.

[0129] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0130] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.

[0131] The processor reads the corresponding computer program from non-volatile memory into memory and then runs it, forming the Zookeeper cluster maintenance device at the logical level. The processor executes the program stored in memory and specifically performs the following operations:

[0132] The batch operation interface receives batch operation requests for multiple target Znodes, and the batch operation requests for target Znodes include information about each target Znode.

[0133] Verify the information of each target Znode node in the batch operation request;

[0134] Based on the verification results, determine whether to execute the batch operation corresponding to the batch operation request on each target Znode node.

[0135] The above is as stated in this application. Figure 1The method executed by the Zookeeper cluster maintenance device disclosed in the illustrated embodiments can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0136] The electronic device can also perform Figure 1 The method executed by the Zookeeper cluster maintenance device, and the implementation of the Zookeeper cluster maintenance device in... Figure 1 The functions of the embodiments shown are not described in detail here.

[0137] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by an electronic device including multiple applications, enable the electronic device to perform... Figure 1 The method executed by the Zookeeper cluster maintenance device in the illustrated embodiment is specifically used to execute:

[0138] The batch operation interface receives batch operation requests for multiple target Znodes, and the batch operation requests for target Znodes include information about each target Znode.

[0139] Verify the information of each target Znode node in the batch operation request;

[0140] Based on the verification results, determine whether to execute the batch operation corresponding to the batch operation request on each target Znode node.

[0141] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0142] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0143] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0144] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0145] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0146] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0147] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0148] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0149] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0150] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for maintaining a ZooKeeper cluster, executed by a ZooKeeper cluster control server, wherein, The method includes: The batch operation interface receives batch operation requests for multiple target Znodes, and the batch operation requests for target Znodes include information about each target Znode. Verify the information of each target Znode node in the batch operation request; Based on the verification results, determine whether to execute the batch operation corresponding to the batch operation request for each target Znode node; The verification includes validating the parameters carried in the batch operation request and verifying the feasibility of the batch operation request to the target Znode node. The verification of the information of each target Znode node in the batch operation request includes: The batch operation type is determined based on the batch operation request of the target Znode node; Based on the batch operation type, the information of each target Znode node in the batch operation request is verified to obtain the verification result; The step of verifying the information of each target Znode node in the batch operation request according to the batch operation type, and obtaining the verification result includes: The batch operation request of the target Znode node is converted into the first ZooKeeper four-word command; The first ZooKeeper four-word command is used to establish a communication connection with the server where the ZooKeeper cluster is located, so as to obtain the result returned by the server. Based on the results returned by the server and the batch operation type, determine the verification result of the information of each target Znode node in the batch operation request; The result returned by the server includes information about all Znode nodes currently existing on the server. The process of receiving batch operation requests for multiple target Znode nodes through the batch operation interface includes: Configure the batch operation interface according to the preset parameter format, wherein the preset parameter format includes the parameter format of the ZooKeeper four-word command.

2. The method as described in claim 1, wherein, The step of verifying the information of each target Znode node in the batch operation request according to the batch operation type includes: Based on the information of each target Znode node, a match is performed in the Znode node information database to obtain the matching results; Based on the matching results and the batch operation type, the verification result of the information of each target Znode node in the batch operation request is determined.

3. The method as described in claim 2, wherein, The information of the target Znode includes the node identifier of the target Znode. The matching process, based on the information of each target Znode, in the Znode information database to obtain the matching results includes: Determine whether the node identifier of the target Znode can be found in the Znode information database; If so, the matching result is determined to be a successful match; If not, then the matching result is determined to be a matching failure.

4. The method as described in claim 2, wherein, The step of determining the verification result of the information of each target Znode node in the batch operation request based on the matching result and the batch operation type includes: If the matching result is a successful match and the batch operation type is a batch deletion operation, or if the matching result is a failed match and the batch operation type is a batch addition operation, then the verification result is determined to be a successful verification.

5. The method as described in claim 1, wherein, The verification result includes the verification result of the information of the current target Znode node. Determining whether to execute the batch operation corresponding to the batch operation request on each target Znode node based on the verification result includes: If the verification result of the information of the current target Znode node is successful, determine to perform the batch operation corresponding to the batch operation request on the current target Znode node and return the first prompt information; If the verification result of the information of the current target Znode node is that the verification fails, the second prompt message will be returned directly. The current target Znode node can be any one of multiple target Znode nodes.

6. The method of claim 1, wherein, The method further includes: Provide the front-end page; The process of receiving batch operation requests for multiple target Znode nodes through the batch operation interface includes: The batch operation interface is invoked through the front-end page to receive the batch operation request.

7. The method of claim 6, wherein, The method further includes: The front-end page receives query requests for Znode information. The query request for Znode information is converted into a second ZooKeeper four-word command. The second ZooKeeper four-word command is used to establish a communication connection with the server where the ZooKeeper cluster is located in order to obtain the query results returned by the server. Receive the query results returned by the server.

8. The method of claim 2, wherein, The Znode information database is obtained in the following way: Receive information about the Znode nodes from the server through the preset Znode node information receiving interface; The information of the Znode nodes on the server is formatted. The formatted Znode information is stored in the Znode information database.

9. The method of claim 8, wherein, The information of the Znode on the server side also includes at least one of the following: node creation time, node version number, parent node information, child node information, and node status information.

10. A ZooKeeper cluster maintenance device, applied to a ZooKeeper cluster control server, wherein, The device includes: The first receiving unit is configured to receive batch operation requests for multiple target Znode nodes through a batch operation interface, wherein the batch operation requests for target Znode nodes include information about each target Znode node. The verification unit is used to verify the information of each target Znode node in the batch operation request; An operation unit is used to determine, based on the verification result, whether to execute the batch operation corresponding to the batch operation request on each target Znode node; The verification includes validating the parameters carried in the batch operation request and verifying the feasibility of the batch operation request to the target Znode node. The verification unit is specifically used for: The batch operation type is determined based on the batch operation request of the target Znode node; Based on the batch operation type, the information of each target Znode node in the batch operation request is verified to obtain the verification result; The verification unit is specifically used for: The batch operation request of the target Znode node is converted into the first ZooKeeper four-word command; The first ZooKeeper four-word command is used to establish a communication connection with the server where the ZooKeeper cluster is located, so as to obtain the result returned by the server. Based on the results returned by the server and the batch operation type, determine the verification result of the information of each target Znode node in the batch operation request; The result returned by the server includes information about all Znode nodes currently existing on the server. The first receiving unit is specifically used for: Configure the batch operation interface according to the preset parameter format, wherein the preset parameter format includes the parameter format of the ZooKeeper four-word command.

11. An electronic device, comprising: processor; as well as A memory configured to store computer-executable instructions, which, when executed, cause the processor to perform the method of any one of claims 1 to 9.

12. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of applications, cause the electronic device to perform the method of any one of claims 1 to 9.