Database migration method and device and database cluster
A database and cluster technology, applied in database indexing, database design/maintenance, database distribution/replication, etc., can solve problems such as low database migration efficiency, and achieve the effect of improving migration efficiency
Pending Publication Date: 2021-08-24
ALIBABA SINGAPORE HLDG PTE LTD
0 Cites 2 Cited by
AI-Extracted Technical Summary
Problems solved by technology
[0005] In view of this, the embodiment of the present application provides a database migration method and device, and a database cluster to solve the problem that in the prior art, when the...
Method used
In the embodiment of the present application, by utilizing the storage rule information of the source cluster, querying the index table associated with the data table, the data table and the index table are copied to the target cluster at the same time, without needing to be the key values in the data table one by one Create an index directory to improve the migration efficiency of the database.
[0048] Data partitioning: a physical database design technique, which is obtained by segmenting the data table, so that the data in the database table can be evenly allocated to different storage spaces, and part of the data is stored in each data partition. After the data table is divided into data partitions, it is actually still a data table. Partitioning can balance the data in the table to different places, improve the efficiency of data retrieval, and reduce the access pressure of the database. When querying a database table, it will be split into multiple data partitions for querying, and the query results of different data partitions can be summarized as the final result for the entire database table. After the data table is partitioned, it is stored in the corresponding storage space in a certain file format. For example, after a data table in the Cassandra database is partitioned, multiple SSTable (Sorted String Table) files can be obtained. SSTable is a file format used to store key-value pairs on disk in an orderly manner. A data file, multiple SSTable files can be stored in different computing nodes of the cluster to real...
Abstract
The embodiment of the invention provides a database migration method and device and a database cluster, and the method comprises the steps: in response to a migration request for any database in a source cluster, determining a to-be-migrated data table corresponding to the database; obtaining storage rule information of the to-be-migrated data table in the source cluster; according to the storage rule information, querying an index table of the to-be-migrated data table stored in the source cluster in an associated manner; and associating and copying the to-be-migrated data table and the index table to a target cluster. According to the embodiment of the invention, the database migration efficiency is improved.
Application Domain
Database distribution/replicationSpecial data processing applications +2
Technology Topic
Table (database)Data science +3
Image
Examples
- Experimental program(1)
Example Embodiment
[0037] In order to make the objects, technical solutions, and advantages of the present application, the technical solutions in the present application embodiment will be clearly described, and the described embodiments will be described in conjunction with the drawings in the present application embodiment. It is an embodiment of the present application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative labor, are the scope of the present application.
[0038] The terms used in the present application examples are only for the purposes of describing particular embodiments, not intended to limit the application. The "one", "one", "one", "one", "" "" and "" "as used in the present application embodiment and the appended claims are also intended to include many forms, unless the context clearly represents other meanings," multiple " It is generally included, but the case containing at least one is not excluded.
[0039] It should be understood that the terms "and / or" as used herein are merely a correlation relationship to the associated object, indicating that there are three relationships, such as A and / or B, which may be represented: Alone A, at the same time B, there is three cases of B alone. In addition, the characters "/" in this article generally indicate that the front and rear association objects are a "or" relationship.
[0040] Depending on the context, if "if" "if" as used herein, "if" can be interpreted as "when" or "when ..." or "in response to determination" or "in response to recognition". Similarly, depending on the context, the phrase "if it is determined" or "if the identification (condition or event)" can be interpreted as "when it is determined" or "in response to determination" or "as a condition or event "Or" in response to identifying (conditions or events).
[0041] It will also be noted that the terms "including", "comprising" or any other variable is intended to cover non-exclusive contained container, so that a product or system including a series of elements includes not only those elements, but also not clearly listed. Other elements, or elements that are also inherent to this item or system. In the absence of more restrictions, the elements defined by the statement "include a ...", and do not exclude additional same elements in the goods or systems including the elements.
[0042] The technical solution of the present application can be applied to the migration scenario of the database, such as fast migration of the database for Cassandra (open source distributed NOSQL (Not Only Structured Query Language) database system) database.
[0043] In order to facilitate understanding of the present application, the technical terms that may occur in the present application will be first explained:
[0044] Database: A long-term stored in the computer, organized, shared, unified data collection, you can use the database name to set a database.
[0045] Data table: table: Table of real data in the database, one of the data in the data table is called record, and the record is typically composed of one or more key-value.
[0046] Index Table: The table index directory formed by the index directory established by each record is composed of Key and corresponding components. When a record in the data table, you can query the recorded key and query the storage location corresponding to the key, and then go directly This storage location query the required data, and does not need to scan the data table, and quickly obtain the required data, improve data query efficiency. In the Cassandra database, the index table is invisible to the user of the database or the rental party.
[0047] The data sheet can be divided into primary index and secondary index according to the primary or successive relationship. The primary index is a gathering index, and the leaf node is saved is the primary key index. The secondary index is a non-aggregated index, and the leaf node saves the data line corresponding to the main key value.
[0048] Data Partition: A physical database design technology, seizes the data table so that the data of the database table can be equalized to different storage spaces, and some data is stored in each data partition. After the data sheet is cut into data partition, it is actually a data sheet. By partitioning can balance the data of the table to a different place, improve the efficiency of data retrieval, and reduce the access pressure of the database. When querying the database table, it will be queried to multiple data partitions. The query results of different data partitions can be summarized as the final result of the entire database table. After the data table is partitioned, stored in a corresponding storage space in a certain file format. For example, a data table in the Cassandra database is partitioned by the data partition, and the Sstable is a file format for an orderly stored key value to the disk. A data file, multiple SSTABLE files can be stored in a different computing node in the cluster, implement distributed storage.
[0049] Due to the user's own reasons, there may be a database of databases to another computer cluster, or a cloud server that provides a database service in the background. This application can also be migrated to another computer cluster. In order to improve the query efficiency of the database, after the data table of the database is migrated, records or data in the database can be read one by one to construct a new index for each data according to the construction method of the database index directory. For example, when the Cassandra database needs to copy the SSTable file on the source node, the data file, copy to the target node, you can call the noderefre command, load the SSTable file to the target node, and traverse each data of the SSTable file. Read the value corresponding to the key, then build a secondary index based on the size of Key and Kalue. Or directly copy each of the key-value data in the data table to the CSV format file, and then use the COPY FORM command to read each data in the CSV file, write to the target node, and write the target node When the secondary index is constructed for each key value written. The above two indexes of indexes are all read key values on data and build an index, which requires a lot of time, resulting in lower migration efficiency of the database.
[0050] In the present application embodiment, by utilizing the storage rule information of the source cluster, query the index table associated with the data table, simultaneously copy the data table and the index table to the target cluster, no need to establish an index for the key value in the data table. Directory, improve the migration efficiency of the database.
[0051] Next, the technical solutions in the present application embodiment will be described in the following examples, and clearly, the embodiments described are intended to be described herein, not all of the embodiments. Based on the embodiments in this application, those skilled in the art do not have all other embodiments obtained without creative labor, and are the scope of the present application.
[0052] figure 1 A flowchart of one embodiment of a database migration method provided in the present application embodiment, which may include the following steps:
[0053] 101: Determine the database corresponding to the data table in response to the migration request for any database in the source cluster.
[0054] 102: Get the storage rule information of the source cluster to be migrated.
[0055] The present application can be applied to computing devices, for example, can include, for example, a cloud server, computer, super personal computer, a laptop, and other devices, and the specific type of computing device is not limited in the present application embodiment.
[0056] The data table is the dependent unit of data in the database, using the database to query the data items in the data table. When migrating the database, the data table corresponding to the database needs to be migrated. In practical applications, the amount of data stored in the data table is relatively large, and the larger memory is occupied, thus generating distributed storage requirements, and the data table can be partitioned to be stored in a plurality of nodes of the source cluster. For example, when the storage space occupied by the data table is 1TB (TERABYTE, too byte), it can be subjected to a data partition, distributed in multiple nodes of the cluster. In order to improve the query efficiency of the data table, in the case, the index table can be established for the data table, and the data table is associated with the corresponding index table.
[0057] Different data sheets can distinguish using data sheet identity. The migration request can include the logo of the database to determine the database to be migrated.
[0058] Alternatively, the migration request can be initiated by a target user, and this method may further include receiving a migration request for any database. Target users can, for example, to the user of the database or the maintenance party that provides a database saved service. The user of the database can use the database to use the database to perform data queries for data tables. The service maintenance party of the database can provide operation and maintenance users who provide data set storage services. When the computing device detects the migration request initiated by the target user, the target user can detect the migration request initiated by the target user based on the database identification of any database.
[0059] Alternatively, the migration request can also be automatically generated by a computing device to detect a data inventory during migration requirements. At this time, the method can also include detecting that the migration request of the database is generated when either the database meets the migration condition. When the computing device generates a migration request for the migration data table, a migration request can be generated based on the identity of the database to be migrated.
[0060] In practical applications, the storage rule information of the data table is known. Storage rule information can be set to the local computing device for real-time reading; or can also be stored in the source cluster, requesting the storage rule information of the data table to be migrated from the source cluster after determining the data table to be migrated; or Provided by the target user, i.e., after determining the data table to be migrated, the storage rule information of the target user enters the data table entered by the target user is detected.
[0061] 103: According to the storage rule information, query the index table to be migrated in the source set group.
[0062] The data sheet stores in the source cluster in a certain storage mode in the source set group, and the index table corresponding to the data table can be associated with the data table in the source cluster. Depending on the storage rule information, the index table that is queried to be migrated in the source cluster can include: Determining the associated storage relationship to be migrated to the corresponding index table according to the storage rule information, determines whether to migrate according to the associated storage relationship according to the storage rule information. Data table is associated with stored index tables.
[0063] Alternatively, the index table to be migrated the data table can be a secondary index table. For a primary index, since the primary key index, the amount of data is small, the reconstruction cost is low. For the secondary index, the amount of data is very large, so for the secondary index, the reconstruction cost is very high, and the secondary index is required for each key value. Therefore, the two needed to migrate the data table. Class cables, directly related to the data table to be migrated, and do not need to be rebuild the index table of the data table, improve the migration efficiency of the index table.
[0064] 104: Copy the data table and the index table to the target cluster.
[0065] The index table associated with the data table to be migrated is copied to the target cluster. Once the target cluster obtains the index table to be migrated on the data table and the index to be migrated, the target table to be migrated can be stored with the index table associated with it.
[0066] In the present application embodiment, in response to the migration request of the data table in the source cluster, the storage rule information of the source cluster can be obtained, so that according to the storage rule information, query the index table to be migrated in the source set associated storage, and will Migration data tables and index tables are copied to the target cluster. No need to raise the key value in the data table to establish an index directory to improve the migration efficiency of the database.
[0067] In practical applications, the amount of data stored in the data table corresponding to the database is usually large. The time overhead of copying the data sheet from the source cluster to the target cluster is low, for example, the replication time of 1TB data sheet is about 1 minute. However, in general, the index table corresponding to the data table is generally invisible due to the constraints of the prior art. In order to continue to efficiently query data in the target cluster, new index tables can be created for the data table in the target cluster. However, if you build a new index by one of the key values in the data table in the target cluster, you take a few hours, resulting in existing index asynchronous reconstruction consumption, which greatly reduces the efficiency of database migration.
[0068] In order to solve technical problems with lower migration efficiency in the source cluster. The inventor studies have found that when the data sheet is stored in the source cluster, in order to solve the data sheet data, it is not conducive to data storage and data query efficiency improvement, and the source cluster is usually distributed in distributing data sheets. Store the data table distributed in at least one node of the source cluster. When the data sheet is distributed in different nodes, the data files stored in each node are associated with their corresponding index files.
[0069] The storage rule information of the source cluster can include: data table store information on at least one first node of the source cluster. Since the data files on any first node and the index file associated with the storage path of the index file are related to the storage path of the data file, the storage path of the index file belongs to the subpath of the storage path of the data file, and the data file is determined, it can The storage path of the index file is determined by the storage path of the data file.
[0070] like figure 2 As shown, a flow chart of one embodiment of a database migration method provided in the present application embodiment, the method can include the following steps:
[0071] 201: Determine the data table to be migrated by the database in response to the migration request for any of the databases in the source cluster.
[0072] It should be noted that the partial step in the present application is the same as the partial steps in the foregoing embodiment, and details are not described herein.
[0073] 202: Get the storage rule information of the source cluster to be migrated.
[0074] Alternatively, the storage rule information may include: data table corresponding to data partition information in the source cluster.
[0075] The data table to be migrated is stored as a corresponding data file in the source set group according to the data partition information distribution corresponding to the at least one first node. The key value in the data file stored in the first node is to satisfy the data partition information corresponding to the first node.
[0076] 203: Determine the data file corresponding to the at least one first node to be migrated in the source cluster according to the storage rule information.
[0077]Storage rule information includes at least one data partition information corresponding to the respective first nodes. The data sheet can be used by the data partition as a plurality of data range ranges. For example, assume that the data value of the target key of the data table ranges from 0 to 50000, and it can be divided into three data intervals, respectively from 0 to 200,000, 20001 to 40000, 40001 to 50000, respectively. Any data range value range can be configured as a data partition information of a first node, at least one data range value range can be configured to the corresponding first node, respectively, as a data partition information corresponding to the at least one first node. At this time, the data partition information of any of the first data nodes can be a range of data configured for the first node. Typically, any of the data values ranges corresponding to a first node, and each first node stores a data file that meets the respective data range range. The data table stores in at least one first node in partition, any first node stores a data file stored in the data table.
[0078] Depending on the storage rule information, it is determined that the data file corresponding to the at least one first node to be migrated in the source cluster may include: querying the data partition information corresponding to the at least one first node corresponding to at least one first node Data files stored separately.
[0079] 204: Query the data file of any first node is associated with the stored index file to obtain the data files and index files corresponding to at least one first node.
[0080] The associated storage relationship between the data sheet and the index table can include the path dependencies between the data table and the index table. There is a dependency between the data files between the data files in the first node and the index file. The storage path of the data file is the main path of the memory path of the index file, and the memory path of the index file is a subpath of the storage path of the data file. Assuming that the storage path of the data file is A / B, the memory path of the index file can be sub-path A / B / C for the storage path of the data file. Moreover, in practical applications, the path owner of the data file and the index file is known from the rule. Therefore, when the storage path of the data file is determined, the storage path of the data file can be used to determine the index file from the rule. The storage path. The master-slave rule can provide a path mapping relationship between the storage path of the data file and the storage path of the index file, for example, in the Cassandra cluster, the memory path of the index file is a primary subpath of the storage path of the data file, in the data file When the storage path is determined, the path lookup directly to the next level is stored to obtain the corresponding index file.
[0081] Alternatively, the index file that queries any of the first nodes in the first node associated stored index file can include: determining any one of the first nodes of data files in the first storage path of the first node; utilizing the first storage path, The second storage path corresponding to the index file stored in the subpath of the first storage path is determined; the index file associated with the data file of the first node is acquired according to the second storage path.
[0082] 205: Set the corresponding second node in the target cluster.
[0083] Since at least one first node is set in the source set, at least one first node corresponds to the data partition information, but to facilitate the accurate migration of the data file to ensure that the migration can continue to query, at least one can be set in the target cluster. The first node corresponding to the second node, respectively, to ensure that at least one second node saves the data file and the index file corresponding to the first node, implement the image migration of the data table, ensuring that the migrated data table can be effectively used.
[0084] 206: Associate the data file and the index file corresponding to any of the first nodes to the second node corresponding to the first node to copy the corresponding data files and index files, respectively, respectively, respectively, respectively. node.
[0085] Alternatively, the second node corresponding to any of the first nodes and the index file is copied to the first node, and the corresponding data file and the index file are read from any of the first nodes. The data file of the first node and the index file are sent to the second node corresponding to the first node. That is, the data file corresponding to any of the first nodes and the index file is forwarded to the second node corresponding to the first node.
[0086] In the present application, in response to the migration request of any of the databases in the source cluster, the data table to be migrated by the database is determined. After obtaining the storage rule information of the data sheet to be migrated, it can determine the data file corresponding to the data file in the source cluster at least one first node, according to the storage rule information. In turn, the data file of any first node is queried in the first node associated with the stored index file to obtain the data files and index files corresponding to at least one first node. The corresponding second node is set in the target cluster. Further, the data files corresponding to any of the first nodes and the index file are copied to the second node corresponding to the first node, and the at least one first node corresponds to the corresponding data file and the index file to the corresponding second node copy. The corresponding second node is established by at least one of the active clusters in the target cluster, so that the node architecture of the target cluster is the same as the node architecture of the source cluster. When migrating the index table corresponding to the migration data table and the migration data table, the data file to be migrated on the data table and its associated index table can be stored in accordance with the node distribution architecture of the source cluster. Mirror migration makes the data table in the target cluster, and the index table is fully migrated to facilitate the use of migration after the cause of the data table, ensuring the use of the data sheet while improving the migration efficiency of the data table.
[0087] In practical applications, when the data table partition is stored, at least one of the first nodes in the source cluster can be set respectively. The data storage value range is the range of value of the data value of the target key. The target key can be any of the data tables.
[0088] The storage rule information can include: at least one of the first nodes respectively corresponds to the data partition information, respectively.
[0089] As an embodiment, the second node corresponding to at least one first node setting in the target cluster may include:
[0090] The second node is associated with at least one first node in the target cluster.
[0091] For any of the first nodes, the first node corresponding to the data partition information is set to the data partition information of the second node associated with the first node, and the second node corresponding to the at least one first node is obtained.
[0092] The data table can be stored in accordance with the data partition information corresponding to the at least one first node. As a possible implementation, the method can also include:
[0093] According to the data partition information corresponding to the at least one first node, the data table is divided into at least one first node, respectively, and obtains the corresponding data file corresponding to the at least one first node.
[0094] The stored procedure of the data table is stored in accordance with the data partition information corresponding to at least one first node.
[0095] In the target cluster, each of the first nodes set the corresponding second node, that is, the data partition information mirror image of the first node is set to a second node, and the second node is the first node corresponding to the first node. Second node.
[0096] As a possible implementation, the data partition information corresponding to the at least one first node can be obtained by detecting the configuration parameters of the data partition information corresponding to the at least one first node. Further, the data partition information corresponding to the at least one first node can also be obtained by the management user input. The data partition information corresponding to the at least one first node input to the user input can be detected.
[0097] In order to ensure accurate determination of the second node corresponding to any of the first nodes, the identity of the first node can be identified as a node identifier corresponding to the second node. In some embodiments, the second node is associated with at least one first node in the target cluster, respectively, can include:
[0098] According to the respective first node identifier of at least one first node, it is determined that at least one first node identifies the image identifier corresponding to respectively.
[0099] At least one configuration node having the same number of nodes at least one first node is determined in the target cluster;
[0100] The at least one mirror identifier is set to at least one node identifier to be configured to obtain at least one second node;
[0101] A second node that is associated with the at least one first node is determined based on the corresponding mirror identity, respectively, respectively, respectively.
[0102] If the first node of the first node identifies the second node, the second node is associated with the first node is determined to determine the second node associated with the first node.
[0103] In the present application embodiment, the first node of any first node is identified as the first node corresponding to the second node identifier to establish a mirror identifier, ensuring that the first node identifier through the first node, quick query and the first node The corresponding second node, realizing the association migration of the index file, increasing the accuracy of data migration, and implementing the accurate migration of the data table.
[0104] As an embodiment, the data file of any first node and the file type of the index file associated with the data file is the same. Take the Cassandra, the LTS database as an example, data files, and index files in the node in the node in the SSTABLE file format. In order to solve the problem of reading difficulties in the index file, the read mode of the data file can be read, and the index file is read. As a possible implementation, the method may further include:
[0105] On any second node, the data files and index files in the second node are loaded using a predetermined load mode to load the respective data files of the second node and the index files, completing the data table, and the migration of the index table.
[0106] The data file is the same as the file format of the index file, and the file load can be used in the same load mode. Taking the SSTable file format as an example, on either second node, the file format can be used to load the data file and the index file on the second node.
[0107] In actual applications, the storage rule information except for the data partition information corresponding to at least one first node in the source cluster, and may include a data table corresponding to the storage path information corresponding to the at least one first node. When the data table is configured to be migrated, it is possible to directly determine the storage location corresponding to the at least one first node corresponding to the storage position of the at least one first node, respectively. Find the index file associated with the data file stored in any first node through the path dependent between the data file and the index file.
[0108] Different data sheets can be stored corresponding to their respective index tables. For example, in practical applications, the storage path of the data table can be used as the main path of the index table, and the storage path of the index table can be a sub-path to the corresponding data table storage path. For example, it is assumed that the data table is stored in the storage path of E: \ 11222 \ 11111, the index table corresponding to the data table can be stored in the storage path of E: \ 11222 \ 11111 \ 1111. When the storage path of the data table is determined, the storage path information of the index table can be determined according to the memory path information of the data table and the memory path information of the index table, and according to the storage path information of the index table, the query is obtained. The index table for the migration data table is associated.
[0109] When the respective data files on at least one first node are known, in order to solve the technical problem of the data table corresponding to the indexing table, the migration of the database can be converted to the data files stored on each node and the corresponding migration of the data file.
[0110] Under the constraint of the storage rule, you can determine the copy mode of the data file and the index file.
[0111] In a possible design, it can also include:
[0112] It is determined that at least one data file is respectively stored in the corresponding first node.
[0113] The data file corresponding to any first node and the index file association copy to the first node corresponding to the second node can include:
[0114] Generate copy instructions for any data file and the index file associated with the data file;
[0115] Respond to the copy instruction, copy the data file and the index file associated with the data file to the second node corresponding to the first node;
[0116] The data file and its associated index file are associated with the index file therein in the second node in the second node in the second node in the second node in accordance with any of the storage path information corresponding to the first node.
[0117] Take the Cassandra distributed database as an example, assume that there is a three node in the source cluster, and the data partition information corresponding to the A node is (a, b], and the data partition information corresponding to (b, c], The data partition information corresponding to the C node is (C, A] .A node, the corresponding data file and the index file (SSTA1, SSTA2, SSTA3, INDEXA1, INDEXA2), the corresponding data files and index files (SSTB1) , SSTB2, SSTB3, INDEXB1, C correspondence files, and index files (SSTC1, SSTC2, SSTC3, INDEXC1, INDEXC2). where SST is a data file, index is an index file.
[0118] Assuming three nodes in the target cluster, after the node name corresponds to replication, it is A '/ b' / c ', respectively, and the A and A' correspond, B is corresponding, C and C 'correspond. The data partition information (A, B] corresponding to the A node can be set to the data partition information of A ', the data partition information (B, C] corresponding to the B' data partition information, the data partition corresponding to the C node. Information (C, A] is set to c 'data partition information. After that, the data file and index file can be copied, and the A node (SSTA1, SSTA2, SSTA3) can be copied to the A' node, and the B node ( SSTB1, SSTB2, SSTB3) Copy to the b 'node, copy the C' node (SSTC1, SSTC2, SSTC3) to the C 'node. Copy the data file and index file to the target cluster, you can implement fast copy of the data and index And after copying, the data file can continue to use the original index file to effectively enhance the migration efficiency of the database.
[0119] For convenience of understanding, the three first nodes M11 to M13 are constructed in the source cluster M1, and the target cluster is configured as an example, and the technical solution of the present application embodiment will be described in detail.
[0120] In the present application embodiment, the database can be stored in the source cluster, and the database actually stores the data table in the original cluster. Typically, the data table is stored in three first nodes according to the data partition information in the source cluster, and each first node can store the key value pair of data in the range of data values in the range of data. Reference image 3 The computing device M3 configured with the database migration method provided by the present application embodiment, detects the migration request of the database, can determine the data table to be migrated in response to the migration request. Since the data table to be migrated is stored in the source cluster corresponding to the data partition information distribution in accordance with at least one first node, it is possible to determine the data files of the three first nodes of the source cluster. Further, according to the data file corresponding to the three first nodes, for example, the memory path information of the data file is obtained, the index file associated with the data file is obtained to obtain the index files associated with the respective data files of the three first nodes.
[0121] It is assumed that the calculation device M3 is the corresponding second node of three first nodes M11 to M13 in the target cluster, M21 to M23. That is, the second node M21 in the target cluster corresponds to the first node M11 in the source cluster, and the second node M22 corresponds to the first node M12, and the second node M23 corresponds to the first node M13. In order to ensure the accurate reading of the data file and the index file, the data file of the first node M11 and its associated index file can be migrated into the second node M21, and the data file of the first node M12 and the index file thereof. Migrate to the second node M22, the data file of the first node M13 can be migrated to the second node M23. Furthermore, the accurate migration of the data sheet and its associated index table, improve the migration efficiency of the data table.
[0122] like Figure 4 As shown, it is a flow chart of yet another embodiment of a database migration method according to the embodiment of the present application, and the method can include the following steps:
[0123] 401: Respond to the database migration interface corresponding to the database migration interface in response to the database migration interface.
[0124] The following steps are performed using the processing resource corresponding to the database migration interface:
[0125] 402: Determine the database corresponding to the data table in response to the migration request for any database in the source cluster.
[0126] Where the migration request can be received through the database migration interface.
[0127] 403: Get the storage rule information of the source cluster to be migrated.
[0128] 404: According to the storage rule information, query the index table to be migrated in the source set group.
[0129] 405: Copy the data sheet and the index table to the target cluster.
[0130] In the present application embodiment, in response to the migration request of the data table in the source cluster, the storage rule information of the source cluster can be obtained, so that according to the storage rule information, query the index table to be migrated in the source set associated storage, and will Migration data tables and index tables are copied to the target cluster. No need to raise the key value in the data table to establish an index directory to improve the migration efficiency of the database.
[0131] The specific steps performed by the processing resource corresponding to the database migration interface in the present application embodiment Figure 1 ~ 3 The processing steps shown in the database migration method are the same, and the specific implementations and technical effects of each technical feature are already Figure 1 ~ 3 The illustrated embodiment is described in detail, and details are not described herein again.
[0132] The database migration method in the present application is provided to the target user in the form of migration services, and the specific service form includes web services, software program services, or SDK (Software Development Kit, Software Development Kit) or API (Application Programming Interface) , The application programming interface) The program module exists, and the program module can provide a response to provide services. The target user acquires the database migration service provided by the present application embodiment by browsing the information processing interface interface, a service software interface, or a software module interface, and the like.
[0133] like Figure 5 As shown, it is a flow chart of yet another embodiment of the present application embodiment, which may include:
[0134] Request Response Module 501: Determine the database corresponding to the data table to be migrated to be migrated in response to the migration request for any database in the source cluster.
[0135] Rule Getting Module 502: Used to get the storage rule information of the source cluster to be migrated.
[0136] Index Query Module 503: Used to query the index table in the source set associated storage based on the storage rule information.
[0137] Data Migration Module 504: Used to copy to the target cluster to the target cluster to be migrated data tables and index tables.
[0138] In the present application embodiment, in response to the migration request of the data table in the source cluster, the storage rule information of the source cluster can be obtained, so that according to the storage rule information, query the index table to be migrated in the source set associated storage, and will Migration data tables and index tables are copied to the target cluster. No need to raise the key value in the data table to establish an index directory to improve the migration efficiency of the database.
[0139] As an embodiment, the index query module can include:
[0140] The file determination unit is configured to determine the data file corresponding to at least one first node to be migrated in the source cluster according to the storage rule information.
[0141] The index query unit is used to query the data files of any first node in the first node associated with the stored index file to obtain the data files and index files corresponding to the at least one first node;
[0142] Data migration modules can include:
[0143] The node setting unit is configured to set the second node corresponding to at least one first node in the target cluster;
[0144] File migration unit, configured to copy the data files corresponding to any of the first nodes and the index file to the second node corresponding to the first node to copy the corresponding data files and index files corresponding to the at least one first node to respective correspondence The second node.
[0145] In some embodiments, the storage rule information includes: the data partition information corresponding to the at least one first node.
[0146] The node setting unit can include:
[0147] The node associated subunit is used to associate a second node for at least one first node in the target cluster;
[0148] The partition setting subunit is used to set the data partition information of any of the first nodes to the second node associated with the first node to obtain the second node corresponding to the at least one first node.
[0149] In a possible design, the device can also include:
[0150] The distribution storage module is used to divide the data file to be migrated to the at least one first node to be stored in accordance with the data partition information corresponding to at least one first node, and obtain the data file corresponding to the at least one first node.
[0151] As a possible implementation, the node associated sub-unit can be used for:
[0152]According to the respective first node identifier of at least one first node, the at least one first node identifies the corresponding image identifier; at least one of the same amount as the number of nodes in the target cluster is determined; at least A mirror identifier is set to at least one node identifier to be configured to obtain at least one second node; determine the second node associated with the at least one first node based on the corresponding mirror identifier, respectively, respectively, respectively.
[0153] As yet another embodiment, the file type of any of the data files of any of the first nodes and the index file associated with the data file is the same. The device can also include:
[0154] The file load module is used to load the data files and index files in the second node using a predetermined data load mode on either second node to load the data files and index files to be migrated by loading at least one second node. And the migration of the index table.
[0155] In some embodiments, the apparatus can also include:
[0156] The path determination module is used to determine that at least one data file is respectively stored in the corresponding first node.
[0157] File migration units can be used in:
[0158] Generate a copy instruction for any data file and the index file associated with the data file; respond to the copy command, copy the index file associated with the data file and the data file to the first node corresponding to the second node; according to the corresponding first node according to the data file The storage path information is stored in the second node to associate the data file and the data file corresponding to the index file.
[0159] Figure 5 Database migration device can be executed figure 1 The database migration method of the examples, the principle and technical effects are not repeated. A detailed description of the various steps performed in the respective modules and units in the above embodiments has been described in detail herein, which will not be described in detail herein.
[0160] In practical applications, Figure 5 The database migration device shown can be configured as a computing device, such as Image 6 As shown, the computing device can include a storage component 601 and a processing component 602. The storage component 601 can be used to store one or more computer instructions, which can be processed by the processing component 602 to perform figure 1 The database migration method of any of the embodiments.
[0161] The processing component 602 can include one or more processors to perform computer instructions to complete all or part of the steps in the above method. Of course, the processing component can also be one or more application dedicated integrated circuit (ASIC), a Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), on-site programmable gate array (FPGA) , Controller, microcontroller, microprocessor or other electronic component implementation for performing the above database migration method.
[0162] The storage component 601 is configured to store various types of data to support the operation of the terminal. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), electrical erasable programmable read only memory (EEPROM), can be erased Programmable Read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, disk or disc.
[0163] Of course, the server must also include other components, such as input / output interfaces, communication components, and the like. The input / output interface provides an interface between the processing component and the peripheral interface module, and the peripheral interface module can be an output device, an input device, and the like. The communication component is configured to facilitate the server and other devices, such as communication between the user equipment, the wireless or wireless mode.
[0164] like Figure 7 As shown, a structural schematic view of one embodiment of a database cluster provided in the present application embodiment, the database cluster may include: the respective data table distribution of one or more databases is stored in at least one node 701.
[0165] The database processing component can be used to determine the data table corresponding to the database in response to the migration request for any database. Get the storage rule information of the data table to be migrated. Query the index table to be migrated to be migrated by the storage rule information. Copy the data table and the index table to the target cluster.
[0166] Specific implementations of each step in the database processing assembly in the present application embodiment figure 1 Each of the steps of the database migration method in the illustrated embodiment is the same, and details are not described herein in order to describe the simpleness of the description.
[0167] Optionally, Figure 7 The database cluster in the illustrated embodiment may be a source cluster in the foregoing embodiment, and the target cluster can be Figure 7 The database cluster shown has the same structure to realize the image migration of the database. That is, the target cluster may have a node having the same node number of at least one node 701 or more than the number of nodes of at least one node 701.
[0168] like Figure 8 As shown, a structural schematic structural diagram of one embodiment of a database system provided herein, the database system can include: source set 801, computing device 802, and target cluster 803. The source set 801 and the target cluster 803 can be transmitted or passed with the computing device 802. The data tables distributed in one or more databases are stored in the source cluster 801.
[0169] The computing device 802 can be used to determine the database corresponding to the data table corresponding to the data table to be migrated in response to the migration request for any of the source cluster 801; obtain the storage rule information of the source cluster 801; The storage rule information, queries the desired data table to be stored in the source cluster 801; copied the migrated data table and the index table to the target cluster 803.
[0170] Alternatively, the various steps performed by the computing device 802 in the present application embodiment figure 1 In the illustrated embodiment, it is not described herein in order to describe the simpleness of the description.
[0171] Further, the present application embodiment also provides a computer readable storage medium, and the storage medium can store one or more computer instructions, one or more computer instructions are executed for implementation. figure 1 The database migration method in the examples.
[0172] The device embodiment described above is merely schematic, wherein as the separation member explains may or may not be physically separated, and the components displayed as the unit may be or may not be a physical unit, that is, it can be located in one place. Or can also be distributed to multiple network units. The object of the present embodiment can be implemented in accordance with the actual needs to select the part or all of the modules. One of ordinary skill in the art can understand and implement without the creative labor.
[0173] Through the description of the above embodiments, those skilled in the art will clearly understand that the embodiments can be implemented by means of a necessary general-purpose hardware platform, and of course, it can also be implemented by hardware and software. Based on this, the above technical solution essentially or contributes to the prior art, can be embodied in the form of a computer product, and the present application can use a computer that contains a computer available program code in one or more. Media (including, but not limited to, disk memory, CD-ROM, optical memory, etc.) implemented in the form of computer program products.
[0174] It will be noted that the above embodiments are intended to illustrate the technical solutions of the present application, and will not limit the present application, however, those skilled in the art will understand that it is still The technical solution described in the foregoing embodiments is modified, or part of the technical features in which these modifications or replacements do not allow the nature of the corresponding technical solutions to the spirit and scope of the present invention.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
Similar technology patents
Data migration method and system and computer readable storage medium
Owner:CHINA MOBILE SUZHOU SOFTWARE TECH CO LTD +1
Virtual machine migration method, ARP proxy gateway and VTEP
PendingCN113590268AAvoid virtual machine migration failure issuesImprove migration efficiency
Owner:CHINA UNITED NETWORK COMM GRP CO LTD
Data one-key migration method and device, electronic device and storage medium
InactiveCN110674113AImprove migration efficiency
Owner:MIGU MUSIC CO LTD +1
Classification and recommendation of technical efficacy words
- Improve migration efficiency
Data migration method and system and computer readable storage medium
Owner:CHINA MOBILE SUZHOU SOFTWARE TECH CO LTD +1
Data one-key migration method and device, electronic device and storage medium
InactiveCN110674113AImprove migration efficiency
Owner:MIGU MUSIC CO LTD +1
Virtual machine migration method, ARP proxy gateway and VTEP
PendingCN113590268AAvoid virtual machine migration failure issuesImprove migration efficiency
Owner:CHINA UNITED NETWORK COMM GRP CO LTD