Super-large-scale big data platform data migration method and device
Through the combination of full synchronization and incremental synchronization, using RBF cluster architecture and dedicated racks for data migration, we solve the problems of business interruption, NameNode performance pressure and data quality in ultra-large-scale data migration, and achieve efficient data migration and consistency calibration. test.
Patent Information
- Application Number
- CN202410552128.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-07
- Publication Date
- 2024-08-23
AI Technical Summary
In ultra-large-scale big data platforms, the data migration process often faces long-term business interruptions, pressure on NameNode performance, difficulty in ensuring data quality, and long-tail effects caused by file replication, resulting in low migration efficiency and difficulty in ensuring data integrity. .
Using the method of full synchronization and incremental synchronization, through the RBF cluster architecture and dedicated rack for data migration, data migration and consistency verification can be completed within a few minutes to ten minutes, and the virtual copy and replica synchronization mechanism is used to improve data transmission efficiency. , and perform incremental data synchronization when the source cluster is running normally.
The data synchronization time is significantly shortened, allowing data migration and consistency verification to be completed within a few minutes to ten minutes, reducing business interruption time, and ensuring data quality and integrity through an efficient copy synchronization mechanism.
Smart Images

Figure CN118535526A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data migration, and in particular to a method and device for migrating data on an ultra-large-scale big data platform. Background Art
[0002] A Hadoop big data cluster consists of multiple servers. In a large-scale cluster, the number of server nodes can reach tens of thousands. The amount of stored data reaches the PB level, and the number of files reaches hundreds of millions. With the rapid development of business, the scale is getting bigger and bigger, which puts higher requirements and challenges on the big data cluster. In various scenarios such as upgrading the technical architecture of the system and relocating the computer room, data migration may be required for the big data cluster. When the data volume reaches PB or even dozens of PB, data migration faces many challenges.
[0003] Big data platforms usually use distcp or other data migration tools to efficiently migrate data between different Hadoop big data clusters.
[0004] Distributed Copy is a high-performance copy tool used within large-scale clusters or between clusters.
[0005] Distcp supports full data migration and incremental migration, and can only copy the files and directories that have changed between the source and target. This can reduce unnecessary data transmission and improve migration efficiency. However, in large-scale data migration, using distcp or other migration tools may face the following problems:
[0006] (1) Long business interruption: During large-scale data migration, business services need to be stopped to prevent data from continuing to be read and written in the big data cluster, causing data inconsistency. However, due to the huge amount of data (in PB), the entire synchronization process may take a day or even several days to complete. This leads to long business interruptions, which will have a significant impact on business systems that need to run continuously.
[0007] (2) Large-scale data migration puts severe pressure on the performance of NameNode. During the migration process, frequent interactions with NameNode will significantly affect its performance and may even interfere with the normal operation of the business system.
[0008] (3) It is difficult to ensure data quality during the migration process. During the data migration process, you may encounter various errors and failures, such as network interruptions, hardware failures, or problems with the migration tool, which may result in data loss or degradation of data quality.
[0009] (4) The file replication mechanism of HDFS may cause a long tail effect. In HDFS, a file is divided into multiple data blocks. To ensure the order of data, the file is replicated in the order of data blocks. In other words, each file is processed by only one copy task. When faced with very large files, copying the entire file will cause significant time delays. Summary of the invention
[0010] In order to solve the problems existing in the prior art, the present invention provides a method and device for data migration of an ultra-large-scale big data platform. By combining full synchronization with incremental synchronization, the data synchronization time is greatly shortened, so that all data migration and data consistency verification can be completed within a few minutes to more than ten minutes after stopping the source cluster data writing.
[0011] To achieve the above object, the present invention adopts the following technical solutions:
[0012] In one embodiment of the present invention, a method for migrating data on an ultra-large-scale big data platform is proposed, the method comprising:
[0013] S01. Expand the new cluster based on RBF and upgrade the source cluster according to the HDFS RBF (Router-based Federation) architecture. Since RBF can manage multiple subclusters, the source cluster is used as a subcluster of RBF, and a new subcluster is added as the target cluster to synchronize the data of the source cluster;
[0014] In the same RBF cluster architecture, multiple subclusters can share data nodes. This feature can be used to achieve data synchronization between clusters.
[0015] RBF cluster management architecture: DataNode stores the block data that make up the file, and each block of data is called a Block. Multiple subclusters can share data nodes, but each Block can only belong to one subcluster. Figure 2 In the example, data node 2 is shared by the source cluster and the target cluster. It stores the block data of the source cluster and the target cluster.
[0016] S02. Configure a dedicated rack for data migration and configure the data nodes of the source cluster into two racks, one of which is used as a shared rack for data synchronization.
[0017] In the RBF cluster architecture, the data node composition between subclusters is specified by each subcluster. In the initial state, the data nodes of the source cluster include all the data nodes before the RBF cluster architecture upgrade. The data nodes of the target cluster are specified when they are built, and data nodes can also be added after the construction is completed.
[0018] Hadoop big data clusters are composed of multiple data nodes, which are distributed on different racks to ensure data security and minimize network latency and bandwidth usage caused by cross-rack data transmission. Users can configure Hadoop racks, specify which data nodes each rack contains, and these racks do not need to correspond one-to-one to racks in the actual computer room.
[0019] Furthermore, the data synchronized in S02 is copied into three copies, with Block as the smallest storage unit. When a new Block is generated, it is stored on three different nodes according to the rule of three copies.
[0020] Furthermore, the specific rules include: the first copy is placed on the local data node that generates the Block, the second copy is placed on another data node of the rack to which the local data node belongs, and the third copy is placed on the data nodes of other racks.
[0021] Because the source cluster is split into two racks, each rack contains the complete cluster data.
[0022] The shared rack is shared by the source cluster and the target cluster. The target cluster adds the nodes of the shared rack to its data nodes as the nodes of the shared rack of the target cluster. In addition, the target cluster will also add multiple other racks and add its own data nodes.
[0023] The data nodes of the shared rack are composed of the data nodes of one of the two racks of the source cluster and are shared by the target cluster. The target cluster can be configured with multiple racks.
[0024] S03, full synchronization, traverse the file list of the source cluster, and copy the data of the source cluster to the target cluster on the data node of the shared rack;
[0025] Further, the S03 includes:
[0026] S031. Get the list of files to be migrated from the source cluster. In the actual data migration process, sometimes only part of the data needs to be migrated, or specific data needs to be excluded. To meet this requirement, the whitelist and blacklist functions can be introduced. The whitelist function allows only the data files specified in the whitelist to be migrated, while the blacklist function can exclude data files that do not need to be migrated. By using the whitelist or blacklist, the scope of data migration can be controlled more flexibly.
[0027] S032. Traverse the file list of the source cluster, and create an empty target file in the target cluster according to the files of the source cluster;
[0028] Further, the S032 includes:
[0029] S0321. Obtain the permissions of the source cluster file, whether it can be written, the total size of the block, the number of copies, and other information;
[0030] S0322. Create an empty file in the NameNode of the target cluster based on the information obtained from the source cluster file and generate a file ID.
[0031] The created file does not correspond to any Block, so no data is stored.
[0032] S033. Create a Block file with the same inode number to implement a virtual copy;
[0033] Further, the S033 includes:
[0034] S0331. Each file consists of multiple Blocks. For each file in the source cluster, traverse the list of one or more Block objects it contains;
[0035] S0332. Blocks are distributed on different nodes. In order to copy data on a shared rack node, the data node of the Block object must be designated as a data node of the shared rack.
[0036] S0333. For each Block, obtain its inode number on the data node file system, and create a new Block using the same inode number on the current data node. The new Block will be used as a Block of the target file in the target cluster. Since the inode numbers are the same, no physical data copy is performed, but the same disk location is pointed to. Therefore, the creation speed is very fast.
[0037] S034. Register the Block object of the file in the target cluster. The Block object is mainly composed of the file ID, data node, Block object path, etc. Construct the Block object and report it to the NameNode of the target cluster, so as to realize the mapping of the file of the target cluster to the Block.
[0038] S04. Synchronize the replicas of the target cluster. Through the rack-aware mechanism of the big data platform itself, after the data nodes in the shared rack of the target cluster have completed data synchronization, the replicas are automatically synchronized to the data nodes of each rack of the target cluster.
[0039] Further, the S04 includes:
[0040] On the nodes of the shared rack, the target cluster's files are created, but there are no replicas of the files.
[0041] S041. The replica guarantee and synchronization mechanism of the big data platform automatically searches for nodes to synchronize data when the number of replicas is insufficient to ensure that the number of data replicas meets the set number;
[0042] S042. The newly created Block of the target cluster is in the shared rack node. According to the replica synchronization mechanism of HDFS itself, when the number of replicas is set to 3, the Block of the shared rack will be automatically synchronized to the nodes of each rack of the target cluster;
[0043] S043. After waiting for the replica data to be synchronized, the synchronization of the ultra-large-scale data is completed.
[0044] During this period, the source cluster is still providing services to the outside world and continuously writing incremental data. Therefore, we also need to synchronize this incremental data.
[0045] S05, incremental data synchronization. Incremental synchronization requires reading files that have changed in the source cluster since the full synchronization or the last incremental synchronization, and physically copying them to the target cluster using tools such as distcp that come with the cluster.
[0046] The target cluster replica synchronization may take a long time. After the target cluster replica synchronization is completed, one or more rounds of incremental synchronization are performed.
[0047] Further, the S05 includes:
[0048] Incremental synchronization requires reading the contents of the file data in the source cluster and physically copying it to the target cluster;
[0049] During each incremental synchronization, the source cluster's services continuously write new data. When an incremental synchronization is completed, new data is written to the cluster again.
[0050] Set the incremental data synchronization threshold. After each synchronization is completed, determine whether the ratio of synchronized data to total data traffic exceeds the threshold. If it does not exceed the threshold, continue to perform incremental synchronization. Repeat this cycle until the ratio of synchronized data to total data traffic exceeds the specified threshold, and then stop the data write service of the source cluster business.
[0051] S051. Take a snapshot of the source cluster to ensure that data does not change during synchronization;
[0052] S052. Compare the differences between the files of the source cluster snapshot and the files of the target cluster;
[0053] S053. Perform incremental synchronization for files with differences;
[0054] S054, synchronization is completed, and it is determined whether the ratio of synchronized data to total data traffic exceeds a threshold;
[0055] S055. If the threshold is not exceeded, the incremental synchronization process is executed again;
[0056] S056: If the threshold is exceeded, stop the data writing service of the source cluster business.
[0057] In HDFS, a file is divided into multiple data blocks. To ensure the order of data, file synchronization is performed in the order of blocks, that is, each file is processed by only one copy task. When facing very large files, copying the entire file will cause significant time delay.
[0058] In order to solve the problem of slow large file copying, the files to be copied can be decomposed into many byte strings, and the information of each byte string (location, file name, etc.) is written to the HDFS file. The incremental data synchronization task will use the byte string as the synchronization unit instead of the file. This increases the number of large file data synchronization tasks, thereby improving the data copy speed.
[0059] S06. Stop the data writing service of the source cluster and perform the last incremental data synchronization.
[0060] When the ratio of synchronized data to total data traffic exceeds the threshold, it means that most of the data has been successfully synchronized to the target cluster. At this point, the amount of data to be synchronized is very small. In order to achieve complete synchronization, stop the write service of the source cluster and perform an incremental synchronization operation. Since the amount of data is not large, the incremental synchronization time is very short.
[0061] S07: Target cluster quality verification: perform quality verification on data inconsistency and data corruption caused by node anomalies during synchronization. If the quality verification fails, perform incremental data synchronization until the target cluster quality verification passes.
[0062] Furthermore, the verification method in S07 is: comparing the data consistency of the source cluster / target cluster, including but not limited to the size of the file, whether the file is damaged, etc.
[0063] S08. Clean up RBF and shared racks. The target cluster can effectively manage and synchronize data between its own racks. The RBF architecture cluster is cleaned up as needed to ensure that the target cluster can provide external services in an independent manner.
[0064] In one embodiment of the present invention, a device for migrating data on an ultra-large-scale big data platform is also proposed, and the device includes:
[0065] Based on RBF, the new cluster module is expanded and the source cluster is upgraded according to the HDFS RBF architecture. The source cluster is used as a subcluster of RBF, and a new subcluster is added as the target cluster to synchronize the data of the source cluster.
[0066] Configure a dedicated rack module for data migration and configure the data nodes of the source cluster into two racks, one of which is used as a shared rack for data synchronization.
[0067] The full synchronization module traverses the file list of the source cluster and copies the data of the source cluster to the target cluster on the data node of the shared rack;
[0068] The target cluster replica synchronization module uses the rack awareness mechanism of the big data platform to automatically synchronize replicas to the data nodes of each rack of the target cluster after the data nodes in the target cluster shared rack have completed data synchronization;
[0069] Incremental data synchronization module: Incremental synchronization requires reading files that have changed in the source cluster since the full synchronization or the last incremental synchronization, and physically copying them to the target cluster using tools such as distcp that come with the cluster.
[0070] Stop the data writing service module of the source cluster and perform the last incremental data synchronization;
[0071] The target cluster quality verification module verifies the quality of node anomalies during synchronization. If the quality verification fails, incremental data synchronization is performed until the target cluster passes the quality verification.
[0072] Clean up the RBF and shared rack modules. The target cluster can effectively manage and synchronize data between its own racks. The RBF architecture cluster is cleaned up as needed to ensure that the target cluster can provide external services in an independent manner.
[0073] In one embodiment of the present invention, a computer device is also proposed, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the aforementioned method of data migration of an ultra-large-scale big data platform when executing the computer program.
[0074] In one embodiment of the present invention, a computer-readable storage medium is also proposed, which stores a computer program for executing a method for migrating data on an ultra-large-scale big data platform.
[0075] Beneficial effects:
[0076] The present invention discloses a method and device for data migration of a large-scale big data platform. By initializing full data synchronization and incremental synchronization, data migration and data verification are completed within a few minutes to more than ten minutes after stopping the source cluster data writing. By setting a data migration shared rack, a Block file with the same inode number as the source cluster is efficiently generated locally on the data node of the shared rack through virtual copy. At the same time, the target cluster copy synchronization can also be efficiently copied through the rack mechanism. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 It is a flow chart of a method for data migration of a super-large-scale big data platform of the present invention;
[0078] Figure 2 This is a schematic diagram of the RBF cluster management architecture;
[0079] Figure 3 This is a schematic diagram of the architecture of data nodes sharing a rack;
[0080] Figure 4 yes Figure 1 The specific process diagram of S03;
[0081] Figure 5 It is a schematic diagram of the structure of the device for data migration of a super-large-scale big data platform of the present invention;
[0082] Figure 6 It is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0083] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0084] The professional terms and their explanations involved in the present invention are as follows:
[0085] Inode: It is an important concept in the file system. Each file and directory has an inode in the file system, which contains basic metadata information of the file or directory, such as file size, creation time, owner, etc.
[0086] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0087] According to an implementation manner of the present invention, a method and device for data migration of an ultra-large-scale big data platform are proposed. By combining full synchronization with incremental synchronization, the data synchronization time is greatly shortened, so that all data migration and data consistency verification can be completed within a few minutes to more than ten minutes after stopping data writing in the source cluster.
[0088] The principle and spirit of the present invention are explained in detail below with reference to several representative embodiments of the present invention.
[0089] like Figure 1 As shown, the present invention relates to a method for migrating data on an ultra-large-scale big data platform, the method comprising:
[0090] S01. Expand the new cluster based on RBF and upgrade the source cluster according to the HDFS RBF (Router-based Federation) architecture. Since RBF can manage multiple subclusters, the source cluster is used as a subcluster of RBF, and a new subcluster is added as the target cluster to synchronize the data of the source cluster;
[0091] In the same RBF cluster architecture, multiple subclusters can share data nodes. This feature can be used to achieve data synchronization between clusters.
[0092] Figure 2 The architecture of RBF cluster management is shown in the figure: DataNode stores the block data that make up the file, and each block data is called a Block. Multiple subclusters can share data nodes, but each Block can only belong to one subcluster. Figure 2 In the example, data node 2 is shared by the source cluster and the target cluster. It stores the block data of the source cluster and the target cluster.
[0093] S02. Configure a dedicated rack for data migration and configure the data nodes of the source cluster into two racks, one of which is used as a shared rack for data synchronization.
[0094] In the RBF cluster architecture, the data node composition between subclusters is specified by each subcluster. In the initial state, the data nodes of the source cluster include all the data nodes before the RBF cluster architecture upgrade. The data nodes of the target cluster are specified when they are built, and data nodes can also be added after the construction is completed.
[0095] Hadoop big data clusters are composed of multiple data nodes, which are distributed on different racks to ensure data security and minimize network latency and bandwidth usage caused by cross-rack data transmission. Users can configure Hadoop racks, specify which data nodes each rack contains, and these racks do not need to correspond one-to-one to racks in the actual computer room.
[0096] The data synchronized in S02 is copied into three copies, with Block as the smallest storage unit. When a new Block is generated, it is stored on three different nodes according to the rule of three copies.
[0097] The specific rules include: the first copy is placed on the local data node that generates the Block, the second copy is placed on another data node of the rack to which the local data node belongs, and the third copy is placed on the data nodes of other racks.
[0098] Because the source cluster is split into two racks, each rack contains the complete cluster data.
[0099] The shared rack is shared by the source cluster and the target cluster. The target cluster adds the nodes of the shared rack to its data nodes as the nodes of the shared rack of the target cluster. In addition, the target cluster will also add multiple other racks and add its own data nodes.
[0100] like Figure 3 As shown, the data nodes of the shared rack are composed of the data nodes of one of the two racks of the source cluster and are shared by the target cluster. The target cluster can be configured with multiple racks.
[0101] S03, full synchronization, traverse the file list of the source cluster, and copy the data of the source cluster to the target cluster on the data node of the shared rack;
[0102] like Figure 4 As shown, the S03 includes:
[0103] S031. Get the list of files to be migrated from the source cluster. In the actual data migration process, sometimes only part of the data needs to be migrated, or specific data needs to be excluded. To meet this requirement, the whitelist and blacklist functions can be introduced. The whitelist function allows only the data files specified in the whitelist to be migrated, while the blacklist function can exclude data files that do not need to be migrated. By using the whitelist or blacklist, the scope of data migration can be controlled more flexibly.
[0104] S032. Traverse the file list of the source cluster, and create an empty target file in the target cluster according to the files of the source cluster;
[0105] The S032 includes:
[0106] S0321. Obtain the permissions of the source cluster file, whether it can be written, the total size of the block, the number of copies, and other information;
[0107] S0322. Create an empty file in the NameNode of the target cluster based on the information obtained from the source cluster file and generate a file ID.
[0108] The created file does not correspond to any Block, so no data is stored.
[0109] S033. Create a Block file with the same inode number to implement a virtual copy;
[0110] The S033 includes:
[0111] S0331. Each file consists of multiple Blocks. For each file in the source cluster, traverse the list of one or more Block objects it contains;
[0112] S0332. Blocks are distributed on different nodes. In order to copy data on a shared rack node, the data node of the Block object must be designated as a data node of the shared rack.
[0113] S0333. For each Block, obtain its inode number on the data node file system, and create a new Block using the same inode number on the current data node. The new Block will be used as a Block of the target file in the target cluster. Since the inode numbers are the same, no physical data copy is performed, but the same disk location is pointed to. Therefore, the creation speed is very fast.
[0114] S034. Register the Block object of the file in the target cluster. The Block object is mainly composed of the file ID, data node, Block object path, etc. Construct the Block object and report it to the NameNode of the target cluster, so as to realize the mapping of the file of the target cluster to the Block.
[0115] S04. Synchronize the replicas of the target cluster. Through the rack-aware mechanism of the big data platform itself, after the data nodes in the shared rack of the target cluster have completed data synchronization, the replicas are automatically synchronized to the data nodes of each rack of the target cluster.
[0116] The S04 includes:
[0117] On the nodes of the shared rack, the target cluster's files are created, but there are no replicas of the files.
[0118] S041. The replica guarantee and synchronization mechanism of the big data platform automatically searches for nodes to synchronize data when the number of replicas is insufficient to ensure that the number of data replicas meets the set number;
[0119] S042. The newly created Block of the target cluster is in the shared rack node. According to the replica synchronization mechanism of HDFS itself, when the number of replicas is set to 3, the Block of the shared rack will be automatically synchronized to the nodes of each rack of the target cluster;
[0120] S043. After waiting for the replica data to be synchronized, the synchronization of the ultra-large-scale data is completed.
[0121] During this period, the source cluster is still providing services to the outside world and continuously writing incremental data. Therefore, we also need to synchronize this incremental data.
[0122] S05, incremental data synchronization. Incremental synchronization requires reading files that have changed in the source cluster since the full synchronization or the last incremental synchronization, and physically copying them to the target cluster using tools such as distcp that come with the cluster.
[0123] The target cluster replica synchronization may take a long time. After the target cluster replica synchronization is completed, one or more rounds of incremental synchronization are performed.
[0124] The S05 includes:
[0125] Incremental synchronization requires reading the contents of the file data in the source cluster and physically copying it to the target cluster;
[0126] During each incremental synchronization, the source cluster's services continuously write new data. When an incremental synchronization is completed, new data is written to the cluster again.
[0127] Set the incremental data synchronization threshold. After each synchronization is completed, determine whether the ratio of synchronized data to total data traffic exceeds the threshold. If it does not exceed the threshold, continue to perform incremental synchronization. Repeat this cycle until the ratio of synchronized data to total data traffic exceeds the specified threshold, and then stop the data write service of the source cluster business.
[0128] S051. Take a snapshot of the source cluster to ensure that data does not change during synchronization;
[0129] S052. Compare the differences between the files of the source cluster snapshot and the files of the target cluster;
[0130] S053. Perform incremental synchronization for files with differences;
[0131] S054, synchronization is completed, and it is determined whether the ratio of synchronized data to total data traffic exceeds a threshold;
[0132] S055. If the threshold is not exceeded, the incremental synchronization process is executed again;
[0133] S056: If the threshold is exceeded, stop the data writing service of the source cluster business.
[0134] In HDFS, a file is divided into multiple data blocks. To ensure the order of data, file synchronization is performed in the order of blocks, that is, each file is processed by only one copy task. When facing very large files, copying the entire file will cause significant time delay.
[0135] In order to solve the problem of slow large file copying, the files to be copied can be decomposed into many byte strings, and the information of each byte string (location, file name, etc.) is written to the HDFS file. The incremental data synchronization task will use the byte string as the synchronization unit instead of the file. This increases the number of large file data synchronization tasks, thereby improving the data copy speed.
[0136] S06. Stop the data writing service of the source cluster and perform the last incremental data synchronization.
[0137] When the ratio of synchronized data to total data traffic exceeds the threshold, it means that most of the data has been successfully synchronized to the target cluster. At this point, the amount of data to be synchronized is very small. In order to achieve complete synchronization, stop the write service of the source cluster and perform an incremental synchronization operation. Since the amount of data is not large, the incremental synchronization time is very short.
[0138] S07: Target cluster quality verification: perform quality verification on data inconsistency and data corruption caused by node anomalies during synchronization. If the quality verification fails, perform incremental data synchronization until the target cluster quality verification passes.
[0139] The verification method in S07 is: comparing the data consistency of the source cluster / target cluster, including but not limited to the size of the file, whether the file is damaged, etc.
[0140] S08. Clean up RBF and shared racks. The target cluster can effectively manage and synchronize data between its own racks. The RBF architecture cluster is cleaned up as needed to ensure that the target cluster can provide external services in an independent manner.
[0141] It should be noted that, although the operations of the method of the present invention are described in a specific order in the above embodiments and the accompanying drawings, this does not require or imply that the operations must be performed in the specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0142] In order to explain the above-mentioned method of data migration of ultra-large-scale big data platform more clearly, it is described in conjunction with a specific embodiment below. However, it should be noted that this embodiment is only for better illustrating the present invention and does not constitute an improper limitation to the present invention.
[0143] Assume that there are two subclusters named cluster1 and cluster2, and the data of cluster1 needs to be migrated to cluster2.
[0144] S01. Upgrade the source cluster to an architecture based on HDFS RBF.
[0145] Edit the hdfs-site.xml file of the source cluster and add the following configuration items
[0146]
[0147]
[0148]
[0149]
[0150]
[0151] The above configuration will create an HDFS RBF-based architecture with two subclusters (cluster1 and cluster2). Each subcluster has two NameNode nodes. The NameNode nodes of cluster1 are nn1 and nn2, and the NameNode nodes of cluster2 are nn3 and nn4. The default namespace is specified as mycluster1, and the management address of the Router node is router.example.com.
[0152] S02, configure data migration to share a dedicated rack;
[0153] Create a network topology script file on all node hosts of the two subclusters. Datanode1 and datanode2 are the two data nodes of subcluster cluster1, and datanode3 and datanode4 are the two data nodes of subcluster cluster2.
[0154] #! / bin / bash
[0155] #Node mapping of subcluster cluster1
[0156] echo "datanode1 / rack1"
[0157] echo "datanode2 / rack1"
[0158] #Node mapping of subcluster cluster2
[0159] echo "datanode3 / rack1"
[0160] echo "datanode4 / rack1"
[0161] In the hdfs-site.xml configuration files of all nodes in the two subclusters, add the following properties to specify the path of the network topology script file.
[0162] <property>
[0163] <name> dfs.net.topology.script.file.name< / name>
[0164] <value> / xxx / topology.sh< / value>
[0165] < / property>
[0166] In the hdfs-site.xml configuration file of all nodes in the two subclusters, add the following properties to specify the shared rack information
[0167] <property>
[0168] <name> dfs.namenode.datanode.registration.ip-hostname-check< / name>
[0169] <value> false< / value>
[0170] < / property>
[0171] <property>
[0172] <name> dfs.client.failover.proxy.provider.ns1< / name>
[0173] <value> org.apache.hadoop.hdfs.server.federation.router.RBFConfiguredFailoverProxyProvider< / value>
[0174] < / property>
[0175] <property>
[0176] <name> dfs.client.failover.proxy.provider.ns2< / name>
[0177] <value> org.apache.hadoop.hdfs.server.federation.router.RBFConfiguredFailoverProxyProvider< / value>
[0178] < / property>
[0179] S03, full synchronization;
[0180] Get the file list of the source cluster, traverse the file list of the source cluster, and create an empty target file in the target cluster based on the files of the source cluster.
[0181] Use the hadoop fs-ls command to obtain the file list and detailed information of the specified directory on the subcluster cluster1, and save the results to a file
[0182] hadoop fs-ls-R hdfs: / / xxxx / xxx / >filelist.txt
[0183] The following example parses each line of the file list using space as a delimiter and stores the details in the corresponding variable:
[0184]
[0185] For each file in subcluster cluster1, use the hdfsdfs-touchz command on the NameNode of subcluster cluster2 to create an empty file and generate a file ID.
[0186] hdfs dfs-touchz hdfs: / / subclustercluster2 / path / to / destination / file
[0187] file_id=$(hdfs dfs-ls-d hdfs: / / subcluster2 / path / to / de stination / file|awk'{print$NF}')
[0188] By executing the create_block.sh script, a Block file with the same inode number is created in the subcluster cluster2 to implement a virtual copy.
[0189] The content of create_block.sh is as follows:
[0190] #! / bin / bash
[0191] #Path of the subcluster cluster1 file
[0192] file_path="hdfs: / / xxxx / xxxx
[0193] #Get the Block information of the subcluster cluster1 file
[0194] block_info=$(hdfs fsck$file_path-blocks-locations)
[0195] #Parse the Block information and extract the inode number
[0196] inode_numbers=($(echo"$block_info"|awk' / Block[0-9]+ / {block=$2} / Block replica / {print block,$3}'))
[0197] #Create a new Block on the data node of subcluster cluster2
[0198] for inode_number in"${inode_numbers[@]}"
[0199] do
[0200] #Assume that you have access rights on the data node of subcluster cluster2 and execute the command as root user
[0201] sudo -u hdfs hdfs debug recoverBlocks-blockId$inode_number
[0202] done
[0203] Use hdfs debug recoverBlocks-blockId to construct a reporting command and report the Block object to the NameNode of subcluster B.
[0204] S04, target cluster replica synchronization;
[0205] On the nodes of the shared rack, the target cluster's files are created, but there are no copies of the files. Due to the copy guarantee and synchronization mechanism of the big data platform, when the number of copies is insufficient, it will automatically find nodes to synchronize data to ensure that the number of copies of the data meets the set number.
[0206] S05, incremental data synchronization;
[0207] The key logic is implemented as follows:
[0208]
[0209]
[0210] S06. Stop the data writing service of the source cluster business;
[0211] When the ratio of synchronized data to total data traffic exceeds the threshold, it means that most of the data has been successfully synchronized to the target cluster. At this point, the amount of data to be synchronized is very small. In order to achieve complete synchronization, stop the write service of the source cluster and perform an incremental synchronization operation. Since the amount of data is not large, the incremental synchronization time is very short.
[0212] S07, cluster cluster2 quality check;
[0213] Verify data consistency by executing the following script
[0214]
[0215] S08. Clean up RBF and shared racks.
[0216] Stop the RBF service:
[0217] hadoop-daemon.sh stop router
[0218] Delete the RBF configuration file and clean up the RBF-related namespace and routing table.
[0219] rm-rf / path / to / router / config / dir
[0220] hdfs dfsrouteradmin-refreshNamespaces
[0221] hdfs dfsrouteradmin-refreshRoutes
[0222] Clean up shared rack settings
[0223] Delete the following configuration from the hdfs-site.xml configuration files of cluster1 and cluster2.
[0224] dfs.network.topology.script.file
[0225] dfs.replication.considerLoad
[0226] dfs.replication.considerLoad.period
[0227] dfs.replication.considerLoad.factor
[0228] dfs.replication.considerLoad.multiplier
[0229] dfs.replication.considerLoad.maxConcurrentMovers
[0230] Clean up the node cache files:
[0231] rm -rf / hadoop / cache / directory /
[0232] Based on the same inventive concept, the present invention also proposes a device for data migration of an ultra-large-scale big data platform. The implementation of the device can refer to the implementation of the above method, and the repeated parts will not be repeated. The term "module" used below can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0233] Figure 5 Schematic diagram of the device structure of the ultra-large-scale big data platform data migration of the present invention. Figure 5 As shown, the device comprises:
[0234] Based on the RBF extension new cluster module 110, the source cluster is upgraded according to the HDFS RBF architecture, the source cluster is used as a sub-cluster of RBF, and a new sub-cluster is added as the target cluster to synchronize the data of the source cluster;
[0235] Configure a dedicated rack module 120 for data migration, and configure the data nodes of the source cluster into two racks, one of which is used as a shared rack for synchronizing data;
[0236] The full synchronization module 130 traverses the file list of the source cluster and copies the data of the source cluster to the target cluster at the data node of the shared rack;
[0237] The target cluster replica synchronization module 140 automatically synchronizes the replicas to the data nodes of each rack of the target cluster through the rack perception mechanism of the big data platform itself after the data nodes in the target cluster shared rack have completed data synchronization;
[0238] Incremental data synchronization module 150: Incremental synchronization requires reading files that have changed in the source cluster since the full synchronization or the last incremental synchronization, and physically copying them to the target cluster using tools such as distcp that come with the cluster.
[0239] Stop the data writing service module 160 of the source cluster and perform the last incremental data synchronization;
[0240] The target cluster quality verification module 170 performs quality verification on node anomalies during synchronization. If the quality verification fails, incremental data synchronization is performed again until the target cluster quality verification passes.
[0241] Clean up the RBF and shared rack modules 180. The target cluster can effectively manage and synchronize data between its own racks. The cluster of the RBF architecture is cleaned up as needed to ensure that the target cluster can provide external services in an independent manner.
[0242] It should be noted that although several modules of the device for data migration of a large-scale big data platform are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules described above can be concretized in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules for concretization.
[0243] Based on the above invention concept, Figure 6As shown, the present invention also proposes a computer device 200, including a memory 210, a processor 220, and a computer program 230 stored in the memory 210 and executable on the processor 220, and the processor 220 implements the aforementioned method of ultra-large-scale big data platform data migration when executing the computer program 230.
[0244] Based on the aforementioned inventive concept, the present invention also proposes a computer-readable storage medium, which stores a computer program for executing the aforementioned method for migrating data on an ultra-large-scale big data platform.
[0245] The present invention discloses a method and device for data migration of a large-scale big data platform. By initializing full data synchronization and incremental synchronization, data migration and data verification are completed within a few minutes to more than ten minutes after stopping the source cluster data writing. By setting a data migration shared rack, a Block file with the same inode number as the source cluster is efficiently generated locally on the data node of the shared rack through virtual copy. At the same time, the target cluster copy synchronization can also be efficiently copied through the rack mechanism.
[0246] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements contained in the spirit and scope of the attached claims.
[0247] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0248] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0249] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0250] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0251] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0252] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0253] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0254] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
[0255] Regarding the limitation of the protection scope of the present invention, those skilled in the art should understand that, based on the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the protection scope of the present invention.
Claims
1. A method for data migration of an ultra-large-scale big data platform, characterized in that: The method includes: S01. Expand a new cluster based on RBF. Upgrade the source cluster according to the HDFS RBF architecture. The source cluster is used as a subcluster of RBF. A new subcluster is added as the target cluster to synchronize the data of the source cluster. S02. Configure a dedicated rack for data migration and configure the data nodes of the source cluster into two racks, one of which is used as a shared rack for data synchronization. S03, full synchronization, traverse the file list of the source cluster, and copy the data of the source cluster to the target cluster on the data node of the shared rack; S04. Synchronize the replicas of the target cluster. Through the rack-aware mechanism of the big data platform itself, after the data nodes in the shared rack of the target cluster have completed data synchronization, the replicas are automatically synchronized to the data nodes of each rack of the target cluster. S05, incremental data synchronization. Incremental synchronization requires reading files that have changed in the source cluster since the full synchronization or the last incremental synchronization, and physically copying them to the target cluster using tools such as distcp that come with the cluster. S06. Stop the data writing service of the source cluster and perform the last incremental data synchronization. S07: Target cluster quality check: perform quality check on node anomalies during synchronization. If the quality check fails, perform incremental data synchronization until the target cluster quality check passes. S08. Clean up RBF and shared racks. The target cluster can effectively manage and synchronize data between its own racks. The RBF architecture cluster is cleaned up as needed to ensure that the target cluster can provide external services in an independent manner.
2. The method for migrating data on a large-scale big data platform according to claim 1, characterized in that: The data synchronized in S02 is copied into three copies, with Block as the smallest storage unit. When a new Block is generated, it is stored on three different nodes according to the rule of three copies.
3. The method for migrating data on a large-scale big data platform according to claim 2, characterized in that: The specific rules of the replicas include: the first replica is placed on the local data node that generates the Block, the second replica is placed on another data node of the rack to which the local data node belongs, and the third replica is placed on data nodes of other racks.
4. The method for migrating data on a large-scale big data platform according to claim 1, characterized in that: The S03 includes: S031. Obtain the list of files to be migrated from the source cluster and introduce the whitelist and blacklist functions. The whitelist function allows you to migrate only the data files specified in the whitelist, while the blacklist function can exclude the data files that do not need to be migrated. By using the whitelist or blacklist, you can more flexibly control the scope of data migration. S032. Traverse the file list of the source cluster, and create an empty target file in the target cluster according to the files of the source cluster; S033. Create a Block file with the same inode number to implement a virtual copy; S034. Register the Block object of the file in the target cluster. The Block object consists of a file ID, a data node, and a Block object path. Construct the Block object and report it to the NameNode of the target cluster, thereby realizing the mapping of the file of the target cluster to the Block.
5. The method for migrating data on a large-scale big data platform according to claim 4, characterized in that: The S032 includes: S0321. Obtain the permissions, writable flag, total size of blocks, and number of copies of the source cluster file; S0322. Create an empty file in the NameNode of the target cluster based on the information obtained from the source cluster file and generate a file ID.
6. The method for migrating data on a large-scale big data platform according to claim 4, characterized in that: The S033 includes: S0331. For each file in the source cluster, traverse the list of one or more Block objects contained in it; S0332, Block blocks are distributed in different nodes, and the data nodes of the Block block objects are designated as the data nodes of the shared rack; S0333. For each Block, obtain its inode number on the data node file system, and create a new Block using the same inode number on the current data node. The new Block will serve as a Block of the target file in the target cluster.
7. The method for migrating data on a large-scale big data platform according to claim 1, characterized in that: The S04 includes: S041. The replica guarantee and synchronization mechanism of the big data platform automatically searches for nodes to synchronize data when the number of replicas is insufficient to ensure that the number of data replicas meets the set number; S042. The newly created Block of the target cluster is in the shared rack node. According to the replica synchronization mechanism of HDFS itself, when the number of replicas is set to 3, the Block of the shared rack will be automatically synchronized to the nodes of each rack of the target cluster; S043. After waiting for the replica data to be synchronized, the synchronization of the ultra-large-scale data is completed.
8. The method for migrating data on a large-scale big data platform according to claim 1, characterized in that: The S05 includes: S051. Take a snapshot of the source cluster to ensure that data does not change during synchronization; S052. Compare the differences between the files of the source cluster snapshot and the files of the target cluster; S053. Perform incremental synchronization for files with differences; S054, synchronization is completed, and it is determined whether the ratio of synchronized data to total data traffic exceeds a threshold; S055. If the threshold is not exceeded, the incremental synchronization process is executed again; S056: If the threshold is exceeded, stop the data writing service of the source cluster business.
9. The method for migrating data on a large-scale big data platform according to claim 1, characterized in that: The verification method in S07 is: comparing the data consistency of the source cluster / target cluster, including the size of the file and whether the file is damaged.
10. A device for data migration of a large-scale big data platform, characterized in that: The device includes: Based on RBF, the new cluster module is expanded and the source cluster is upgraded according to the HDFS RBF architecture. The source cluster is used as a subcluster of RBF, and a new subcluster is added as the target cluster to synchronize the data of the source cluster. Configure a dedicated rack module for data migration and configure the data nodes of the source cluster into two racks, one of which is used as a shared rack for data synchronization. The full synchronization module traverses the file list of the source cluster and copies the data of the source cluster to the target cluster on the data node of the shared rack; The target cluster replica synchronization module uses the rack awareness mechanism of the big data platform to automatically synchronize replicas to the data nodes of each rack of the target cluster after the data nodes in the target cluster shared rack have completed data synchronization; Incremental data synchronization module: Incremental synchronization requires reading files that have changed in the source cluster since the full synchronization or the last incremental synchronization, and physically copying them to the target cluster using tools such as distcp that come with the cluster. Stop the data writing service module of the source cluster and perform the last incremental data synchronization; The target cluster quality verification module verifies the quality of node anomalies during synchronization. If the quality verification fails, incremental data synchronization is performed until the target cluster passes the quality verification. Clean up the RBF and shared rack modules. The target cluster can effectively manage and synchronize data between its own racks. The RBF architecture cluster is cleaned up as needed to ensure that the target cluster can provide external services in an independent manner.
11. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 9 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the method according to any one of claims 1 to 9.
Citation Information
Cited By
Method and system for optimizing seamless upgrade of large-scale HDFS (Hadoop Distributed File System) storage system
CN119484280A
Method, system, device and equipment for data transmission among multiple sites and medium
CN120560573A
