A znbase distributed database deployment method and device

By using the ZnBase distributed database deployment method in the Kubernetes cluster, the problems of complex traditional database deployment and resource waste are solved, rapid deployment and efficient scaling are achieved, and the availability of the database cluster is improved.

CN115220735BActive Publication Date: 2025-09-19上海沄熹科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210721886.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-24
Publication Date
2025-09-19
Estimated Expiration
2042-06-24

AI Technical Summary

Technical Problem

Traditional commercial database deployment methods are cumbersome and difficult to deploy, and they cannot be expanded or reduced in time, resulting in a waste of resources.

Method used

Adopt the znbase distributed database deployment method, use CRD.yaml, znbase-operator.yaml, znbase-operator container image, znbase-example.yaml and znbase container image files to create and manage custom resources in the Kubernetes cluster, and write znbase-operator programs through the operator framework to achieve rapid deployment and automatic scaling.

Benefits of technology

It improves deployment efficiency, reduces deployment complexity, enhances the high availability of database clusters, reduces time loss, and improves the efficiency of scaling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115220735B_ABST
    Figure CN115220735B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of distributed database technology and specifically provides a ZnBase distributed database deployment method. The method first prepares five files: CRD.yaml, znbase-operator.yaml, a znbase-operator container image, znbase-example.yaml, and a znbase container image. The CRD.yaml file is used to create a ZNBaseCluster resource in a Kubernetes cluster. The ZnBase-operator container image is then pulled from an image repository configured in the Kubernetes cluster. A database is created or updated in the Kubernetes cluster using the znbase-example.yaml file. The ZnBase container image is then pulled from an image repository configured in the Kubernetes cluster. Compared to existing technologies, the method reduces the time lost by traditional deployment methods, lowers deployment complexity, improves database scaling efficiency, and enhances the high availability of the ZnBase database cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of distributed databases, and specifically provides a znbase distributed database deployment method and device. Background Art

[0002] With the rise of internet finance, commercial banks are facing a massive impact on both their business and technical aspects. As a crucial piece of banking infrastructure, databases have always served as the foundation of their foundation. With ever-increasing data volumes, increasingly complex data models, accelerated application iterations, and a surge in concurrent workloads, traditional commercial databases are facing unprecedented challenges.

[0003] Solving the problems of existing deployment methods, such as cumbersome deployment methods, difficult deployment, inability to scale up and down in a timely manner, and waste of resources, is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0004] The present invention aims to overcome the above-mentioned deficiencies in the prior art and provides a highly practical znbase distributed database deployment method.

[0005] A further technical task of the present invention is to provide a znbase distributed database deployment device that is rationally designed, safe and applicable.

[0006] The technical solution adopted by the present invention to solve its technical problem is:

[0007] A method for deploying a znbase distributed database. First, prepare five files: CRD.yaml, znbase-operator.yaml, znbase-operator container image, znbase-example.yaml, and znbase container image.

[0008] Create a ZNBaseCluster resource in the Kubernetes cluster using CRD.yaml. Deploy the znbase-operator service in the Kubernetes cluster using the znbase-operator.yaml file. During the startup of the znbase-operator service, the znbase-operator container image is pulled from the image repository configured in the Kubernetes cluster. Create or update a database in the Kubernetes cluster using the znbase-example.yaml file. Kubernetes detects whether the znbase-example.yaml file is updated, pulls the znbase container image from the image repository configured in the Kubernetes cluster, and starts and initializes the znbase database cluster.

[0009] Furthermore, in CRD.yaml, a resource of type ZNBaseCluster is created in the Kubernetes cluster. The CRD defines the specification and metadata based on which the custom resource should be created. When a request is made to create a CRD, the metadata is validated using the Kubernetes internal schema type, and then the custom resource CRD object is created.

[0010] Furthermore, znbase-example.yaml creates or updates the database in the Kubernetes cluster, and Kubernetes detects whether znbase-example.yaml is updated.

[0011] If the resource is not configured, the related resource will be created;

[0012] If the resource is configured to be updated only, the relevant actions are performed.

[0013] Furthermore, after determining whether znbase-example.yaml has been updated, kubernetes will create a PV. If resources are not configured, it will perform operations related to creating a database. znbase-operator will verify the object based on the metadata in the file znbase-operator.yaml and the CRD specification in the file CRD.yaml, and create related resources accordingly.

[0014] Next, create the following related resources: first, create a service account, role, and rolebindings, then create the zbase cluster certificate, and finally create the service and statefulSet resources to pull the znbase container image from the image repository configured in the Kubernetes cluster.

[0015] Furthermore, the created znbase cluster certificate is copied to the pod, and the znbase cluster node certificate is created at the same time. Each node is the pod to which the znbase cluster belongs. The znbase service is started. When the pod status is RUNNING, the znbase cluster is initialized. The znbase-operator monitors events and status changes, manages custom resources based on CRDs, and provides event or status status to perform CRUD operations on custom resources. Therefore, whenever the status of a custom resource is changed, the corresponding event can be triggered.

[0016] Furthermore, if you expand the znbase cluster nodes and only update the resources that have been configured, and the number of znbase nodes in the znbase-example.yaml file is greater than the number of nodes at the time of creation, the expansion of the znbase cluster nodes will be triggered to form new cluster nodes.

[0017] Furthermore, create a PV for the new cluster node, modify the number of statefulSet replicas to the number of znbase nodes in znbase-example.yaml, copy the cluster certificate to the expanded pod, create the znbase cluster node certificate at the same time, start the znbase service, and automatically join the initialized cluster.

[0018] Furthermore, when scaling down the znbase cluster nodes and resources are configured only for update, if the number of znbase nodes in znbase-example.yaml is less than the number of nodes at creation and greater than 3, the operation of scaling up the znbase cluster nodes will be triggered, the znbase service of the scaled-down node will be decommissioned normally, and the number of statefulset replicas will be changed to the number of znbase nodes in znbase-example.yaml.

[0019] A znbase distributed database deployment device, comprising: at least one memory and at least one processor;

[0020] The at least one memory is configured to store a machine-readable program;

[0021] The at least one processor is configured to call the machine-readable program to execute a znbase distributed database deployment method.

[0022] Compared with the prior art, the ZnBase distributed database deployment method and device of the present invention have the following outstanding beneficial effects:

[0023] The present invention provides a cloud-native deployment method based on Kubernetes and uses the operator framework to write the znbase-operator program to achieve rapid deployment in Kubernetes, thereby improving deployment efficiency, reducing the time loss caused by the complexity of traditional deployment methods, reducing deployment complexity, improving database expansion and contraction efficiency, and enhancing the high availability of the znbase database cluster. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0025] Attachment Figure 1 The present invention is a flowchart of a ZnBase distributed database deployment method. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the solutions of the present invention, the present invention will be further described in detail below in conjunction with specific embodiments. Obviously, the embodiments described are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0027] A best embodiment is given below:

[0028] like Figure 1 As shown, a znbase distributed database deployment method in this embodiment first needs to prepare five files:

[0029] File F101, CRD.yaml: is a product of znbase-operator development and is used to declare a resource of type ZNBaseCluster in a Kubernetes cluster.

[0030] File F102, znbase-operator.yaml: This is the product of znbase-operator development and is used to start the operator service in the Kubernetes cluster.

[0031] File F103, znbase-operator container image: This is a product of znbase-operator development and is used to start the znbase-operator service in a Kubernetes cluster.

[0032] File F104, znbase-example.yaml: This is a product of the znbase-operator development process and is a custom resource (CR) in Kubernetes. It is used to deploy a ZnBase distributed database cluster in a Kubernetes cluster. The resource type in the file is ZNBaseCluster.

[0033] File F105, znbase container image: This is the container image of the znbase database, used to deploy the image used by the znbase distributed database cluster in the Kubernetes cluster.

[0034] The steps to deploy ZnBase in a Kubernetes cluster through ZnBase-Operator are:

[0035] S1. Create a resource of type ZNBaseCluster in the Kubernetes cluster using the file F101CRD.yaml. The CRD defines the specification and metadata based on which the custom resource should be created. When a request is made to create a CRD, the metadata is validated using the Kubernetes internal schema type (OpenAPI v3 schema) and then the custom resource (CRD) object is created.

[0036] S2. Deploy the znbase-operator service in the Kubernetes cluster using the file F102 znbase-operator.yaml.

[0037] During the startup of S3 and the znbase-operator service, the znbase-operator container image, file F103, is pulled from the image repository configured in the Kubernetes cluster. The znbase-operator service is then started.

[0038] S4. Create or update a database in the Kubernetes cluster using the znbase-example.yaml file (F104). Kubernetes will check whether the znbase-example.yaml file has been updated. If the resource is not configured, it will create the relevant resource. If the resource is configured and updated, it will perform the relevant operation.

[0039] S5. Create PV.

[0040] When resources are not configured, perform operations related to creating a database. The znbase-operator (custom controller) will verify the object according to the metadata in file F102 and the CRD specification in file F101, and create related resources accordingly.

[0041] S6. Create service accounts, roles, and role bindings.

[0042] S7. Create a zbase cluster certificate.

[0043] S8. Create service and statefulSet resources.

[0044] S9. Pull the znbase container image, file F105, from the image repository configured in the Kubernetes cluster.

[0045] S10. Copy the znbase cluster certificate created in step S7 to the pod and create the znbase cluster node certificate.

[0046] S11. Each node, i.e., the pod to which the znbase cluster belongs, starts the znbase service.

[0047] S12. When the pod status is RUNNING, initialize the znbase cluster. znbase-operator monitors events and status changes and manages custom resources based on CRDs. It can provide events or status to perform CRUD operations on custom resources. Therefore, whenever the status of a custom resource changes, the corresponding event is triggered.

[0048] S13, expand the capacity of the znbase cluster nodes. The resources have been configured and only updated. The number of znbase nodes in file F104 is greater than the number of nodes at the time of creation, which will trigger the operation of expanding the capacity of the znbase cluster nodes.

[0049] S14. Create PV for the new cluster node.

[0050] S15. Change the number of statefulSet replicas to the number of znbase nodes in file F104. Repeat step S9.

[0051] S16. Copy the cluster certificate to the expansion pod and create the znbase cluster node certificate.

[0052] S17. Start the znbase service and automatically join the initialized cluster.

[0053] S18. Scaling down the znbase cluster nodes. The resources have been configured and only updated. The number of znbase nodes in file F104 is less than the number of nodes at creation time and is greater than 3, which will trigger the expansion of the znbase cluster nodes.

[0054] S19. Normally decommission the znbase service of the scaled-down node.

[0055] S20. Change the number of statefulset replicas to the number of znbase nodes in file F104.

[0056] CRD (Custom Resource Definition) is a type that allows users to customize Kubernetes resources, including a specifiable name and schema, without requiring any programming. The Kubernetes API provides and handles the storage of custom resources.

[0057] CR (Custom Resource): a specific instance of CRD;

[0058] Custom Resources: Objects that extend the Kubernetes API or allow custom APIs to be introduced into a Kubernetes cluster.

[0059] Custom controllers: Handle built-in Kubernetes objects like Deployment and Service in new ways, or manage custom resources as if they were native Kubernetes components.

[0060] Operator mode (applicable to CRDs and custom controllers): Operators are based on Kubernetes resources and controllers and add configuration that allows operators to perform common application tasks.

[0061] Based on the above method, a znbase distributed database deployment device in this embodiment includes: at least one memory and at least one processor;

[0062] The at least one memory is configured to store a machine-readable program;

[0063] The at least one processor is configured to call the machine-readable program to execute a znbase distributed database deployment method.

[0064] The above specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above specific implementations. Any appropriate changes or substitutions made by ordinary technicians in any of the above technical fields that conform to the claims of the znbase distributed database deployment method and device of the present invention shall fall within the patent protection scope of the present invention.

[0065] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A znbase distributed database deployment method, characterized in that: First, prepare five files: CRD.yaml, znbase-operator.yaml, znbase-operator container image, znbase-example.yaml, and znbase container image. Create a ZNBaseCluster resource in the Kubernetes cluster using CRD.yaml. Deploy the znbase-operator service in the Kubernetes cluster using the znbase-operator.yaml file. During the startup of the znbase-operator service, the znbase-operator container image is pulled from the image repository configured in the Kubernetes cluster. Create or update a database in the Kubernetes cluster using the znbase-example.yaml file. Kubernetes detects whether the znbase-example.yaml file is updated, pulls the znbase container image from the image repository configured in the Kubernetes cluster, and starts and initializes the znbase database cluster.

2. A znbase distributed database deployment method according to claim 1, characterized in that: In CRD.yaml, a resource of type ZNBaseCluster is created in the Kubernetes cluster. The CRD defines the specification and metadata based on which the custom resource should be created. When a request is made to create a CRD, the metadata is validated using the Kubernetes internal schema type, and then the custom resource CRD object is created.

3. A znbase distributed database deployment method according to claim 2, characterized in that: znbase-example.yaml creates or updates a database in the Kubernetes cluster. Kubernetes will detect whether znbase-example.yaml is updated. If the resource is not configured, the related resource will be created; If the resource is configured to be updated only, the relevant actions are performed.

4. A znbase distributed database deployment method according to claim 3, characterized in that: After determining whether znbase-example.yaml has been updated, Kubernetes will create a PV. If resources are not configured, it will perform operations related to creating a database. znbase-operator will verify the object based on the metadata in the file znbase-operator.yaml and the CRD specification in the file CRD.yaml, and create related resources accordingly.

5. A znbase distributed database deployment method according to claim 3, characterized in that: Create the following related resources: first, create a service account, role, and role bindings, then create the zbase cluster certificate, and finally create the service and statefulSet resources. Pull the znbase container image from the image repository configured in the Kubernetes cluster.

6. A znbase distributed database deployment method according to claim 5, characterized in that: Copy the created znbase cluster certificate to the pod and create the znbase cluster node certificate. Each node is a pod belonging to the znbase cluster. Start the znbase service. When the pod status is RUNNING, initialize the znbase cluster. The znbase-operator monitors events and status changes, manages custom resources based on CRDs, and provides event or status status to perform CRUD operations on custom resources. Therefore, whenever the status of a custom resource changes, the corresponding event can be triggered.

7. A znbase distributed database deployment method according to claim 6, characterized in that: Expand the znbase cluster nodes. If the resources have been configured and only updated, and the number of znbase nodes in the znbase-example.yaml file is greater than the number of nodes at creation time, the znbase cluster node expansion operation will be triggered to form new cluster nodes.

8. A znbase distributed database deployment method according to claim 7, characterized in that: Create a PV for the new cluster node, modify the number of statefulSet replicas to the number of znbase nodes in znbase-example.yaml, copy the cluster certificate to the expanded pod, create the znbase cluster node certificate, start the znbase service, and automatically join the initialized cluster.

9. A znbase distributed database deployment method according to claim 8, characterized in that: When scaling down the ZnBase cluster nodes, resources are configured and only updated. If the number of ZnBase nodes in znbase-example.yaml is less than the number of nodes at creation and greater than 3, the ZnBase cluster node expansion operation is triggered. The ZnBase service of the scaled-down node is normally decommissioned, and the number of StatefulSet replicas is changed to the number of ZnBase nodes in znbase-example.yaml.

10. A znbase distributed database deployment device, characterized in that: include: at least one memory and at least one processor; The at least one memory is configured to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • CDC-based inter-cluster data synchronization method and system

    CN114416872A

  • Cloud desktop data persistence method and system based on ZNBase database cluster

    CN114443774A