Management method and system for database operation and maintenance operation
By using a declarative API to uniformly manage database operation and maintenance, the problem of inconsistent management of different database operation and maintenance operations is solved, achieving ease of use, consistency and scalability of operations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU YUNYUANSHENG DATA CO LTD
- Filing Date
- 2023-09-15
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, the operation and maintenance of various databases cannot be managed in a unified manner, resulting in complex operations and difficulty in expansion.
A declarative API is used to define operation and maintenance operations. By defining operation and maintenance operation request objects and definition objects, general and custom operations are distinguished, and operation and maintenance operation controllers are created to automatically execute operations.
It enables unified management of database operation and maintenance, reduces operational complexity, improves ease of use and consistency, and supports extended access to different databases.
Smart Images

Figure CN121901176A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database management technology, and in particular to a management method and system for database operation and maintenance. Background Technology
[0002] In the contemporary software development environment, the diversity and differences of database systems are becoming increasingly apparent. For example, relational databases such as MySQL and PostgreSQL, non-relational databases such as MongoDB and Cassandra, and time-series databases such as InfluxDB all have their own unique characteristics and operational requirements, making it impossible to implement unified operation and maintenance management. Summary of the Invention
[0003] This application provides a database operation and maintenance management method, which aims to solve the problem that the operation and maintenance of various databases cannot be managed uniformly in the existing technology.
[0004] To achieve the above objectives, this application adopts the following technical solution:
[0005] This application discloses a database operation and maintenance management method, which includes the following steps:
[0006] Define an operation and maintenance request object and an operation and maintenance definition object. The operation and maintenance request object includes a general operation and maintenance request object and a custom operation and maintenance request object.
[0007] Determine the type of the target operation and maintenance operation, and create a target operation and maintenance operation definition object and a target operation and maintenance operation request object respectively according to the type of the target operation and maintenance operation;
[0008] An operation and maintenance controller is created. When the operation and maintenance controller detects the target operation and maintenance request object, it executes the operation and maintenance operation according to the target operation and maintenance definition object.
[0009] Preferably, the step of determining the type of the target operation and maintenance operation, and creating a target operation and maintenance operation definition object and a target operation and maintenance operation request object respectively according to the type of the target operation and maintenance operation, includes:
[0010] Determine whether the target operation is a custom operation. If so, create a new target operation definition object and a custom operation request object. If the target operation is a general operation, create a new general operation request object.
[0011] Preferably, the customized operation and maintenance operation is an operation and maintenance operation specific to the target database.
[0012] Preferably, the operation and maintenance definition object contains the execution logic of the custom operation and maintenance operation, which is referenced by the custom operation and maintenance request object.
[0013] Preferably, when the operation and maintenance controller detects the target operation and maintenance request object, executing the operation and maintenance operation according to the target operation and maintenance definition object includes:
[0014] When the operation and maintenance controller detects the target operation and maintenance request object, it determines whether the target operation and maintenance request object is a custom operation and maintenance request object. If so, it executes the operation and maintenance operation contained in the target operation and maintenance definition object it calls.
[0015] Preferably, the method further includes:
[0016] When the target operation is a general operation, the execution logic of the target operation is built into the operation controller.
[0017] A database operation and maintenance management system, comprising:
[0018] The definition module is used to define operation and maintenance operation request objects and operation and maintenance operation definition objects. The operation and maintenance operation request objects include general operation and maintenance operation request objects and custom operation and maintenance operation request objects.
[0019] A new module is created to determine the type of the target operation and maintenance operation, and to create a target operation and maintenance operation definition object and a target operation and maintenance operation request object respectively according to the type of the target operation and maintenance operation;
[0020] The execution module is used to create an operation and maintenance controller, and when the operation and maintenance controller listens for the target operation and maintenance request object, it executes the operation and maintenance operation according to the target operation and maintenance definition object.
[0021] Preferably, the system further includes:
[0022] An embedded module is used to embed the execution logic of the target operation and maintenance operation into the operation and maintenance operation controller when the target operation and maintenance operation is a general operation and maintenance operation.
[0023] An electronic device includes a memory and a processor, the memory being used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a database operation and maintenance management method as described in any one of the above descriptions.
[0024] A computer-readable storage medium storing a computer program that, when executed by a computer, enables a database operation and maintenance management method as described in any one of the above descriptions.
[0025] The present invention has the following beneficial effects:
[0026] This application introduces a declarative API to describe database operation and maintenance, eliminating the need to write complex scripts and commands. It also uses concise syntax to define operation types, target databases, operation parameters, etc., enabling the system to automatically parse and execute these declarative operations, ensuring the correctness and consistency of the operations. Furthermore, it adds custom operation and maintenance operations, making it convenient for database vendors to extend and integrate them. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of a database operation and maintenance management method provided in Embodiment 1 of this application;
[0029] Figure 2 This is the working logic diagram of the operation and maintenance controller in Embodiment 1 of this application;
[0030] Figure 3 This is a schematic diagram of a database operation and maintenance management system provided in Embodiment 2 of this application;
[0031] Figure 4 This is a schematic diagram of an electronic device that implements a database operation and maintenance management method according to Embodiment 3 of this application. Detailed Implementation
[0032] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0033] The terms “first,” “second,” etc., used in the claims and description of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate. This is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion so that a process, method, system, product, or apparatus that comprises a series of units is not necessarily limited to those units, but may include other units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0034] Example 1
[0035] like Figure 1 As shown, a database operation and maintenance management method includes the following steps:
[0036] S110. Define an operation and maintenance request object and an operation and maintenance definition object. The operation and maintenance request object includes a general operation and maintenance request object and a custom operation and maintenance request object.
[0037] S120. Determine the type of the target operation and maintenance operation, and create a target operation and maintenance operation definition object and a target operation and maintenance operation request object according to the type of the target operation and maintenance operation;
[0038] S130. Create an operation and maintenance controller. When the operation and maintenance controller detects the target operation and maintenance request object, it executes the operation and maintenance operation according to the target operation and maintenance definition object.
[0039] In this embodiment, an API object named `OpsRequest` is first defined to represent an operation / maintenance request. Database operation / maintenance operations are categorized into two types: general operation / maintenance operations and custom operation / maintenance operations. General operation / maintenance operations include horizontal scaling, vertical scaling, service restart, volume expansion, version upgrade, and configuration changes. Custom operation / maintenance operations refer to operations specific to the target database, such as re-sharding for Elasticsearch document databases, rebalance for InfluxDB time-series databases, and topic management for Kafka message queues. Correspondingly, the `OpsRequest` object is also divided into two categories: general operation / maintenance request objects and custom operation / maintenance request objects. The general operation / maintenance request object mainly contains fields such as the database cluster being operated on, the operation type, the corresponding MySQL service component, and the required CPU / memory resources. The operation type here refers to the type of operation / maintenance operation, as detailed below:
[0040] apiVersion:ops.database.io / v1
[0041] kind:OpsRequest
[0042] metadata:
[0043] name:volume-expansion
[0044] namespace:default
[0045] spec:
[0046] clusterRef:mysqlCluster # The database cluster being operated on.
[0047] type:VolumeExpansion#Operation type
[0048] `volumeExpansion:#volumeExpansion` declares which components and their volumes are being operated on, and by how much capacity to expand.
[0049] -componentRef: The component corresponding to mysql#
[0050] volumes:
[0051] -name:data#Data Volume
[0052] storage: 100Gi # Needs to be expanded to the specified storage size
[0053] To enable database system-specific operations to quickly access and uniformly utilize the defined OpsRequest object, this embodiment also abstracts an API object for operations definition, namely OpsDefinition. The execution logic for these specific operations is placed within OpsDefinition. OpsRequest can execute the corresponding operations by referencing OpsDefinition. This object contains fields such as the operation definition, current step name, and current step type, as detailed below:
[0054] apiVersion:ops.database.io / v1
[0055] kind:OpsDefinition
[0056] metadata:
[0057] name:influxdb-rebalance
[0058] spec:
[0059] description: "influxdb rebalance" # Describes what this ops does (required)
[0060] argsAsEnv:#opsRequest allows you to pass parameters based on the defined parameters, and these parameters will be injected as environment variables (optional).
[0061] -name:source_ip_addr
[0062] -name:dest_ip_addr
[0063] phases:
[0064] -name:rebalance#Current step name (required)
[0065] type:pod # The type of the current step. pod indicates that a pod will be started to execute the current step (required).
[0066] podSpec:#k8s pod spec describes the current pod specifications (required).
[0067] containers: (required) (containers contained in the current pod)
[0068] -name:rebalance(container name required)
[0069] image:influxdb-tool:latest (container image required)
[0070] command: (The command that the container will execute, that is, the specific implementation of the current operation and maintenance (required))
[0071] -bash
[0072] --c
[0073] -|
[0074] influxd-ctl truncate-shards
[0075] shard_id=$(influxd-ctl show-shards|sed-e'1d'|awk'{print$1}')
[0076] influxd-ctl copy-shard${source_ip_addr}${dest_ip_addr}${shard_id}
[0077] influxd-ctl remove-shard${source_ip_addr}${shard_id}
[0078] The OpsRequest object used to reference the OpsDefinition object is the custom operation request object. This custom operation request object mainly contains fields such as the database cluster to be operated on, the operation type, and the name indicating which OpsDefinition to use. The specific content is shown below:
[0079] api:ops.database.io / v1
[0080] kind:OpsRequest
[0081] metadata:
[0082] generateName:influxdb-reblance-ops
[0083] namespace:default
[0084] spec:
[0085] clusterRef:my-influxdb # The database cluster being operated on.
[0086] type:custom# Operation type, custom: indicates a custom operation / maintenance operation.
[0087] opsDefinition:
[0088] name:influxdb-rebalance # Indicates which opsDefinition to use
[0089] args: # Parameters passed to opsDefinition are a map object
[0090] source_ip_addr:"my-influxdb.svc.default:8086"
[0091] dest_ip_addr:"to-influxdb.svc.default:8086"
[0092] When the operation type in the OpsRequest object is a custom operation, an OpsDefinition object must be referenced to describe how to process this OpsRequest object; otherwise, the validation will fail and an error message will be displayed indicating that the OpsRequest object is invalid. Similarly, if the operation type is a general operation such as VerticalScaling, a general operation object must be referenced to describe the expected CPU / memory of VerticalScaling.
[0093] After defining the OpsRequest and OpsDefinition objects, you can configure them according to your needs, such as... Figure 2 As shown, the process first determines whether the target operation is a custom operation. If so, a target operation definition object and a custom operation request object are created. The custom operation request object references the target operation definition object. If it is a general operation, a general operation request object is created, along with an operation controller, i.e., an OpsRequest Controller. This OpsRequest Controller listens for creation and update events of OpsRequest resources. Alternatively, an OpsRequest Controller can be created beforehand. When the OpsRequest Controller detects a newly created target operation request object, it first determines whether the target operation request object is a custom operation request object. If so, the operation called by the target operation definition object is executed. If not, the execution logic of the target operation is embedded in the OpsRequest Controller, and then the corresponding operation is executed.
[0094] This embodiment provides a unified declarative API standard interface that supports rapid access to any database and has the following advantages:
[0095] 1) High ease of use and readability: Declarative APIs provide a more intuitive and easy-to-understand configuration method, reducing the learning and understanding costs of operations;
[0096] 2) High degree of automation and consistency: The system automatically parses and executes declarative operations, reducing the risk of human error while ensuring operational consistency;
[0097] 3) Wide scalability and adaptability: The declarative API can be flexibly extended to support different types of databases and operation and maintenance, and is suitable for diverse scenarios.
[0098] Example 2
[0099] like Figure 3 As shown, a database operation and maintenance management system includes a definition module, a creation module, and an execution module, wherein:
[0100] The definition module is used to define operation and maintenance operation request objects and operation and maintenance operation definition objects. The operation and maintenance operation request objects include general operation and maintenance operation request objects and custom operation and maintenance operation request objects.
[0101] A new module is created to determine the type of the target operation and maintenance operation, and to create a target operation and maintenance operation definition object and a target operation and maintenance operation request object respectively according to the type of the target operation and maintenance operation;
[0102] The execution module is used to create an operation and maintenance controller, and when the operation and maintenance controller listens for the target operation and maintenance request object, it executes the operation and maintenance operation according to the target operation and maintenance definition object.
[0103] Furthermore, the system also includes a built-in module, used to embed the execution logic of the target operation and maintenance operation into the operation and maintenance operation controller when the target operation and maintenance operation is a general operation and maintenance operation.
[0104] Example 3
[0105] like Figure 3 As shown, an electronic device includes a memory 401 and a processor 402. The memory 401 is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor 402 to implement the above-described database operation and maintenance management method.
[0106] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the electronic device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0107] A computer-readable storage medium storing a computer program that, when executed by a computer, enables a database operation and maintenance management method as described above.
[0108] For example, a computer program can be divided into one or more modules / units. One or more modules / units are stored in memory 401 and executed by processor 402. Data I / O interface transmission is completed by input interface 405 and output interface 406 to complete the present invention. One or more modules / units can be a series of computer program instruction segments capable of performing specific functions. The instruction segments are used to describe the execution process of the computer program in the computer device.
[0109] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a memory 401 and a processor 402. Those skilled in the art will understand that this embodiment is merely an example of a computer device and does not constitute a limitation on the computer device. It may include more or fewer components, or a combination of certain components, or different components. For example, the computer device may also include an input device 407, a network access device, a bus, etc.
[0110] The processor 402 can be a Central Processing Unit (CPU), or other general-purpose processors 402, digital signal processors 402 (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor 402 can be a microprocessor 402, or any conventional processor 402, etc.
[0111] The memory 401 can be an internal storage unit of a computer device, such as a hard disk or memory. The memory 401 can also be an external storage device of a computer device, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 401 can include both internal and external storage units. The memory 401 is used to store computer programs and other programs and data required by the computer device. The memory 401 can also be used for temporary storage in the output device 408. The aforementioned storage media include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM) 403, random access memory (RAM) 404, discs, or optical discs.
[0112] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A management method for database operation and maintenance, characterized in that, Includes the following steps: Define an operation and maintenance request object and an operation and maintenance definition object. The operation and maintenance request object includes a general operation and maintenance request object and a custom operation and maintenance request object. Determine the type of the target operation and maintenance operation, and create a target operation and maintenance operation definition object and a target operation and maintenance operation request object respectively according to the type of the target operation and maintenance operation; An operation and maintenance controller is created. When the operation and maintenance controller detects the target operation and maintenance request object, it executes the operation and maintenance operation according to the target operation and maintenance definition object.
2. The database operation and maintenance management method according to claim 1, characterized in that, The step of determining the type of the target operation and maintenance operation, and creating a target operation and maintenance operation definition object and a target operation and maintenance operation request object respectively according to the type of the target operation and maintenance operation, includes: Determine whether the target operation is a custom operation. If so, create a new target operation definition object and a custom operation request object. If the target operation is a general operation, create a new general operation request object.
3. The database operation and maintenance management method according to claim 2, characterized in that, The custom operation and maintenance operation is an operation and maintenance operation specific to the target database.
4. The database operation and maintenance management method according to claim 1, characterized in that, The operation and maintenance definition object contains the execution logic of the custom operation and maintenance operation, which is referenced by the custom operation and maintenance request object.
5. The database operation and maintenance management method according to claim 4, characterized in that, When the operation and maintenance controller detects the target operation and maintenance request object, it executes the operation and maintenance operation according to the target operation and maintenance definition object, including: When the operation and maintenance controller detects the target operation and maintenance request object, it determines whether the target operation and maintenance request object is a custom operation and maintenance request object. If so, it executes the operation and maintenance operation contained in the target operation and maintenance definition object it calls.
6. The database operation and maintenance management method according to claim 1, characterized in that, The method further includes: When the target operation is a general operation, the execution logic of the target operation is built into the operation controller.
7. A database operation and maintenance management system, characterized in that, include: The definition module is used to define operation and maintenance operation request objects and operation and maintenance operation definition objects. The operation and maintenance operation request objects include general operation and maintenance operation request objects and custom operation and maintenance operation request objects. A new module is created to determine the type of the target operation and maintenance operation, and to create a target operation and maintenance operation definition object and a target operation and maintenance operation request object respectively according to the type of the target operation and maintenance operation; The execution module is used to create an operation and maintenance controller, and when the operation and maintenance controller listens for the target operation and maintenance request object, it executes the operation and maintenance operation according to the target operation and maintenance definition object.
8. The database operation and maintenance management system according to claim 7, characterized in that, The system also includes: An embedded module is used to embed the execution logic of the target operation and maintenance operation into the operation and maintenance operation controller when the target operation and maintenance operation is a general operation and maintenance operation.
9. An electronic device, characterized in that, The system includes a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a database operation and maintenance management method as described in any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that, The computer program enables the computer to implement a database operation and maintenance management method as described in any one of claims 1 to 6 when executed.