Data migration method, device, apparatus, and storage medium

By receiving migration requests through the target migration server, saving encrypted target migration files, and using preset database sharding and table partitioning rules to determine the target database and tables, the consistency and regularity issues in data migration are resolved, and the accuracy and orderliness of data migration are improved.

CN117194378BActive Publication Date: 2026-01-13BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311182047.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-13
Publication Date
2026-01-13
Estimated Expiration
2043-09-13

AI Technical Summary

Technical Problem

Existing technologies cannot guarantee data consistency during data migration, have low accuracy, and the data migrated to the target database has low regularity.

Method used

The target migration server receives migration requests from the devices to be migrated, obtains and saves encrypted target migration files based on the source database identifier, determines the target database using preset database sharding rules, and determines the target table using preset table sharding rules, ensuring that the data to be migrated is migrated to the target table that matches its actual situation in a targeted and regular manner.

Benefits of technology

It improves the consistency and accuracy of data after migration, enhances the regularity of the migrated data in the destination table, and makes the data in the same destination table have a certain regularity and order.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117194378B_ABST
    Figure CN117194378B_ABST
Patent Text Reader

Abstract

The application provides a data migration method, device, equipment and storage medium. The method relates to big data technology or other related technologies, and comprises the following steps: obtaining and saving a target migration file; the target migration file is an encrypted file; obtaining current to-be-migrated file data from the target migration file, determining a corresponding target database based on the current to-be-migrated file data and a preset database splitting rule, and determining a corresponding target table in the target database based on the current to-be-migrated file data and a preset table splitting rule corresponding to the target database; migrating the current to-be-migrated file data to the target table, taking to-be-migrated file data arranged in the next position as the current to-be-migrated file data, and continuously executing the steps from determining the target database corresponding to the current to-be-migrated file data based on the current to-be-migrated file data and the preset database splitting rule to taking the to-be-migrated file data arranged in the next position as the current to-be-migrated file data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to big data technology, and particularly relates to a data migration method and device, equipment and a storage medium. BACKGROUND

[0002] With the development of big data technology, a large amount of data is generated in daily life and work, and is stored in a first database. Since the large amount of data is too large, the performance of the first database is prone to decline. Therefore, the large amount of data in the first database can be migrated to a plurality of second databases to release the storage space of the first database.

[0003] In the prior art, at least one piece of to-be-migrated data and corresponding migration information are obtained from the first database, a destination database identifier is obtained from the migration information, and the at least one piece of to-be-migrated data is migrated to the corresponding destination database according to the destination database identifier.

[0004] However, the data migration in the prior art cannot guarantee data consistency, so the accuracy is low. Meanwhile, the data migrated to the destination database has low regularity. SUMMARY

[0005] The present application provides a data migration method, device, equipment and storage medium to solve the problems that data migration cannot guarantee data consistency, the accuracy is low, and the regularity of the migrated data is low.

[0006] In a first aspect, the present application provides a data migration method, which is applied to a target migration server, the target migration server is located in a distributed cluster, the distributed cluster includes at least one remaining migration server, and the method comprises the following steps:

[0007] receiving a migration request about a source database sent by a migration device; the migration request includes a source database identifier;

[0008] obtaining and saving a target migration file according to the source database identifier; the target migration file includes at least one piece of to-be-migrated file data; and the target migration file is an encrypted file;

[0009] obtaining current to-be-migrated file data from the target migration file, determining a destination database corresponding to the current to-be-migrated file data based on the current to-be-migrated file data and a preset database splitting rule, and determining a destination table corresponding to the current to-be-migrated file data in the destination database based on the current to-be-migrated file data and a preset table splitting rule corresponding to the destination database;

[0010] migrate the current to-be-migrated file data to the target table, and take the to-be-migrated file data ranked next as the current to-be-migrated file data, and continue to perform the steps of determining the target database corresponding to the current to-be-migrated file data based on the current to-be-migrated file data and the preset database splitting rule, to taking the to-be-migrated file data ranked next as the current to-be-migrated file data, until all the to-be-migrated file data are successfully migrated;

[0011] In response to successful migration of all the to-be-migrated file data, a migration success response is generated and sent to the migration device.

[0012] In a second aspect, the present application provides a data migration device, which is located in a target migration server, the target migration server is located in a distributed cluster, the distributed cluster includes at least one remaining migration server, and the device includes:

[0013] The receiving module is configured to receive a migration request about the source database sent by the migration device, and the migration request includes a source database identifier;

[0014] The obtaining and saving module is configured to obtain and save a target migration file according to the source database identifier, the target migration file includes at least one to-be-migrated file data, and the target migration file is an encrypted file;

[0015] The obtaining module is configured to obtain the current to-be-migrated file data from the target migration file, the determining module is configured to determine the target database corresponding to the current to-be-migrated file data based on the current to-be-migrated file data and a preset database splitting rule, and determine the target table corresponding to the current to-be-migrated file data in the target database based on the current to-be-migrated file data and a preset table splitting rule corresponding to the target database;

[0016] The migration module is configured to migrate the current to-be-migrated file data to the target table, and take the to-be-migrated file data ranked next as the current to-be-migrated file data, and continue to perform the steps of determining the target database corresponding to the current to-be-migrated file data based on the current to-be-migrated file data and the preset database splitting rule, to taking the to-be-migrated file data ranked next as the current to-be-migrated file data, until all the to-be-migrated file data are successfully migrated;

[0017] The generating module is configured to generate a migration success response in response to successful migration of all the to-be-migrated file data, and the sending module is configured to send the migration success response to the migration device.

[0018] In a third aspect, the present application provides a target migration server, which includes a processor, and a memory and a transceiver connected with the processor in communication;

[0019] The memory stores computer-executable instructions; and the transceiver is configured to transceive data.

[0020] The processor executes the computer-executable instructions stored in the memory to implement the method according to the first aspect or any of the implementations.

[0021] In a fourth aspect, the present application provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method according to the first aspect or any of the implementations.

[0022] In a fifth aspect, the present application provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the method according to the first aspect or any of the implementations.

[0023] The data migration method, device, equipment and storage medium provided by the present application, in the present application, the target migration server first receives the migration request about the source database sent by the migration equipment, then obtains and saves the target migration file based on the source database identifier in the migration request, at least one piece of to-be-migrated file data is included in the target migration file, at the same time, the target migration file in the present application is an encrypted file, since the target migration file is encrypted, the to-be-migrated file data included in the target migration file is not easy to be tampered with and lost, so the consistency after data migration can be ensured, the similarity of the to-be-migrated file data before migration and the data after migration is higher, and the accuracy of data migration is improved. In addition, the target migration server obtains the current to-be-migrated file data from the target migration file, and determines the target database corresponding to the current to-be-migrated file data based on the current to-be-migrated file data and the preset database splitting rule. Since the preset database splitting rule can be set in advance, the determined target database meets the current migration requirement. Then, after determining the target database, the target table corresponding to the current to-be-migrated file data in the target database is determined according to the preset table splitting rule. It can be seen that the present application not only determines the target database, but also makes the to-be-migrated file data migrate to a target table that is more in line with the actual situation of the to-be-migrated file data itself in a targeted and regular manner, so as to more finely determine the corresponding target table. The target table is in line with the actual situation of the to-be-migrated file data itself, so it can be seen that the to-be-migrated file data received in the target table is actually the same or similar in nature. Therefore, the present application improves the regularity of the to-be-migrated file data after migration, so that the data in the same target table has a certain regularity, which also reflects that the present application can more finely and regularly migrate the to-be-migrated file data. BRIEF DESCRIPTION OF DRAWINGS

[0024] The accompanying drawings, which are incorporated herein and constitute part of this specification, illustrate embodiments consistent with the application and, together with the description, further serve to explain the principles of the application.

[0025] Figure 1 An application scenario diagram of a data migration method provided by the application;

[0026] Figure 2 A data migration method flowchart provided by embodiment one;

[0027] Figure 3 A data migration method flowchart provided by embodiment two;

[0028] Figure 4 A data migration method flowchart provided by embodiment three;

[0029] Figure 5 A data migration method flowchart provided by embodiment four;

[0030] Figure 6 A data migration method flowchart provided by embodiment five;

[0031] Figure 7 A data migration method flowchart provided by embodiment seven;

[0032] Figure 8 A data migration method flowchart provided by embodiment eight;

[0033] Figure 9 A data migration device structure diagram provided by embodiment nine;

[0034] Figure 10 A target migration server structure diagram provided by embodiment ten.

[0035] The specific embodiments of the application have been shown by the above-described drawings, and will be described in more detail hereinafter. These drawings and written descriptions are not intended to limit the scope of the concept of the application by any means, but to illustrate the concept of the application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0036] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The description of the exemplary embodiments is intended to apply to various alternative embodiments of the application. It is to be understood that features illustrated or described as part of one embodiment can be provided with one or more of the other embodiments as well. Variations to these embodiments can become apparent to those of ordinary skill in the art once the concepts of the application are understood. The following detailed description is, therefore, not to be taken in a limiting sense, as the scope of the application is defined by the claims.

[0037] The prior art obtains at least one piece of to-be-migrated data and corresponding migration information from a first database, obtains a destination database identifier in the migration information, determines a destination database through the destination database identifier, and thus migrates the at least one piece of to-be-migrated data to the corresponding destination database.

[0038] However, the data migration in the prior art cannot guarantee data consistency, so the accuracy is low; meanwhile, the data migrated to the destination database in the prior art has low regularity.

[0039] To solve the defects of the prior art, the present application inventors have designed a new scheme after creative research. The present application provides a data migration method. To solve the problem that the data migration in the prior art cannot guarantee data consistency and the accuracy is low, the target migration server in the present application receives a migration request about a source database sent by a migration device, and then obtains and saves a target migration file based on a source database identifier included in the migration request, wherein the target migration file is an encrypted file. Since the target migration file is encrypted, the to-be-migrated file data in the target migration file cannot be tampered with and is not easy to lose, so the data migration based on the target migration file can improve data consistency and thus improve the accuracy. In addition, to solve the problem that the data migrated to the destination database in the prior art has low regularity, only the destination database is determined in the prior art, and then the to-be-migrated data is migrated to the destination database, so the data included in the destination database is disorganized and has no regularity. After the current to-be-migrated file data is obtained from the target migration file, the destination database corresponding to the current to-be-migrated data is determined based on the current to-be-migrated file data and a preset database splitting rule in the present application, and after the destination database is determined, the corresponding destination table in the target database is determined according to the current to-be-migrated file data and a preset table splitting rule corresponding to the destination database. The preset table splitting rule has certain regularity, and the preset table splitting rule can include a rule for migrating the current to-be-migrated data of the same type or similar type to the corresponding table, so that the destination table corresponding to the current to-be-migrated file data in the destination database can be further determined more finely on the basis of the determined destination database in the present application, and thus the current to-be-migrated file data is migrated to the destination table. Only the same type or similar type of data is included in the destination table after the migration, so the regularity of the migrated data is improved and is more orderly.

[0040] The application scenario of the data migration method, device, equipment and storage medium provided by the present application is introduced below.

[0041] Figure 1 The application scenario of the data migration method provided by the present application is shown in the following figure. Figure 1As shown in the diagram, the application scenario includes migration device 101, target migration server 102, and other migration servers 103 in the distributed cluster.

[0042] Among them, the migration device 101 can be a mobile phone, computer or other device, and there are no restrictions here.

[0043] The migration device 101 communicates with the target migration server 102 and the other migration servers 103 in the distributed cluster. The connection method can be wired or wireless.

[0044] Among them, the target migration server 102 is migration server A, which is located in the distributed cluster, and the other migration servers 103 and the target migration server 102 are all migration servers under the distributed cluster.

[0045] The remaining migration servers 103 include at least one migration server. Figure 1 Among them, the remaining migration servers 103 include migration server B 1031 and migration server C 1302 as examples.

[0046] Specifically, the user triggers a migration request for the source database through migration device 101, thereby generating a migration request and sending the migration request to the distributed cluster. The migration request is received by any migration server in the distributed cluster, and the migration server that receives the migration request becomes the target migration server 102.

[0047] Furthermore, the target migration server 102 receives the migration request. The migration request includes the source database identifier.

[0048] Furthermore, the target migration server 102 obtains and saves the target migration file based on the source database identifier. The target migration file includes at least one record of data to be migrated, and the target migration file is an encrypted file.

[0049] Furthermore, the target migration server 102 obtains the current migration file data from the target migration file, retrieves the preset database sharding rules in its own storage area 104, and determines the target database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules.

[0050] Furthermore, the target migration server 102 obtains the preset table partitioning rules corresponding to the target database from the storage area 104, and determines the target table in the target database based on the current file data to be migrated and the preset table partitioning rules.

[0051] Furthermore, the target migration server 102 migrates the current file data to be migrated to the destination table, takes the next-ranked file data to be migrated as the current file data to be migrated, and continues to execute the steps from determining the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules to taking the next-ranked file data to be migrated as the current file data to be migrated, until all file data to be migrated is successfully migrated.

[0052] Furthermore, the target migration server 102 generates a migration success response and sends the migration success response to the migration device.

[0053] It should be noted that when migration device 102 sends a migration request, it sends the migration request to a distributed cluster. Multiple job servers included in the distributed cluster compete for the migration request. That is, migration server A 102, migration server B 1031, and migration server C 1032 will all compete for the migration request. In this application scenario, the migration server that first competes for the migration request is the target migration server. That is, in this application scenario, migration server A 102 is the target migration server.

[0054] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0055] It should be noted that the data migration method, apparatus, device and storage medium provided in this application can be applied to the field of big data technology, or to any field other than big data technology. The application field of this application is not limited.

[0056] This application provides a data migration method aimed at solving the aforementioned technical problems of the prior art.

[0057] 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.

[0058] Example 1

[0059] The subject of this application is a data migration device, which is located in a target migration server. The target migration server is located in a distributed cluster, which includes at least one other migration server.

[0060] Figure 2 This is a schematic diagram of a data migration method provided in Embodiment 1. Figure 2 As shown, the specific steps are as follows.

[0061] S201, Receive a migration request for the source database sent by the migration device; the migration request includes the source database identifier.

[0062] The term "transfer device" refers to the user's corresponding control device, which can be a mobile phone or computer, etc. There are no restrictions here.

[0063] A migration request refers to a request to migrate data included in the source database.

[0064] Here, the source database identifier refers to the name or other unique identifier corresponding to the source database. For example, the source database identifier can be the unique name of the source database.

[0065] The source database refers to the database whose data needs to be migrated. The source database includes the data to be migrated.

[0066] In one approach, the user enters a source database identifier on the migration device and then triggers a migration request. The migration device then generates a migration request based on the source database identifier and sends the migration request to the target migration server.

[0067] S202, Obtain and save the target migration file based on the source database identifier; the target migration file includes at least one piece of data to be migrated; the target migration file is an encrypted file.

[0068] The target migration file refers to a file that packages all the data to be migrated together in a specific file format. It should be noted that after packaging, the data to be migrated is transformed into the migration file data, but the substantive content of the migration file data remains unchanged from the original data.

[0069] Among them, the file data to be migrated refers to the file data that needs to be migrated.

[0070] It should be noted that the target migration file in this application is an encrypted file, and the encryption method is not limited.

[0071] S203: Obtain the current file data to be migrated from the target migration file; determine the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database partitioning rules; and determine the destination table corresponding to the current file data to be migrated in the destination database based on the current file data to be migrated and the preset table partitioning rules corresponding to the destination database.

[0072] The preset database sharding rules refer to the pre-defined rules for partitioning the databases. For example, assuming the data to be migrated is basic customer information, including customer gender, age, and address, the preset database sharding rules stipulate that database A receives the data to be migrated corresponding to male gender, and database B receives the data to be migrated corresponding to female gender.

[0073] The preset table partitioning rules refer to the pre-defined rules for partitioning tables. It should be noted that different databases can correspond to different preset table partitioning rules. For example, database A corresponds to preset table partitioning rule A, and database B corresponds to preset table partitioning rule B.

[0074] For example, database A includes three tables: Table A, Table B, and Table C. The preset table partitioning rules divide the data into three categories: Table A receives the data to be migrated from customers aged 0-10, Table B receives the data to be migrated from customers aged 11-20, and Table C receives the data to be migrated from customers aged 21-30.

[0075] For example, the target migration server determines the destination database corresponding to the file data to be migrated as database A according to the preset database sharding rules. Then, database A is determined as the target database. The target migration server determines the destination table corresponding to the file data to be migrated according to the preset table sharding rule A corresponding to the target database (database A).

[0076] It should be noted that the target table belongs to the target database, and the target database includes at least one table.

[0077] S204, migrate the current file data to be migrated to the destination table, and take the next-ranked file data to be migrated as the current file data to be migrated, and continue to execute the steps from determining the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules to taking the next-ranked file data to be migrated as the current file data to be migrated, until all file data to be migrated is successfully migrated.

[0078] Specifically, assuming there are three files to be migrated, namely the first file to be migrated, the second file to be migrated, and the third file to be migrated, if the currently executed migration data is the first file to be migrated, the data migration device will migrate the first file to be migrated to the destination table. Then, the file to be migrated next in the order (i.e., the second file to be migrated) will be identified as the current file to be migrated, and the device will continue to determine the destination database corresponding to the current file to be migrated (i.e., the second file to be migrated). After determining the corresponding destination table, the current file to be migrated (i.e., the second file to be migrated) will be migrated to the corresponding destination table. Then, the file to be migrated next in the order (i.e., the third file to be migrated) will be identified as the current file to be migrated, and the device will continue to migrate the current file to be migrated (i.e., the third file to be migrated) to its corresponding destination table, thereby completing the successful migration of all file data to be migrated.

[0079] In one approach, this method is an optional way to migrate the current file data to the destination table, as detailed below.

[0080] Transform the current file data to be migrated according to the preset destination table rules to obtain the current data transfer object; then migrate the current data transfer object to the destination table.

[0081] Among them, the preset destination table rules are the pre-set rules such as the format of the destination table.

[0082] For example, assuming the current file data to be migrated is the first file data to be migrated, the destination database corresponding to the first file data to be migrated is database A, and the corresponding destination table is table A, then the preset destination table rule A corresponding to table A in database A is obtained from its own storage area. Then the data migration device transforms the current file data to be migrated (i.e. the first file data to be migrated) according to the preset destination table rule A to obtain the current data transmission object A, and then transmits the current data transmission object A to table A in database A.

[0083] The current data transfer object is a data object that conforms to the rules of the destination table and can be completely saved to the corresponding destination table.

[0084] The current data transfer object refers to the data object that has been transformed from the file to be migrated and migrated to the destination table.

[0085] S205, in response to the successful migration of all files to be migrated, generates a migration success response and sends it to the migration device.

[0086] Among them, the migration success response is a feedback message generated only when all files to be migrated have been successfully migrated.

[0087] It should be noted that a migration success response will be sent to the migration device to remind the user to check the data migration results.

[0088] This embodiment provides a data migration method. In this embodiment, the target migration server first receives a migration request for the source database sent by the migration device. Then, based on the source database identifier in the migration request, it obtains and saves a target migration file. The target migration file includes at least one piece of data to be migrated. Furthermore, in this embodiment, the target migration file is an encrypted file. Because the target migration file is encrypted, the data to be migrated included in the target migration file is not easily tampered with or lost, thus ensuring data consistency after migration. This results in a higher degree of similarity between the data to be migrated before and after migration, thereby improving the accuracy of data migration. In addition, the target migration server obtains the current data to be migrated from the target migration file. Based on the current data to be migrated and preset database sharding rules, the first step is to determine the destination database corresponding to the current data to be migrated. Since the preset database sharding... The rules can be preset to ensure that the target database meets the current migration requirements. Then, after determining the target database, the corresponding target table for the file data to be migrated is determined according to the preset table partitioning rules. Therefore, this embodiment not only determines the target database but also, to ensure the file data to be migrated can be migrated in a targeted and regular manner to a location more suitable for the actual situation of the file data itself, further refines the determination of the corresponding target table. The target table is consistent with the actual situation of the file data to be migrated, indicating that the file data received in the target table may actually be the same or similar in nature. Therefore, this embodiment improves the regularity of the migrated file data, making the data in the same target table exhibit certain regularity. This also demonstrates that this solution can migrate file data in a more refined and regular manner.

[0089] Example 2

[0090] This embodiment is a further refinement of the first embodiment described above. This embodiment is an optional method for obtaining and saving the target migration file based on the source database identifier.

[0091] Figure 3 This is a schematic diagram of a data migration method provided in Embodiment 2. Figure 3 As shown, the specific steps are as follows.

[0092] S301, determine the corresponding source database based on the source database identifier.

[0093] For example, the data migration device can determine the corresponding source database based on the unique name of the source database.

[0094] The source database contains at least one piece of data to be migrated.

[0095] S302, retrieve at least one piece of data to be migrated from the source database, and identify the at least one piece of data to be migrated as at least one file data to be migrated.

[0096] Specifically, the data migration device identifies at least one piece of data to be migrated from the source database as at least one file data to be migrated.

[0097] S303: Package at least one piece of data to be migrated into a file and encrypt the packaged file to obtain the target migration file.

[0098] Furthermore, at least one piece of data to be migrated is packaged into a file and encrypted using symmetric or asymmetric encryption to obtain the target migration file.

[0099] It should be noted that other methods can be used to encrypt the packaged files; no restrictions are imposed here.

[0100] S304. Save the target migration file to the shared space and determine the shared space storage path and the target migration file identifier to ensure that all migration servers in the distributed cluster can access it.

[0101] Shared space refers to a storage space that can be shared with migration servers in a distributed cluster.

[0102] Among them, the shared space storage path refers to the storage address of the shared space, etc., and the shared space can be located based on the shared space storage path.

[0103] The target migration file identifier refers to the name or other unique identifier corresponding to the target migration file.

[0104] like Figure 1 As shown, the distributed cluster includes migration server A, migration server B, and migration server C. It is understood that this shared space is accessible to all three migration servers in the distributed cluster, facilitating the execution of the following steps: If the target migration server has not successfully migrated all the data to be migrated, the migration device sends a continuation migration request to the distributed cluster again. To ensure that the remaining migration servers in the distributed cluster can access the target migration file when they receive the resent continuation migration request, the target migration file is saved to the shared space. For a detailed description, please refer to Embodiment Eight, which will not be repeated here.

[0105] This embodiment provides a data migration method. In this embodiment, the corresponding source database can be accurately identified by the source database identifier. Then, at least one piece of data to be migrated is identified as at least one piece of file data to be migrated and packaged into a file. In order to ensure the security of the file and prevent tampering, the packaged file is encrypted to obtain the target migration file. Furthermore, the target migration file is saved to a shared space, and the storage path of the shared space and the target migration file identifier are determined for subsequent migration tasks.

[0106] Example 3

[0107] This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for obtaining the current file data to be migrated from the target migration file.

[0108] Figure 4 This is a schematic diagram of a data migration method provided in Embodiment 3. Figure 4 As shown, the specific steps are as follows.

[0109] S401, locate the shared space according to the shared space storage path, and determine the target migration file in the shared space according to the target migration file identifier.

[0110] Specifically, the data migration device locates the shared space based on the shared space storage path, and then determines the target migration file in the shared space based on the target migration identifier.

[0111] S402, decrypt the target migration file and obtain the current file data to be migrated from at least one file data to be migrated in the decrypted target migration file.

[0112] Furthermore, the data migration device decrypts the target migration file and obtains the current file data to be migrated from at least one piece of file data to be migrated in the decrypted target migration file.

[0113] It should be noted that if the migration task has just started, the current file data to be migrated is the first file data to be migrated, and the migration task is executed on it. Then, the migration tasks are executed on the remaining files to be migrated in the target migration file in sequence.

[0114] This embodiment provides a data migration method. This embodiment can accurately locate the shared space based on the shared space storage path, and then accurately determine the target migration file based on the target migration file identifier. Then, the target migration file is decrypted, and the current file data to be migrated is obtained from at least one file data to be migrated in the decrypted target migration file, so that the obtained current file data to be migrated is also accurate.

[0115] In one approach, this method is an optional approach after obtaining and saving the target migration file based on the source database identifier, as detailed below.

[0116] Obtain the preset concurrency level; split the target migration file into multiple target migration sub-files; the number of target migration sub-files is consistent with the preset concurrency level; each target migration sub-file contains at least one piece of data to be migrated; execute in parallel the decryption of multiple target migration sub-files, execute in parallel the acquisition of the current data to be migrated from at least one piece of data to be migrated from each decrypted target migration file, and execute in parallel the steps of migrating each current data to the destination table of the corresponding target database to using the next sorted data to be migrated as the current data to be migrated, until all data to be migrated in each target migration sub-file is successfully migrated.

[0117] Concurrent data refers to the number of migration tasks processed in parallel. It should be noted that the preset concurrency level can refer to the number of concurrent threads.

[0118] Furthermore, the target migration file is split according to a preset concurrency level to obtain multiple target migration sub-files. The data migration device decrypts the multiple target migration sub-files in parallel and executes the migration task of the current sub-file data to be migrated in each target migration sub-file in parallel. It should be noted that the execution steps of the migration task of the current sub-file data to be migrated are the same as the migration task of the data to be migrated, until all the sub-file data to be migrated in each target migration sub-file is successfully migrated.

[0119] Example 4

[0120] This embodiment is a further refinement of any of the above embodiments. In this embodiment, the preset database sharding rules include at least one preset database sharding indicator and its corresponding preset database.

[0121] This embodiment is an optional method for determining the target database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules.

[0122] Figure 5 This is a schematic diagram of a data migration method provided in Embodiment 4. Figure 5 As shown, the specific steps are as follows.

[0123] S501: Read the database sharding fields included in the current file data to be migrated to determine the database sharding metrics to which the current file data to be migrated belongs.

[0124] The data in the files to be migrated includes database sharding fields.

[0125] Among them, the sharding field refers to the field used to shard the current file data to be migrated into a database.

[0126] Among them, the database sharding indicator refers to the actual database sharding indicator to which the currently pending file data belongs.

[0127] In one approach, suppose a current file data to be migrated includes basic customer information, such as gender, age, and address. Suppose this current file data is designated as the first file data to be migrated, and it includes "Name: Xiaoming, Gender: Male; Age: 25, and other basic information." Gender is preset as a database sharding field. The data migration device then reads the corresponding database sharding field (i.e., gender) from the first file data to be migrated, thus determining that the current file data to be migrated (i.e., the first file data to be migrated) belongs to the database sharding indicator of "male."

[0128] S502, query the preset sharding indicators that are consistent with the sharding indicators in the preset sharding rules.

[0129] The preset database sharding rules include at least one preset database sharding indicator and its corresponding preset database.

[0130] Among them, the preset database sharding indicators are the indicators for database sharding that are set in advance.

[0131] The preset database refers to a database that has been set up in advance.

[0132] Based on the exemplary description in Embodiment 1, Table 1 provides a schematic table of preset database sharding rules.

[0133] Table 1: Preset Database Sharing Rules.

[0134] Pre-set database division index Pre-set database First pre-set database division index: male Database A Second pre-set database division index: female Database B

[0135] As shown in Table 1, the preset database sharding indicators include a first preset database sharding indicator and a second preset database sharding indicator. The first preset database sharding indicator is male, and the corresponding preset database is database A; the second preset database sharding indicator is female, and the corresponding preset database is database B.

[0136] It should be noted that any embodiment or example of numbers in this application is for illustrative purposes only and does not represent the actual situation.

[0137] Based on the example in step S502, the first database segmentation index to which the data to be migrated belongs is determined to be male, and the consistent preset database segmentation index is determined in Table 1 as the first preset database segmentation index.

[0138] S503, determine the preset database corresponding to the consistent preset database sharding indicators as the target database.

[0139] Furthermore, the data migration device determines the preset database (i.e., database A) corresponding to the consistent preset database sharding index (i.e., the first preset database sharding index) as the target database.

[0140] This embodiment provides a data migration method. In this embodiment, the data migration device reads the database sharding fields included in the current file data to be migrated, thereby determining the database sharding index to which the current file data to be migrated belongs. In this embodiment, the preset database sharding rules include at least one preset database sharding index and its corresponding preset database. Thus, the data migration device can accurately determine the preset database sharding index that is consistent with the database sharding index based on the preset database sharding rules, and determine the preset database corresponding to the consistent preset database sharding index, thereby determining the preset database as the destination data. Therefore, this embodiment can accurately determine the destination database.

[0141] Example 5

[0142] This embodiment is a further refinement of any of the above embodiments. In this embodiment, the preset table partitioning rules include at least one preset table partitioning index and its corresponding preset table.

[0143] This embodiment is an optional method for determining the target table in the target database based on the current file data to be migrated and the preset table partitioning rules corresponding to the target database.

[0144] Figure 6 This is a schematic diagram of a data migration method provided in Embodiment 5. Figure 6 As shown, the specific steps are as follows.

[0145] S601: Read the table partitioning fields included in the current file data to be migrated to determine the table partitioning metrics to which the current file data to be migrated belongs.

[0146] Among them, the partitioning field refers to the field used as the basis for partitioning the data of the file to be migrated into a table.

[0147] Among them, the table partitioning indicator refers to the actual indicator used for table partitioning to which the current file data to be migrated belongs.

[0148] As described in step S501 above, assuming the current file data to be migrated is the first file data to be migrated, the first file data to be migrated includes "Name: Xiaoming, Gender: Male; Age: 25 years old, and other basic information". Age is preset as a database sharding field, so the data migration device reads the corresponding sharding field (i.e., age) from the first file data to be migrated, thereby determining that the sharding index of the current file data to be migrated (i.e., the first file data to be migrated) is age 25 years old.

[0149] S602, query the preset table partitioning criteria that are consistent with the corresponding table partitioning criteria in the preset table partitioning rules.

[0150] Among them, the preset table partitioning rules retain at least one preset table partitioning indicator and its corresponding preset table.

[0151] Among them, the preset table segmentation indicators refer to the indicators of the pre-set table segmentation.

[0152] Among them, the preset table refers to the table that is set in advance.

[0153] Based on the exemplary description in Embodiment 1, Table 2 provides a schematic table of preset table partitioning rules.

[0154] Table 2: Preset table splitting rules illustration.

[0155] Pre-set table division index Pre-set table First pre-set table division index: 0-10 years old Table A Second pre-set table division index: 11-20 years old Table B Third pre-set table division index: 21-30 years old Table C

[0156] As shown in Table 2, the preset sub-table indicators include a first preset sub-table indicator, a second preset sub-table indicator, and a third preset sub-table indicator. The first preset sub-table indicator is for ages 0-10, and the corresponding preset table is Table A; the second preset sub-table indicator is for ages 11-20, and the corresponding preset table is Table B; the third preset sub-table indicator is for ages 21-30, and the corresponding preset table is Table C. According to the description in step S502 above, the corresponding sub-table indicator is 25 years old, so the preset sub-table indicator that matches it in Table 2 is the third preset sub-table indicator.

[0157] S603, determine the preset table corresponding to the consistent preset table segmentation index as the target table.

[0158] Furthermore, the preset table (i.e., table C) corresponding to the third preset sub-table indicator is determined as the target table.

[0159] This embodiment provides a data migration method. In this embodiment, the data migration device reads the table partitioning fields included in the current file data to be migrated, thereby determining the table partitioning index to which the current file data to be migrated belongs. Since the preset table partitioning rules include at least one preset table partitioning index and its corresponding preset table, the preset table partitioning index that matches the corresponding table partitioning index can be accurately queried in the preset table partitioning rules. Thus, the preset table corresponding to the matching preset table partitioning index can be determined as the destination table, so the destination table can be accurately determined. In addition, this application can further refine the table partitioning of the file data to be migrated, thereby making the data in the destination table have a certain regularity.

[0160] Example 6

[0161] This embodiment is a further refinement of any of the above embodiments, and the specific content is as follows:

[0162] In response to the successful migration of the file data to be migrated, the file data identifier to be migrated is determined as the successfully migrated data identifier;

[0163] The successfully migrated data identifier is sent to the job database; the job database is used to store the identifiers of the files to be migrated that have been successfully migrated; the job database stores the successfully migrated data identifiers in the order they are received.

[0164] For example, if the first file data to be migrated has been successfully migrated as the current file data to be migrated, then the identifier of the first file data to be migrated is determined as the successfully migrated data identifier, and it is also sent to the job database.

[0165] The job database is a separate database used to store identifiers of files that have been successfully migrated. The job database stores these identifiers in the order they were received; the first file to be migrated successfully is stored at the beginning of the database. As each subsequent file is successfully migrated, its identifier is stored below the identifier of the previous file.

[0166] As exemplified, Table 3 is a schematic table of successfully migrated data identifiers stored in a job database.

[0167] Table 3: A table illustrating successfully migrated data identifiers.

[0168] Sequence Successfully migrated data identifier 1 First to-be-migrated file data identifier (A) 2 Second to-be-migrated file data identifier (B)

[0169] As shown in Table 3, the data that has been successfully migrated are the first file data to be migrated and the second file data to be migrated. Sequence 1 is the identifier of the first file data to be migrated (A), and sequence 2 is the identifier of the second file data to be migrated (B).

[0170] For example, if the identifiers of the files to be migrated include a first identifier, a second identifier, and a third identifier, then Table 3 indicates that the first and second files to be migrated have been successfully migrated, and the third file to be migrated remains unmigrated.

[0171] This embodiment provides a data migration method. The job database in this embodiment can save the identifiers of successfully migrated data in the order of receipt, so that the data stored in the job database is orderly, which is conducive to completing the data migration.

[0172] Example 7

[0173] This embodiment is a further refinement of any of the above embodiments, and the specific content is as follows:

[0174] In response to any unsuccessful migration of the file data to be migrated, the migration of the remaining file data to be migrated in the target migration file is stopped, and a migration failure response is generated based on the shared space storage path, the target migration file identifier, and the job database identifier; the migration failure response is then sent to the migration device.

[0175] For example, suppose the file data to be migrated includes first file data to be migrated, second file data to be migrated, and third file data to be migrated. When the data migration device performs a migration task for a certain file data to be migrated (let's say the second file data to be migrated), it cannot locate the destination table in its corresponding destination database, thus failing to successfully migrate the second file data to be migrated. Consequently, the data migration device stops migrating the remaining file data to be migrated in the target migration file.

[0176] The remaining file data to be migrated refers to the file data that was not successfully migrated. In this example, the remaining file data to be migrated consists of the second file data to be migrated and the third file data to be migrated.

[0177] Furthermore, the data migration device generates a migration failure response based on the shared space storage path, the target migration file identifier, and the job database identifier.

[0178] Among them, the migration failure response refers to the feedback message corresponding to the failure to successfully complete the migration task of all files to be migrated.

[0179] It is understood that in this embodiment, if the second file data to be migrated fails to migrate successfully, the subsequent file data to be migrated will not be migrated either; instead, the migration of the remaining file data to be migrated will be stopped directly.

[0180] This embodiment provides a data migration method. If any file data to be migrated is successfully migrated, the migration of the remaining file data to be migrated will be stopped, and a migration failure response will be generated and sent to the migration device, so as to promptly remind the user that the migration request has not been successfully completed.

[0181] In one approach, if the migration device sends a continued migration request for the source database again, and the continued migration request includes a shared space storage path, a target migration file identifier, and a job database identifier, the method in this embodiment further includes the following:

[0182] It should be noted that the distributed cluster also includes other migration servers, such as... Figure 1 The B migration server and C migration server are mentioned. The execution entity of this application is the A migration server, i.e., the target migration server.

[0183] Specifically, after the target migration server generates a migration failure response, it sends the migration failure response to the migration device. After receiving the migration failure response, the migration device continues to generate a continue migration request for the source database to complete the migration of all files to be migrated in the source database.

[0184] Furthermore, the migration device will continue to send the migration request to the distributed cluster (including migration server A, migration server B, and migration server C), so that any migration server in the distributed cluster has the opportunity to receive the continued migration request.

[0185] It should be noted that migration servers in a distributed cluster can all compete for the request to continue migration, and the migration server that first wins the request will execute the migration task.

[0186] In this approach, it is assumed that migration server A will still receive the request to continue migration, and migration server A will continue to execute the migration task.

[0187] Figure 7 This is a schematic diagram of a data migration method provided in Embodiment Seven. Figure 7 As shown, the specific steps are as follows.

[0188] S701 locates the job database based on the job database identifier.

[0189] Specifically, after receiving a continue migration request, the target migration server obtains the job database identifier from the continue migration request and then locates the job database based on the job database identifier.

[0190] S702 reads the last saved successfully migrated data identifier from the job database.

[0191] Specifically, as shown in Table 3, the last saved successfully migrated data is identified as the second file data to be migrated.

[0192] S703 migrates the remaining unmigrated file data in the target migration file based on the shared space storage path, the target migration file identifier, and the identifier of the last successfully migrated data.

[0193] This embodiment provides a data migration method. In this embodiment, if the target migration server receives a continued migration request for the source database sent again by the migration device, the data migration device locates the job database based on the job database identifier, reads the last saved successfully migrated data identifier from the job database, and further migrates the remaining unmigrated file data in the target migration file. Therefore, this embodiment can migrate the remaining unmigrated file data based on the previously failed migration file data, thereby saving the computing resources of the migration server and realizing the migration of all file data to be migrated faster.

[0194] Example 8

[0195] This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for migrating the remaining unmigrated files in the target migration file based on the shared space storage path, the target migration file identifier, and the identifier of the last saved successfully migrated data.

[0196] Figure 8 This is a schematic diagram of a data migration method provided in Example 8. Figure 8 As shown, the specific steps are as follows.

[0197] S801 locates the shared space based on the shared space storage path and determines the target migration file based on the target migration file identifier.

[0198] S802, obtain the next file data to be migrated from the decrypted target migration file, which is the last saved successfully migrated data identifier, and determine the next file data to be migrated as the current file data to be migrated. Continue to execute the steps from determining the target database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules, to taking the next file data to be migrated as the current file data to be migrated, until all the remaining unmigrated file data to be migrated is successfully migrated.

[0199] It should be noted that if any file data to be migrated fails to migrate, the previously decrypted target migration file can be re-encrypted until the target migration server receives a request to continue migration. The server then locates the shared space based on the shared space storage path and identifies the target migration file based on the target migration file identifier. Therefore, the encrypted target migration file is decrypted again. The next file data to be migrated, which is the last saved successfully migrated data identifier, is retrieved from the decrypted target migration file. This next file data is then identified as the current file data to be migrated. The same migration task is then performed, including the steps, to complete the migration of the remaining unmigrated file data.

[0200] This embodiment provides a data migration method. In this embodiment, the data migration device obtains the next file data to be migrated from the decrypted target migration file, which is the last saved successfully migrated data identifier, and determines it as the current file data to be migrated. Then, it executes the steps included in the migration task. Thus, this embodiment can further realize the migration of the remaining file data to be migrated based on the previously unmigrated file data to be migrated. Therefore, it can save the computing resources of the target migration server and also save time.

[0201] Example 9

[0202] The following is an embodiment of the device of this application. Figure 9 This is a schematic diagram of a data migration device provided in Embodiment Nine. Figure 9 As shown, device 900 is located on the target migration server, which is located in a distributed cluster. The distributed cluster includes at least one other migration server. Device 900 includes the following modules:

[0203] The receiving module 901 is used to receive a migration request for the source database sent by the migration device; the migration request includes the source database identifier;

[0204] The acquisition and saving module 902 is used to acquire and save the target migration file according to the source database identifier; the target migration file includes at least one piece of data to be migrated; the target migration file is an encrypted file;

[0205] The acquisition module 903 acquires the current file data to be migrated from the target migration file, and the determination module 904 is used to determine the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database partitioning rules, and to determine the destination table corresponding to the current file data to be migrated in the destination database based on the current file data to be migrated and the preset table partitioning rules corresponding to the destination database.

[0206] Migration module 905 is used to migrate the current file data to be migrated to the destination table, and to take the next file data to be migrated as the current file data to be migrated, and continue to execute the steps from determining the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules to taking the next file data to be migrated as the current file data to be migrated, until all file data to be migrated is successfully migrated.

[0207] The generation module 906 is used to generate a migration success response in response to the successful migration of all files to be migrated, and the sending module 907 is used to send it to the migration device.

[0208] In one approach, the acquisition and saving module 902, when acquiring and saving the target migration file based on the source database identifier, is specifically used for:

[0209] The corresponding source database is determined based on the source database identifier; at least one piece of data to be migrated is obtained from the source database, and at least one piece of data to be migrated is identified as at least one piece of data to be migrated file; at least one piece of data to be migrated file is packaged into a file and the packaged file is encrypted to obtain the target migration file; the target migration file is saved to the shared space, and the storage path of the shared space and the target migration file identifier are determined to ensure that all migration servers in the distributed cluster can access it.

[0210] In one approach, the acquisition module 903, when retrieving the current file data to be migrated from the target migration file, is specifically used for:

[0211] Locate the shared space based on the shared space storage path, and determine the target migration file in the shared space based on the target migration file identifier; decrypt the target migration file, and obtain the current file data to be migrated from at least one file data to be migrated in the decrypted target migration file.

[0212] In one approach, the preset database sharding rules include at least one preset database sharding indicator and its corresponding preset database;

[0213] Module 904, when determining the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules, is specifically used for...

[0214] Read the database sharding fields included in the current file data to be migrated to determine the database sharding metric to which the current file data to be migrated belongs; query the preset database sharding metric that is consistent with the database sharding metric in the preset database sharding rules; and determine the preset database corresponding to the consistent preset database sharding metric as the destination database.

[0215] In one approach, the preset table partitioning rules include at least one preset table partitioning metric and its corresponding preset table;

[0216] Module 904, when determining the destination table in the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset table partitioning rules corresponding to the destination database, is specifically used for:

[0217] Read the table partitioning fields included in the current file data to be migrated to determine the table partitioning metric to which the current file data to be migrated belongs; query the preset table partitioning metric that is consistent with the corresponding table partitioning metric in the preset table partitioning rules; and determine the preset table corresponding to the consistent preset table partitioning metric as the destination table.

[0218] In one embodiment, the modules include a determining module 904, which is further configured to determine the identifier of the file data to be migrated as a successfully migrated data identifier in response to the successful migration of the file data to be migrated; a sending module 907, which is further configured to send the successfully migrated data identifier to a job database; the job database is used to store the identifiers of the successfully migrated file data to be migrated; the job database stores the successfully migrated data identifiers in the order of receipt.

[0219] In one embodiment, this data migration apparatus further includes a stop module;

[0220] The stop module is used to stop migrating the remaining data in the target migration file in response to any unsuccessful migration of any file data to be migrated during the migration process. The generation module 906 is also used to generate a migration failure response based on the shared space storage path, the target migration file identifier, and the job database identifier.

[0221] The sending module 907 is also used to send a migration failure response to the migration device.

[0222] In one approach, if the migration device sends a continued migration request for the source database again; the continued migration request includes the shared space storage path, the target migration file identifier, and the job database identifier;

[0223] This embodiment provides a data migration device, which further includes: a positioning module and a reading module;

[0224] The positioning module is used to locate the job database based on the job database identifier;

[0225] The read module is used to read the last saved successfully migrated data identifier from the job database;

[0226] The migration module is also used to migrate the remaining unmigrated file data in the target migration file based on the shared space storage path, the target migration file identifier, and the identifier of the last saved successfully migrated data.

[0227] In one approach, the migration module, when migrating the remaining unmigrated files in the target migration file based on the shared space storage path, the target migration file identifier, and the identifier of the last successfully migrated data, is specifically used for:

[0228] Based on the shared space storage path, locate the shared space and determine the target migration file based on the target migration file identifier; obtain the next file data to be migrated from the decrypted target migration file, which is the last saved successfully migrated data identifier, and determine the next file data to be migrated as the current file data to be migrated. Continue to execute the steps from determining the target database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules, to taking the next file data to be migrated as the current file data to be migrated, until all the remaining unmigrated file data to be migrated is successfully migrated.

[0229] Example 10

[0230] Figure 10 This is a schematic diagram of a target migration server structure provided in Embodiment 10. Figure 10 As shown, the target migration server 1000 may include: a processor 1001, and a memory 1002 and a transceiver 1003 communicatively connected to the processor 1001. The memory 1002 stores computer-executable instructions; the transceiver 1003 is used for sending and receiving data; the processor 1001 executes the computer-executable instructions stored in the memory 1002 to implement any one of the method embodiments in Embodiments 1 to 8 above. The specific implementation methods and technical effects are similar, and will not be repeated here.

[0231] In this embodiment, the transceiver 1003, storage 1002, and processor 1001 are connected via a bus. 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. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 10 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0232] Example 11

[0233] This application provides a computer-readable storage medium storing computer-executable instructions. When executed by a processor, the computer-executable instructions are used to implement any one of the method embodiments 1 to 8 described above. The specific implementation methods and technical effects are similar and will not be repeated here.

[0234] Example 12

[0235] This application provides a computer program product, including a computer program that, when executed by a processor, implements any one of the method embodiments of Examples 1 to 8 above. The specific implementation methods and technical effects are similar, and will not be repeated here.

[0236] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules 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 through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0237] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0238] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or in the form of hardware plus software functional modules.

[0239] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable interrupt handling device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0240] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0241] Furthermore, although the operations are described in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the invention. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.

[0242] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0243] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A data migration method, characterized in that, The method is applied to a target migration server, which is located in a distributed cluster, the distributed cluster including at least one other migration server, and the method includes: Receive a migration request for the source database sent by the migration device; the migration request includes the source database identifier; The target migration file is obtained and saved based on the source database identifier; the target migration file includes at least one piece of data to be migrated; the target migration file is an encrypted file. Obtain the current file data to be migrated from the target migration file, determine the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules, and determine the destination table corresponding to the current file data to be migrated in the destination database based on the current file data to be migrated and the preset table sharding rules corresponding to the destination database. The current file data to be migrated is migrated to the destination table, and the file data to be migrated in the next order is used as the current file data to be migrated. The steps from determining the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules to using the file data to be migrated in the next order as the current file data to be migrated are executed until all file data to be migrated is successfully migrated. Upon successful migration of all files and data to be migrated, a migration success response is generated and sent to the migration device. The step of obtaining and saving the target migration file based on the source database identifier includes: The corresponding source database is determined based on the source database identifier; Obtain at least one piece of data to be migrated from the source database, and determine the at least one piece of data to be migrated as at least one file data to be migrated; Package the at least one piece of data to be migrated into a file, and encrypt the packaged file to obtain the target migration file; The target migration file is saved to the shared space, and the storage path of the shared space and the target migration file identifier are determined to ensure that all migration servers in the distributed cluster can access it. The step of obtaining the current file data to be migrated from the target migration file includes: The shared space is located according to the shared space storage path, and the target migration file is determined in the shared space according to the target migration file identifier; The target migration file is decrypted, and the current file data to be migrated is obtained from at least one file data to be migrated in the decrypted target migration file.

2. The method according to claim 1, characterized in that, The preset database sharding rules include at least one preset database sharding indicator and its corresponding preset database; The step of determining the destination database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules includes: Read the database sharding fields included in the current file data to be migrated to determine the database sharding index to which the current file data to be migrated belongs; Query the preset database sharding rules to find the preset database sharding indicator that matches the corresponding database sharding indicator; The preset database corresponding to the consistent preset database sharding indicators is determined as the target database.

3. The method according to claim 2, characterized in that, The preset table partitioning rules include at least one preset table partitioning indicator and its corresponding preset table; The step of determining the destination table corresponding to the current file data to be migrated in the destination database based on the current file data to be migrated and the preset table partitioning rules corresponding to the destination database includes: Read the table partitioning fields included in the current file data to be migrated to determine the table partitioning index to which the current file data to be migrated belongs; Query the preset table partitioning rules for the preset table partitioning indicators that are consistent with the corresponding table partitioning indicators. The preset table corresponding to the consistent preset table segmentation index is determined as the target table.

4. The method according to any one of claims 1-3, characterized in that, The method further includes: In response to the successful migration of the file data to be migrated, the file data identifier to be migrated is determined as the successfully migrated data identifier; The successfully migrated data identifier is sent to the job database; the job database is used to store the identifiers of the files to be migrated that have been successfully migrated; the job database stores the successfully migrated data identifiers in the order they are received.

5. The method according to claim 4, characterized in that, The method further includes: In response to any unsuccessful migration of file data during the migration process, the migration of the remaining file data in the target migration file is stopped, and a migration failure response is generated based on the shared space storage path, the target migration file identifier, and the job database identifier. The migration failure response is sent to the migration device.

6. The method according to claim 5, characterized in that, If the migration device sends a continuation migration request for the source database again; the continuation migration request includes the shared space storage path, the target migration file identifier, and the job database identifier; The method further includes: Locate the job database based on the job database identifier; Read the last saved successfully migrated data identifier from the job database; Based on the shared space storage path, the target migration file identifier, and the identifier of the last saved successfully migrated data, the remaining unmigrated file data to be migrated in the target migration file is migrated. The process of migrating the remaining unmigrated files in the target migration file based on the shared space storage path, the target migration file identifier, and the identifier of the last successfully migrated data includes: The shared space is located based on the shared space storage path, and the target migration file is determined based on the target migration file identifier; The next file data to be migrated is obtained from the decrypted target migration file, which is sorted according to the last saved successfully migrated data identifier. The next file data to be migrated is determined as the current file data to be migrated. The process continues to execute the steps from determining the target database corresponding to the current file data to be migrated based on the current file data to be migrated and the preset database sharding rules, to taking the next sorted file data to be migrated as the current file data to be migrated, until all the remaining unmigrated file data to be migrated is successfully migrated.

7. A target migration server, comprising: A processor, and a memory and a transceiver communicatively connected to the processor; The memory stores computer-executed instructions; The transceiver is used for sending and receiving data; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-6.

8. 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-6.

Citation Information

Patent Citations

  • File migration method, device, computer device, and storage medium

    CN109359085A

  • Data structured migration method and device, computer equipment and storage medium

    CN110209650A