Database data migration method, system and device, storage medium and program product
By selecting appropriate data migration modes and synchronization mechanisms, the problem of excessive processing pressure in traditional database systems during data migration was solved, achieving fast and stable data migration results and improving system availability and performance.
Patent Information
- Application Number
- CN202511930565.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-10
AI Technical Summary
Traditional database systems lack effective data distribution strategies during data migration, leading to excessive processing pressure on a single node when the data volume increases, affecting system speed and response time, and making it difficult to complete the migration of business data in a short period of time.
This paper provides a database data migration method. By obtaining database cluster information, selecting an appropriate data migration mode, such as centralized mode, hash mode or routing table mode, and using round-robin distribution, consistent hashing algorithm or index fields, the data is stored in the main index database and synchronized to the backup index database when necessary, ensuring the distributed architecture and fast and stable data migration.
It enables the selection of appropriate data migration modes based on the number of clusters and business rules, reducing data processing pressure, achieving fast and smooth data migration, and improving system availability and performance.
Smart Images

Figure CN121833659A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of databases, and more particularly to a database data migration method, system, device, storage medium, and program product. Background Technology
[0002] During the migration of data from a centralized database to a distributed architecture server, it is required to divide data and services into units according to business rules in order to achieve the static implementation of routing rules. However, traditional database systems are difficult to implement effective data partitioning during the migration process. In fact, business data cannot be migrated in a short time or there are no corresponding rules to partition the data.
[0003] The main problem is that traditional database systems lack corresponding data distribution strategies. When the amount of data increases, a single node in the database needs to handle all requests, which leads to excessive system pressure and affects the data processing speed and response time of the entire system. Summary of the Invention
[0004] The purpose of this application is to provide a database data migration method, system, device, storage medium, and program product to solve the above-mentioned problems.
[0005] To achieve the above objectives, the first aspect of this application provides a database data migration method, comprising: obtaining a data migration request; in response to the data migration request, obtaining database cluster information to be migrated, wherein the database cluster information includes the number of database clusters to be migrated and the business rules of different partitions in each cluster; based on the database cluster information, selecting a corresponding data migration mode, and storing the data to be migrated in the main index database through a round-robin distribution matching the data migration mode, or a consistent hashing algorithm, or an index field in the data to be migrated.
[0006] In this embodiment of the application, the data migration mode includes a centralized mode. The step of selecting the corresponding data migration mode based on the database cluster information includes: obtaining the number of clusters of the database to be migrated based on the database cluster information; when the number of clusters of the database to be migrated is one, selecting the centralized mode and distributing the data to be migrated to the main index database in a round-robin fashion.
[0007] In this embodiment of the application, the data migration mode includes a hash mode. The step of selecting the corresponding data migration mode based on the database cluster information includes: obtaining the number of clusters of the database to be migrated and the business rules of different partitions in each cluster based on the database cluster information; when the number of clusters of the database to be migrated is two or more and the business rules of different partitions in each cluster are the same, the hash mode is selected, and the data to be migrated is migrated to the main index database through a consistent hashing algorithm.
[0008] In this embodiment of the application, the data migration mode includes a routing table mode. The step of selecting the corresponding data migration mode based on the database cluster information includes: obtaining the number of clusters of the database to be migrated and the business rules of different partitions in each cluster based on the database cluster information; when the number of clusters of the database to be migrated is two or more and the business rules of different partitions in each cluster are different, the routing table mode is selected, and the data to be migrated is migrated to the cluster partition of the corresponding main index database based on the index field in the data to be migrated.
[0009] In this embodiment of the application, the database data migration method further includes: when the data to be migrated is migrated to the main index database, synchronizing the data to be migrated to the standby index database; and when new data is migrated to the main index database, comparing the data in the standby index database with the data in the main index database, filtering out the new data in the main index database, and synchronizing the new data to the standby index database.
[0010] In this embodiment, the backup index database is communicatively connected to the main index database, and the database data migration method further includes: responding to a data query instruction by calling and querying data in the main index database; and when the main index database is in a query abnormal state, switching to the backup index database and calling and querying data in the backup index database.
[0011] In this embodiment of the application, the step of synchronizing data in the main index database to the standby index database includes: synchronizing data in the main index database to the transit database cluster, and synchronizing data in the transit database cluster to the standby index database; and when new migration data is migrated to the main index database, synchronizing the new migration data to the transit database cluster; based on the index data of the transit database cluster, comparing the data in the standby index database with the data in the transit database cluster, selecting the new migration data, and synchronizing the new migration data to the standby index database.
[0012] A second aspect of this application provides a database data migration system, comprising: a first acquisition module for acquiring a data migration request; a second acquisition module for acquiring database cluster information to be migrated based on the data migration request, wherein the database cluster information includes the number of database clusters to be migrated and the business rules of different partitions in each cluster; and a data migration module for selecting a corresponding data migration mode based on the database cluster information, and storing the data to be migrated in the main index database through a round-robin distribution matching the data migration mode, a consistent hashing algorithm, or an index field in the data to be migrated.
[0013] A third aspect of this application provides a database data migration apparatus, comprising: a processor and a memory, wherein the memory stores instructions; the processor invokes the instructions in the memory to cause the processor to execute the database data migration method of any of the foregoing embodiments of the first aspect of this application.
[0014] A fourth aspect of this application provides a machine-readable storage medium storing instructions that, when executed by a processor, configure the processor to perform a database data migration method according to any of the foregoing embodiments of the first aspect of this application.
[0015] The fifth aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the database data migration method of any of the foregoing embodiments of the first aspect of this application.
[0016] The technical solution described in this application enables the selection of a corresponding data migration mode based on the number of clusters to be migrated, allowing the data to be migrated to be migrated in a distributed architecture, reducing the data processing pressure during the data migration process, and achieving faster and smoother data migration.
[0017] Other features and advantages of the embodiments of this application will be described in detail in the following detailed description section. Attached Figure Description
[0018] The accompanying drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the following detailed description to explain the embodiments of this application, but do not constitute a limitation on the embodiments of this application. In the drawings: Figure 1 This illustration schematically shows an application environment diagram of the database data migration method according to an embodiment of this application; Figure 2 The illustration shows a schematic flowchart of a database data migration method according to an embodiment of this application; Figure 3 This illustration shows a flowchart of the database data migration method according to an embodiment of the present application when selecting the corresponding data migration mode; Figure 4 The schematic diagram illustrates a flow chart of step S130 in a database data migration method according to an embodiment of this application; Figure 5 The schematic diagram illustrates a flow chart of a database data migration method according to another embodiment of this application; Figure 6 This illustration schematically shows a flowchart of a database data migration method according to another embodiment of the present application when a query exception occurs; Figure 7The schematic diagram illustrates a flow chart of step S250 in a database data migration method according to another embodiment of this application; Figure 8 This illustration schematically shows a flowchart of a database data migration method according to another embodiment of the present application; Figure 9 This schematically illustrates a flowchart of a database data migration method according to another embodiment of the present application, specifically the process of synchronizing data to a backup index library. Figure 10 This illustration schematically shows a flowchart of a database data migration method according to another embodiment of the present application, in which new migrated data is synchronized to a standby index library; Figure 11 This illustration schematically shows a flowchart of a database data migration method according to another embodiment of the present application, in which data is migrated through a transit database cluster; Figure 12 This schematically illustrates a structural block diagram of a database data migration system according to an embodiment of the present application; Figure 13 The diagram illustrates the internal structure of a computer device according to an embodiment of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for illustration and explanation of the embodiments of this application and are not intended to limit the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0020] It should be noted that if the embodiments of this application involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.
[0021] Furthermore, if the embodiments of this application involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0022] The acquisition, transmission, storage, use, and processing of data in this application comply with relevant laws and regulations. Furthermore, it should be noted that certain software, components, models, and other existing industry solutions may be mentioned in the embodiments of this application. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.
[0023] The database data migration method provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 110 communicates with server 120 via a network to implement the database data migration method of this embodiment. Terminal 110 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices, and server 120 can be a standalone server or a server cluster consisting of multiple servers.
[0024] Figure 2 A schematic diagram illustrating a database data migration method according to an embodiment of this application is provided. Figure 2 As shown, in one embodiment of this application, a database data migration method is provided. This embodiment mainly applies this method to the above-mentioned... Figure 1 Taking server 120 as an example, the database data migration method in this embodiment of the invention includes steps S110 to S130.
[0025] In step S110, a data migration request is obtained.
[0026] In this embodiment, after receiving the data migration request, the data migration begins, and the specific steps are as follows.
[0027] In step S120, in response to the data migration request, the database cluster information to be migrated is obtained. This database cluster information includes the number of database clusters to be migrated and the business rules for different partitions within each cluster.
[0028] In step S130, based on the database cluster information, the corresponding data migration mode is selected, and the data to be migrated is stored in the main index database through round-robin distribution, consistent hashing algorithm, or index field in the data to be migrated, which matches the data migration mode.
[0029] like Figure 3 and Figure 4 As shown, in some optional embodiments, the data migration mode includes centralized mode, hash mode, and routing table mode. Step S130 includes steps S131 to S132.
[0030] In step S131, the number of clusters of the databases to be migrated is obtained based on the database cluster information.
[0031] In step S132, the data to be migrated is migrated to the main index database according to the number of clusters of the database to be migrated and the business rules of different partitions in each cluster, using the corresponding data migration mode.
[0032] Specifically, when the number of clusters of databases to be migrated is one, a centralized mode is selected, and the data to be migrated is distributed to the main index database in a round-robin fashion; or When there are two or more clusters of databases to be migrated, and the business rules of different partitions in each cluster are the same, choose the hash mode and use the consistent hashing algorithm to migrate the data to be migrated to the main index database; or When there are two or more clusters of databases to be migrated, and the business rules of different partitions in each cluster are different, the routing table mode is selected. Based on the index fields in the data to be migrated, the data to be migrated is migrated to the cluster partition of the corresponding main index database.
[0033] In this embodiment, routing decisions are used to distribute requests according to different patterns, and routes them to different service clusters of the database.
[0034] In centralized mode, the system to be migrated has only one service cluster. There is no difference between services within the cluster, and requests are distributed in a round-robin fashion.
[0035] In hash mode, the system to be migrated consists of multiple service clusters. Services within a cluster are indistinguishable, but services between clusters are distinct. The hash result serves as the cluster distribution rule. To achieve evenly distributed data access and good fault tolerance, a consistent hashing algorithm can be used to minimize the impact on existing routes when adding new nodes or removing old nodes.
[0036] In the routing table mode, the business rules of different partitions in each cluster are determined based on the key fields of the request content. Then, the routing target is determined based on the number of clusters of the database to be migrated and the key fields of the request content, so as to ensure that the relevant data is stored centrally and thus improve read and write efficiency.
[0037] Furthermore, such as Figure 5 As shown, in the second embodiment of the present invention, the database data migration method includes steps S210 to S250.
[0038] Steps S210 to S230 are the same as steps S110 to S130 in the first embodiment of the present invention, and will not be repeated here.
[0039] In step S210, a data migration request is obtained.
[0040] In step S220, in response to the data migration request, the database cluster information to be migrated is obtained. This database cluster information includes the number of database clusters to be migrated and the business rules for different partitions within each cluster.
[0041] In step S230, based on the database cluster information, the corresponding data migration mode is selected, and the data to be migrated is stored in the main index database through round-robin distribution, consistent hashing algorithm, or index field in the data to be migrated, which matches the data migration mode.
[0042] In step S240, when the data to be migrated is migrated to the main index database, the data to be migrated is synchronized to the standby index database.
[0043] In step S250, when new migration data is migrated to the main index database, the data in the standby index database is compared with the data in the main index database, the new migration data in the main index database is selected, and the new migration data is synchronized to the standby index database.
[0044] like Figure 8 As shown, in this embodiment, the primary index library can be the TiKV distributed key-value library, and the backup index library can be the GoldenDB database.
[0045] The TiKV database serves as the primary data storage and query node, while the GoldenDB database is used only for fallback queries under specific conditions. The TiKV database handles all regular data write operations and most data read requests. When the TiKV database is unable to respond to query requests in a timely manner due to network failures, hardware errors, or other reasons, it will automatically retry the query in the GoldenDB database.
[0046] In this way, the overall availability and performance of the system can be enhanced by leveraging the fast response capabilities of the GoldenDB library without relying entirely on it.
[0047] like Figure 7 As shown, specifically, the steps to synchronize data from the primary index database to the backup index database include steps S251 to S253.
[0048] In step S251, the data in the main index database is synchronized to the intermediate database cluster, and the data in the intermediate database cluster is synchronized to the backup index database.
[0049] In step S252, when new migration data is migrated to the main index database, the new migration data is synchronized to the transit database cluster.
[0050] In step S253, based on the index data of the transit database cluster, the data in the standby index database is compared with the data in the transit database cluster to filter out the new migration data, and the new migration data is synchronized to the standby index database.
[0051] like Figure 10 and Figure 11 As shown, in this embodiment, the transit database cluster can be used as a temporary cluster to transit data in the TiKV database. The TiKV database is used as the primary database to store data through the existing data processing tool, and the entire database is scanned by the existing data processing tool. The data in the TiKV database is compared with the data in the GoldenDB database to update the data in the GoldenDB database and maintain consistency between the data in the GoldenDB database and the TiKV database.
[0052] Furthermore, a heterogeneous index database is added as a backup index database on the basis of the main index database. When a read exception occurs in the business index, such as network timeout or data block failure, the heterogeneous index database can be actively retried to improve the fault tolerance and availability of the index database, so as to realize the routing service.
[0053] like Figure 5 and Figure 6 As shown, further, the backup index library is connected to the main index library, and the database data migration method also includes steps S260 to S270.
[0054] In step S260, in response to the data query instruction, the data in the main index database is called and queried.
[0055] In step S270, when the main index database is in a query abnormal state, the system switches to the standby index database and calls and queries the data in the standby index database.
[0056] In this embodiment, when an external application writes business index data into the TiKV index database, the business index data format can be synchronously written to a queue and asynchronously written to the GoldenDB database to achieve index management services.
[0057] The database data migration method provided in this embodiment of the invention includes: obtaining a data migration request; in response to the data migration request, obtaining database cluster information to be migrated, wherein the database cluster information is the number of database clusters to be migrated; based on the database cluster information, selecting a corresponding data migration mode, and storing the data to be migrated in the main index database through a round-robin distribution matching the data migration mode, or a consistent hashing algorithm, or an index field in the data to be migrated.
[0058] The database data migration method provided in this embodiment of the invention can select the corresponding data migration mode according to the number of clusters to be migrated, so that the data to be migrated can be migrated in a distributed architecture, reducing the data processing pressure during the data migration process and achieving faster and smoother data migration.
[0059] It should be understood that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0060] For the above method embodiments, such as Figure 12 As shown, this application also provides a database data migration system, including: a first acquisition module 201, a second acquisition module 202, and a data migration module 203, wherein: The first acquisition module 201 is used to acquire data migration requests.
[0061] The second acquisition module 202 is used to obtain the database cluster information to be migrated according to the data migration request. The database cluster information includes the number of database clusters to be migrated and the business rules of different partitions in each cluster.
[0062] The data migration module 203 is used to select the corresponding data migration mode based on the database cluster information, and store the data to be migrated in the main index database through round-robin distribution, consistent hashing algorithm, or index fields in the data to be migrated, which are matched with the data migration mode, and synchronize the data to be migrated to the standby index database.
[0063] The functional modules in the database data migration system provided in this embodiment of the invention can select the corresponding data migration mode according to the number of clusters to be migrated by implementing the above steps, so that the data to be migrated can be migrated in a distributed architecture, reducing the data processing pressure during the data migration process and achieving faster and smoother data migration.
[0064] The database data migration system includes a processor and a memory. The first acquisition module 201, the second acquisition module 202, and the data migration module 203 are all stored in the memory as program units. The processor executes the program modules stored in the memory to implement the corresponding functions.
[0065] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and the methods described above in this application can be implemented by adjusting the kernel parameters.
[0066] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0067] This application also provides a storage medium storing a program that, when executed by a processor, implements the database data migration method described above.
[0068] In one embodiment of this application, the database data migration system can be a computer device, which can be a server, and its internal structure diagram can be as follows. Figure 13As shown. The computer device includes a processor A01, a network interface A02, a memory (not shown), and a database (not shown) connected via a system bus. The processor A01 provides computing and control capabilities. The memory includes internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02, and a database (not shown). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 stored in the non-volatile storage medium A04. The database stores programs for the relevant steps of the database data migration method of this application. The network interface A02 communicates with external terminals via a network connection. When the computer program B02 is executed by the processor A01, it implements the database data migration method of this application.
[0069] Those skilled in the art will understand that Figure 13 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0070] In one embodiment, the database data migration system provided in this application can be implemented as a computer program, which can be implemented in various ways, such as... Figure 13 It runs on the computer device shown. The computer device's memory can store the various program modules that make up the database data migration system, for example, Figure 12 The first acquisition module 201, the second acquisition module 202, and the data migration module 203 are shown. The computer program comprised of these modules causes the processor to execute the steps in the database data migration methods of the various embodiments of this application described in this specification.
[0071] Figure 13 The computer device shown can be used as follows Figure 12 In the database data migration system shown, the first acquisition module 201 executes step S110, the second acquisition module 202 executes step S120, and the data migration module 203 executes step S130.
[0072] This application embodiment also provides a database data migration device. The database data migration includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: Step S110: Obtain the data migration request.
[0073] Step S120: In response to the data migration request, obtain the database cluster information to be migrated. This database cluster information includes the number of database clusters to be migrated and the business rules for different partitions within each cluster.
[0074] Step S130: Based on the database cluster information, select the corresponding data migration mode, and store the data to be migrated into the main index database through round-robin distribution, consistent hashing algorithm, or index fields in the data to be migrated, which are matched with the data migration mode.
[0075] The database data migration device provided in this embodiment of the invention, by implementing the above method steps, can select the corresponding data migration mode according to the number of clusters to be migrated, so that the data to be migrated can be migrated in a distributed architecture, reducing the data processing pressure during the data migration process and achieving faster and smoother data migration.
[0076] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: Step S110: Obtain the data migration request.
[0077] Step S120: In response to the data migration request, obtain the database cluster information to be migrated. The database cluster information refers to the number of database clusters to be migrated.
[0078] Step S130: Based on the database cluster information, select the corresponding data migration mode, and store the data to be migrated into the main index database through round-robin distribution, consistent hashing algorithm, or index fields in the data to be migrated, which are matched with the data migration mode.
[0079] The computer program product provided in this embodiment of the invention, by implementing the above method steps, can select the corresponding data migration mode according to the number of clusters to be migrated, so that the data to be migrated can be migrated in a distributed architecture, reducing the data processing pressure during the data migration process and achieving faster and smoother data migration.
[0080] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0081] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0082] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0083] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0084] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0085] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0086] Computer-readable media include both permanent and non-permanent, removable and non-removable media, which can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0087] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0088] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A database data migration method, characterized in that, include: Get data migration request; In response to the data migration request, obtain the database cluster information to be migrated, wherein the database cluster information includes the number of database clusters to be migrated and the business rules of different partitions in each cluster; Based on the database cluster information, a corresponding data migration mode is selected, and the data to be migrated is stored in the main index database through round-robin distribution, consistent hashing algorithm, or index fields in the data to be migrated, which are matched with the data migration mode.
2. The database data migration method according to claim 1, characterized in that, The data migration mode includes a centralized mode, and the step of selecting the corresponding data migration mode based on the database cluster information includes: Based on the database cluster information, obtain the number of clusters of the databases to be migrated; When there is only one cluster of databases to be migrated, the centralized mode is selected, and the data to be migrated is distributed to the main index database in a round-robin fashion.
3. The database data migration method according to claim 1, characterized in that, The data migration mode includes a hash mode, and the step of selecting the corresponding data migration mode based on the database cluster information includes: Based on the database cluster information, obtain the number of database clusters to be migrated, as well as the business rules of different partitions in each cluster; When there are two or more clusters of databases to be migrated, and the business rules of different partitions in each cluster are the same, the hash mode is selected, and the data to be migrated is migrated to the main index database through the consistent hashing algorithm.
4. The database data migration method according to claim 1, characterized in that, The data migration mode includes a routing table mode, and the step of selecting the corresponding data migration mode based on the database cluster information includes: Based on the database cluster information, obtain the number of database clusters to be migrated, as well as the business rules of different partitions in each cluster; When there are two or more clusters of databases to be migrated, and the business rules of different partitions in each cluster are different, the routing table mode is selected, and the data to be migrated is migrated to the corresponding cluster partition of the main index database based on the index fields in the data to be migrated.
5. The database data migration method according to claim 1, characterized in that, The method further includes: When the data to be migrated is migrated to the primary index database, the data to be migrated is synchronized to the backup index database; and When new migration data is migrated to the main index database, the data in the backup index database is compared with the data in the main index database, the new migration data in the main index database is selected, and the new migration data is synchronized to the backup index database.
6. The database data migration method according to claim 5, characterized in that, The backup index database is communicatively connected to the primary index database, and the method further includes: In response to a data query command, the system calls and queries the data in the main index database. When the primary index is in a query error state, switch to the backup index and call and query the data in the backup index.
7. The database data migration method according to claim 5, characterized in that, The steps for synchronizing data from the primary index repository to the backup index repository include: Synchronize the data in the primary index database to the intermediate database cluster, and synchronize the data in the intermediate database cluster to the backup index database; and When new migration data is migrated to the main index database, the new migration data is synchronized to the transit database cluster; Based on the index data of the transit database cluster, the data in the backup index database is compared with the data in the transit database cluster to filter out the new migration data, and the new migration data is synchronized to the backup index database.
8. A database data migration system, characterized in that, include: The first acquisition module is used to obtain data migration requests; The second acquisition module is used to obtain the database cluster information to be migrated according to the data migration request, wherein the database cluster information includes the number of database clusters to be migrated and the business rules of different partitions in each cluster. The data migration module is used to select the corresponding data migration mode based on the database cluster information, and store the data to be migrated into the main index database through round-robin distribution, consistent hashing algorithm, or index field in the data to be migrated that matches the data migration mode.
9. A database data migration device, characterized in that, The database data migration device includes a processor and a memory, wherein the memory stores instructions; The processor invokes the instructions in the memory to cause the database data migration device to implement the database data migration method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing instructions thereon, characterized in that, When the instruction is executed by the processor, it implements the database data migration method as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the database data migration method as described in any one of claims 1 to 7.