Database capacity expansion and contraction method and device, electronic equipment and storage medium
By deploying a custom controller in a Kubernetes cluster to listen to and update ConfigMap files to drive the elastic scaling of database Pods, the service interruption problem of database systems in container cloud environments is solved, achieving efficient automated management and resource utilization, and improving the scalability and maintainability of the database.
Patent Information
- Application Number
- CN202511765444.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-27
AI Technical Summary
In existing technologies, database systems face the risk of service interruption when scaling horizontally in a container cloud environment, resulting in low scalability and maintainability of the database and low resource utilization.
By deploying a custom controller in a Kubernetes cluster, it listens for changes to custom resources in the target database, updates the ConfigMap file, and mounts it inside the database Pod, driving the database Pod to perform elastic scaling, thus achieving automated management and dynamic transmission of configuration information.
It has enabled automated management of database cluster operations, reduced operation and maintenance costs and error rates, improved the scalability and maintainability of the database, and ensured business continuity and high system availability.
Smart Images

Figure CN121579481A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of database, and in particular to a database scale-in / out method and device, electronic equipment and storage medium. BACKGROUND
[0002] With the development of cloud computing and containerization technology, database systems gradually evolve towards cloud-native architecture. In actual business scenarios, database load presents a dynamic fluctuation trend, requiring the database to have elastic scaling capability, especially in high concurrency, high load or burst business situations, to quickly expand resources and ensure performance stability.
[0003] In related technologies, the horizontal scale-in / out (adding or deleting database nodes) of the database generally adopts a static configuration deployment method. When a new database node needs to be added, the service often needs to be suspended, the configuration needs to be modified, the data needs to be manually synchronized, and then the database instance needs to be restarted. Although the existing mainstream databases have a certain degree of elasticity in the cloud-native environment, they still need to rely on the redeployment operation of the stateful service, which has the problem of service interruption risk in actual application, reducing the scalability and maintainability of the database in the running process and affecting the resource utilization of the database. SUMMARY
[0004] Therefore, it is necessary to provide a database scale-in / out method, device, electronic equipment and storage medium to solve the technical problem of service interruption of the database system in the horizontal scale-in / out in the container cloud environment, low scalability and maintainability of the database in the running process, and low resource utilization of the database.
[0005] To solve the above technical problems, in a first aspect, the present application provides a database scale-in / out method applied to a self-defined controller deployed in a Kubernetes cluster, the method comprising: updating a ConfigMap file in the Kubernetes cluster in response to listening to a change event of a target database self-defined resource; mounting the updated ConfigMap file to the inside of a Pod of the target database to drive the elastic scaling of the Pod of the target database.
[0006] In a possible implementation, a dmctl (Dream Database Boot Program) is deployed in the inside of each Pod of the target database. The mounting of the updated ConfigMap file to the inside of the Pod of the target database to drive the elastic scaling of the Pod of the target database comprises: The dmctl process running inside the Pod of the target database listens to the mounted ConfigMap file in real time, and sends a node scaling instruction to the master process of the target database when a change in the mounted ConfigMap file is captured. The master process of the target database executes the node scaling instruction to realize the elastic scaling of the Pod of the target database.
[0007] In a possible implementation, the control of the master process of the target database to execute the node scaling instruction to realize the elastic scaling of the Pod of the target database includes: In the case that the node scaling instruction is scaling up, the master process of the target database starts a node registration process according to the node scaling instruction, and obtains a registered new node; The master process of the target database performs synchronization processing on the new node; The ConfigMap file is updated according to the current node cluster of the target database.
[0008] In a possible implementation, the control of the master process of the target database to execute the node scaling instruction to realize the elastic scaling of the Pod of the target database includes: In the case that the node scaling instruction is scaling down, a node to be offline is determined according to the node scaling instruction; The master process of the target database performs offline processing on the node to be offline; The ConfigMap file is updated according to the current node cluster of the target database.
[0009] In a possible implementation, after the control of the master process of the target database to perform synchronization processing on the new node, the method further includes: The running state and the synchronization state of the Pod of the target database are continuously monitored; In the case that node registration fails or synchronization is abnormal, a failure rollback is triggered.
[0010] In a possible implementation, after the control of the master process of the target database to perform offline processing on the node to be offline, the method further includes: The running state of the Pod of the target database is continuously monitored; In the case that the node to be offline fails to be offline, a failure rollback is triggered.
[0011] In a possible implementation, after the updated ConfigMap file is mounted into the Pod of the target database to drive the elastic scaling of the Pod of the target database, the method further includes: obtaining an operation log of the elastic scaling and a cluster state of the target database. visualizing the operation log.
[0012] In a second aspect, the application further provides a database scaling device, which is applied to a custom controller deployed in a Kubernetes cluster, and the device includes: an updating unit configured to update a ConfigMap file in the Kubernetes cluster in response to a change event of a target database custom resource being listened to; a scaling unit configured to mount the updated ConfigMap file into a Pod of the target database to drive elastic scaling of the Pod of the target database.
[0013] In a third aspect, the application further provides an electronic device including a memory and a processor, wherein the memory is configured to store a program; the processor is coupled to the memory and is configured to execute the program stored in the memory to implement the steps of the database scaling method in any of the above implementation manners.
[0014] In a fourth aspect, the application further provides a computer-readable storage medium configured to store a computer-readable program or instruction, which, when executed by a processor, can implement the steps of the database scaling method in any of the above implementation manners.
[0015] The application has the following beneficial effects: The database scaling method provided by this invention updates the ConfigMap file in the Kubernetes cluster in response to changes in custom resources of the target database. This eliminates business interruptions caused by manual configuration modifications or rolling restarts, ensuring business continuity and high system availability. It transforms cluster operations of the target database from manual intervention to automated management based on declarative configuration, achieving automated management of the database cluster lifecycle and resource status, reducing operational costs and error rates. The updated ConfigMap file is mounted into the target database's Pod to drive the elastic scaling of the Pod. This enables automatic execution of Pod creation, update, and deletion operations, and dynamic transfer of configuration information without requiring container restarts, improving the scalability and maintainability of the target database during operation. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A schematic flowchart of an embodiment of the database scaling method provided by the present invention; Figure 2 For the present invention Figure 1 A schematic diagram of an embodiment of S102; Figure 3 For the present invention Figure 2 A schematic diagram of an embodiment of S202; Figure 4 A schematic diagram of an embodiment of the database scaling device provided by the present invention; Figure 5 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0019] In the description of the embodiments of the application, unless otherwise specified, the meaning of "a plurality of" is two or more. The association relationship of the associated objects described by "and / or" indicates that there can be three relationships, for example: A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone.
[0020] The descriptions of "first", "second", and the like in the embodiments of the application are only for the purpose of description, and cannot be understood as indicating or implying the relative importance of the indicated technical features or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined with "first", "second" can explicitly or implicitly include at least one of the features.
[0021] In this document, the term "embodiment" means that the specific features, structures or characteristics described in connection with the embodiment can be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor is it independent or alternative to other embodiments. The skilled person in the art explicitly and implicitly understands that the embodiments described herein can be combined with other embodiments.
[0022] Before the embodiments are described, the following terms are explained.
[0023] Kubernetes cluster: an open source container orchestration platform that can automatically deploy, scale and manage containerized applications. It provides powerful resource management, load balancing, automatic recovery and other functions, and can realize cloud native applications.
[0024] Custom controller (Operator): a component that monitors the state changes of database custom resources (Custom Resource, CR) in the Kubernetes cluster, automatically performs creation, deletion and update operations of database pods, and maintains the node size and resource configuration of the database cluster.
[0025] ConfigMap: refers to a configuration management tool provided by the Kubernetes cluster, which can store configuration information in the form of key-value pairs and inject it into containers through mounting. This method makes the update and management of database configuration more flexible, without the need to redeploy containers.
[0026] Real-time monitoring capability of containerized database boot program (dmctl): dmctl: the boot program of DreamDB, responsible for starting, stopping and configuration management of the database. Through real-time monitoring mechanism, dmctl can respond to changes in database nodes in a timely manner to ensure the normal operation of the database.
[0027] Custom Operator: A component of automation technology for managing and operating complex applications in Kubernetes clusters, based on Kubernetes cluster Custom Resource Definitions (CRD) and Controller mechanism, allowing developers to create custom operators for managing specific types of applications or services.
[0028] Pod: The smallest unit that can be created and managed in a Kubernetes cluster, is the smallest resource object model created or deployed by users in the resource object model, and is also the resource object for running containerized applications on a Kubernetes cluster.
[0029] The application provides a database scaling method and device, electronic equipment and storage medium, which are described below.
[0030] Figure 1 An embodiment flow diagram of the database scaling method provided by the application is shown in Figure 1 The database scaling method is applied to a custom operator deployed in a Kubernetes cluster, and the method comprises: S101, in response to listening to the change event of the target database custom resource, updating the ConfigMap file in the Kubernetes cluster.
[0031] In this embodiment, the target database can be a Dream Database.
[0032] The change event refers to an event in which the state of the target database custom resource (CR) object in the Kubernetes cluster changes, such as an event in which the number of cluster replicas or related resource configurations of the target database changes.
[0033] The ConfigMap file includes the cluster topology, node role, connection parameters and related running parameters of the target database.
[0034] Specifically, the Operator continuously monitors the state change of the CR corresponding to the target database, and in response to the change event of the target database custom resource, updates the ConfigMap file in the Kubernetes cluster in real time, without manually logging into the container to modify the ini, eliminating the business terminal caused by manual configuration modification or rolling restart, ensuring business continuity and system high availability, and facilitating subsequent database instance startup to load the updated ConfigMap file, and completing node self-registration, role and cluster construction according to the updated ConfigMap file content, so that the cluster operation of the target database is changed from manual intervention to automatic management based on declarative configuration, realizing the automatic management of the database cluster life cycle and resource state, reducing the operation and maintenance cost and error rate.
[0035] S102, mount the updated ConfigMap file into the Pod of the target database to drive the elastic scaling of the Pod of the target database.
[0036] The updated ConfigMap file includes the updated cluster topology structure, node role, connection parameter and related running parameter of the target database.
[0037] Specifically, the Operator injects the updated ConfigMap file into the Pod corresponding to the target database in the form of volume mounting to drive the elastic scaling of the Pod of the target database, realizes the automatic execution of the creation, update and deletion operations of the Pod of the target database, and realizes the dynamic delivery of configuration information, without the need to restart the container, thereby improving the scalability and maintainability of the target database in the running process.
[0038] It can be understood that the embodiments of the present application realize real-time delivery of configuration by combining the dynamic mounting of the updated ConfigMap file, improve the automation management level and resource scheduling efficiency of the database cluster, significantly reduce the complexity and risk of traditional manual operation and maintenance, and meet the strict requirements of database elasticity, high availability and autonomous control in the cloud native environment.
[0039] In conclusion, the database expansion and contraction method provided by the embodiment of the application eliminates the business terminal caused by manual configuration modification or rolling restart, ensures business continuity and system high availability, changes the cluster operation of the target database from manual intervention to automatic management based on declarative configuration, realizes automatic management of the database cluster life cycle and resource state, reduces operation and maintenance cost and error rate, mounts the updated ConfigMap file to the Pod of the target database to drive the elastic scaling of the Pod of the target database, realizes automatic execution of the creation, update and deletion operation of the Pod of the target database, and realizes dynamic delivery of configuration information without restarting the container, and improves the scalability and maintainability of the target database in the running process.
[0040] In some embodiments of the application, as shown in Figure 2 The step S102 comprises: S201, controlling the dmctl process running in the Pod of the target database to listen to the mounted ConfigMap file in real time, and sending a node expansion and contraction instruction to the main process of the target database when the mounted ConfigMap file is captured; S202, controlling the main process of the target database to execute the node expansion and contraction instruction to realize the elastic scaling of the Pod of the target database.
[0041] In some embodiments of the application, as shown in
[0042] Specifically, the dmctl process running in the Pod of the target database listens to the mounted ConfigMap file in real time, which can be realized by using the inotify mechanism of the Linux kernel through the dmctl of the Dream Database, and sending a node expansion and contraction instruction to the main process of the target database when the mounted ConfigMap file is captured, realizing instant perception and dynamic response to the target database configuration, controlling the main process of the target database to execute the node expansion and contraction instruction to realize the elastic scaling of the Pod of the target database, effectively avoiding the business interruption risk caused by the traditional expansion and contraction, and ensuring the continuity and high availability of the business.
[0043] In some embodiments of the application, as shown in Figure 3 The step S202 comprises: S301, in the case of the node expansion instruction is expansion, control the main process of the target database to start node registration process according to the node expansion instruction, obtain the registered new node; S302, control the main process of the target database to carry out synchronization processing to the new node; S303, update the ConfigMap file according to the current node cluster of the target database.
[0044] Specifically, in the case of the node expansion instruction is expansion, control the main process of the target database to start node registration process according to the node expansion instruction, obtain the registered new node, then, control the main process of the target database to carry out synchronization processing to the new node, avoid the service interruption and data inconsistency problem caused by node change, ensure data consistency and state synchronization; update the ConfigMap file according to the current node cluster of the target database, ensure that the target database process can synchronize the latest configuration in time and accurately, improve system flexibility and response speed.
[0045] In one specific embodiment, Operator automatically generates new database Pod resource definition (Deployment / StatefulSet) according to the expansion instruction, completes the scheduling and startup of the Pod. At the same time, Operator updates the ConfigMap file according to the latest cluster state, including the topology information, role allocation, connection address and related parameters of all nodes. The expansion process is as follows: the new node automatically initiates a join request, after cluster authentication, completes metadata pulling and log flattening, ensures data consistency and state synchronization. The newly added node can participate in business requests after completing registration, and the overall business of the system is expanded without perception. This dynamic synchronization mechanism ensures the accuracy and consistency of the cluster member state.
[0046] In some embodiments of the application, step S303 comprises: S401, in the case of the node expansion instruction is shrinkage, determine the node to be offline according to the node expansion instruction; S402, control the main process of the target database to carry out offline processing to the node to be offline; S403, update the ConfigMap file according to the current node cluster of the target database.
[0047] Specifically, in the case that the node expansion and contraction instruction is a contraction, the node to be offline is determined according to the node expansion and contraction instruction, and then the main process of the target database is controlled to perform offline processing on the node to be offline, so as to realize the contraction operation of the database with consistent cluster state without service interruption and data loss, avoid service interruption and data inconsistency caused by node change, and ensure data consistency and state synchronization; the ConfigMap file is updated according to the current node cluster of the target database, so that the target database process can synchronize the latest configuration in real time and accurately, and the system flexibility and response speed are improved.
[0048] In one specific embodiment, the Operator controls the node to be offline to start the graceful offline process according to the expansion and contraction instruction, including connection migration, cache flushing and state cleaning, so that the node to be offline is removed from the cluster member list and resources are released, specifically: stopping accepting new connection requests; migrating or closing the current active connection to ensure no service interruption; flushing the cache and the log to synchronize the data to other nodes in the cluster; cleaning the local state to complete the data cleaning. The node is removed from the cluster member list and the resources are released; the Operator deletes the corresponding database Pod to complete the contraction. The whole process is not interrupted and has rollback capability.
[0049] In some embodiments of the application, after step S302, the method further comprises: S501, continuously monitoring the running state and synchronization state of the Pod of the target database; S502, if node registration fails or synchronization is abnormal, triggering failure rollback.
[0050] The failure rollback process includes node resource cleaning, configuration recovery and log auditing, which ensures that the system returns to the stable state before expansion, avoids data damage or service unavailability, and synchronously feeds back the fault information and operation log to the operation and maintenance platform to support rapid positioning and processing.
[0051] Specifically, the Operator continuously monitors the running state and synchronization state of the Pod of the target database, and if node registration fails or synchronization is abnormal, triggers failure rollback, thereby ensuring that the database system has good robustness and high controllability when facing expansion exceptions, and ensuring the safety, stability and high reliability of the database system.
[0052] In some embodiments of the application, after step S402, the method further comprises: S601, continuously monitoring the running state of the Pod of the target database; S602, if the offline of the node to be offline fails, triggering failure rollback.
[0053] Specifically, the Operator continuously monitors the running state of the Pod of the target database, and when detecting that the offline failure of the to-be-offlined node fails, triggers a failure rollback, so that the abnormal state can be found in time during the scaling process and quickly restored to a stable configuration, thereby ensuring that the database system has good robustness and high controllability when facing scaling exceptions, and ensuring the safety, stability and high reliability of the database system.
[0054] In one specific embodiment, the Operator continuously monitors the state and data synchronization of the new and old nodes. If it is found that the scaling node registration fails, the data synchronization is abnormal, or the node cannot gracefully exit during the scaling process, the system automatically triggers a failure rollback process, such as stopping the service of the abnormal node, restoring the old configuration file, cluster state, and deleting the Pod resource of the failed node, to ensure that the cluster state returns to stability.
[0055] In some embodiments of the present application, after step S102, further comprising: S701, obtaining the scaling operation log of the elastic scaling of the Pod driving the target database and the cluster state of the target database; S702, visualizing the scaling operation log.
[0056] Specifically, the Operator obtains the scaling operation log of the elastic scaling of the Pod driving the target database and the cluster state of the target database, and visualizes the scaling operation log, which improves the administrator's control over the dynamic of the database system, reduces the operation and maintenance complexity, and enhances the maintainability and reliability of the system.
[0057] It is worth noting that the real-time feedback of the visualized scaling operation log to the operation and maintenance platform can improve the transparent control of the system state by the operation and maintenance personnel, while supporting flexible adjustment of the node size according to the business load, realizing the elastic allocation and efficient utilization of resources, and reducing the operation cost.
[0058] It can be understood that the entire online horizontal scaling process in the embodiment is controlled by the Operator, which cooperates with the dmctl and the database master process to form a complete closed loop from configuration change, Pod management, configuration notification, database synchronization, exception handling to state feedback. The closed loop management and operation and maintenance visualization mechanism can improve the operation and maintenance efficiency and the system disaster recovery capability, and meet the key needs of enterprises for high availability and automated operation and maintenance of the database.
[0059] In order to better implement the database scaling method in the embodiment of the present application, on the basis of the database scaling method, corresponding to Figure 4As shown, this embodiment of the invention also provides a database scaling device, applied to a custom controller deployed in a Kubernetes cluster. The database scaling device 400 includes: Update unit 401 is used to update the ConfigMap file in the Kubernetes cluster in response to a change event of a custom resource in the target database. The scaling unit 402 is used to mount the updated ConfigMap file into the Pod of the target database to drive the elastic scaling of the Pod of the target database.
[0060] The database scaling device 400 provided in the above embodiments can implement the technical solutions described in the above database scaling method embodiments. The specific implementation principles of each module or unit can be found in the corresponding content in the above database scaling method embodiments, and will not be repeated here.
[0061] like Figure 5 As shown, the present invention also provides an electronic device 500. The electronic device 500 includes a processor 501, a memory 502, and a display 503. Figure 5 Only some components of the electronic device 500 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0062] In some embodiments, processor 501 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 502 or process data, such as the database scaling method in this invention.
[0063] In some embodiments, processor 501 may be a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, processor 501 may be local or remote. In some embodiments, processor 501 may be implemented on a cloud platform. In one embodiment, the cloud platform may include a private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, inter-cloud, multi-cloud, or any combination thereof.
[0064] In some embodiments, memory 502 may be an internal storage unit of electronic device 500, such as a hard disk or memory of electronic device 500. In other embodiments, memory 502 may also be an external storage device of electronic device 500, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 500.
[0065] Further, the memory 502 can include both an internal storage unit of the electronic device 500 and an external storage device. The memory 502 is used to store application software installed in the electronic device 500 and various types of data.
[0066] The display 503 can be an LED display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, etc. in some embodiments. The display 503 is used to display information of the electronic device 500 and to display a visualized user interface. The components 501-503 of the electronic device 500 communicate with each other through a system bus.
[0067] In an embodiment, when the processor 501 executes the database scaling procedure in the memory 502, the following steps can be implemented: In response to listening to the change event of the target database custom resource, updating the ConfigMap file in the Kubernetes cluster; Mounting the updated ConfigMap file into the Pod of the target database to drive the elastic scaling of the Pod of the target database.
[0068] It should be understood that, in addition to the above functions, the processor 501 can also implement other functions when executing the database scaling procedure in the memory 502. For details, refer to the description of the corresponding method embodiments.
[0069] Further, the type of the electronic device 500 referred to in the embodiments of the present application is not specifically limited, and the electronic device 500 can be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, etc. Exemplary embodiments of the portable electronic device include but are not limited to a portable electronic device running an IOS, an android, a microsoft or other operating system. The above-mentioned portable electronic device can also be other portable electronic devices such as a laptop computer having a touch-sensitive surface (e.g. a touch panel), etc. It should also be understood that in some other embodiments of the present application, the electronic device 500 can also not be a portable electronic device, but a desktop computer having a touch-sensitive surface (e.g. a touch panel).
[0070] Correspondingly, the embodiment of the present application further provides a computer readable storage medium, which is used to store computer readable programs or instructions, and the programs or instructions are executed by a processor to realize the steps or functions in the database expansion and contraction method provided by the above-mentioned method embodiments.
[0071] Those skilled in the art can understand that all or part of the processes of the above-mentioned embodiment methods can be completed by a computer program instructing relevant hardware (such as a processor, a controller, etc.) to complete, and the computer program can be stored in a computer readable storage medium. The computer readable storage medium is a disk, an optical disk, a read-only memory or a random access memory, etc.
[0072] The database expansion and contraction method, device, electronic equipment and storage medium provided by the present application are described in detail above, and the principle and implementation mode of the present application are described by applying specific examples in this paper. The above embodiment is only used to help understand the method and core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above description should not be understood as a limitation of the present application.
Claims
1. A method for scaling up or down a database, characterized in that, The method, applied to a custom controller deployed in a Kubernetes cluster, includes: In response to the detection of a change event to a custom resource in the target database, the ConfigMap file in the Kubernetes cluster is updated; The updated ConfigMap file is mounted inside the target database's Pod to drive the elastic scaling of the target database's Pod.
2. The database scaling method according to claim 1, characterized in that, Each target database Pod has a DM database bootstrap program (dmctl) deployed inside it; the step of mounting the updated ConfigMap file inside the target database Pod to drive the elastic scaling of the target database Pod includes: The dmctl process running inside the Pod of the target database monitors the mounted ConfigMap file in real time, and sends node scaling instructions to the main process of the target database when it detects changes in the mounted ConfigMap file. The main process of the target database is controlled to execute the node scaling instructions to achieve elastic scaling of the target database's Pods.
3. The database scaling method according to claim 2, characterized in that, The process of controlling the main process of the target database to execute the node scaling instructions to achieve elastic scaling of the target database's Pods includes: When the node scaling instruction is for scaling up, the main process controlling the target database starts the node registration process according to the node scaling instruction to obtain the new node to be registered; The main process of the target database is controlled to synchronize the new node; Update the ConfigMap file based on the current node cluster of the target database.
4. The database scaling method according to claim 2, characterized in that, The process of controlling the main process of the target database to execute the node scaling instructions to achieve elastic scaling of the target database's Pods includes: If the node scaling instruction is for scaling down, the node to be taken offline is determined according to the node scaling instruction. The main process of the target database is controlled to take the nodes to be taken offline. Update the ConfigMap file based on the current node cluster of the target database.
5. The database scaling method according to claim 3, characterized in that, After the main process controlling the target database performs synchronization processing on the new node, the process further includes: Continuously monitor the running and synchronization status of the Pods in the target database; If a node registration failure or synchronization anomaly is detected, a failure rollback is triggered.
6. The database scaling method according to claim 4, characterized in that, After the main process controlling the target database performs the offline process on the node to be taken offline, the process further includes: Continuously monitor the running status of the target database's Pods; If the failure to take a node offline is detected, a rollback is triggered.
7. The database scaling method according to claim 1, characterized in that, After mounting the updated ConfigMap file into the target database's Pod to drive the elastic scaling of the target database's Pod, the method further includes: Obtain the scaling operation logs of the Pod that drives the target database and the cluster status of the target database; The scaling up and down operation logs are visualized.
8. A database scaling device, characterized in that, A device for use with a custom controller deployed in a Kubernetes cluster, the device comprising: The update unit is used to update the ConfigMap file in the Kubernetes cluster in response to a change event of a custom resource in the target database. The scaling unit is used to mount the updated ConfigMap file into the Pod of the target database to drive the elastic scaling of the Pod of the target database.
9. An electronic device, characterized in that, It includes a memory and a processor, wherein the memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the database scaling method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the database scaling method according to any one of claims 1 to 7.