Database instance processing method based on cloud platform, electronic equipment and storage medium
By performing legality verification, data flushing and locking on the database instance on the cloud platform, creating block storage volume snapshots and associating them with storage backup metadata, the problems of long backup time, insufficient data consistency and large business interference in the existing technology are solved, and efficient and reliable database backup and recovery are achieved.
Patent Information
- Application Number
- CN202511605429.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-04
- Publication Date
- 2026-02-13
AI Technical Summary
Existing database backup solutions in cloud computing platforms suffer from problems such as long backup times, difficulty in ensuring data consistency, insufficient adaptability to master-slave replication scenarios, significant disruption to business operations during the backup process, and high operational complexity, resulting in insufficient management efficiency and disaster recovery capabilities.
By verifying the legitimacy of data backup creation requests and database instances to be backed up, performing data flushing and read-only locking, creating block storage volume snapshots, and associating backup unique identifiers with snapshot information for storage, the management of backup metadata and the recovery process are automated.
It improves the efficiency of database instance backup, ensures the consistency of backup data, reduces the interference of the backup process on business, and achieves precise binding between backup identifiers and snapshot information.
Smart Images

Figure CN121523971A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database management, and more particularly to a database instance processing method, electronic device, and storage medium based on a cloud platform. Background Technology
[0002] With the development of cloud computing technology, resource pooling and multi-tenant architecture have become the mainstream deployment mode. As the core data storage component, the database's high availability, rapid recovery capability and data consistency guarantee have become key requirements for cloud computing platform management.
[0003] Existing database backup and recovery solutions mainly include physical backup based on data file copying, logical backup based on statement export, incremental backup dependent on logs, and virtual machine-level overall snapshot backup. These solutions achieve data backup and recovery through full data copying, log playback, or whole machine status recording.
[0004] Existing technologies generally suffer from problems such as long backup and recovery times, difficulty in ensuring data consistency, insufficient adaptability to master-slave replication scenarios, significant disruption to business operations during backup, and high operational complexity. As a result, the management efficiency and disaster recovery capabilities of database instances in cloud computing platforms cannot meet the needs of actual applications. Summary of the Invention
[0005] This application provides a database instance processing method, electronic device, and storage medium based on a cloud platform, which can simplify the backup operation process and reduce the interference of the backup process on business operations.
[0006] In a first aspect, embodiments of this application provide a database instance processing method based on a cloud platform, comprising:
[0007] Obtain the data backup creation request and the database instance to be backed up, and perform legality verification on the data backup creation request and the database instance to be backed up to obtain the verification result;
[0008] When the verification result is detected as passed, a snapshot backup is created based on the database instance to be backed up;
[0009] Assign a unique backup identifier to the snapshot backup, and write the unique backup identifier and the account configuration information of the instance to be backed up to the data disk of the instance to be backed up;
[0010] Execute data flushing and read-only locking commands to flush the non-persistent table data in the instance to be backed up to the storage engine, and apply a read-only lock to the database instance to be backed up;
[0011] Execute the master database status query command to obtain the parsing information of the instance to be backed up;
[0012] A parsing file conforming to a preset backup format is generated based on the parsing information, and the parsing file is written to the data disk;
[0013] Perform a memory data flush operation to flush the data in the memory cache to the data disk and apply a file system level lock to the mount directory of the data disk;
[0014] The parsed file is written as backup metadata into the management node database;
[0015] Call the block storage interface of the cloud computing platform to create a block storage volume snapshot for the data disk and assign a corresponding unique identifier for the block storage volume snapshot;
[0016] Write the unique identifier of the block storage volume snapshot into the management node database and associate it with the unique identifier of the backup to complete the snapshot backup of the database instance to be backed up.
[0017] In one possible implementation, the step of validating the data backup creation request and the database instance to be backed up, and obtaining the verification result, includes:
[0018] The data backup creation request is analyzed and verified to obtain a first verification result as to whether the backup type meets the first preset condition;
[0019] The snapshot support of the database instance to be backed up is verified to obtain a second verification result of whether the instance supports creating snapshot backups, and the instance status of the database instance to be backed up is verified to obtain a third verification result of whether the instance is in a normal state.
[0020] When the first verification result, the second verification result, and the third verification result are all detected as passed, a successful verification result is obtained.
[0021] When any one of the first, second, and third verification results fails, a failed verification result is generated.
[0022] In one possible implementation, performing the memory data flush operation, which flushes the data in the memory cache to the data disk, includes:
[0023] By sequentially executing data flushing instructions at the operating system level and file system locking instructions, a memory data flushing operation is performed, flushing the data in the memory cache to the data disk.
[0024] In one possible implementation, after completing the snapshot backup of the database instance to be backed up, the method further includes:
[0025] The file system unlock command and the database read-only lock release command are executed sequentially to restore write permissions for the data disk and write operation permissions for the database service.
[0026] In one possible implementation, it also includes:
[0027] Obtain the snapshot recovery request of the target database instance, and perform parameter validity verification on the snapshot recovery request to obtain the recovery verification result, wherein the snapshot recovery request contains the unique identifier of the target block storage volume snapshot;
[0028] When the recovery verification result is detected as passed, record information for creating a new database instance is created in the management node database;
[0029] Based on the preset instance specification information, basic configuration information and configuration files to be injected are generated for the new database instance;
[0030] Invoke the preset network service to create a default security group and virtual network interface for the new database instance;
[0031] The block storage interface is invoked, passing in the unique identifier of the target block storage volume snapshot, and the target snapshot backup is determined based on the unique identifier of the target block storage volume snapshot;
[0032] A new data volume is created based on the target snapshot backup as the target data disk for the new database instance;
[0033] The preset computing network service is invoked to start a new virtual machine based on the pre-specified version of the database image, the configuration file to be injected, the virtual network card, and the target data disk;
[0034] A backup and recovery preparation request is sent to the new virtual machine through a preset message queue to perform a snapshot backup operation and complete the snapshot recovery of the target snapshot backup.
[0035] In one possible implementation, sending a backup and recovery preparation request to the new virtual machine via a preset message queue to perform a snapshot backup operation and complete the snapshot recovery of the target snapshot backup includes:
[0036] A backup and restore request is sent to the new virtual machine via a preset message queue, enabling the virtual machine instance operation service within the virtual machine to function.
[0037] Upon receiving the backup and restore request, add the startup configuration parameters to the configuration file to be injected;
[0038] Skip the data disk formatting operation and perform file system expansion operation;
[0039] Retrieve the account configuration information of the target database instance from the data disk to restore account access permissions;
[0040] Delete the database service identifier file in the data disk so that a new service identifier is generated when the new database instance starts;
[0041] Read the table name case sensitivity configuration information from the data disk and write it into the configuration file to be injected;
[0042] When it is detected that the current snapshot backup was created by the slave management node database and the original management node database information in the slave management node database can be obtained, the master-slave replication clearing command is executed to complete the snapshot recovery of the target snapshot backup.
[0043] In one possible implementation, it also includes:
[0044] Convert the target snapshot backup into a separate data copy.
[0045] Secondly, embodiments of this application provide a database instance processing apparatus based on a cloud platform, comprising:
[0046] The acquisition module is used to acquire a data backup creation request and a database instance to be backed up, and to perform legality verification on the data backup creation request and the database instance to be backed up, and obtain the verification result.
[0047] The detection module is used to create a snapshot backup based on the database instance to be backed up when the verification result is detected as passed.
[0048] The allocation module is used to allocate a unique backup identifier to the snapshot backup and write the unique backup identifier and the account configuration information of the instance to be backed up into the data disk of the instance to be backed up;
[0049] The execution module is used to execute data flushing and read-only locking instructions, flushing the non-persistent table data in the instance to be backed up to the storage engine, and applying a read-only lock to the database instance to be backed up;
[0050] The execution module is also used to execute the master database status query command to obtain the parsing information of the instance to be backed up;
[0051] The generation module is used to generate a parsing file that conforms to a preset backup format based on the parsing information, and write the parsing file to the data disk;
[0052] The flashing module is used to perform memory data flashing operations, write the data in the memory cache to the data disk, and apply file system level locking to the mount directory of the data disk;
[0053] The generation module is also used to write the parsed file as backup metadata into the management node database;
[0054] The identification module is used to call the block storage interface of the cloud computing platform to create a block storage volume snapshot for the data disk and assign a corresponding unique identifier for the block storage volume snapshot;
[0055] The backup module is used to write the unique identifier of the block storage volume snapshot into the management node database and store it in association with the unique backup identifier, thereby completing the snapshot backup of the database instance to be backed up.
[0056] In one possible implementation, the acquisition module is specifically used for:
[0057] The data backup creation request is analyzed and verified to obtain a first verification result as to whether the backup type meets the first preset condition;
[0058] The snapshot support of the database instance to be backed up is verified to obtain a second verification result of whether the instance supports creating snapshot backups, and the instance status of the database instance to be backed up is verified to obtain a third verification result of whether the instance is in a normal state.
[0059] When the first verification result, the second verification result, and the third verification result are all detected as passed, a successful verification result is obtained.
[0060] When any one of the first, second, and third verification results fails, a failed verification result is generated.
[0061] In one possible implementation, the writing module is specifically used for:
[0062] By sequentially executing data flushing instructions at the operating system level and file system locking instructions, a memory data flushing operation is performed, flushing the data in the memory cache to the data disk.
[0063] In one possible implementation, the backup module is further configured to:
[0064] The file system unlock command and the database read-only lock release command are executed sequentially to restore write permissions for the data disk and write operation permissions for the database service.
[0065] In one possible implementation, a recovery module is further included, the recovery module being specifically used for:
[0066] Obtain the snapshot recovery request of the target database instance, and perform parameter validity verification on the snapshot recovery request to obtain the recovery verification result, wherein the snapshot recovery request contains the unique identifier of the target block storage volume snapshot;
[0067] When the recovery verification result is detected as passed, record information for creating a new database instance is created in the management node database;
[0068] Based on the preset instance specification information, basic configuration information and configuration files to be injected are generated for the new database instance;
[0069] Invoke the preset network service to create a default security group and virtual network interface for the new database instance;
[0070] The block storage interface is invoked, passing in the unique identifier of the target block storage volume snapshot, and the target snapshot backup is determined based on the unique identifier of the target block storage volume snapshot;
[0071] A new data volume is created based on the target snapshot backup as the target data disk for the new database instance;
[0072] The preset computing network service is invoked to start a new virtual machine based on the pre-specified version of the database image, the configuration file to be injected, the virtual network card, and the target data disk;
[0073] A backup and recovery preparation request is sent to the new virtual machine through a preset message queue to perform a snapshot backup operation and complete the snapshot recovery of the target snapshot backup.
[0074] In one possible implementation, the recovery module is further configured to:
[0075] A backup and restore request is sent to the new virtual machine via a preset message queue, enabling the virtual machine instance operation service within the virtual machine to function.
[0076] Upon receiving the backup and restore request, add the startup configuration parameters to the configuration file to be injected;
[0077] Skip the data disk formatting operation and perform file system expansion operation;
[0078] Retrieve the account configuration information of the target database instance from the data disk to restore account access permissions;
[0079] Delete the database service identifier file in the data disk so that a new service identifier is generated when the new database instance starts;
[0080] Read the table name case sensitivity configuration information from the data disk and write it into the configuration file to be injected;
[0081] When it is detected that the current snapshot backup was created by the slave management node database and the original management node database information in the slave management node database can be obtained, the master-slave replication clearing command is executed to complete the snapshot recovery of the target snapshot backup.
[0082] In one possible implementation, the recovery module is further configured to:
[0083] Convert the target snapshot backup into a separate data copy.
[0084] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0085] The memory stores computer-executed instructions;
[0086] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0087] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0088] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0089] The cloud-based database instance processing method, electronic device, and storage medium provided in this application verify the legality of the data backup creation request and the database instance to be backed up. After the verification is successful, data flushing, read-only locking, and file system-level locking operations are performed. Combined with block storage volume snapshot creation and backup metadata association storage, the database instance backup efficiency is improved, backup data consistency is ensured, and the backup process is reduced to reduce business interference. At the same time, the backup identifier and snapshot information are accurately bound. Attached Figure Description
[0090] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0091] Figure 1 A flowchart illustrating the cloud platform-based database instance processing method provided in this application;
[0092] Figure 2 A schematic diagram of the structure of the cloud platform-based database instance processing device provided in this application;
[0093] Figure 3 A schematic diagram of the hardware structure of the electronic device provided in this application.
[0094] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0095] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0096] First, let me explain the terms used in this application:
[0097] The block storage interface (Cinder interface) refers to the standardized interface in a cloud computing platform that provides block storage resource management functions, used to implement block-level storage operations such as data volume creation, snapshot generation, and data reading and writing.
[0098] Cinder volume snapshot: refers to an instantaneous record of the state of a data volume at a certain moment, created through the block storage interface, which enables fast backup and reuse of data based on mechanisms such as copy-on-write.
[0099] Management node database: refers to the system used to store metadata for database instance management, including core management data such as backup identifiers, snapshot association information, and instance configuration data;
[0100] Database instance to be backed up: refers to the database service instance in the cloud computing platform that needs to be backed up, including complete data and configuration information such as instance running status, business data, and account configuration;
[0101] Backup unique identifier: refers to a globally unique identifier assigned to each snapshot backup, used to distinguish different backup tasks and achieve accurate location and management of backup information;
[0102] Snapshot recovery request: refers to the operation command that triggers the snapshot recovery of the database instance. It contains key parameters such as the unique identifier of the target block storage volume snapshot, which are used to specify the data source to be recovered.
[0103] Copy-on-write (CoW): refers to the optimization mechanism used in the creation and data copying process of block storage snapshots. The original data block is copied only when the data block is modified, reducing the time spent on redundant data storage and operation.
[0104] Flattening interface: refers to the interface in block storage service used to convert snapshot data based on copy-on-write mechanism into a full independent data copy, eliminating the dependency on the original snapshot through full block-level writing;
[0105] Read-only locks are access restriction mechanisms applied to database instances or data storage objects, allowing only read operations while prohibiting write operations, and are used to ensure the consistency of data state during backup.
[0106] File system level locking refers to file system-level access restrictions imposed on the mount directory of the data disk to prevent file system data from being modified during snapshot creation and to ensure the integrity of snapshot data.
[0107] Parsing information refers to transaction-related data obtained by querying the database instance status, including transaction execution status and data consistency verification information, which is used to support the generation of backup metadata;
[0108] Backup metadata refers to the data set that describes the core information of snapshot backups, including parsing information, backup identifiers, snapshot association information, etc., and is used for data matching in the backup management and recovery process;
[0109] Virtual machine instance operation service: refers to a dedicated service process running inside the virtual machine, used to receive and execute snapshot recovery related configuration operations, and to initialize and start the database instance;
[0110] Service Identifier File: This refers to the file generated by the database service to uniquely identify an instance. It contains instance-specific identification information to avoid identification conflicts between different instances.
[0111] Master-slave replication clear command: This refers to the operation command used to remove the original master-slave replication configuration in the database instance, so that the restored instance becomes an independently running database service entity.
[0112] In existing technologies, database backups achieved through full data replication or whole-machine snapshots suffer from technical problems such as long backup times, difficulty in ensuring data consistency, significant disruption to business operations during the backup process, and a lack of precise correlation between backup information and storage snapshots.
[0113] The cloud-based database instance processing method provided in this application solves the technical problems of low database backup efficiency, insufficient data consistency, large business interference, and inaccurate association between backup and snapshot information in the prior art through legality verification, data flushing and multi-level locking, block storage volume snapshot creation, and the association of backup metadata and snapshot identifier storage.
[0114] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0115] Figure 1 The flowchart illustrating the cloud platform-based database instance processing method provided in this application is shown below. Figure 1 As shown, this embodiment provides a database instance processing method based on a cloud platform, which includes the following steps:
[0116] Step S101: Obtain the data backup creation request and the database instance to be backed up, and perform a validity verification on the data backup creation request and the database instance to be backed up to obtain the verification result.
[0117] Specifically, based on preset verification rules, the legitimacy of data backup creation requests and the status and functional support of the database instance to be backed up are verified to ensure that the prerequisites for backup operations are met. By filtering invalid or illegitimate backup requests, backup failures due to abnormal instance status or unsupported functions are avoided, providing a basic guarantee for the smooth execution of subsequent backup processes, reducing the consumption of system resources by invalid operations, lowering the probability of errors during backup, and improving the reliability of backup operations.
[0118] Step S102: When the verification result is detected as passed, a snapshot backup is created based on the database instance to be backed up.
[0119] Specifically, after successful verification, the snapshot backup process for the database instance to be backed up is initiated, triggering backup preparation based on the instance's current data state. The timing of the backup operation is clearly defined; subsequent backup steps are initiated only after all conditions are confirmed to be ready, ensuring the backup process proceeds as expected, achieving an orderly start of the backup operation, and avoiding data inconsistencies or process interruptions caused by performing backups when conditions are not met.
[0120] Step S103: Assign a unique backup identifier to the snapshot backup, and write the unique backup identifier and the account configuration information of the instance to be backed up to the data disk of the instance to be backed up.
[0121] Specifically, a unique identifier is assigned to each snapshot backup to achieve global differentiation, and key account configuration information is stored on the data disk of the instance to be backed up, ensuring that necessary access credentials can be obtained during recovery. The unique identifier enables precise location and management of backups, while the storage of account configuration information guarantees normal database access permissions after recovery, improving the identifiability and manageability of backups and providing data support for the rapid restoration of account permissions during subsequent recovery processes.
[0122] Step S104: Execute data flushing and read-only locking commands to flush the non-persistent table data in the instance to be backed up to the storage engine and apply a read-only lock to the database instance to be backed up.
[0123] Specifically, the data flush command writes non-persistent table data from memory to the storage engine, while applying read-only locks to restrict write operations and ensure data stability. This prevents incomplete transactions from affecting backup consistency, prevents data modification during backup, ensures that backup data reflects the state at a specific point in time, guarantees transactional consistency of backup data, and reduces inaccuracies in backup content caused by real-time data changes.
[0124] Step S105: Execute the master database status query command to obtain the parsing information of the instance to be backed up.
[0125] Specifically, key operational parameters and transaction information of the instance to be backed up are extracted using the master database status query command, providing raw data for the generation of backup metadata. This obtains core information reflecting the current transaction state of the database, providing a basis for subsequent parsing file generation and backup consistency verification, and establishing the association between backup data and transaction state, thus supporting the integrity and traceability of the backup.
[0126] Step S106: Generate a parsing file that conforms to the preset backup format based on the parsing information, and write the parsing file to the data disk.
[0127] Specifically, the parsed information is standardized according to the preset backup format, generating a parsed file and storing it on the data disk to achieve structured preservation of transaction information; unstructured state information is converted into a standard format file to facilitate the extraction of backup metadata and the reading of information during subsequent recovery, ensuring the standardized storage and efficient reuse of transaction information, and providing a reliable data carrier for matching transaction states during the recovery process.
[0128] Step S107: Perform a memory data flush operation to flush the data in the memory cache to the data disk and apply a file system level lock to the mount directory of the data disk.
[0129] Specifically, operating system-level instructions force memory cache data to be written to the data disk, and file system-level locking is applied to the mounted directory to prevent data writing and file system changes. This ensures that all data (including data in the operating system cache) is fully persisted to the disk, and file system locking further prevents any data modification operations during backup, ensuring data consistency at the physical storage level and avoiding incomplete snapshot data due to unflushed caches or file system changes.
[0130] Step S108: Write the parsed file as backup metadata into the management node database.
[0131] Specifically, the backup metadata contained in the parsed files is stored in the management node database, enabling centralized management and persistent storage of metadata. By establishing a link between backup metadata and the management system, metadata support is provided for backup querying, management, and subsequent recovery, achieving systematic management of backup metadata and improving the accessibility and maintainability of backup information.
[0132] Step S109: Call the block storage interface of the cloud computing platform to create a block storage volume snapshot for the data disk and assign a unique identifier to the corresponding block storage volume snapshot.
[0133] Specifically, the block storage interface is called to create a block storage volume snapshot based on the current data disk status, and a unique identifier is assigned to distinguish different snapshots. The snapshot function of block storage is used to quickly capture the current status of the data disk. The unique identifier ensures the accurate location and management of the snapshot, realizes the instant recording of the data disk status, greatly improves backup efficiency, and reduces backup time.
[0134] Step S110: Write the unique identifier of the block storage volume snapshot into the management node database and associate it with the unique identifier of the backup to complete the snapshot backup of the database instance to be backed up.
[0135] Specifically, the unique identifier of the block storage volume snapshot is associated with the unique identifier of the backup and stored in the management node database to establish a correspondence between backups and snapshots. By clearly defining the mapping relationship between backups and underlying storage snapshots, a basis is provided for the accurate recall of snapshots during subsequent recovery, realizing the precise binding of backup logic information and underlying storage snapshots, and ensuring that the corresponding snapshot resources can be accurately matched during the recovery process.
[0136] The cloud-based database instance processing method provided in this invention ensures the validity of backup prerequisites through legality verification, guarantees data consistency through multi-level data flushing and locking, improves backup efficiency through block storage snapshots, and achieves precise management by associating metadata with snapshot identifiers. This realizes the high efficiency, consistency, and manageability of database instance backups on the cloud platform.
[0137] This embodiment provides a detailed explanation of the process for validating the data backup creation request and the database instance to be backed up in the above embodiments, and obtaining the verification result. The specific implementation of this process includes the following steps:
[0138] Step a1: Perform request analysis and verification on the data backup creation request to obtain the first verification result of whether the backup type meets the first preset condition.
[0139] Specifically, based on preset backup rules and regulations, the backup type information contained in the data backup creation request is parsed and compared to determine whether it meets the first preset conditions set by the system (such as the matching between backup type and instance type, the correlation between incremental backup and basic backup, etc.). Backup types that meet the system's supported scope and logical requirements are selected, and invalid backup requests caused by type mismatch or logical conflicts are excluded. This lays the foundation for the compliance of subsequent backup processes, ensuring that the type parameters of backup operations are within the system's allowed range, and reducing backup process interruptions or data inconsistencies caused by type errors.
[0140] Step a2: Perform snapshot support verification on the database instance to be backed up to obtain a second verification result on whether the instance supports creating snapshot backups, and perform instance status verification on the database instance to be backed up to obtain a third verification result on whether the instance is in a normal state.
[0141] Specifically, by querying the functional attributes and configuration information of the database instance to be backed up, we verify whether it has the underlying support and functional modules required for snapshot backup. Simultaneously, we monitor the instance's operational status parameters (such as service availability, resource load, and the presence of concurrent operations) to determine if it is in a normal state suitable for backup execution. We confirm that the instance's technical capabilities and current status can support snapshot backup execution, avoiding operations on instances that do not support snapshot functionality, or forcibly performing backups when instances are abnormal (such as service crashes or resource overruns). This ensures that backup operations are performed only when the instance has the necessary capabilities and is in a stable state, reducing the probability of backup failures due to instance-specific issues.
[0142] Step a3: When the first verification result, the second verification result, and the third verification result are all detected as passed, the verification result is obtained.
[0143] Specifically, a logical AND operation is performed on the first, second, and third verification results. When all results pass, the data backup creation request and the database instance to be backed up are deemed to meet all legality conditions, generating a successful verification result. By integrating multi-dimensional verification results, a final legality judgment is formed, ensuring that subsequent backup processes are only allowed to start when all preconditions are met. This rigorous multi-condition verification provides comprehensive protection for the smooth execution of backup operations, avoiding problems caused by the omission of a single condition.
[0144] Step a4: When any one of the first, second, and third verification results fails, a failed verification result is generated.
[0145] Specifically, logical checks are performed on the first, second, and third verification results. If any one of these verification results fails, the data backup creation request or the database instance to be backed up is deemed to have a legality defect, generating a failed verification result with a possible reason for failure. This promptly terminates ineligible backup requests, preventing invalid operations from consuming system resources. It also provides clear feedback to users and the system, indicating the issues that need correction, improving system resource utilization efficiency, reducing invalid backup attempts, and facilitating the rapid identification and resolution of legality issues through clear feedback.
[0146] This invention, through compliance verification of backup types, validity verification of instance functions and status, and comprehensive judgment of multi-dimensional results, achieves a comprehensive check of the legality of data backup creation requests and instances to be backed up, ensuring the feasibility and reliability of subsequent backup processes.
[0147] This embodiment provides a detailed description of the process of performing a memory data flushing operation in the above embodiment, which involves flushing data from the memory cache to the data disk. The specific implementation of this process includes:
[0148] By sequentially executing data flushing instructions at the operating system level and file system locking instructions, a memory data flushing operation is performed, flushing the data in the memory cache to the data disk.
[0149] Specifically, by utilizing the data flushing instructions provided by the operating system, temporary data that has not yet been written to the disk in the memory cache is forcibly flushed to the data disk, ensuring the persistence of data at the storage medium level; then, file system locking instructions are executed to restrict write operations to the data disk mount directory, maintaining the stability of the current state of the data disk.
[0150] The data flushing command solves the problem of inconsistency between memory data and disk data caused by the asynchronous write mechanism of the operating system. The file system locking command prevents data from being accidentally modified during the snapshot creation process, providing a point in time where the data status of block storage volume snapshots is determined.
[0151] Ensure that the data on the data disk fully reflects the committed state in memory, avoid incomplete backup data due to cache not being refreshed or data changes during snapshot, and improve the consistency between snapshot data and actual business data.
[0152] This invention achieves forced persistence of memory cache data to the data disk by sequentially executing data flushing and file system locking instructions at the operating system layer, and maintains the stability of the data state at the time of snapshot creation, thus ensuring the physical consistency of backup data.
[0153] In some optional implementations, after completing the snapshot backup of the database instance to be backed up, the following steps are also included:
[0154] The file system unlock command and the database read-only lock release command are executed sequentially to restore write permissions for the data disk and write operation permissions for the database service.
[0155] Specifically, after the snapshot backup is completed, the system first executes a file system unlock command in a preset order to remove write restrictions on the data disk's mounted directory. Then, it executes a database read-only lock release command to remove write operation restrictions on the database instance, restoring the system to a normal read-write state. By terminating the file system lock and database read-only restrictions imposed during the backup process, normal write permissions for the data disk and database service are restored, ensuring that business systems can continue to perform data writing operations. This avoids business interruptions or data write blockages caused by persistent locking, guaranteeing rapid business recovery and continuous operation after the backup operation is completed.
[0156] This invention, through sequential execution of file system unlock and database read-only lock release commands, quickly restores write operation permissions for the data disk and database service, achieving seamless integration between backup operations and business operations, and ensuring business continuity.
[0157] Based on the above embodiments, this embodiment provides a detailed description of the snapshot recovery process, which includes the following steps:
[0158] Step b1: Obtain the snapshot recovery request of the target database instance, and perform parameter validity verification on the snapshot recovery request to obtain the recovery verification result. The snapshot recovery request contains the unique identifier of the target block storage volume snapshot.
[0159] Specifically, the snapshot recovery request containing the unique identifier of the target block storage volume snapshot is parsed, and the validity of the identifier, permission matching, and associated resource status are verified to determine whether the request meets the prerequisites for recovery operation. Invalid or illegal recovery requests are effectively filtered out, ensuring that the snapshot identifier used for recovery is legal and accessible. This provides a foundation for the accuracy of subsequent recovery processes, avoids recovery failures due to incorrect parameters or permission issues, and reduces the consumption of system resources by invalid operations.
[0160] Step b2: When the recovery verification result is detected as passed, record information for creating a new database instance is created in the management node database.
[0161] Specifically, after successful recovery verification, a record containing a unique identifier and associated snapshot information is created for the new database instance in the management node database, establishing the metadata baseline for the new instance. This enables the new instance to register its identity in the management system, providing a data association foundation for subsequent resource allocation and configuration, ensuring that the entire lifecycle of the new instance can be traced and managed by the system, and improving the traceability of the recovery process.
[0162] Step b3: Generate basic configuration information and configuration files to be injected for the new database instance based on the preset instance specification information.
[0163] Specifically, based on preset instance specifications (such as computing resources, storage capacity, etc.), the system generates basic operating parameters for the new database instance and configuration files to be injected into the virtual machine, including database service startup parameters, network configuration, etc. This provides the new instance with a runtime environment configuration that meets the specifications, ensuring that it meets performance and functional requirements after startup. This standardizes and automates the generation of new instance configurations, reducing manual configuration costs and improving recovery efficiency.
[0164] Step b4: Invoke the preset network service to create a default security group and virtual network interface card for the new database instance.
[0165] Specifically, by calling network services, a default security group (restricting internal management access rules) and a virtual network interface card (for user access and internal communication, respectively) are created for the new instance, and corresponding security policies are bound to them. This builds a network isolation environment and communication channel for the new instance, ensuring the security and standardization of network access, enabling rapid deployment of the new instance's network environment, and ensuring that it can interact with the outside world while maintaining internal management security.
[0166] Step b5: Call the block storage interface and pass in the unique identifier of the target block storage volume snapshot, and determine the target snapshot backup based on the unique identifier of the target block storage volume snapshot.
[0167] Specifically, the unique identifier of the target block storage volume snapshot is passed through the block storage interface. The snapshot metadata corresponding to this identifier is queried in the block storage service to locate the target snapshot backup to be used for recovery. The association between the recovery request and the underlying storage snapshot is established to ensure that subsequent data volume creation is based on the correct snapshot source, achieving a precise mapping from snapshot identifier to actual snapshot resource and ensuring the accuracy of the recovered data.
[0168] Step b6: Create a new data volume based on the target snapshot backup as the target data disk for the new database instance.
[0169] Specifically, based on the target snapshot backup, a new data volume is created using block storage services. The data state in the snapshot is copied as the initial state of the new volume, serving as the target data disk for the new instance. The historical data state stored in the snapshot is migrated to the new data volume, providing a data foundation for the new instance. This leverages the characteristics of block storage snapshots to achieve rapid data reuse, avoiding full data copying and shortening recovery time.
[0170] Step b7: Invoke the preset computing network service to start a new virtual machine based on the pre-specified version of the database image, the configuration file to be injected, the virtual network card, and the target data disk.
[0171] Specifically, the computing service is invoked to integrate the specified version of the database image, the generated configuration file, the created virtual network interface card, and the target data disk, and a new virtual machine is started to build the runtime environment for the new instance. This integrates computing, storage, network resources, and software environment to form a runnable new database instance hardware and basic software platform, enabling automated deployment of the new instance's runtime environment and quickly completing the conversion from snapshot to usable virtual machine.
[0172] Step b8: Send a backup and recovery preparation request to the new virtual machine through a preset message queue to perform a snapshot backup operation and complete the snapshot recovery of the target snapshot backup.
[0173] Specifically, a recovery preparation request is sent to the new virtual machine via a message queue, triggering the agent service within the virtual machine to perform operations such as configuration injection, data disk mounting, and account recovery, completing the initialization and startup of the database service. This completes the final configuration of the new instance from infrastructure to a usable database service, ensuring the database service can operate normally based on snapshot data, automating the recovery process, transforming the infrastructure into a usable database service, and improving the completeness and efficiency of the recovery.
[0174] This invention achieves efficient and accurate recovery of snapshot-based database instances by ensuring the legitimacy of recovery requests through parameter verification, standardizing the new instance environment through resource configuration, accelerating data recovery through block storage snapshot reuse, and completing service initialization through automated processes. This ensures the availability and data consistency of the recovered instance.
[0175] This embodiment provides a detailed description of the process described in the above embodiment, which involves sending a backup and recovery preparation request to a new virtual machine via a preset message queue to perform a snapshot backup operation and complete the snapshot recovery of the target snapshot backup. The specific implementation of this process includes the following steps:
[0176] Step c1: Send a backup and restore request to the new virtual machine through a preset message queue to enable the virtual machine instance operation service within the virtual machine.
[0177] Specifically, by leveraging the asynchronous communication mechanism of a pre-defined message queue, backup and recovery requests are directed to the new virtual machine, triggering the response and execution of dedicated operation services within the virtual machine, thus ensuring reliable delivery and processing of the requests. A communication link is established between the management node and the new virtual machine to transmit recovery operation instructions, activate the backup and recovery processing flow within the virtual machine, ensure efficient and stable transmission of recovery requests, provide triggering conditions for a series of subsequent recovery configuration operations, and guarantee the orderly start of the process.
[0178] Step c2: After receiving the backup and restore request, add the startup configuration parameters to the configuration file to be injected.
[0179] Specifically, after receiving a request, the virtual machine instance operation service identifies and adds specific startup configuration parameters to the configuration file to be injected. These parameters control the core behavior pattern of the database service during startup. By predefining the startup rules of the database service through configuration parameters, default behaviors that do not meet recovery requirements are avoided during startup, ensuring that the database service starts according to the needs of the recovery scenario and providing basic configuration guarantees for subsequent data consistency and service availability.
[0180] Step c3 skips the data disk formatting operation and performs a file system expansion operation.
[0181] Specifically, based on the integrity of the snapshot data, formatting operations that might erase data are skipped, and the original data in the snapshot is directly retained. If the capacity of the new data volume exceeds the capacity corresponding to the original snapshot, a file system expansion operation is performed to adapt to the new storage resources. This protects the backup data in the snapshot from corruption, while ensuring that the storage capacity of the new data volume can be fully utilized to meet the instance's operational needs, avoid data loss, guarantee the complete reuse of backup data, and achieve flexible adaptation of storage resources, thereby improving the storage scalability of the instance after recovery.
[0182] Step c4: Retrieve the account configuration information of the target database instance from the data disk to restore account access permissions.
[0183] Specifically, the system reads the account configuration information stored during backup from a specified storage location on the target data disk. Through the database service's permission configuration mechanism, it restores the access and operation permissions of the corresponding accounts. By restoring the database instance's account system, it ensures that the instance can be legally accessed and managed after recovery, without needing to reconfigure account permissions. This achieves automated account permission recovery, improves the availability of the restored instance, and reduces manual configuration costs and operation time.
[0184] Step c5: Delete the database service identifier file in the data disk so that a new service identifier is generated when the new database instance starts.
[0185] Specifically, the unique identifier file automatically generated by the database service in the data disk is deleted, eliminating the identifier association of the original instance. This allows the new instance to regenerate its own unique service identifier based on its environment upon startup. This avoids conflicts caused by duplicate identifiers between the new and original instances, ensures the uniqueness and independence of the new instance in the system, guarantees the normal registration and operation of the new instance, avoids service anomalies caused by identifier conflicts, and improves the stability of the instance after recovery.
[0186] Step c6: Read the table name case sensitivity configuration information from the data disk and write it to the configuration file to be injected.
[0187] Specifically, the case sensitivity configuration information for table names stored during backup is extracted from the data disk and written into the database's core configuration file to ensure consistency with the original instance. Maintaining the continuity of database table name processing rules avoids data access anomalies or table name recognition errors due to inconsistent configurations, ensures configuration compatibility of the restored instance, guarantees that business operations handle table names in the same way as the original instance, and improves the accuracy of data access.
[0188] Step c7: When it is detected that the current snapshot backup was created by the slave management node database and the original management node database information in the slave management node database can be obtained, the master-slave replication clearing command is executed to complete the snapshot recovery of the target snapshot backup.
[0189] Specifically, by detecting the source attributes of the snapshot backup and the associated master database information, it is determined whether it is a slave node backup. If the conditions are met, a master-slave replication information clearing command is executed to remove the original master-slave replication configuration association. This eliminates the residual master-slave replication relationship in the new instance, making it an independent database instance, avoiding unnecessary replication behavior or configuration conflicts, ensuring that the new instance runs in independent mode, adapting to the usage requirements of recovery scenarios, and improving the flexibility and applicability of the instance.
[0190] This invention achieves automated, accurate, and complete snapshot recovery by triggering recovery operations through message queues, optimizing startup behavior through configuration parameters, preserving original data and adapting to storage capacity, restoring account permissions and key configurations, and eliminating identifier conflicts and redundant replication configurations. This ensures the independent operation capability and configuration consistency of the database instance after recovery.
[0191] In some alternative implementations, it also includes:
[0192] Convert the target snapshot backup into a separate data copy.
[0193] Specifically, by calling the full data write interface of the block storage service, the data blocks in the target snapshot backup that are stored deferred based on the copy-on-write mechanism are forcibly written to the new data volume. This eliminates the new data volume's dependency on the original snapshot, forming an independent storage entity containing complete data. By severing the association between the new data volume and the original snapshot, the data storage of the new database instance does not depend on the existing state of the original snapshot, enhancing the independence and autonomy of data storage. This ensures that even if the original snapshot or associated resources experience anomalies, the new data volume can still maintain data integrity and availability, strengthening data disaster recovery capabilities and stability.
[0194] By converting the target snapshot backup into a separate data copy, this embodiment of the invention eliminates the new data volume's dependence on the original snapshot, improves the independence of data storage and disaster recovery reliability, and ensures the long-term stable operation of the new database instance.
[0195] In some alternative implementations, it also includes:
[0196] After the snapshot recovery operation is completed, the recovered instance is converted into a separate data copy, so that it no longer depends on the original snapshot backup. This improves the disaster recovery capability of the snapshot and the new instance as a whole, and does not affect the new instance if the snapshot or the original instance is damaged.
[0197] Based on the block storage service's flattening interface, through underlying block-level operations, all unmodified and non-replicable-on-write (ROW) original data blocks in the data disk are fully written, making the recovered instance data an independent and complete storage entity, decoupling it from the original snapshot backup. This decouples the recovered instance data from the original snapshot, ensuring data storage autonomy, preventing anomalies in the original snapshot or related resources from affecting the new instance, strengthening the independence of data entities, and shortening processing time in scenarios with large data volumes by leveraging the efficiency of block-level replication. Simultaneously, it ensures the independent availability of new instance data across various data volume scenarios, improving the overall stability of the disaster recovery system. By calling the block storage flattening interface to perform a full block-level data write, the recovered instance becomes an independent data copy, decoupling from the original snapshot. This ensures data independence and disaster recovery capabilities while adapting to the efficiency requirements of different data volume scenarios.
[0198] Figure 2 This is a schematic diagram of the structure of the cloud-based database instance processing device provided in this application. Figure 2 As shown, the cloud platform-based database instance processing device 20 includes:
[0199] The acquisition module 201 is used to acquire the data backup creation request and the database instance to be backed up, and to perform legality verification on the data backup creation request and the database instance to be backed up, and obtain the verification result.
[0200] The detection module 202 is used to create a snapshot backup based on the database instance to be backed up when the verification result is detected as passed.
[0201] The allocation module 203 is used to allocate a backup unique identifier for the snapshot backup and write the backup unique identifier and the account configuration information of the instance to be backed up to the data disk of the instance to be backed up.
[0202] Execution module 204 is used to execute data flushing and read-only locking instructions, flushing the non-persistent table data in the instance to be backed up to the storage engine, and applying read-only locks to the database instance to be backed up.
[0203] Execution module 204 is also used to execute master database status query commands to obtain parsing information of the instance to be backed up.
[0204] The generation module 205 is used to generate a parsing file that conforms to a preset backup format based on the parsing information, and write the parsing file to the data disk.
[0205] The flashing module 206 is used to perform memory data flashing operations, write the data in the memory cache to the data disk, and apply file system level locking to the mount directory of the data disk.
[0206] The generation module 205 is also used to write the parsed file as backup metadata into the management node database.
[0207] The identification module 207 is used to call the block storage interface of the cloud computing platform to create a block storage volume snapshot for the data disk and assign a unique identifier to the corresponding block storage volume snapshot.
[0208] Backup module 208 is used to write the unique identifier of the block storage volume snapshot into the management node database and associate it with the unique identifier of the backup, so as to complete the snapshot backup of the database instance to be backed up.
[0209] In one possible implementation, the acquisition module 201 is specifically used for:
[0210] The data backup creation request is analyzed and verified to obtain the first verification result of whether the backup type meets the first preset condition.
[0211] The system performs a snapshot support verification on the database instance to be backed up, obtaining a second verification result indicating whether the instance supports creating snapshot backups. It also performs an instance status verification on the database instance to be backed up, obtaining a third verification result indicating whether the instance is in a normal state.
[0212] When the first, second, and third verification results are all found to be passed, a successful verification result is obtained.
[0213] If any of the first, second, and third verification results fail, a failed verification result is generated.
[0214] In one possible implementation, the flashing module 206 is specifically used for:
[0215] By sequentially executing data flushing instructions at the operating system level and file system locking instructions, a memory data flushing operation is performed, flushing the data in the memory cache to the data disk.
[0216] In one possible implementation, the backup module 208 is further configured to:
[0217] The file system unlock command and the database read-only lock release command are executed sequentially to restore write permissions for the data disk and write operation permissions for the database service.
[0218] In one possible implementation, a recovery module 209 is further included, which is specifically used for:
[0219] Obtain the snapshot recovery request of the target database instance, and perform parameter validity verification on the snapshot recovery request to obtain the recovery verification result. The snapshot recovery request contains the unique identifier of the target block storage volume snapshot.
[0220] When the recovery verification result is detected as passed, the record information for creating a new database instance is created in the management node database.
[0221] Based on the preset instance specifications, generate basic configuration information and configuration files to be injected for the new database instance.
[0222] Invoke the default network service to create a default security group and virtual network interface for the new database instance.
[0223] Call the block storage interface, pass in the unique identifier of the target block storage volume snapshot, and determine the target snapshot backup based on the unique identifier of the target block storage volume snapshot.
[0224] Create a new data volume based on the target snapshot backup as the target data disk for the new database instance.
[0225] The system invokes a pre-defined computing network service to start a new virtual machine based on a pre-specified version of the database image, the configuration file to be injected, the virtual network card, and the target data disk.
[0226] A backup and recovery preparation request is sent to the new virtual machine through a preset message queue to perform a snapshot backup operation and complete the snapshot recovery of the target snapshot backup.
[0227] In one possible implementation, the recovery module 209 is further configured to:
[0228] A backup and restore request is sent to the new virtual machine via a pre-defined message queue, enabling the virtual machine instance operation service within the virtual machine to resume.
[0229] After receiving the backup and restore request, add the startup configuration parameters to the configuration file to be injected.
[0230] Skip the data disk formatting operation and perform file system expansion operation instead.
[0231] Retrieve the account configuration information of the target database instance from the data disk to restore account access permissions.
[0232] Delete the database service identifier file in the data disk so that a new service identifier is generated when the new database instance starts.
[0233] Read the case sensitivity configuration information of table names from the data disk and write it to the configuration file to be injected.
[0234] When it is detected that the current snapshot backup was created by the slave management node database and the original management node database information in the slave management node database can be obtained, the master-slave replication clear command is executed to complete the snapshot recovery of the target snapshot backup.
[0235] In one possible implementation, the recovery module 209 is further configured to:
[0236] Convert the target snapshot backup into a separate data copy.
[0237] The cloud-based database instance processing device provided in this embodiment can be used to execute the cloud-based database instance processing method described above. Its implementation principle and technical effect are similar, and will not be repeated here.
[0238] Figure 3 A schematic diagram of the hardware structure of the electronic device provided in this application, such as... Figure 3 As shown, the electronic device 30 includes at least one processor 301 and a memory 302. Optionally, the electronic device 30 also includes a communication component 303. The processor 301, memory 302, and communication component 303 are connected via a bus 304.
[0239] In the specific implementation process, at least one processor 301 executes computer execution instructions stored in memory 302, causing at least one processor 301 to perform the above method.
[0240] The specific implementation process of processor 301 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0241] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0242] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0243] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0244] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0245] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0246] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0247] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0248] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0249] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0250] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0251] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0252] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0253] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A database instance processing method based on a cloud platform, characterized in that, include: Obtain the data backup creation request and the database instance to be backed up, and perform legality verification on the data backup creation request and the database instance to be backed up to obtain the verification result; When the verification result is detected as passed, a snapshot backup is created based on the database instance to be backed up; Assign a unique backup identifier to the snapshot backup, and write the unique backup identifier and the account configuration information of the instance to be backed up to the data disk of the instance to be backed up; Execute data flushing and read-only locking commands to flush the non-persistent table data in the instance to be backed up to the storage engine and apply a read-only lock to the database instance to be backed up; Execute the master database status query command to obtain the parsing information of the instance to be backed up; A parsing file conforming to a preset backup format is generated based on the parsing information, and the parsing file is written to the data disk; Perform a memory data flush operation to flush the data in the memory cache to the data disk and apply a file system level lock to the mount directory of the data disk; The parsed file is written as backup metadata into the management node database; Call the block storage interface of the cloud computing platform to create a block storage volume snapshot for the data disk and assign a corresponding unique identifier for the block storage volume snapshot; Write the unique identifier of the block storage volume snapshot into the management node database and associate it with the unique identifier of the backup to complete the snapshot backup of the database instance to be backed up.
2. The method according to claim 1, characterized in that, The validity of the data backup creation request and the database instance to be backed up is verified, and the verification results are obtained, including: The data backup creation request is analyzed and verified to obtain a first verification result as to whether the backup type meets the first preset condition; The database instance to be backed up is subjected to snapshot support verification to obtain a second verification result of whether the instance supports creating snapshot backups, and the instance status of the database instance to be backed up is verified to obtain a third verification result of whether the instance is in a normal state. When the first verification result, the second verification result, and the third verification result are all detected as passed, a successful verification result is obtained. When any one of the first, second, and third verification results fails, a failed verification result is generated.
3. The method according to claim 1, characterized in that, The step of performing a memory data flush operation, which flushes the data in the memory cache to the data disk, includes: By sequentially executing data flushing instructions at the operating system level and file system locking instructions, a memory data flushing operation is performed, flushing the data in the memory cache to the data disk.
4. The method according to claim 1, characterized in that, After completing the snapshot backup of the database instance to be backed up, the process also includes: The file system unlock command and the database read-only lock release command are executed sequentially to restore write permissions for the data disk and write operation permissions for the database service.
5. The method according to claim 1, characterized in that, Also includes: Obtain the snapshot recovery request of the target database instance, and perform parameter validity verification on the snapshot recovery request to obtain the recovery verification result, wherein the snapshot recovery request contains the unique identifier of the target block storage volume snapshot; When the recovery verification result is detected as passed, record information for creating a new database instance is created in the management node database; Based on the preset instance specification information, basic configuration information and configuration files to be injected are generated for the new database instance; Invoke the preset network service to create a default security group and virtual network interface for the new database instance; The block storage interface is invoked, passing in the unique identifier of the target block storage volume snapshot, and the target snapshot backup is determined based on the unique identifier of the target block storage volume snapshot; A new data volume is created based on the target snapshot backup as the target data disk for the new database instance; The preset computing network service is invoked to start a new virtual machine based on the pre-specified version of the database image, the configuration file to be injected, the virtual network card, and the target data disk; A backup and recovery preparation request is sent to the new virtual machine through a preset message queue to perform a snapshot backup operation and complete the snapshot recovery of the target snapshot backup.
6. The method according to claim 5, characterized in that, The step of sending a backup and recovery preparation request to the new virtual machine through a preset message queue to perform a snapshot backup operation and complete the snapshot recovery of the target snapshot backup includes: A backup and restore request is sent to the new virtual machine via a preset message queue, enabling the virtual machine instance operation service within the virtual machine to function. Upon receiving the backup and restore request, add the startup configuration parameters to the configuration file to be injected; Skip the data disk formatting operation and perform file system expansion operation; Retrieve the account configuration information of the target database instance from the data disk to restore account access permissions; Delete the database service identifier file in the data disk so that a new service identifier is generated when the new database instance starts; Read the table name case sensitivity configuration information from the data disk and write it into the configuration file to be injected; When it is detected that the current snapshot backup was created by the slave management node database and the original management node database information in the slave management node database can be obtained, the master-slave replication clearing command is executed to complete the snapshot recovery of the target snapshot backup.
7. The method according to claim 5 or 6, characterized in that, Also includes: The target snapshot backup is converted into a separate data copy.
8. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 7.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 7.