Method and device for managing ZooKeeper cluster

Through automated ZooKeeper cluster management methods and devices, the deployment and monitoring process of ZooKeeper cluster is simplified by using the Deployment controller and yaml template files, solving the problems of difficult management and complex operations in the existing technology, and achieving efficient cluster management and monitor.

CN119127220APending Publication Date: 2024-12-13BEIJING SOHU NEW MEDIA INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411143337.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The deployment, configuration, upgrade, operation and monitoring of existing ZooKeeper clusters requires a lot of manpower, which is difficult and complicated to operate.

Method used

Provides a management method and device for ZooKeeper cluster. By receiving deployment requests, a Deployment controller is generated, and the deployment is automatically completed based on yaml template files and configuration information. It supports version switching, configuration management, life cycle management, monitoring and alarms, and simplifies operations. process.

Benefits of technology

Reduces the complexity and labor costs of ZooKeeper cluster management, improves the efficiency of automated deployment and monitoring, simplifies user operations, and enhances system availability and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127220A_ABST
    Figure CN119127220A_ABST
Patent Text Reader

Abstract

The invention provides a ZooKeeper cluster management method and device. The ZooKeeper cluster management method comprises the following steps: receiving a deployment request of a ZooKeeper cluster; according to the number of nodes of a ZooKeeper cluster in a reusable packet in the deployment request, determining the target number of Deployment controllers, and according to a yaml template file of Kubernetes resources in the reusable packet in the deployment request, generating the target number of Deployment controllers; and the Deployment controller completes the deployment of the ZooKeeper cluster according to the data storage directory in the reusable packet in the deployment request and the port information of the client. And the deployment process of the ZooKeeper cluster is simplified by using the modes of templating and parameterizing. The user only needs to provide necessary configuration parameters, and does not need to manually create and manage a plurality of Kubernetes resources, so that the operation complexity is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a management method and device for a ZooKeeper cluster. Background Art

[0002] In existing distributed systems, ZooKeeper, as a very important component, provides configuration management, naming services, master election and other functions, and needs to have extremely high availability. However, in existing technologies, the deployment, configuration, upgrade, operation and maintenance, and monitoring of ZooKeeper clusters often require a lot of manpower to complete, which is very difficult. Summary of the invention

[0003] In view of this, the present application provides a ZooKeeper cluster management method and device, which simplifies the difficulty of managing the ZooKeeper cluster.

[0004] The first aspect of the present application provides a ZooKeeper cluster management method, including:

[0005] Receive a deployment request for a ZooKeeper cluster; wherein the deployment request for the ZooKeeper cluster includes a reusable package; the reusable package includes configuration information and a template directory of an application; the configuration information of the application includes the number of nodes, a data storage directory, and client port information of the ZooKeeper cluster; the template directory includes a yaml template file of a Kubernetes resource;

[0006] Determine the target number of Deployment controllers based on the number of nodes in the ZooKeeper cluster;

[0007] Generate the target number of Deployment controllers according to the YAML template file of the Kubernetes resources;

[0008] For each Deployment controller, the Deployment controller completes the deployment of the ZooKeeper cluster according to the data storage directory and the client port information.

[0009] Optionally, the reusable package further includes a container image and version information of the container image, and the ZooKeeper cluster management method further includes:

[0010] Receive a version switching request; wherein the version switching request includes target version information; the target version information is the version information to be switched to this time;

[0011] Determine a target container image according to the target version information and the version information of the container image;

[0012] The ZooKeeper cluster is switched to a target version according to the target container image.

[0013] Optionally, the ZooKeeper cluster management method further includes:

[0014] Receive a configuration request; wherein the configuration request includes configuration information of a target configuration option; the target configuration option is an option in the configuration information of the application;

[0015] The target configuration option is configured according to the configuration information of the target configuration option.

[0016] Optionally, the ZooKeeper cluster management method further includes:

[0017] Get lifecycle hook information when the ZooKeeper cluster is upgraded or deployed;

[0018] Determine the parts of the current ZooKeeper cluster that need to be initialized and the parts that need to be cleaned up according to the lifecycle hook information;

[0019] Initialize the parts of the current ZooKeeper cluster that need to be initialized;

[0020] Clean up the parts of the current ZooKeeper cluster that need to be cleaned up.

[0021] Optionally, each node in the ZooKeeper cluster is deployed with a StatefulSet controller.

[0022] Optionally, the reusable package further includes installation information and configuration information of the ZooNavigator console, and the ZooKeeper cluster management method further includes:

[0023] Complete the installation of the ZooNavigator console according to the installation and configuration information of the ZooNavigator console.

[0024] Optionally, the reusable package further includes installation information and configuration information of Prometheus, and the ZooKeeper cluster management method further includes:

[0025] Complete the installation of Prometheus according to the installation and configuration information of the Prometheus console.

[0026] Optionally, the reusable package further includes installation information and configuration information of Grafana, and the ZooKeeper cluster management method further includes:

[0027] Complete the installation of Grafana according to the installation information and configuration information of the Grafana console; wherein the Grafana is used to display the key performance indicators and status information of the ZooKeeper cluster.

[0028] Optionally, the reusable package further includes Prometheus alert rules, and the ZooKeeper cluster management method further includes:

[0029] When the key performance indicators and status information of the ZooKeeper cluster meet the alarm conditions in the alarm rules, an alarm message is generated.

[0030] A second aspect of the present application provides a ZooKeeper cluster management device, including:

[0031] A first receiving unit, configured to receive a deployment request of a ZooKeeper cluster; wherein the deployment request of the ZooKeeper cluster includes a reusable package; the reusable package includes configuration information and a template directory of an application; the configuration information of the application includes the number of nodes of the ZooKeeper cluster, a data storage directory, and client port information; the template directory includes a yaml template file of a Kubernetes resource;

[0032] A first determining unit, configured to determine a target number of Deployment controllers according to the number of nodes in the ZooKeeper cluster;

[0033] A generation unit, used to generate a target number of Deployment controllers according to the yaml template file of the Kubernetes resource;

[0034] The deployment unit is used for each Deployment controller, wherein the Deployment controller completes the deployment of the ZooKeeper cluster according to the data storage directory and the client port information.

[0035] Optionally, the reusable package further includes a container image and version information of the container image, and the management device of the ZooKeeper cluster further includes:

[0036] A second receiving unit is used to receive a version switching request; wherein the version switching request includes target version information; the target version information is the version information to be switched to this time;

[0037] A second determining unit, configured to determine a target container image according to the target version information and the version information of the container image;

[0038] A switching unit is used to switch the ZooKeeper cluster to a target version according to the target container image.

[0039] Optionally, the ZooKeeper cluster management device further includes:

[0040] A third receiving unit, configured to receive a configuration request; wherein the configuration request includes configuration information of a target configuration option; the target configuration option is an option in the configuration information of the application;

[0041] A configuration unit is used to configure the target configuration option according to the configuration information of the target configuration option.

[0042] Optionally, the ZooKeeper cluster management device further includes:

[0043] The acquisition unit is used to obtain lifecycle hook information when the ZooKeeper cluster is upgraded or deployed;

[0044] A third determining unit, configured to determine, according to the lifecycle hook information, a part of the current ZooKeeper cluster that needs to be initialized and a part that needs to be cleaned up;

[0045] The initialization unit is used to initialize the parts of the current ZooKeeper cluster that need to be initialized;

[0046] The cleaning unit is used to clean up the parts of the current ZooKeeper cluster that need to be cleaned up.

[0047] Optionally, each node in the ZooKeeper cluster is deployed with a StatefulSet controller.

[0048] Optionally, the reusable package further includes installation information and configuration information of the ZooNavigator console, and the management device of the ZooKeeper cluster further includes:

[0049] The first installation unit is used to complete the installation of the ZooNavigator console according to the installation information and configuration information of the ZooNavigator console.

[0050] Optionally, the reusable package further includes installation information and configuration information of Prometheus, and the management device of the ZooKeeper cluster further includes:

[0051] The second installation unit is used to complete the installation of Prometheus according to the installation information and configuration information of the Prometheus console.

[0052] Optionally, the reusable package further includes installation information and configuration information of Grafana, and the management device of the ZooKeeper cluster further includes:

[0053] The third installation unit is used to complete the installation of Grafana according to the installation information and configuration information of the Grafana console; wherein the Grafana is used to display the key performance indicators and status information of the ZooKeeper cluster.

[0054] Optionally, the reusable package further includes Prometheus alert rules, and the management device of the ZooKeeper cluster further includes:

[0055] The alarm unit is used to generate alarm information when the key performance indicators and status information of the ZooKeeper cluster meet the alarm conditions in the alarm rules.

[0056] A third aspect of the present application provides an electronic device, including:

[0057] one or more processors;

[0058] a storage device having one or more programs stored thereon;

[0059] When the one or more programs are executed by the one or more processors, the one or more processors implement the ZooKeeper cluster management method as described in any one of the first aspects.

[0060] A fourth aspect of the present application provides a computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the ZooKeeper cluster management method as described in any one of the first aspects is implemented.

[0061] It can be seen from the above scheme that the present application provides a management method and device for a ZooKeeper cluster. After receiving a deployment request for a ZooKeeper cluster, the target number of Deployment controllers is determined according to the number of nodes of the ZooKeeper cluster in the reusable package in the deployment request, and the target number of Deployment controllers are generated according to the yaml template file of the Kubernetes resources in the reusable package in the deployment request; then, for each Deployment controller, the Deployment controller completes the deployment of the ZooKeeper cluster according to the data storage directory and client port information in the reusable package in the deployment request. The present application uses templated and parameterized methods to simplify the deployment process of the ZooKeeper cluster. Users only need to provide the necessary configuration parameters without manually creating and managing multiple Kubernetes resources, thereby reducing operational complexity. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0063] Figure 1 A specific flow chart of a ZooKeeper cluster management method provided in an embodiment of the present application;

[0064] Figure 2 A flowchart of a ZooKeeper cluster management method provided in another embodiment of the present application;

[0065] Figure 3 A flowchart of a ZooKeeper cluster management method provided in another embodiment of the present application;

[0066] Figure 4 A schematic diagram of a ZooKeeper cluster management device provided in another embodiment of the present application;

[0067] Figure 5 A schematic diagram of an electronic device for implementing a ZooKeeper cluster management method provided in another embodiment of the present application. DETAILED DESCRIPTION

[0068] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0069] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0070] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0071] It should be noted that the concepts such as "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0072] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0073] First, the technical terms used in this application are explained:

[0074] ZooKeeper: ZooKeeper is a distributed, open source distributed application coordination service. It is often used for node election and configuration in distributed scenarios.

[0075] Kubernetes: kubernetes, also known as K8s, is an open source containerized application management platform for multiple hosts. The goal of Kubernetes is to make the deployment of containerized applications simple and efficient. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance.

[0076] Deployment: A container controller in k8s that manages container deployment, upgrades, and rollbacks in multi-copy situations.

[0077] StatefulSet: A container controller in k8s that manages container deployment, upgrades, and rollbacks for stateful services (with startup dependency order / master-slave structure / dependency storage).

[0078] HeadlessService: A service definition declaration in k8s, used to provide fixed access endpoints for stateful services in a k8s cluster.

[0079] Prometheus: Prometheus (developed in Go language) is a combination of open source monitoring, alarm, and time series (sorted by time) databases.

[0080] Grafana: Grafana is an open source interactive data visualization platform developed by Grafana Labs, where users can view their data in tables and images and unify these tables and images on one (or more) dashboards for easier explanation and understanding.

[0081] The present application embodiment provides a method for managing a ZooKeeper cluster, such as Figure 1 As shown, the specific steps include:

[0082] S101. Receive a deployment request for a ZooKeeper cluster.

[0083] The deployment request of the ZooKeeper cluster includes a reusable package; the reusable package includes the configuration information and template directory of the application; the configuration information of the application includes the number of nodes of the ZooKeeper cluster, the data storage directory and the client port information; the template directory includes the yaml template file of the Kubernetes resource.

[0084] In the specific implementation process of this application, the configuration information and template directory of the application can be encapsulated into a package as a reusable package by, but not limited to, defining a Helm Chart, which makes deployment, upgrading, etc. more consistent and controllable.

[0085] In the specific implementation of this application, the Helm Chart should include the following key components:

[0086] hart.yaml: Contains the Chart's metadata, such as name, version, and description.

[0087] values.yaml: defines the configuration parameters, such as the number of nodes, image version, port, etc. of the ZooKeeper cluster.

[0088] templates directory: contains yaml template files of Kubernetes resources, which are used to define the components of deploying a ZooKeeper cluster.

[0089] It should be noted that Helm Chart allows the use of parameterized configuration, which means that the configuration of the application can be customized according to the environment or specific needs. By modifying the values.yaml file or using Helm's command line parameters, the configuration of the application can be easily adjusted without modifying the Chart file, including parameters such as the number of nodes, data storage directory, and client port, allowing users to adjust according to their actual needs.

[0090] At the same time, Helm supports the definition and management of application dependencies. Through the dependencies between Charts, complex systems consisting of multiple applications can be effectively organized and managed.

[0091] In addition, Helm has a version control function, which allows you to easily roll back to the previous version to deal with problems that may arise after the upgrade. This greatly helps the stability and maintainability of the system. Helm Chart can be customized for different environments (such as development, testing, and production), so that the same application can be deployed in different environments with corresponding configurations and parameters. Since Helm Chart is a Kubernetes-native deployment tool, the same Chart can be used for deployment on different Kubernetes clusters. This facilitates the deployment of applications across clusters in multiple environments.

[0092] In the specific implementation process of this application, configuration parameters can be provided through values.yaml to meet the customization of different environments and requirements. An implementation method of the ZooKeeper cluster management method also includes:

[0093] A configuration request is received; wherein the configuration request includes configuration information of a target configuration option; the target configuration option is an option in the configuration information of the application; and the target configuration option is configured according to the configuration information of the target configuration option.

[0094] Specifically, users can customize the configuration of the application according to the environment or specific needs. By modifying the values.yaml file or using Helm's command line parameters, the configuration of the application can be easily adjusted without modifying the Chart file.

[0095] S102: Determine the target number of Deployment controllers according to the number of nodes in the ZooKeeper cluster.

[0096] It should be noted that the number of nodes in the ZooKeeper cluster and the number of Deployment controllers can be in a one-to-one correspondence or a one-to-many relationship. This is not limited here and can be selected based on actual conditions.

[0097] S103. Generate a target number of Deployment controllers according to the YAML template file of the Kubernetes resources.

[0098] In the specific implementation process of this application, the content of the yaml template file of the Kubernetes resource can be read through but not limited to the kubectl command; and the read content is applied to the Kubernetes cluster to create a Deployment controller.

[0099] S104: For each Deployment controller, the Deployment controller completes the deployment of the ZooKeeper cluster according to the data storage directory and the client port information.

[0100] From the above scheme, it can be seen that this application provides a ZooKeeper cluster management method, which uses template and parameterization to simplify the deployment process of the ZooKeeper cluster. Users only need to provide the necessary configuration parameters without manually creating and managing multiple Kubernetes resources, thereby reducing operational complexity.

[0101] In the specific implementation process of this application, the security of the ZooKeeper cluster is considered, including but not limited to improving the security of the ZooKeeper cluster through the configuration of ACL (access control list) and the activation of TLS (transport layer security), which is not limited here.

[0102] Through the configuration parameters provided by Helm Chart, users can easily enable these security features to ensure the confidentiality and integrity of ZooKeeper data.

[0103] In the specific implementation process of this application, the service discovery mechanism of the ZooKeeper cluster can be provided through but not limited to the Headless Service, allowing other applications to query the IP address of the ZooKeeper node through DNS.

[0104] Optionally, in another embodiment of the present application, each node in the ZooKeeper cluster is deployed with a StatefulSet controller. In addition, in values.yaml, the number of nodes in the ZooKeeper cluster is parameterized, combined with the automatic Pod state recovery of StatefulSet and the node election mechanism of ZooKeeper to ensure high availability and fault recovery.

[0105] Specifically, you only need to define the number of nodes to be maintained in the valuse.yaml file and submit the Helm Chart package to k8s through the helm command. Using the native capabilities of StatefulSet in k8s, the container will be automatically pulled up if it exits abnormally. Zookeeper's own election mechanism will ensure that there will always be a master node in the cluster to provide services.

[0106] Optionally, in another embodiment of the present application, the reusable package also includes a container image and version information of the container image, an implementation method of the ZooKeeper cluster management method, such as Figure 2 As shown, it also includes:

[0107] S201: Receive a version switching request.

[0108] The version switching request includes target version information; the target version information is the version information to be switched to this time.

[0109] In the specific implementation process of this application, you can use but not limited to the helm command to easily switch to other versions, which is not limited here.

[0110] S202: Determine a target container image according to the target version information and the version information of the container image.

[0111] S203. Switch the ZooKeeper cluster to the target version according to the target container image.

[0112] Among them, Helm Chart allows users to easily configure ZooKeeper container images and container image version information, ensuring that users can use the latest and stable ZooKeeper version. In addition, it also provides users with flexible control over ZooKeeper versions while ensuring the stability of applications.

[0113] Optionally, in another embodiment of the present application, an implementation method of a ZooKeeper cluster management method is as follows: Figure 3 As shown, it also includes:

[0114] S301. When the ZooKeeper cluster is upgraded or deployed, lifecycle hook information is obtained.

[0115] S302: Determine the parts of the current ZooKeeper cluster that need to be initialized and the parts that need to be cleaned up according to the lifecycle hook information.

[0116] Among them, life cycle hooks include but are not limited to pre-install, post-install, pre-upgrade, post-upgrade, etc., which are not limited here.

[0117] S303: Initialize the part of the current ZooKeeper cluster that needs to be initialized.

[0118] S304: Clean up the parts of the current ZooKeeper cluster that need to be cleaned up.

[0119] Optionally, in another embodiment of the present application, the reusable package further includes installation information and configuration information of the ZooNavigator console, and the installation of the ZooNavigator console is completed according to the installation information and configuration information of the ZooNavigator console.

[0120] The ZooNavigator console is suitable for ZooKeeper clusters. It provides an intuitive graphical interface that allows users to view nodes and data in the ZooKeeper cluster. The Helm Chart contains the installation and configuration information of the ZooNavigator console. Ensure that the console can correctly connect to the ZooKeeper cluster when deploying the Helm Chart.

[0121] It should be noted that the console also integrates the topology diagram of the ZooKeeper cluster, showing the connection relationship between nodes and the status of each node. This helps users intuitively understand the structure and topology of the cluster. Provides real-time data viewing function, allowing users to instantly view the data stored on the ZooKeeper cluster nodes. In the specific implementation process of this application, CRUD operations can be supported through but not limited to a simple graphical interface, which is not limited here.

[0122] In addition, the console integrates operation and maintenance functions, such as node creation, deletion, and modification, as well as data import and export, which helps simplify the operation and management of the ZooKeeper cluster.

[0123] Optionally, in another embodiment of the present application, the reusable package also includes installation information and configuration information of Prometheus, and the installation of Prometheus is completed according to the installation information and configuration information of the Prometheus console.

[0124] Specifically, define Prometheus's service discovery rules to ensure that it can automatically discover and collect metrics data from ZooKeeper instances. Ensure that ZooKeeper nodes export relevant monitoring metrics so that Prometheus can capture and store this data. And enable JMX metric export by configuring ZooKeeper's zoo.cfg file.

[0125] Optionally, in another embodiment of the present application, the reusable package also includes installation information and configuration information of Grafana, and the installation of Grafana is completed according to the installation information and configuration information of the Grafana console; wherein Grafana is used to display key performance indicators and status information of the ZooKeeper cluster.

[0126] In the specific implementation of this application, a predefined Grafana dashboard can be included in the Helm Chart, which is not limited here. Among them, the Grafana dashboard is used to display the key performance indicators and status information of ZooKeeper. Ensure that these dashboards have an intuitive design to facilitate operation and maintenance personnel to quickly locate potential problems.

[0127] Optionally, in another embodiment of the present application, the reusable package also includes Prometheus alert rules, and when the key performance indicators and status information of the ZooKeeper cluster meet the alert conditions in the alert rules, an alert message is generated. In order to promptly notify the operation and maintenance personnel of information about potential problems. This includes alert rules for ZooKeeper's key performance thresholds, connection problems, leader elections, etc.

[0128] Optionally, in another embodiment of the present application, the reusable package also includes writing a detailed Helm Chart document, including all configuration parameters, environment variables, service discovery, security settings and other information, to facilitate users to correctly use and customize the Helm Chart.

[0129] From the above solutions, it can be seen that this application provides a ZooKeeper cluster management method, which packages the configuration and components required for the entire life cycle of ZooKeeper into one package and deploys it in a Kubernetes cluster. It simplifies the difficulty of ZooKeeper cluster installation, configuration, operation and maintenance, monitoring, upgrade, rollback, etc., and rebuilds a suitable reusable package from the perspectives of security, flexibility, and documentation.

[0130] The present application embodiment provides a management device for a ZooKeeper cluster, such as Figure 4 As shown, specifically including:

[0131] The first receiving unit 401 is used to receive a deployment request of a ZooKeeper cluster.

[0132] The deployment request of the ZooKeeper cluster includes a reusable package; the reusable package includes the configuration information and template directory of the application; the configuration information of the application includes the number of nodes of the ZooKeeper cluster, the data storage directory and the client port information; the template directory includes the yaml template file of the Kubernetes resource.

[0133] The first determining unit 402 is configured to determine a target number of Deployment controllers according to the number of nodes in the ZooKeeper cluster.

[0134] The generating unit 403 is used to generate a target number of Deployment controllers according to the YAML template file of the Kubernetes resources.

[0135] The deployment unit 404 is used to complete the deployment of the ZooKeeper cluster according to the data storage directory and the client port information for each Deployment controller.

[0136] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 1 As shown, no further description is given here.

[0137] It can be seen from the above scheme that the present application provides a management device for a ZooKeeper cluster. After the first receiving unit 401 receives the deployment request of the ZooKeeper cluster; the first determining unit 402 determines the target number of Deployment controllers according to the number of nodes of the ZooKeeper cluster in the reusable package in the deployment request, and the generating unit 403 generates the target number of Deployment controllers according to the yaml template file of the Kubernetes resources in the reusable package in the deployment request; then, the deploying unit 404 targets each Deployment controller, and the Deployment controller completes the deployment of the ZooKeeper cluster according to the data storage directory and client port information in the reusable package in the deployment request. The present application uses templated and parameterized methods to simplify the deployment process of the ZooKeeper cluster. Users only need to provide the necessary configuration parameters without manually creating and managing multiple Kubernetes resources, thereby reducing operational complexity.

[0138] Optionally, in another embodiment of the present application, the reusable package further includes a container image and version information of the container image, and an implementation of the management device of the ZooKeeper cluster further includes:

[0139] The second receiving unit is used to receive a version switching request.

[0140] The version switching request includes target version information; the target version information is the version information to be switched to this time.

[0141] The second determining unit is used to determine the target container image according to the target version information and the version information of the container image.

[0142] The switching unit is used to switch the ZooKeeper cluster to the target version according to the target container image.

[0143] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 2 As shown, no further description is given here.

[0144] Optionally, in another embodiment of the present application, an implementation of the management device of the ZooKeeper cluster further includes:

[0145] The third receiving unit is used to receive a configuration request.

[0146] The configuration request includes configuration information of a target configuration option; the target configuration option is an option in the configuration information of the application.

[0147] The configuration unit is used to configure the target configuration option according to the configuration information of the target configuration option.

[0148] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here.

[0149] Optionally, in another embodiment of the present application, an implementation of the management device of the ZooKeeper cluster further includes:

[0150] The acquisition unit is used to obtain lifecycle hook information when the ZooKeeper cluster is upgraded or deployed.

[0151] The third determining unit is used to determine the part that needs to be initialized and the part that needs to be cleaned up in the current ZooKeeper cluster according to the life cycle hook information.

[0152] The initialization unit is used to initialize the parts of the current ZooKeeper cluster that need to be initialized.

[0153] The cleaning unit is used to clean up the parts of the current ZooKeeper cluster that need to be cleaned up.

[0154] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 3 As shown, no further description is given here.

[0155] Optionally, in another embodiment of the present application, each node in the ZooKeeper cluster is deployed with a StatefulSet controller.

[0156] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here.

[0157] Optionally, in another embodiment of the present application, the reusable package further includes installation information and configuration information of the ZooNavigator console, and an implementation of the management device of the ZooKeeper cluster further includes:

[0158] The first installation unit is used to complete the installation of the ZooNavigator console according to the installation information and configuration information of the ZooNavigator console.

[0159] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here.

[0160] Optionally, in another embodiment of the present application, the reusable package further includes installation information and configuration information of Prometheus, and an implementation of the management device of the ZooKeeper cluster further includes:

[0161] The second installation unit is used to complete the installation of Prometheus according to the installation information and configuration information of the Prometheus console.

[0162] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here.

[0163] Optionally, in another embodiment of the present application, the reusable package further includes installation information and configuration information of Grafana, and an implementation of the management device of the ZooKeeper cluster further includes:

[0164] The third installation unit is used to complete the installation of Grafana according to the installation information and configuration information of the Grafana console.

[0165] Among them, Grafana is used to display the key performance indicators and status information of the ZooKeeper cluster.

[0166] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here.

[0167] Optionally, in another embodiment of the present application, the reusable package further includes an alarm rule of Prometheus, and an implementation of the management device of the ZooKeeper cluster further includes:

[0168] The alarm unit is used to generate alarm information when the key performance indicators and status information of the ZooKeeper cluster meet the alarm conditions in the alarm rules.

[0169] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here.

[0170] From the above scheme, it can be seen that this application provides a management device for ZooKeeper cluster, which simplifies the difficulty of ZooKeeper cluster installation, configuration, operation and maintenance, monitoring, upgrade, rollback, etc., and rebuilds a suitable reusable package from the perspectives of security, flexibility, documentation, etc. by packaging the configuration and components required for the entire life cycle of ZooKeeper in one package and deploying it in a Kubernetes cluster.

[0171] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0172] Another embodiment of the present application provides an electronic device, such as Figure 5 As shown, including:

[0173] One or more processors 501 .

[0174] The storage device 502 stores one or more programs.

[0175] When the one or more programs are executed by the one or more processors 501, the one or more processors 501 implement the ZooKeeper cluster management method as described in any one of the above embodiments.

[0176] Another embodiment of the present application provides a computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for managing a ZooKeeper cluster as described in any one of the above embodiments is implemented.

[0177] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0178] It should be noted that the computer-readable medium mentioned above in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0179] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0180] Another embodiment of the present application provides a computer program product. When the computer program product is executed, it is used to execute any of the above-mentioned ZooKeeper cluster management methods.

[0181] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

[0182] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

[0183] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present application. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.

[0184] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.

Claims

1. A method for managing a ZooKeeper cluster, characterized in that: include: Receive a deployment request for a ZooKeeper cluster; wherein the deployment request for the ZooKeeper cluster includes a reusable package; the reusable package includes configuration information and a template directory of an application; the configuration information of the application includes the number of nodes, a data storage directory, and client port information of the ZooKeeper cluster; the template directory includes a yaml template file of a Kubernetes resource; Determine the target number of Deployment controllers based on the number of nodes in the ZooKeeper cluster; Generate the target number of Deployment controllers according to the YAML template file of the Kubernetes resources; For each of the Deployment controllers, the Deployment controller completes the deployment of the ZooKeeper cluster according to the data storage directory and the client port information.

2. The method for managing a ZooKeeper cluster according to claim 1, wherein: The reusable package also includes a container image and version information of the container image. The ZooKeeper cluster management method further includes: Receive a version switching request; wherein the version switching request includes target version information; the target version information is the version information to be switched to this time; Determine a target container image according to the target version information and the version information of the container image; The ZooKeeper cluster is switched to a target version according to the target container image.

3. The method for managing a ZooKeeper cluster according to claim 1, wherein: Also includes: receiving a configuration request; wherein the configuration request includes configuration information of a target configuration option; the target configuration option is an option in the configuration information of the application; The target configuration option is configured according to the configuration information of the target configuration option.

4. The method for managing a ZooKeeper cluster according to claim 1, wherein: Also includes: Get lifecycle hook information when the ZooKeeper cluster is upgraded or deployed; Determine the parts of the current ZooKeeper cluster that need to be initialized and the parts that need to be cleaned up according to the lifecycle hook information; Initialize the parts of the current ZooKeeper cluster that need to be initialized; Clean up the parts of the current ZooKeeper cluster that need to be cleaned up.

5. The method for managing a ZooKeeper cluster according to claim 1, wherein: Each node in the ZooKeeper cluster is deployed with a StatefulSet controller.

6. The method for managing a ZooKeeper cluster according to claim 1, wherein: The reusable package also includes installation information and configuration information of the ZooNavigator console, and the management method of the ZooKeeper cluster also includes: Complete the installation of the ZooNavigator console according to the installation and configuration information of the ZooNavigator console.

7. The method for managing a ZooKeeper cluster according to claim 1, wherein: The reusable package also includes installation information and configuration information of Prometheus, and the management method of the ZooKeeper cluster also includes: Complete the installation of Prometheus according to the installation and configuration information of the Prometheus console.

8. The method for managing a ZooKeeper cluster according to claim 7, wherein: The reusable package also includes installation information and configuration information of Grafana, and the management method of the ZooKeeper cluster also includes: Complete the installation of Grafana according to the installation information and configuration information of the Grafana console; wherein the Grafana is used to display the key performance indicators and status information of the ZooKeeper cluster.

9. The method for managing a ZooKeeper cluster according to claim 8, characterized in that: The reusable package also includes Prometheus alert rules, the ZooKeeper cluster management method, and: When the key performance indicators and status information of the ZooKeeper cluster meet the alarm conditions in the alarm rules, an alarm message is generated.

10. A ZooKeeper cluster management device, characterized in that: include: A first receiving unit, configured to receive a deployment request of a ZooKeeper cluster; wherein the deployment request of the ZooKeeper cluster includes a reusable package; the reusable package includes configuration information and a template directory of an application; the configuration information of the application includes the number of nodes of the ZooKeeper cluster, a data storage directory, and client port information; the template directory includes a yaml template file of a Kubernetes resource; A first determining unit, configured to determine a target number of Deployment controllers according to the number of nodes in the ZooKeeper cluster; A generation unit, used to generate a target number of Deployment controllers according to the yaml template file of the Kubernetes resource; The deployment unit is used for completing the deployment of the ZooKeeper cluster according to the data storage directory and the client port information for each of the Deployment controllers.