Cross-cluster access method, device, equipment and storage medium

By calculating the migration cost of each data cluster and selecting the optimal cluster for data transfer and execution of query instructions, the problem of low performance and insufficient security during cross-cluster data access is solved, and efficient and safe data transmission is achieved.

CN112597127BActive Publication Date: 2024-08-23深圳市汉云科技有限公司
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011483662.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-15
Publication Date
2024-08-23
Estimated Expiration
2040-12-15

AI Technical Summary

Technical Problem

The existing cross-cluster data access process has low performance and insecurity, leading to system crashes and high costs.

Method used

By receiving data query instructions, it calculates the migration cost value of each data cluster, selects the cluster with the lowest migration cost for data transfer, and executes the query instructions on this cluster to ensure data security and performance optimization.

Benefits of technology

Improves the performance and security of cross-cluster data transmission, reduces costs, and avoids the risk of system crashes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112597127B
    Figure CN112597127B
Patent Text Reader

Abstract

The present invention relates to the field of data migration, and discloses a cross-cluster access method, device, equipment and storage medium. The method includes: receiving data query instructions of N data initial tables; calculating the migration cost values ​​corresponding to the N data initial tables, and sequentially calculating the sum of the migration cost values ​​of the data initial tables stored corresponding to M data clusters, to obtain the cost removal values ​​corresponding to the M data clusters; summing up the migration cost values ​​corresponding to the N data initial tables to obtain the migration total value, and subtracting the migration total value from the cost removal values ​​corresponding to the M data clusters respectively to obtain the cluster migration total value corresponding to the M data clusters; comparing the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determining the data cluster corresponding to the cluster migration total value as the computing cluster; creating a data transfer table corresponding to the N data initial tables in the computing cluster, and copying the data in the N data initial tables to the data transfer table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data migration, and in particular to a cross-cluster access method, device, equipment and storage medium. Background Art

[0002] In the process of data processing, more and more data is used by governments and enterprises, and a large amount of data is stored in various databases. In actual data use, a large amount of data is distributed in databases in various locations. As a result, when querying and calling data, various clusters call each other, and data migration will result in a large number of cross-cluster accesses. If the amount of data access suddenly increases, various call accesses are very likely to cause system crashes.

[0003] When data are called from one another, there are certain problems with the performance and security of cross-cluster data access. Not only is the efficiency low, but various repeated data migrations lead to high costs and serious performance impacts. Calling various interfaces and protocols also directly affects the security of cross-cluster transmission. Therefore, a technical solution that can ensure performance and transmission security is needed. Summary of the invention

[0004] The main purpose of the present invention is to solve the technical problems of low performance and insecurity in the existing cross-cluster data transmission process.

[0005] A first aspect of the present invention provides a cross-cluster access method, the cross-cluster access method comprising:

[0006] Receive data query instructions for N data initial tables, wherein the N data initial tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers;

[0007] Calculate the migration cost values ​​corresponding to the N data initial tables, and sequentially calculate the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters to obtain cost removal values ​​corresponding to the M data clusters;

[0008] Adding up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and subtracting the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain total cluster migration values ​​corresponding to the M data clusters;

[0009] Compare the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determine the data cluster corresponding to the cluster migration total value as the computing cluster;

[0010] Create data transfer tables corresponding to the N data initial tables in the computing cluster, copy the data in the N data initial tables to the data transfer table, and execute the data query instruction in the computing cluster.

[0011] Optionally, in a first implementation of the first aspect of the present invention, after receiving the data query instruction for N data initial tables, and before calculating the migration cost values ​​corresponding to the N data initial tables, and sequentially calculating the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters, to obtain the cost removal values ​​corresponding to the M data clusters, the method includes:

[0012] Determine whether the data query instruction satisfies a preset SQL language structure;

[0013] If not, the information that data query cannot be performed will be sent to the preset port;

[0014] If the conditions are met, the SQL link in the data query instruction is parsed, and the N data initial tables are accessed according to the SQL link.

[0015] Optionally, in a second implementation of the first aspect of the present invention, the calculating of the migration cost values ​​corresponding to the N data initial tables, and sequentially calculating the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters, to obtain the cost removal values ​​corresponding to the M data clusters includes:

[0016] Read the number of valid rows and average row length corresponding to the initial data table;

[0017] Calculating the product of the number of valid rows corresponding to the initial data table and the average row length to obtain a migration cost value corresponding to the initial data table;

[0018] The migration cost values ​​corresponding to the data initial tables stored in the M data clusters are summed up in sequence to obtain cost removal values ​​corresponding to the M data clusters.

[0019] Optionally, in a third implementation of the first aspect of the present invention,

[0020] , the step of creating data transfer tables corresponding to the N data initial tables in the computing cluster, copying the data in the N data initial tables to the data transfer table, and executing the data query instruction in the computing cluster includes:

[0021] Reading L initial data tables stored in the computing cluster, and marking the L initial data tables to obtain L marked data tables, where L is a positive integer less than N;

[0022] Remove L of the marked data tables from the N data initial tables to obtain NL unmarked data initial tables from the N data initial tables;

[0023] A data transfer table corresponding to NL of the non-labeled data initial tables is created in the computing cluster, and data of the NL of the non-labeled data initial tables are copied to the data transfer table, and the data query instruction is executed in the computing cluster.

[0024] Optionally, in a fourth implementation manner of the first aspect of the present invention, creating data transfer tables corresponding to NL initial tables of unlabeled data in the computing cluster, and copying data of the NL initial tables of unlabeled data to the data transfer table includes:

[0025] Reading the verification strings corresponding to the NL non-marked data initial tables;

[0026] Creating NL data transfer tables in the computing cluster, and writing the NL verification strings into the NL data transfer tables one by one;

[0027] According to the matching relationship of the verification character string, the data of the NL non-marked data initial tables are copied to the data transfer table.

[0028] Optionally, in a fifth implementation of the first aspect of the present invention, after creating data transfer tables corresponding to the N data initial tables in the computing cluster, copying the data in the N data initial tables to the data transfer table, and executing the data query instruction in the computing cluster, it also includes:

[0029] A query termination instruction is received, and all the data transfer tables in the computing cluster are deleted.

[0030] Optionally, in a sixth implementation of the first aspect of the present invention, comparing the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determining the data cluster corresponding to the cluster migration total value as the computing cluster includes:

[0031] Select two cluster migration total values ​​from the M cluster migration total values ​​and compare them with each other, mark the larger cluster migration total value as a non-target option, and perform cyclic comparison to obtain the smallest cluster migration total value, wherein the non-target option does not enter the cluster migration total value of the cyclic comparison;

[0032] The data cluster corresponding to the minimum cluster migration total value is accessed, and the data cluster is marked as a computing cluster.

[0033] A second aspect of the present invention provides a cross-cluster access device, comprising:

[0034] A receiving module, used for receiving data query instructions of N data initial tables, wherein the N data initial tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers;

[0035] A calculation module, used to calculate the migration cost values ​​corresponding to the N data initial tables, and sequentially calculate the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters, to obtain the cost removal values ​​corresponding to the M data clusters;

[0036] A summing and subtraction module, used for summing up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and subtracting the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain the total cluster migration values ​​corresponding to the M data clusters;

[0037] A comparison module, configured to compare the M cluster migration total values, obtain a minimum cluster migration total value, and determine the data cluster corresponding to the cluster migration total value as a computing cluster;

[0038] The replication module is used to create data transfer tables corresponding to the N data initial tables in the computing cluster, and to copy the data in the N data initial tables to the data transfer table, and to execute the data query instruction in the computing cluster.

[0039] A third aspect of the present invention provides a cross-cluster access device, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via lines; the at least one processor calls the instructions in the memory so that the cross-cluster access device executes the above-mentioned cross-cluster access method.

[0040] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned cross-cluster access method. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a schematic diagram of a first embodiment of a cross-cluster access method in an embodiment of the present invention;

[0042] Figure 2 A schematic diagram of a second embodiment of a cross-cluster access method in an embodiment of the present invention;

[0043] Figure 3 A schematic diagram of a third embodiment of a cross-cluster access method in an embodiment of the present invention;

[0044] Figure 4 A schematic diagram of an embodiment of a cross-cluster access device in an embodiment of the present invention;

[0045] Figure 5 It is a schematic diagram of another embodiment of a cross-cluster access device in an embodiment of the present invention;

[0046] Figure 6 The figure is a schematic diagram of an embodiment of a cross-cluster access device in an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The embodiments of the present invention provide a cross-cluster access method, apparatus, device and storage medium.

[0048] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0049] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of a cross-cluster access method in an embodiment of the present invention includes:

[0050] 101. Receive a data query instruction for N initial data tables, where the N initial data tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers;

[0051] In this embodiment, the language of the SQL database is used, and specific SQL language instructions are attached. Examples of the language content used are as follows:

[0052] CREATE TABLE[IF NOT EXISTS]tblna

[0053] me[(create_definition,...)]

[0054] ENGINE=LINKED

[0055] CONNECTION'user / password@ip:port / db.tbl'

[0056] Among them, in the SQL language instruction, table_name indicates the name of the table to be created, create_definition indicates the table structure field definition, user indicates the user name for connecting to the peer cluster, password indicates the password for connecting to the peer cluster, ip indicates the IP address of the peer cluster, port indicates the port of the peer cluster, db indicates the database name of the peer cluster, and tbl indicates the table name of the peer cluster. CREATE is a table creation instruction, and CONNECTION is a connection instruction. It can be understood that the three data initial tables are distributed in the three clusters, and the instruction to read the three data initial tables is received.

[0057] 102. Calculate the migration cost values ​​corresponding to the N data initial tables, and sequentially calculate the sum of the migration cost values ​​of the data initial tables stored in the M data clusters, to obtain the cost removal values ​​corresponding to the M data clusters;

[0058] In this embodiment, the valid number of rows and the average row length avg_length of the three data initial tables are read, and the valid number of rows multiplied by the average row length avg_length are calculated to be countA, countB, and countC, respectively, for the migration costs of the three data initial tables in the three clusters. The sum of the migration cost values ​​stored corresponding to the three data clusters is countA, countB, and countC. It can be understood that if the three data initial tables are all in one cluster, the sum of the migration cost values ​​of the three data clusters is 0, 0, countA+countB+countC, that is, the cost removal values ​​of the three data clusters are 0, 0, countA+countB+countC.

[0059] 103. Add up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and subtract the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain a total cluster migration value corresponding to the M data clusters;

[0060] In this embodiment, the cost removal values ​​stored corresponding to the three data clusters are countA, countB, and countC, and the total migration value is countA+countB+countC. The total migration value is used to subtract countA, countB, and countC in turn. The total migration values ​​of the three data clusters are countB+countC, countA+countC, and countA+countB.

[0061] 104. Compare the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determine the data cluster corresponding to the cluster migration total value as the computing cluster;

[0062] In this embodiment, the size of countB+countC and countA+countC is first determined. If countA+countC is larger, countA+countC is excluded. The sizes of countB+countC and countA+countB are compared. If countA+countB is larger, countA+countB is excluded, leaving countB+countC as the smallest cluster migration total value. The cluster corresponding to countB+countC is found to be the first cluster, and this cluster is determined as the computing cluster.

[0063] 105. Create data transfer tables corresponding to the N data initial tables in the computing cluster, copy the data in the N data initial tables to the data transfer table, and execute data query instructions in the computing cluster.

[0064] In this embodiment, the total migration values ​​of the three data clusters are countB+countC, countA+countC, and countA+countB, respectively, and countB+countC is the smallest total migration value of the cluster. Then, transfer tables tmp c and tmp b are created in the smallest cluster, and the data initial table B and the data initial table C are pulled and copied to tmp b and tmp c using link b and link c. Therefore, there are three data tables tmp b, tmp c, and data initial A in the computing cluster, and the data query instruction is calculated in the computing cluster.

[0065] In an embodiment of the invention, by calculating, comparing and judging the migration costs of all clusters and data tables, a cluster with the lowest data table reading cost among all clusters is obtained, and other data tables that are not stored in the cluster are created in the cluster and copied into the cluster. By querying data in the computing cluster, the query cost is minimized, thereby improving the performance of the cross-cluster data transmission process.

[0066] See also Figure 2 , a second embodiment of the cross-cluster access method in the embodiment of the present invention includes:

[0067] 201. Receive a data query instruction for N initial data tables, where the N initial data tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers;

[0068] The method embodiment described in this embodiment is similar to the first embodiment. You can refer to the corresponding process in the aforementioned method embodiment, which will not be described again.

[0069] 202. Access a preset registration database to determine whether the queried table in the data query instruction belongs to a table in the registration database;

[0070] In this embodiment, the newly designed form will be registered in the registration database. If the form is registered, it is a processable form. If it is not in the registration database, it is not a processable form.

[0071] 203. If it does not belong to, send the data query instruction to the preset transfer port;

[0072] In this embodiment, the data query instruction is sent to the transfer port and processed by other processing methods of the transfer port, that is, the data query instruction is output to other processing logic for processing. 204. If yes, parse the linking mode corresponding to the N data initial tables in the data query instruction, and access the N data initial tables according to the linking mode;

[0073] In this embodiment, the connection mode in the data query instruction is satisfied, and according to the connection mode in the link table, based on the matching of the IP address, port, user name, password, library name and table name, the data initial table distributed in M ​​clusters is accessed.

[0074] 205. Read the number of valid rows and average row length corresponding to the initial data table;

[0075] In this embodiment, the number of valid rows rows and the average row length avg_length of the data initial table are read.

[0076] 206. Calculate the product of the number of valid rows corresponding to the initial data table and the average row length to obtain a migration cost value corresponding to the initial data table;

[0077] In this embodiment, the number of valid rows is 1000 rows, and the average row length avg_length is 96, so the migration cost is: 1000*96=96000.

[0078] 207. Sequentially sum up the migration cost values ​​corresponding to the data initial tables stored in the M data clusters to obtain cost removal values ​​corresponding to the M data clusters;

[0079] In this embodiment, the eight data clusters store 6, 5, 1, 6, 9, 7, 7, and 3 data initial tables respectively. The total migration cost values ​​corresponding to these data initial tables are 5000, 66600, 2000, 66663, 7778, 999, 4223, and 635 respectively. The cost removal values ​​corresponding to the eight data clusters are 5000, 66600, 2000, 66663, 7778, 999, 4223, and 635.

[0080] 208. Add up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and subtract the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain a total cluster migration value corresponding to the M data clusters;

[0081] 209. Compare the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determine the data cluster corresponding to the cluster migration total value as the computing cluster;

[0082] The method embodiments described in embodiments 208 and 209 are similar to the first embodiment. You may refer to the corresponding processes in the aforementioned method embodiments and will not repeat them here.

[0083] 210. Read L initial data tables stored in the computing cluster, and mark the L initial data tables to obtain L marked data tables, where L is a positive integer less than N;

[0084] In this embodiment, three initial data tables are stored in the computing cluster, and the three initial data tables are marked to obtain three marked data tables.

[0085] 211. Remove L of the marked data tables from the N data initial tables to obtain NL of the unmarked data initial tables from the N data initial tables;

[0086] In this embodiment, 3 marked data tables are removed from the 44 initial data tables, thereby obtaining 41 initial data tables.

[0087] 212. Read the verification strings corresponding to the NL non-marked data initial tables;

[0088] In this embodiment, the verification strings corresponding to 41 data initial tables are analyzed, and the verification strings include IP addresses, ports, user names, passwords, library names, and table names.

[0089] 213. Create NL data transfer tables in the computing cluster, and write the NL verification strings into the NL data transfer tables one by one;

[0090] In this embodiment, a data transfer table corresponding to 41 data initial tables is created in the computing cluster, and the IP address, port, user name, password, library name and table name are written into the data transfer table.

[0091] 214. According to the matching relationship of the verification character string, copy the data of the NL non-marked data initial tables to the data transfer table.

[0092] In this embodiment, based on the matching relationship among IP address, port, user name, password, library name and table name, the initial data table is copied to the computing cluster to create 41 data transfer tables to complete the data processing.

[0093] In an embodiment of the invention, by calculating, comparing and judging the migration costs of all clusters and data tables, a cluster with the lowest data table reading cost among all clusters is obtained, and other data tables that are not stored in the cluster are created in the cluster and copied into the cluster. By querying data in the computing cluster, the query cost is minimized, thereby improving the performance of the cross-cluster data transmission process.

[0094] See also Figure 3 , a third embodiment of the cross-cluster access method in the embodiment of the present invention includes:

[0095] 301. Receive a data query instruction for N initial data tables, where the N initial data tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers;

[0096] 302. Calculate the migration cost values ​​corresponding to the N data initial tables, and sequentially calculate the sum of the migration cost values ​​of the data initial tables stored in the M data clusters, to obtain the cost removal values ​​corresponding to the M data clusters;

[0097] 303. Add up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and subtract the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain a total cluster migration value corresponding to the M data clusters;

[0098] The method embodiments described in embodiments 301-303 are similar to the first embodiment. You may refer to the corresponding processes in the aforementioned method embodiments and will not repeat them here.

[0099] 304. Select two cluster migration total values ​​from the M cluster migration total values ​​and compare them with each other, mark the larger cluster migration total value as a non-target option, and perform cyclic comparison to obtain the smallest cluster migration total value, wherein the non-target option does not enter the cluster migration total value in the cyclic comparison;

[0100] In this embodiment, there are 8 cluster migration total values, namely 6222, 63300, 6633, 411, 88243, 935, 4520, and 99964. 6222 and 63300 are captured, and if 63300 is judged to be larger, 63300 is marked as a non-target option. 411 and 6633 are randomly captured, and if 6633 is judged to be larger, 6633 is marked as a non-target option. The cycle is repeated in sequence, and finally 411 is obtained as the minimum cluster migration total value.

[0101] 305. Access the data cluster corresponding to the minimum cluster migration total value, and mark the data cluster as a computing cluster;

[0102] In this embodiment, the data cluster corresponding to 411 is accessed and the data cluster is set as a computing cluster.

[0103] 306. Create data transfer tables corresponding to the N data initial tables in the computing cluster, copy the data in the N data initial tables to the data transfer table, and execute data query instructions in the computing cluster;

[0104] The method embodiment described in this embodiment is similar to the first embodiment. You can refer to the corresponding process in the aforementioned method embodiment, which will not be described again.

[0105] 307. Receive a query termination instruction and delete all data transfer tables in the computing cluster.

[0106] In this embodiment, the data transfer table of the computing cluster corresponding to 411 is cleared according to the end query instruction, ending the entire data query process. The next query will rebuild the data transfer table to obtain a new data table in the cluster, and data update lag will not occur.

[0107] In an embodiment of the invention, by calculating, comparing and judging the migration costs of all clusters and data tables, a cluster with the lowest data table reading cost among all clusters is obtained, and other data tables that are not stored in the cluster are created in the cluster and copied into the cluster. By querying data in the computing cluster, the query cost is minimized, thereby improving the performance of the cross-cluster data transmission process.

[0108] The above describes the cross-cluster access method in the embodiment of the present invention. The following describes the cross-cluster access device in the embodiment of the present invention. Figure 4 In one embodiment of the present invention, a cross-cluster access device includes:

[0109] A receiving module 401 is used to receive data query instructions for N data initial tables, wherein the N data initial tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers;

[0110] The calculation module 402 is used to calculate the migration cost values ​​corresponding to the N data initial tables, and sequentially calculate the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters to obtain the cost removal values ​​corresponding to the M data clusters;

[0111] The summing and subtraction module 403 is used to sum up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and to subtract the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain the total cluster migration values ​​corresponding to the M data clusters;

[0112] A comparison module 404 is used to compare the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determine the data cluster corresponding to the cluster migration total value as the computing cluster;

[0113] The copy module 405 is used to create data transfer tables corresponding to the N data initial tables in the computing cluster, copy the data in the N data initial tables to the data transfer table, and execute the data query instruction in the computing cluster.

[0114] In an embodiment of the invention, by calculating, comparing and judging the migration costs of all clusters and data tables, a cluster with the lowest data table reading cost among all clusters is obtained, and other data tables that are not stored in the cluster are created in the cluster and copied into the cluster. By querying data in the computing cluster, the query cost is minimized, thereby improving the performance of the cross-cluster data transmission process.

[0115] See also Figure 5 Another embodiment of the cross-cluster access device in the embodiment of the present invention includes:

[0116] A receiving module 401 is used to receive data query instructions for N data initial tables, wherein the N data initial tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers;

[0117] The calculation module 402 is used to calculate the migration cost values ​​corresponding to the N data initial tables, and sequentially calculate the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters to obtain the cost removal values ​​corresponding to the M data clusters;

[0118] The summing and subtraction module 403 is used to sum up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and to subtract the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain the total cluster migration values ​​corresponding to the M data clusters;

[0119] A comparison module 404 is used to compare the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determine the data cluster corresponding to the cluster migration total value as the computing cluster;

[0120] The copy module 405 is used to create data transfer tables corresponding to the N data initial tables in the computing cluster, copy the data in the N data initial tables to the data transfer table, and execute the data query instruction in the computing cluster.

[0121] The cross-cluster access device further includes a determination module 406, and the determination module 406 is specifically used for:

[0122] Determine whether the data query instruction satisfies a preset SQL language structure;

[0123] If not, the information that data query cannot be performed will be sent to the preset port;

[0124] If the conditions are met, the SQL link in the data query instruction is parsed, and the N data initial tables are accessed according to the SQL link.

[0125] The calculation module 402 is specifically used for:

[0126] Read the number of valid rows and average row length corresponding to the initial data table;

[0127] Calculating the product of the number of valid rows corresponding to the initial data table and the average row length to obtain a migration cost value corresponding to the initial data table;

[0128] The migration cost values ​​corresponding to the data initial tables stored in the M data clusters are summed up in sequence to obtain cost removal values ​​corresponding to the M data clusters.

[0129] Wherein, the copy module 405 includes:

[0130] A reading unit 4051 is used to read L initial data tables stored in the computing cluster, and mark the L initial data tables to obtain L marked data tables, where L is a positive integer less than N;

[0131] A removing unit 4052 is used to remove L of the marked data tables from the N data initial tables to obtain NL of the unmarked data initial tables from the N data initial tables;

[0132] The copying unit 4053 is used to create data transfer tables corresponding to the NL non-labeled data initial tables in the computing cluster, copy the data of the NL non-labeled data initial tables to the data transfer table, and execute the data query instruction in the computing cluster.

[0133] The copy unit 4053 is specifically used for:

[0134] Reading the verification strings corresponding to the NL non-marked data initial tables;

[0135] Creating NL data transfer tables in the computing cluster, and writing the NL verification strings into the NL data transfer tables one by one;

[0136] According to the matching relationship of the verification character string, the data of the NL non-marked data initial tables are copied to the data transfer table.

[0137] The cross-cluster access device further includes a deletion module 407, and the deletion module 407 is specifically used for:

[0138] A query termination instruction is received, and all the data transfer tables in the computing cluster are deleted.

[0139] The comparison module 404 is specifically used for:

[0140] Select two cluster migration total values ​​from the M cluster migration total values ​​and compare them with each other, mark the larger cluster migration total value as a non-target option, and perform cyclic comparison to obtain the smallest cluster migration total value, wherein the non-target option does not enter the cluster migration total value of the cyclic comparison;

[0141] The data cluster corresponding to the minimum cluster migration total value is accessed, and the data cluster is marked as a computing cluster.

[0142] In an embodiment of the invention, by calculating, comparing and judging the migration costs of all clusters and data tables, a cluster with the lowest data table reading cost among all clusters is obtained, and other data tables that are not stored in the cluster are created in the cluster and copied into the cluster. By querying data in the computing cluster, the query cost is minimized, thereby improving the performance of the cross-cluster data transmission process.

[0143] above Figure 4 and Figure 5 The cross-cluster access device in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The cross-cluster access device in the embodiment of the present invention is described in detail from the perspective of hardware processing.

[0144] Figure 6 : is a schematic diagram of the structure of a cross-cluster access device provided by an embodiment of the present invention. The cross-cluster access device 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 610 (for example, one or more processors) and a memory 620, and one or more storage media 630 (for example, one or more massive storage devices) storing application programs 633 or data 632. Among them, the memory 620 and the storage medium 630 may be short-term storage or persistent storage. The program stored in the storage medium 630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the cross-cluster access device 600. Furthermore, the processor 610 may be configured to communicate with the storage medium 630 to execute a series of instruction operations in the storage medium 630 on the cross-cluster access device 600.

[0145] The cross-cluster based access device 600 may also include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input and output interfaces 660, and / or one or more operating systems 631, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 6 The illustrated cross-cluster access device structure does not constitute a limitation on the cross-cluster access device, and may include more or less components than those illustrated, or may combine certain components, or may have different component arrangements.

[0146] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the cross-cluster access method.

[0147] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device, or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0148] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

[0149] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A cross-cluster access method, characterized in that: Includes steps: Receive data query instructions for N data initial tables, wherein the N data initial tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers; Calculate the migration cost values ​​corresponding to the N data initial tables, and sequentially calculate the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters to obtain cost removal values ​​corresponding to the M data clusters; Adding up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and subtracting the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain total cluster migration values ​​corresponding to the M data clusters; Compare the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determine the data cluster corresponding to the cluster migration total value as the computing cluster; Creating data transfer tables corresponding to N of the data initial tables in the computing cluster, copying the data in the N data initial tables to the data transfer table, and executing the data query instruction in the computing cluster; The calculating of the migration cost values ​​corresponding to the N data initial tables, and sequentially calculating the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters to obtain the cost removal values ​​corresponding to the M data clusters includes: Read the number of valid rows and average row length corresponding to the initial data table; Calculating the product of the number of valid rows corresponding to the initial data table and the average row length to obtain a migration cost value corresponding to the initial data table; The migration cost values ​​corresponding to the data initial tables stored in the M data clusters are summed up in sequence to obtain cost removal values ​​corresponding to the M data clusters.

2. The cross-cluster access method according to claim 1, characterized in that: After receiving the data query instruction of the N data initial tables, and before calculating the migration cost values ​​corresponding to the N data initial tables, and sequentially calculating the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters, to obtain the cost removal values ​​corresponding to the M data clusters, the method includes: Determine whether the data query instruction satisfies a preset SQL language structure; If not, the information that data query cannot be performed will be sent to the preset port; If the conditions are met, the SQL link in the data query instruction is parsed, and the N data initial tables are accessed according to the SQL link.

3. The cross-cluster access method according to claim 1, characterized in that: The step of creating data transfer tables corresponding to the N data initial tables in the computing cluster, copying the data in the N data initial tables to the data transfer table, and executing the data query instruction in the computing cluster includes: Reading L initial data tables stored in the computing cluster, and marking the L initial data tables to obtain L marked data tables, where L is a positive integer less than N; Remove L of the marked data tables from the N data initial tables to obtain NL unmarked data initial tables from the N data initial tables; A data transfer table corresponding to NL of the non-labeled data initial tables is created in the computing cluster, and data of the NL of the non-labeled data initial tables are copied to the data transfer table, and the data query instruction is executed in the computing cluster.

4. The cross-cluster access method according to claim 3, characterized in that: The step of creating data transfer tables corresponding to NL initial tables of non-labeled data in the computing cluster, and copying data of the NL initial tables of non-labeled data to the data transfer tables includes: Reading the verification strings corresponding to the NL non-marked data initial tables; Creating NL data transfer tables in the computing cluster, and writing the NL verification strings into the NL data transfer tables one by one; According to the matching relationship of the verification character string, the data of the NL non-marked data initial tables are copied to the data transfer table.

5. The cross-cluster access method according to claim 1, characterized in that: After creating data transfer tables corresponding to the N data initial tables in the computing cluster, copying the data in the N data initial tables to the data transfer table, and executing the data query instruction in the computing cluster, the method further includes: A query termination instruction is received, and all the data transfer tables in the computing cluster are deleted.

6. The cross-cluster access method according to any one of claims 1 to 5, characterized in that: The comparing the M cluster migration total values ​​to obtain the minimum cluster migration total value, and determining the data cluster corresponding to the cluster migration total value as the computing cluster includes: Select two cluster migration total values ​​from the M cluster migration total values ​​and compare them with each other, mark the larger cluster migration total value as a non-target option, and perform cyclic comparison to obtain the smallest cluster migration total value, wherein the non-target option does not enter the cluster migration total value of the cyclic comparison; The data cluster corresponding to the minimum cluster migration total value is accessed, and the data cluster is marked as a computing cluster.

7. A cross-cluster access device, characterized in that: The cross-cluster access device includes: A receiving module, configured to receive data query instructions for N data initial tables, wherein the N data initial tables are distributed and stored in M ​​data clusters, N is not less than M, and N and M are positive integers; A calculation module, used to calculate the migration cost values ​​corresponding to the N data initial tables, and sequentially calculate the sum of the migration cost values ​​of the data initial tables stored corresponding to the M data clusters, to obtain the cost removal values ​​corresponding to the M data clusters; A summing and subtraction module, used for summing up the migration cost values ​​corresponding to the N data initial tables to obtain a total migration value, and subtracting the total migration value from the cost removal values ​​corresponding to the M data clusters to obtain the total cluster migration values ​​corresponding to the M data clusters; A comparison module, configured to compare the M cluster migration total values, obtain a minimum cluster migration total value, and determine the data cluster corresponding to the cluster migration total value as a computing cluster; A replication module is used to create data transfer tables corresponding to N of the data initial tables in the computing cluster, and to copy the data in the N data initial tables to the data transfer table, and to execute the data query instruction in the computing cluster. Wherein, the calculation module is specifically used for: Read the number of valid rows and average row length corresponding to the initial data table; Calculating the product of the number of valid rows corresponding to the initial data table and the average row length to obtain a migration cost value corresponding to the initial data table; The migration cost values ​​corresponding to the data initial tables stored in the M data clusters are summed up in sequence to obtain cost removal values ​​corresponding to the M data clusters.

8. A cross-cluster access device, characterized in that: The cross-cluster access device includes: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instruction in the memory to enable the cross-cluster access device to execute the cross-cluster access method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the cross-cluster access method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

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

    CN110162517A

  • Data migration method and device, equipment and storage medium

    CN111459411A

  • Optimizing Migration / Copy of De-Duplicated Data

    US20130138902A1

  • Data migration method, migration server, and storage medium

    WO2018177107A1