Data migration methods, apparatus, distributed systems, and computer-readable storage media

By judging the changes in the threshold of faulty nodes in the distributed system and performing corresponding migrations, the problem of low data reliability during data migration is solved, and the reliability adaptation of data block migration after expansion is achieved, ensuring the stability of data blocks after changes in the threshold of faulty nodes.

CN115933981BActive Publication Date: 2026-03-10CHONGQING UNISINSIGHT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-20
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing technologies have low data reliability during data migration, especially after the expansion of distributed systems. Data block migration fails to effectively adapt to changes in the number of faulty nodes, leading to a decline in data reliability.

Method used

In a distributed system, if the migration trigger condition is met, the system first checks whether the threshold of the faulty node has changed. If it has changed, a threshold change migration is performed, followed by a capacity balancing migration. If it has not changed, a capacity balancing migration is performed directly. This ensures that the threshold of the faulty node adapts to changes during the data block migration process, thereby improving data reliability.

Benefits of technology

By first determining the change in the threshold of the faulty node and then performing the corresponding migration, the distributed system ensures that the data reliability is maintained during the data block migration process after expansion, thus avoiding the problem of decreased reliability after data migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115933981B_ABST
    Figure CN115933981B_ABST
Patent Text Reader

Abstract

This application proposes a data migration method, apparatus, distributed system, and computer-readable storage medium, relating to the field of distributed storage technology. When the distributed system meets migration triggering conditions, it is determined whether the corresponding fault node threshold of the distributed system has changed; the fault node threshold is the maximum allowed number of fault nodes in the distributed system. If the fault node threshold changes, a threshold change migration is performed on the data blocks in the distributed system. If the threshold change migration is completed and the distributed system does not meet capacity balancing conditions, a capacity balancing migration is performed on the data blocks in the distributed system. If the fault node threshold does not change and the distributed system does not meet capacity balancing conditions, a capacity balancing migration is performed on the data blocks in the distributed system. This method ensures the data reliability of the distributed system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of distributed storage technology, and more specifically, to a data migration method, apparatus, distributed system, and computer-readable storage medium. Background Technology

[0002] Currently, erasure coding technology can be used to store data in distributed systems. When the used capacity in a distributed system is too large, the number of nodes or the disks in the nodes can be expanded to meet the data storage requirements. In order to ensure the data capacity balance of the distributed system, data migration is required for the data blocks stored in the distributed system.

[0003] In existing technologies, data migration of data blocks often suffers from low data reliability. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a data migration method, apparatus, distributed system and computer-readable storage medium to solve the problem of low data reliability in the prior art when migrating data blocks.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:

[0006] In a first aspect, this application provides a data migration method applied to a distributed system, the distributed system comprising multiple nodes, the method comprising:

[0007] If the distributed system meets the migration triggering conditions, it is determined whether the fault node threshold corresponding to the distributed system has changed; the fault node threshold is the maximum number of fault nodes allowed to occur in the distributed system.

[0008] If the threshold of the fault node changes, the data blocks in the distributed system are migrated according to the threshold change, and if the threshold change migration is completed and the distributed system does not meet the capacity balancing condition, the data blocks in the distributed system are migrated according to the capacity balancing condition.

[0009] If the threshold of the faulty node has not changed and the distributed system does not meet the capacity balancing condition, then the data blocks in the distributed system are migrated for capacity balancing.

[0010] In an optional implementation, determining whether the threshold value of the faulty node corresponding to the distributed system has changed when the distributed system meets the migration triggering conditions includes:

[0011] If the number of nodes in the distributed system remains unchanged when the migration triggering conditions are met, then the fault node threshold corresponding to the distributed system is determined to remain unchanged.

[0012] If the number of nodes in the distributed system increases, and the distributed system meets a preset first threshold change condition or a preset second threshold change condition, then the threshold change of the fault node corresponding to the distributed system is determined.

[0013] In an optional implementation, the first threshold change condition includes the number of original nodes in the distributed system being less than the number of data blocks into which each data is divided, and the number of current nodes in the distributed system being greater than or equal to the number of data blocks into which each data is divided; the number of data blocks into which the data is divided is the sum of the number of original data blocks into which the data is divided and the number of redundant fragments.

[0014] The second threshold change condition includes that the number of original nodes in the distributed system is less than the number of data blocks into which each data is divided, and the threshold for new fault nodes in the distributed system is greater than the threshold for original fault nodes in the distributed system.

[0015] The new fault node threshold is calculated based on the number of original data blocks, the number of redundant fragments, and the current number of nodes in the distributed system. The original fault node threshold is calculated based on the number of original data blocks, the number of redundant fragments, and the original number of nodes in the distributed system.

[0016] In an optional implementation, each node includes at least one disk, and the distributed system stores the correspondence between each data block and the node and disk where the data block is located;

[0017] The threshold change migration of data blocks in the distributed system includes:

[0018] According to the preset threshold change migration conditions, multiple first data blocks to be determined are determined from the correspondence. The location information of the first data blocks to be migrated that meet the first entry conditions and the node information of the migration node of the first data blocks to be migrated are inserted into the preset threshold change migration table.

[0019] According to the threshold change migration table, the first data block to be migrated is migrated to the migration node corresponding to the first data block to be migrated.

[0020] In an optional implementation, the step of determining multiple first data blocks to be determined from the correspondence based on preset threshold change migration conditions, and inserting the location information of the first data blocks to be migrated that meet the first entry condition and the node information of the migration node of the first data blocks to be migrated into the preset threshold change migration table, includes:

[0021] For each data block in the correspondence, determine whether there is a corresponding data block in the same group on the node where the data block is located; the data block in the same group is a data block that belongs to the same data as the data block.

[0022] The data block that has a corresponding data block in the same group is identified as the first data block to be determined.

[0023] When the number of the first data blocks to be determined reaches the first preset number, the first data block to be migrated and the migration node corresponding to the first data block to be migrated are determined according to the first entry condition and the multiple first data blocks to be determined.

[0024] Insert the location information of the first data block to be migrated and the node information of the corresponding migration node of the first data block to be migrated into the threshold change migration table;

[0025] If the number of the first data blocks to be migrated in the threshold change migration table does not reach the second preset number, then for each data block in the correspondence, it is determined whether the data block has a corresponding data block in the same group.

[0026] If the number of the first data blocks to be migrated in the threshold change migration table reaches the second preset number, then the determination of whether the data block exists in the same group as the corresponding data block is paused.

[0027] In an optional implementation, determining the first data block to be migrated and the migration node corresponding to the first data block to be migrated based on the first entry table condition and multiple first data blocks to be determined includes:

[0028] For each of the first data blocks to be determined, if there is no data block in the same group as the first data block to be determined in the threshold change migration table, and there is a node that can be migrated into the first data block to be determined in the newly added nodes of the distributed system, then the first data block to be determined is determined as the first data block to be migrated, and the node with the smallest used capacity among the nodes that can be migrated into the first data block to be migrated is determined as the node to be migrated into the first data block to be migrated.

[0029] If the first data block to be migrated stored in the threshold change migration table contains a data block in the same group as the first data block to be determined, or if there is no node to be migrated into the newly added node of the distributed system, then the first data block to be determined is deleted.

[0030] The node that can be migrated in does not store any data blocks in the same group as the first data block to be determined.

[0031] In an optional implementation, migrating the first data block to be migrated to the receiving node corresponding to the first data block to be migrated according to the threshold change migration table includes:

[0032] According to the threshold change migration table, obtain a first number of first data blocks to be migrated;

[0033] If the migration node corresponding to the first data block to be migrated and the disk in the migration node are online, the first data block to be migrated is added to the threshold change migration queue, and the unmigrated identifier of the first data block to be migrated is modified to the migration preparation identifier in the threshold change migration table.

[0034] Obtain a second number of first data blocks to be migrated from the threshold change migration queue, and determine whether the migration node corresponding to the first data block to be migrated and the disk in the migration node are online;

[0035] If online, the migration preparation flag of the first data block to be migrated is modified to the migration in progress flag in the threshold change migration table, and the first data block to be migrated is migrated to the corresponding migration-in node.

[0036] In an optional implementation, the method further includes:

[0037] If the migration node corresponding to the first data block to be migrated or the disk in the migration node is offline, and the first data block to be migrated is set with a non-migration flag, then the information corresponding to the first data block to be migrated is deleted from the threshold change migration table and added to the migration failure table.

[0038] If the first data block to be migrated is set with a migration preparation flag, and the waiting time for the first data block to be migrated reaches the preset waiting time, then the migration preparation flag is modified to a non-migration flag in the threshold change migration table.

[0039] If the first data block to be migrated is marked as being migrated, and the migration time of the first data block to be migrated reaches the preset migration time, then the first data block to be migrated is deleted from the threshold change migration table and added to the migration failure table.

[0040] The first data to be migrated in the migration failure table is migrated by a threshold change.

[0041] In an optional implementation, the capacity balancing migration of data blocks in the distributed system includes:

[0042] Obtain a preset number of second data blocks to be determined from the disk to be migrated; the disk to be migrated is the disk with the largest used capacity among the nodes to be migrated, and the node to be migrated is the node with the largest used capacity in the distributed system;

[0043] The disk with the smallest used capacity in the node with the smallest used capacity in the distributed system is identified as the destination disk. The location information of the second data block to be migrated that meets the second entry condition and the disk information of the destination disk are inserted into a preset balanced migration table.

[0044] According to the balanced migration table, the second data block to be migrated is migrated to the destination disk corresponding to the second data block to be migrated.

[0045] In an optional implementation, inserting the location information of the second data blocks to be migrated that meet the second entry conditions from among the plurality of second data blocks to be determined, along with the disk information of the disk to be migrated, into a preset balanced migration table includes:

[0046] For each second data block to be determined, if there is no data block in the same group as the second data block to be determined stored in the balanced migration table, no data block in the same group as the second data block to be determined stored in the destination disk, and the number of data blocks in the same group as the second data block to be determined stored in the node to which the destination disk belongs is less than a preset number threshold, then the second data block to be determined is determined as the second data block to be migrated, and the location information of the second data block to be migrated and the disk of the destination disk are inserted into the preset balanced migration table;

[0047] If the second data block to be migrated stored in the balanced migration table contains a data block in the same group as the second data block to be determined, or the destination disk stores a data block in the same group as the second data block to be determined, or the number of data blocks in the same group as the second data block to be determined stored in the node to which the destination disk belongs is greater than or equal to a preset number threshold, then the second data block to be determined is deleted.

[0048] In an optional implementation, migrating the second data block to be migrated to the receiving disk corresponding to the second data block to be migrated according to the balanced migration table includes:

[0049] According to the balanced migration table, obtain the third number of the second data blocks to be migrated;

[0050] If the destination disk corresponding to the second data block to be migrated and the node to which the destination disk belongs are online, the second data block to be migrated is added to the balanced migration queue, and the unmigrated identifier of the second data block to be migrated is changed to the migration preparation identifier in the balanced migration table;

[0051] Obtain the fourth number of the second data blocks to be migrated from the balanced migration queue, and determine whether the destination disk corresponding to the second data block to be migrated and the node to which the destination disk belongs are online;

[0052] If online, the migration preparation identifier of the second data block to be migrated is modified to the migration in progress identifier in the balanced migration table, and the first data block to be migrated is migrated to the corresponding migration-in node.

[0053] In an optional implementation, the method further includes:

[0054] If the destination disk corresponding to the second data block to be migrated or the node where the destination disk is located is offline, and the second data block to be migrated is set with an unmigrated flag, the information corresponding to the second data block to be migrated will be deleted from the balanced migration table.

[0055] If the second data block to be migrated is set with a migration preparation flag, and the waiting time for the migration of the second data block to be migrated reaches the preset waiting time, then the migration preparation flag is modified to a non-migration flag in the balanced migration table.

[0056] If the second data block to be migrated is marked as being in migration, and the migration time of the second data block to be migrated reaches the preset migration time, then the information corresponding to the second data block to be migrated will be deleted from the balanced migration table.

[0057] In an optional implementation, the capacity balancing condition includes that the difference in used capacity of any node in the distributed system is less than or equal to a preset node balancing threshold, and the difference in used capacity of any disk in the distributed system is less than or equal to a preset disk balancing threshold.

[0058] Wherein, the difference in used capacity of any node is the difference between the used capacity of the node and the average used capacity of the nodes in the current distributed system; the difference in used capacity of any disk is the difference between the used capacity of the disk and the average used capacity of the disks of the node to which the disk belongs.

[0059] Secondly, this application provides a data migration apparatus applied to a distributed system, the distributed system comprising multiple nodes, the apparatus comprising:

[0060] The judgment module is used to determine whether the fault node threshold of the distributed system has changed when the distributed system meets the migration triggering conditions; the fault node threshold is the maximum number of fault nodes allowed to occur in the distributed system.

[0061] The migration module is used to perform threshold change migration on data blocks in the distributed system if the threshold of the fault node changes, and to perform capacity balancing migration on data blocks in the distributed system if the threshold change migration is completed and the distributed system does not meet the capacity balancing condition.

[0062] The migration module is further configured to perform capacity balancing migration of data blocks in the distributed system if the fault node threshold has not changed and the distributed system does not meet the capacity balancing conditions.

[0063] Thirdly, this application provides a distributed system including a processor and a memory, wherein the memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement the method described in any of the foregoing embodiments.

[0064] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any of the foregoing embodiments.

[0065] The data migration method, apparatus, distributed system, and computer-readable storage medium provided in this application, when the distributed system meets the migration triggering conditions, first determine whether the threshold of the corresponding fault node in the distributed system has changed. If the threshold of the fault node has changed, a threshold change migration is required first. After the threshold change migration is completed, if the distributed system does not meet the capacity balancing conditions, a capacity balancing migration is performed on the data blocks in the distributed system. If the threshold of the fault node has not changed, a capacity balancing migration is performed on the data blocks in the distributed system even if the capacity balancing conditions are not met. By first determining whether the threshold of the corresponding fault node in the distributed system has changed when data migration is required, and performing a threshold change migration first to adapt the distributed system to the changed fault node threshold if it has changed, and then performing a capacity balancing migration even if the capacity balancing conditions are not met after the threshold change migration is completed, the data reliability of the distributed system can be guaranteed.

[0066] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0067] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0068] Figure 1 A block diagram of a distributed system provided in an embodiment of this application is shown;

[0069] Figure 2 A block diagram of nodes in a distributed system is shown;

[0070] Figure 3 This paper illustrates a flowchart of a data migration method provided in an embodiment of this application.

[0071] Figure 4 This illustration shows another flowchart of the data migration method provided in an embodiment of this application;

[0072] Figure 5 This illustration shows another flowchart of the data migration method provided in an embodiment of this application;

[0073] Figure 6 This illustration shows another flowchart of the data migration method provided in an embodiment of this application;

[0074] Figure 7 This illustration shows another flowchart of the data migration method provided in an embodiment of this application;

[0075] Figure 8 This illustration shows another flowchart of the data migration method provided in an embodiment of this application;

[0076] Figure 9 A functional block diagram of a data migration apparatus provided in an embodiment of this application is shown.

[0077] Icons: 10-Distributed system; 101-Management node; 102-Data node; 110-Storage; 120-Processor; 130-Communication module; 200-Decision module; 210-Migration module. Detailed Implementation

[0078] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can be arranged and designed in various different configurations.

[0079] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0080] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0081] Currently, erasure coding technology can be used to store data in distributed systems. When the used capacity in a distributed system becomes too large, the number of nodes or the disks in the nodes can be expanded to meet the data storage requirements.

[0082] Erasure coding is a data protection technology that can divide data into N original data blocks during data storage and generate M redundant fragments according to the erasure algorithm. The original data blocks and the redundant fragments are then stored as data blocks in a distributed system.

[0083] If the number of damaged data blocks corresponding to a certain data is no more than M, the data can be recovered and reconstructed based on other data blocks. Therefore, in order to ensure reliable data reconstruction, the data blocks corresponding to the same data often need to be evenly distributed on each node, and the maximum number of data blocks distributed on each node should not exceed M.

[0084] Understandably, the number of data blocks that can be distributed across nodes is affected by the number of nodes. At the same time, the maximum number of faulty nodes allowed in a distributed system is also affected by the number of nodes. That is, the more nodes there are, the greater the number of faulty nodes allowed in the distributed system. Obviously, when a distributed system is expanded, it may lead to an increase in the number of faulty nodes allowed in the distributed system.

[0085] However, currently, after expanding the number of nodes, only the data blocks stored in the distributed system are simply migrated to balance the data storage needs and alleviate storage pressure. The problem of the number of nodes that can fail in the distributed system may increase after the node expansion is not taken into account. Therefore, after migrating the data blocks, there is often a problem of low data reliability.

[0086] For example, if the original number of data blocks is 4, the number of redundant fragments is 2, and the distributed system includes 4 nodes, then at this time, the maximum number of nodes allowed to fail in the distributed system is only 1. If the distributed system is expanded to 6 nodes, then at this time, the maximum number of nodes that can fail in the expanded distributed system is 2.

[0087] Understandably, in the example above, the expanded distributed system should be allowed a maximum of 2 nodes to fail. Therefore, if a simple data migration is performed only to balance the storage pressure of the distributed system, the actual maximum number of nodes that can fail after the data migration may not be the same as the maximum number of nodes that should fail, resulting in lower reliability after the data migration.

[0088] Based on this, embodiments of this application provide a data migration method to solve the above problems.

[0089] Specifically, Figure 1 For a block diagram of distributed system 10, please refer to [link / reference]. Figure 1 The distributed system 10 includes multiple nodes.

[0090] Optionally, in order to achieve data management of the distributed system, any one of the multiple nodes can be selected in advance as the management node 101, and the other nodes can be the data nodes 102. Understandably, the management node can be used to manage the data blocks stored in the distributed system according to the data block storage status and node expansion status of the distributed system.

[0091] Optionally, in order to ensure the normal operation of the distributed system 10, if the pre-selected management node is offline or fails, a new management node can be determined from other nodes.

[0092] Optionally, each node may also include at least one disk for storing data blocks.

[0093] Optionally, Figure 2This is a block diagram of a node in a distributed system. The node includes a memory 110, a processor 120, and a communication module 130. The memory 110, processor 120, and communication module 130 are electrically connected to each other directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0094] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.

[0095] The processor 120 is used to read / write data or programs stored in memory and to perform corresponding functions.

[0096] The communication module 130 is used to establish a communication connection between the server and other communication terminals via the network, and to send and receive data via the network.

[0097] It should be understood that, Figure 2 The structure shown is only a schematic diagram of a node; a node may also include components that are larger than... Figure 2 The more or fewer components shown, or having the same Figure 2 The different configurations shown. Figure 2 The components shown can be implemented using hardware, software, or a combination thereof.

[0098] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, can implement the data migration method provided in this application.

[0099] The following section uses the management node in the aforementioned distributed system as the execution entity, and provides an exemplary description of the data migration method provided in this application embodiment, along with a flowchart. Specifically, Figure 3 For a flowchart illustrating the data migration method provided in this application embodiment, please refer to [link / reference]. Figure 3 The method includes:

[0100] Step S20: If the distributed system meets the migration triggering conditions, determine whether the threshold of the corresponding fault node in the distributed system has changed.

[0101] The fault node threshold is the maximum number of fault nodes allowed to occur in a distributed system.

[0102] Optionally, the migration trigger condition can be set according to actual usage, such as determining that the distributed system meets the migration trigger condition when expanding the number of nodes or the disk in the distributed system.

[0103] In one possible implementation, if any node or disk in a node in the distributed system does not meet the preset capacity balancing conditions when creating new data, the management node can determine that the distributed system meets the migration triggering condition.

[0104] In another possible implementation, users can manually modify the node load balancing threshold or the disk load balancing threshold of each node in the distributed system according to the current actual usage, and actively issue a migration command after modification. Upon receiving the migration command, the management node can determine that the distributed system meets the migration triggering conditions.

[0105] Understandably, the node balancing threshold and disk balancing threshold can be used to determine whether the current storage status of the distributed system is in a capacity-balanced state.

[0106] In this embodiment, the management node can determine whether the threshold of the corresponding faulty node in the distributed system has changed when the migration triggering conditions are met.

[0107] Step S21: If the threshold of the fault node changes, the data blocks in the distributed system are migrated according to the threshold change. If the threshold change migration is completed and the distributed system does not meet the capacity balancing condition, the data blocks in the distributed system are migrated according to the capacity balancing condition.

[0108] Optionally, since the failure node threshold changes, it means that the maximum number of nodes that should be allowed to fail in the distributed system has changed. Therefore, it is necessary to first migrate the data blocks according to the threshold change so that the actual maximum number of nodes that should be allowed to fail in the distributed system reaches the maximum number of nodes that should be allowed to fail, thereby ensuring the reliability of the data.

[0109] Optionally, the capacity balancing condition is used to determine whether the current storage status of the distributed system is in a capacity balancing state, that is, whether the storage status of each node in the distributed system is in a capacity balancing state, and whether the storage status of the disks in each node is in a capacity balancing state.

[0110] Optionally, this capacity balancing state refers to the fact that the utilization rate of each node and the disks in each node in the distributed system are balanced within a certain range.

[0111] Optionally, after the threshold change migration, the distributed system may or may not be in a capacity-balanced state. Therefore, it is also necessary to determine whether the storage status of the distributed system is in a capacity-balanced state after the threshold change migration.

[0112] Optionally, if the distributed system is in a capacity-balanced state, there is no need to perform capacity-balanced migration of data blocks; if the distributed system is not in a capacity-balanced state, then capacity-balanced migration of data blocks is required.

[0113] Understandably, by performing capacity-balanced migration of data blocks, the utilization rate of each node and the disks on each node in a distributed system can be balanced.

[0114] Step S22: If the threshold of the faulty node has not changed and the distributed system does not meet the capacity balancing condition, then the data blocks in the distributed system are migrated for capacity balancing.

[0115] Optionally, if the threshold for the faulty node has not changed, it is necessary to determine whether to perform capacity balancing migration on the data blocks in the distributed system based on whether the distributed system meets the capacity balancing conditions.

[0116] In addition, failures may occur during the data block migration process, such as a sudden failure of the management node leading to a management node switch, or a sudden power outage and subsequent power restoration of the distributed system. These failures may cause migration interruptions. After a migration interruption, it is generally necessary to re-trigger the migration based on whether the distributed system meets the migration trigger conditions. Therefore, to avoid the problem of low migration efficiency caused by re-triggering the migration based on whether the distributed system meets the migration trigger conditions after a failure, a capacity balancing table can be set in the database of the distributed system. This allows the capacity balancing table to set a migration status flag for the distributed system when the migration trigger conditions are met.

[0117] Optionally, the migration status identifier can indicate whether the distributed system is currently in the process of migration or has completed the migration. For example, identifier 0 indicates that the distributed system is in the process of migration, and identifier 1 indicates that the distributed system has completed the migration.

[0118] In this scenario, when the distributed system recovers after a failure during migration, it searches the migration status flag in the capacity balancing table. If the migration status flag indicates that the distributed system is in the process of migration, the data block migration can continue without needing to determine whether the distributed system meets the migration trigger conditions again.

[0119] The data migration method provided in this application, when the distributed system meets the migration triggering conditions, first determines whether the threshold of the corresponding fault node in the distributed system has changed. If the threshold has changed, a threshold change migration is performed first. After the threshold change migration is completed, if the distributed system does not meet the capacity balancing conditions, a capacity balancing migration is performed on the data blocks in the distributed system. If the threshold of the fault node has not changed, a capacity balancing migration is performed on the data blocks in the distributed system even if the capacity balancing conditions are not met. By first determining whether the threshold of the corresponding fault node in the distributed system has changed when data migration is required, and performing a threshold change migration first to adapt the distributed system to the changed threshold, and then performing a capacity balancing migration even if the capacity balancing conditions are not met after the threshold change migration is completed, the data reliability of the distributed system can be guaranteed.

[0120] Optionally, since for a distributed system, if only the disk in the node is expanded, the fault node threshold will not change, but if the node is expanded, the fault node threshold may or may not change, based on this, the management node can first determine whether the number of nodes in the distributed system has increased, and then determine whether the fault node threshold corresponding to the distributed system has changed according to the preset threshold change conditions.

[0121] Specifically, step S20 above can also be achieved through the following steps:

[0122] If the number of nodes in a distributed system remains unchanged when the migration triggering conditions are met, then the threshold for the corresponding faulty node in the distributed system remains unchanged.

[0123] Optionally, if the distributed system meets the migration triggering conditions, the distributed system may not have expanded the number of nodes, but rather expanded the disk of a certain node, or neither the node nor the disk may have been expanded, but other configuration situations exist, such as modifying the node balancing threshold or the disk balancing threshold.

[0124] Understandably, if the number of nodes in a distributed system does not change, it means that the threshold for faulty nodes in the distributed system will also not change.

[0125] If the number of nodes in the distributed system increases, and the distributed system meets the preset first threshold change condition or the preset second threshold change condition, then the threshold change of the corresponding fault node in the distributed system is determined.

[0126] Optionally, if the number of nodes in the distributed system increases, the fault node threshold corresponding to the distributed system may or may not change. Therefore, it is necessary to combine the preset threshold change conditions to determine whether the fault node threshold corresponding to the distributed system has changed.

[0127] Specifically, the preset threshold change condition can be either a first threshold change condition or a second threshold change condition. Understandably, the management node can determine whether the threshold of the corresponding faulty node in the distributed system has changed using either the first threshold change condition or the second threshold change condition.

[0128] Optionally, the first threshold change condition includes the number of original nodes in the distributed system being less than the number of data blocks into which each data is divided, and the number of current nodes in the distributed system being greater than or equal to the number of data blocks into which each data is divided.

[0129] Optionally, the number of data blocks into which the data is divided is the sum of the number of original data blocks and the number of redundant fragments. That is, if in a distributed system, each piece of data can be divided into N original data blocks and M redundant fragments, then the number of data blocks for each piece of data is equal to M+N.

[0130] Understandably, when the number of nodes in a distributed system is less than the number of data blocks into which each data is divided, the maximum number of data blocks that can be stored on each node is equal to the number of redundant fragments. In this case, the fault node threshold of the distributed system is less than the number of redundant fragments. When the number of nodes in a distributed system is greater than or equal to the number of data blocks into which each data is divided, the maximum number of data blocks that can be stored on each node is 1. In this case, the fault node threshold of the distributed system is equal to the number of redundant fragments.

[0131] Obviously, if the number of original nodes in the distributed system is less than the number of data blocks into which each data is divided in the distributed system, and the number of current nodes in the distributed system is greater than or equal to the number of data blocks into which each data is divided in the distributed system, then it can be determined that the threshold of the faulty node has changed.

[0132] The original number of nodes in the distributed system refers to the number of nodes in the distributed system before the expansion; the current number of nodes in the distributed system refers to the sum of the original number of nodes and the number of nodes added during expansion.

[0133] In addition, the management node can also determine whether the fault node threshold of the distributed system has changed by directly calculating the new fault node threshold and the original fault node threshold of the distributed system.

[0134] Based on this, the second threshold change condition includes that the number of original nodes in the distributed system is less than the number of data blocks into which each data is divided, and that the threshold for the new fault node in the distributed system is greater than the threshold for the original fault node in the distributed system.

[0135] The threshold for new fault nodes is calculated based on the number of original data blocks, the number of redundant fragments, and the current number of nodes in the distributed system. The threshold for original fault nodes is calculated based on the number of original data blocks, the number of redundant fragments, and the original number of nodes in the distributed system.

[0136] In one possible implementation, the threshold K of the new fault node can be calculated using the following formula. new and the threshold K of the original fault node old :

[0137] K old =ALIGN_DOWN(M / ALIGN_UP((M+N) / OldNum))

[0138] K new =ALIGN_DOWN(M / ALIGN_UP((M+N) / NewNum))

[0139] Wherein, ALIGN_DOWN represents downward alignment, ALIGN_UP represents upward alignment, M represents the number of redundant segments corresponding to each data, N represents the original data blocks into which each data is divided, OldNum represents the number of original nodes in the distributed system, and NewNum represents the number of current nodes in the distributed system.

[0140] Taking the second threshold change condition mentioned above as an example, if each data can be divided into 8 original data blocks and 3 redundant fragments, and the distributed system includes 4 nodes, then the node failure threshold calculated according to the above formula is 1.

[0141] If the distributed system is subsequently expanded to include 5 nodes, the node failure threshold calculated using the above formula will still be 1. Clearly, the original number of nodes in the distributed system is less than the number of data blocks each data segment is divided into, but the new failure node threshold for the distributed system is equal to the original failure node threshold. Therefore, the second threshold change condition is not met, and it can be determined that the failure node threshold for the distributed system remains unchanged. In this embodiment, the management node can determine whether the failure node threshold for the distributed system has changed based on either the first or second threshold change condition.

[0142] Optionally, the distributed system may store the correspondence between each data block and the node and disk where the data block is located, and this correspondence may be stored in the form of, for example, a correspondence table.

[0143] In one possible implementation, this mapping relationship can be stored in a pre-selected management node.

[0144] Based on this, the management node can migrate the threshold changes of data blocks in the distributed system according to the corresponding relationship when the threshold change of the corresponding fault node is determined. Specifically, in Figure 3 On this basis, Figure 4 For another flowchart illustrating the data migration method provided in this application embodiment, please refer to [link / reference]. Figure 4 The threshold change migration of data blocks in the distributed system in step S21 above can also be achieved through the following steps:

[0145] Step S21-1: Based on the preset threshold change migration conditions, determine multiple first data blocks to be determined from the correspondence, and insert the location information of the first data blocks to be migrated that meet the first entry conditions and the node information of the migration node of the first data blocks to be migrated into the preset threshold change migration table.

[0146] Optionally, the management node can scan each data block in the correspondence and determine multiple first data blocks to be determined from the correspondence based on preset threshold change migration conditions, and then determine multiple first data blocks to be migrated from the multiple first data blocks to be determined.

[0147] Optionally, a threshold change migration table can be set to store the information of the first data block to be migrated. Based on this, after determining multiple first data blocks to be migrated and the migration-in node corresponding to each first database to be migrated, the management node can insert the location information of the first data block to be migrated and the node information of the migration-in node into the threshold change migration table.

[0148] Optionally, the location information of the first data block to be migrated may include the migration node information and the migration disk information where the first data block to be migrated is located.

[0149] Optionally, since the first data block to be migrated needs to be migrated into the disk in the destination node, the disk information of the destination disk can also be inserted into the threshold change migration table.

[0150] In one possible implementation, the incoming disk can be the disk with the smallest used capacity in the incoming node; in another possible implementation, the incoming disk can be a randomly selected disk in the incoming node.

[0151] In addition, to facilitate querying the waiting time of the first data to be migrated, the entry time of each first data to be migrated can also be recorded in the threshold change migration table.

[0152] Based on this, the threshold change migration table can store the outgoing node ID, outgoing disk ID, incoming node ID, incoming disk ID, data type, and entry time of the first database to be migrated.

[0153] Step S21-2: According to the threshold change migration table, migrate the first data block to be migrated to the migration node corresponding to the first data block to be migrated.

[0154] Optionally, since the threshold change migration table stores the location information of the first data block to be migrated and the migration node information that needs to be migrated according to the threshold change migration table, the management node can migrate each first data block to be migrated from its location to the corresponding migration node.

[0155] Optionally, in order to improve the efficiency of obtaining the first data block to be migrated, the first data block to be determined can be obtained in multiple times, with only a first preset number of the first data blocks to be determined being obtained each time, and the first data block to be migrated being determined from the first preset number of the first data blocks to be determined each time.

[0156] Specifically, in Figure 4 On this basis, Figure 5 For another flowchart illustrating the data migration method provided in this application embodiment, please refer to [link / reference]. Figure 5 The above step S21-1 can also be achieved through the following steps:

[0157] Step S21-1-1: For each data block in the corresponding relationship, determine whether there is a corresponding data block in the same group on the node where the data block is located;

[0158] Among them, the data blocks in the same group are data blocks that belong to the same data as the data block.

[0159] Step S21-1-2: The data block that has a corresponding data block in the same group is identified as the first data block to be determined.

[0160] Optionally, the file to be stored can be divided into multiple data, and each data can be divided into multiple data blocks. Then, the data blocks corresponding to each data can be considered as the same group of data blocks. That is, if a data block and another data block belong to the same data, then the data block and the other data block are in the same group of data blocks.

[0161] Optionally, the management node can scan each data block in the correspondence sequentially to determine whether there is a corresponding data block in the same group on the node where the data block is located. If there is a corresponding data block in the same group, the data block can be identified as the first data block to be determined.

[0162] Optionally, to facilitate the management node in determining whether a data block exists in the same group, the above correspondence may also store the data attribute information of each data block, which can be represented by the data structure of "file-object-data block". The management node can then determine whether each data block exists in the same group based on the data structure of "file-object-data block".

[0163] Understandably, the threshold change migration condition is that there are data blocks in the same group of data blocks.

[0164] Step S21-1-3: When the number of the first data blocks to be determined reaches the first preset number, determine the first data block to be migrated and the migration node corresponding to the first data block to be migrated according to the first entry table condition and the multiple first data blocks to be determined.

[0165] Step S21-1-4: Insert the location information of the first data block to be migrated and the node information of the corresponding migration node of the first data block to be migrated into the threshold change migration table.

[0166] Optionally, the first preset quantity can be set according to the actual application.

[0167] Optionally, the first entry condition is used to determine whether the first data block to be determined is the first data block to be migrated that needs to undergo threshold change migration.

[0168] In this embodiment, the management node can obtain the first data block to be determined according to the correspondence. If the number of the first data blocks to be determined reaches the first preset number, the first data block to be migrated and the migration node corresponding to the first data block to be migrated are first determined from the first preset number of the first data blocks to be determined. Then, the location information of the first data block to be migrated and the node information of the migration node corresponding to the first data block to be migrated can be inserted into the threshold change migration table.

[0169] Optionally, the management node may, upon determining a first data block to be migrated, insert the location information of the first data block to be migrated and the node information of the corresponding receiving node into the threshold change migration table.

[0170] Step S21-1-5: If the number of the first data blocks to be migrated in the threshold change migration table has not reached the second preset number, then for each data block in the corresponding relationship, determine whether the data block exists in the same group as the corresponding data block.

[0171] Step S21-1-6: If the number of the first data blocks to be migrated in the threshold change migration table reaches the second preset number, then pause determining whether the data block exists in the same group as the corresponding data block.

[0172] Optionally, after inserting the location information of the first data block to be migrated and the node information of the node corresponding to the first data block to be migrated into the threshold change migration table, it can be determined whether the number of the first data blocks to be migrated stored in the threshold change migration table reaches the second preset number.

[0173] Optionally, the second preset quantity can be set according to the actual application.

[0174] In this embodiment, if the number of the first data blocks to be migrated stored in the threshold change migration table does not reach the second preset number, then it is necessary to continue to obtain the first preset number of the first data blocks to be determined, and determine the first data blocks to be migrated from them.

[0175] In this embodiment, if the number of the first databases to be migrated stored in the threshold change migration table reaches the second preset number, the process of obtaining the first module to be determined from the corresponding relationship can be paused.

[0176] Optionally, the management node may delete the information of the first data block to be migrated from the threshold change migration table after the migration of the first data block to be migrated has been completed based on the information in the threshold change migration table.

[0177] Understandably, in this case, the number of the first data blocks to be migrated stored in the threshold change migration table will gradually decrease as the migration is completed. Therefore, if the management node determines that the number of the first data blocks to be migrated stored in the threshold change migration table is lower than the second preset number again, it can continue to obtain the first data blocks to be determined from the corresponding relationship.

[0178] In this embodiment, the management node can repeat the above process until every data block in the corresponding relationship has been scanned.

[0179] Optionally, to facilitate the management node in accurately locating the last scan position when resuming scanning, a cursor can be set to track the scan position, so that the management node can restart scanning based on the cursor position.

[0180] Optionally, considering that among the multiple first data blocks to be determined obtained based on the correspondence, there may still be first data blocks to be determined that are in the same group, it is necessary to further filter the first data blocks to be determined to ensure that the threshold change migration table does not contain first data blocks to be migrated that are in the same group. In addition, it is necessary to determine whether each first data block to be determined has a corresponding node that can be migrated in, so as to finally determine the first data block to be migrated.

[0181] Specifically, the step S21-1-3 above, which determines the first data block to be migrated and the corresponding migration node based on the first entry condition and multiple first data blocks to be determined, can also be achieved through the following steps:

[0182] For each first data block to be determined, if there is no data block in the same group as the first data block to be determined in the threshold change migration table, and there is a node that can be migrated into the first data block to be determined in the newly added nodes of the distributed system, then the first data block to be determined is determined as the first data block to be migrated, and the node with the smallest used capacity among the nodes that can be migrated into the first data block to be migrated is determined as the node to be migrated into the first data block to be migrated.

[0183] If the first data block to be migrated stored in the threshold change migration table contains a data block in the same group as the first data block to be determined, or if there is no node to be migrated into the newly added node of the distributed system, then the first data block to be determined is deleted.

[0184] Among them, the nodes that can be migrated in do not store any data blocks in the same group as the first data block to be determined.

[0185] Understandably, the first entry condition refers to the absence of a corresponding data block in the same group as the first data block to be determined in the first data block to be migrated stored in the threshold change migration table, and the existence of a node that can be migrated into the newly added node of the distributed system, corresponding to the first data block to be determined.

[0186] Optionally, the management node can determine whether there is a corresponding data block in the threshold change migration table for each first data block to be determined. In addition, it also needs to determine whether there is a node that can be migrated into the first data block to be determined.

[0187] In one possible implementation, after determining that there is no corresponding data block in the same group as the first data block to be migrated in the threshold change migration table, it can be determined whether there is a node that can be migrated into the first data block to be determined. In another possible implementation, after determining that there is a node that can be migrated into the first data block to be determined, it can be determined whether there is a corresponding data block in the same group as the first data block to be migrated in the threshold change migration table. This application does not limit this.

[0188] Understandably, regardless of whether there is a corresponding data block in the same group as the first data block to be determined in the first data block to be migrated stored in the threshold change migration table, or whether there is no eligible node to be migrated in the newly added nodes of the distributed system, it means that the first data block to be determined does not meet the first entry condition and is not the first data block to be migrated. Therefore, the first data block to be determined can be skipped.

[0189] Optionally, the node to be migrated in is a newly added node in the distributed system, and the newly added node should not store any data blocks in the same group corresponding to the first data block to be determined.

[0190] Understandably, if a new node is added to the distributed system, and the new node does not store any data blocks in the same group as some of the first data blocks to be determined, then the new node is the node that can be migrated into for these first data blocks to be determined, and is also determined as the migration node.

[0191] Understandably, if multiple new nodes are added to the distributed system, for each first data block to be determined, the new nodes that do not store the corresponding data blocks in the same group among the multiple new nodes can be identified as the nodes that can be migrated into the first data block to be determined.

[0192] At this time, if there is no data block in the same group as the first data block to be migrated in the first data block to be determined stored in the threshold change migration table, and there are multiple nodes that can be migrated in, then the first data block to be determined can be determined as the first data block to be migrated, and the node with the smallest used capacity among the nodes that can be migrated in can be determined as the migration node of the first data block to be migrated.

[0193] In one possible implementation, the management node can first determine all the possible inbound nodes corresponding to a first data block to be determined, and then, if the first data block to be determined is determined to be the first data block to be migrated, determine the inbound node corresponding to the first data block to be migrated from all the possible inbound nodes.

[0194] In another possible implementation, the management node can directly determine whether a new node contains a migration node corresponding to the first undetermined data block. It is understandable that if it is directly determined that a new node contains a migration node corresponding to the first undetermined data block, then it can also be determined that a migration-available node corresponding to the first undetermined data block exists in the distributed system.

[0195] Based on this, in one example, the management node can first select the node with the smallest used capacity among multiple new nodes as the node to be confirmed for migration, and determine whether the node to be confirmed for each first data block to be confirmed stores the same group of data blocks corresponding to the first data block to be confirmed.

[0196] In this example, if a data block in the same group as the first data block to be determined is stored, the node with the smallest used capacity among the other newly added nodes is identified as a new node to be confirmed for migration. It is then determined whether the new node to be confirmed for migration stores a data block in the same group as the first data block to be determined. This process continues until a new node that does not store a data block in the same group as the first data block to be determined is found, or if no new node that does not store a data block in the same group as the first data block to be determined is found after traversing all the new nodes, then it is determined that there is no eligible migration node for the first data block to be determined.

[0197] In this example, if the node to be confirmed for migration does not store the same group of data blocks as the first data block to be determined, then it can be determined that the first data block to be determined has a corresponding migration node, namely the node to be confirmed for migration. At the same time, the node to be confirmed for migration is also the migration node corresponding to the first data block to be determined.

[0198] In this embodiment, after determining that a first data block to be determined is the first data block to be migrated, the management node can add the location information of the first data block to be migrated and the migration node information to the threshold change migration table.

[0199] Understandably, the management node can migrate each first data block to be migrated based on the threshold change in the migration table.

[0200] Optionally, to track the migration status of threshold change migration, a first status identifier that can characterize the threshold change migration status can be set in the threshold change migration table. It is understood that this first status identifier may include an unmigrated identifier, a migration ready identifier, and a migration in progress identifier, and this first status identifier can be updated in real time according to the migration process.

[0201] Based on this, the migration of the first data block to be migrated can be achieved through the following steps, specifically, in Figure 4 On this basis, Figure 6 For another flowchart illustrating the data migration method provided in this application embodiment, please refer to [link / reference]. Figure 6 The above step S21-2 can also be achieved through the following steps:

[0202] Step S21-2-1: Obtain the first number of first data blocks to be migrated according to the threshold change migration table;

[0203] Optionally, this first number can be set according to the actual application.

[0204] In this embodiment, the management node can obtain the first data block to be migrated based on the location information of the first data block to be migrated stored in the threshold change migration table.

[0205] Understandably, at this point, the first state identifier of the first data to be migrated is the non-migration identifier, indicating that it is still in the state of not entering migration.

[0206] Step S21-2-2: If the receiving node corresponding to the first data block to be migrated and the disk in the receiving node are online, add the first data block to be migrated to the threshold change migration queue, and modify the unmigrated flag of the first data block to be migrated to the migration preparation flag in the threshold change migration table.

[0207] Optionally, the management node can determine whether the receiving node and the disk in the receiving node are online for each first data block to be migrated based on the threshold change migration table.

[0208] Optionally, the disk in the migrating node refers to the migrating disk of the first data block to be migrated in the migrating node.

[0209] Optionally, if the receiving node corresponding to the first data block to be migrated and the disk in the receiving node are both online, it means that the first data block to be migrated can be prepared for migration. Therefore, the management node can add the first data block to be migrated to the threshold change migration queue.

[0210] Understandably, when the first data block to be migrated is added to the threshold change migration queue, it enters the migration preparation state, waiting to be migrated from the threshold change migration queue to the receiving node. Therefore, the management node can update the first status identifier of the first data block to be migrated in the threshold change migration table, changing the unmigrated identifier to the migration preparation identifier.

[0211] Step S21-2-3: Obtain the second number of the first data blocks to be migrated from the threshold change migration queue, and determine whether the migration node corresponding to the first data block to be migrated and the disk in the migration node are online;

[0212] Optionally, this second number can be set according to the actual application.

[0213] In step S21-2-4, if online, the migration preparation flag of the first data block to be migrated is changed to the migration in progress flag in the threshold change migration table, and the first data block to be migrated is migrated to the corresponding migration node.

[0214] Optionally, the management node can remove the first data block to be migrated from the threshold change migration queue and perform the migration. To improve the migration success rate, after obtaining a second number of first data blocks to be migrated from the threshold change migration queue, the management node can determine whether the corresponding migration-in node and the disk in the migration-in node are online for each first data block to be migrated. If they are online, then the first data block to be migrated will be migrated.

[0215] Understandably, if it is online, it means that the first data block to be migrated has entered the migration state. Therefore, the migration preparation flag corresponding to the first data block to be migrated in the threshold change migration table can be modified to the migration in progress flag.

[0216] In one possible implementation, the unmigrated flag, the migration ready flag, and the migration in progress flag can be set to numbers, for example, 0 represents the unmigrated flag, 1 represents the migration ready flag, and 2 represents the migration in progress flag.

[0217] Optionally, considering that faults may occur during the threshold change migration process, such as the node or disk storing the first data block to be migrated going offline, or the receiving node or disk corresponding to the first data block to be migrated going offline, in order to handle faults in a timely and efficient manner, the corresponding fault handling method can be determined by combining the first status identifier of the first data to be migrated in the threshold change migration table.

[0218] Optionally, as can be seen from the above migration process, failures may occur at different stages of the migration.

[0219] For example, when obtaining the first number of first data blocks to be migrated according to the threshold change migration table, the node or disk where the first data block to be migrated is located is offline, or the receiving node or the disk in the receiving node corresponding to the first data block to be migrated is offline.

[0220] Understandably, at this time, the migration process of the first data block to be migrated has failed, and the first data block to be migrated has a non-migration flag set. Therefore, the management node can remove the information corresponding to the first data block to be migrated from the threshold change migration table and add the information corresponding to the first data block to be migrated to the preset migration failure table.

[0221] Optionally, the migration failure table stores the first data blocks to be migrated that failed to migrate in this threshold change migration. In order to ensure the reliability of the data, the management node needs to continue to perform threshold change migration on the first data blocks to be migrated in the migration failure table after this threshold change migration, until all the first data blocks to be migrated are successfully migrated.

[0222] For example, after adding the first data block to be migrated to the threshold change migration queue, if the receiving node corresponding to the first data block or the disk in the receiving node goes offline, the first data block to be migrated cannot enter the migration process, resulting in a migration failure. Understandably, the first data block to be migrated has a migration preparation flag set at this time.

[0223] In this case, if the management node has a migration preparation flag set for the first data block to be migrated, and the waiting time for the first data block to be migrated reaches the preset waiting time, the migration preparation flag can be modified to a non-migration flag in the threshold change migration table.

[0224] Optionally, the first data block to be migrated can also be removed from the threshold change migration queue at this time.

[0225] Optionally, the waiting migration duration refers to the duration after the first data block to be migrated is added to the threshold change migration queue. It can be understood that the waiting migration duration can also refer to the duration after the first data block to be migrated has been changed from an unmigration identifier to a migration preparation identifier.

[0226] Optionally, the preset waiting time can be set according to the actual application situation.

[0227] For example, the management node has already removed the first data block to be migrated from the threshold change migration queue, but during the migration process, the receiving node corresponding to the first data block to be migrated, or the disk in the receiving node, goes offline, causing the migration to be interrupted, and the first data block to be migrated cannot complete the migration. Understandably, at this time, since the first data block to be migrated has not yet been successfully migrated, a "migration in progress" flag is set in the threshold change migration table.

[0228] Based on this, when the first data block to be migrated is marked as being in migration and the migration time of the first data block to be migrated reaches the preset migration time, the management node can delete the information corresponding to the first data block to be migrated from the threshold change migration table and add it to the migration failure table.

[0229] Optionally, the migration duration refers to the time it takes for the first data block to be migrated to be migrated after it is taken out of the threshold change migration queue. It can be understood that the migration duration can also refer to the time elapsed after the first data block to be migrated is changed from the migration preparation flag to the migration in progress flag.

[0230] Optionally, the preset migration time can be set according to the actual application situation.

[0231] Optionally, since the distributed system may still not be in a capacity-balanced state after the threshold change migration, the management node can determine whether the distributed system meets the capacity-balanced condition after completing the threshold change migration of the data blocks in the distributed system, so as to determine whether the distributed system is in a capacity-balanced state.

[0232] Understandably, if a distributed system does not meet the capacity balancing conditions, then a capacity balancing migration is still required; if the distributed system meets the capacity balancing conditions, then a capacity balancing migration is not necessary. For example, if the current number of nodes in the distributed system is equal to the number of data blocks into which each data is divided, then after a threshold change migration, the distributed system can be in a capacity-balanced state, and no further capacity balancing migration is needed.

[0233] In addition, the management node also needs to perform capacity balancing migration when the threshold of the faulty node has not changed, but the distributed system does not meet the capacity balancing conditions.

[0234] Therefore, the following section will mainly focus on capacity balancing conditions and how to perform capacity balancing migration.

[0235] In one possible implementation, the capacity balancing condition includes the difference in used capacity of any node in the distributed system being less than or equal to a preset node balancing threshold, and the difference in used capacity of any disk in the distributed system being less than or equal to a preset disk balancing threshold.

[0236] The difference in used capacity of any node is the difference between the node's used capacity and the average used capacity of nodes in the current distributed system; the difference in used capacity of any disk is the difference between the disk's used capacity and the average used capacity of the disks of the node to which the disk belongs.

[0237] Optionally, when determining whether the distributed system meets the capacity balancing condition, the management node may sort the nodes in the distributed system and the disks in each node according to their used capacity. Then, based on the number of nodes in the distributed system and the used capacity of each node, the management node may calculate the average used capacity of the nodes in the distributed system, and based on the number of disks in each node and the used capacity of each disk, the management node may calculate the average used capacity of the disks in that node.

[0238] Optionally, the node balancing threshold and disk balancing threshold can be modified and set by the user according to their storage needs.

[0239] In this embodiment, if the management node determines that the difference between the used capacity of any node and the average used capacity of any node is greater than a preset node balancing threshold, or the difference between the used capacity of any disk and the average used capacity of the disks of the node to which the disk belongs is greater than a preset disk used capacity threshold, then it can be determined that the distributed system does not meet the capacity balancing conditions, and therefore capacity balancing migration is required.

[0240] Optionally, during capacity balancing migration, data blocks can be migrated from the disk with the largest used capacity in the node with the largest used capacity to the disk with the smallest used capacity in the node with the smallest used capacity.

[0241] Specifically, in Figure 3 On this basis, Figure 7 For another flowchart illustrating the data migration method provided in this application embodiment, please refer to [link / reference]. Figure 7 The capacity balancing migration of data blocks in the distributed system in steps S21 and S22 above can also be achieved through the following steps:

[0242] Step S10: Obtain a preset number of second data blocks to be determined from the disk to be migrated;

[0243] Among them, the disk to be migrated is the disk with the largest used capacity among the nodes to be migrated, and the node to be migrated is the node with the largest used capacity in the distributed system.

[0244] Optionally, the management node can determine the data blocks in the disk to be migrated based on the correspondence between each data block and the node and disk where the data block is located, thereby obtaining a preset number of second data blocks to be determined from the disk to be migrated.

[0245] Optionally, the preset number can be set in advance according to the actual application.

[0246] In this embodiment, since each node in the distributed system and each disk in each node are sorted according to the size of the used capacity when determining whether the distributed system meets the capacity balancing conditions, the management node can directly determine the disk to be migrated.

[0247] Step S11: Determine the disk with the smallest used capacity in the node with the smallest used capacity in the distributed system as the migration disk, and insert the location information of the second data block to be migrated that meets the second entry condition and the disk information of the migration disk into the preset balanced migration table.

[0248] Optionally, the management node can determine the disks to be migrated based on the size of the used capacity.

[0249] In this embodiment, after determining the disk to be migrated, the management node needs to determine the second data block to be migrated from a plurality of second data blocks to be determined that meets the second table entry conditions, and then insert the location information of the second data block to be migrated and the disk information of the disk to be migrated into a preset balanced migration table.

[0250] Understandably, the management node also needs to insert the node information of the node where the disk to be migrated is located into the load balancing migration table.

[0251] Optionally, the data content stored in the equilibrium migration table is the same as the data content stored in the threshold change migration table, which will not be elaborated on here.

[0252] In one possible implementation, the equilibrium migration table and the threshold change migration table can be the same migration table.

[0253] Step S12: According to the balanced migration table, migrate the second data block to be migrated to the corresponding destination disk.

[0254] Optionally, after obtaining the balance migration table, the management node can obtain the second data block to be migrated based on the location information of the second data block to be migrated in the balance migration table, and migrate the second data block to be migrated to its corresponding migration disk.

[0255] Optionally, the step S11 above, which involves inserting the location information of the second data blocks to be migrated that meet the second entry conditions and the disk information of the destination disk from among multiple second data blocks to be determined into a preset balanced migration table, can also be achieved through the following steps:

[0256] For each second data block to be determined, if there is no data block in the same group as the second data block to be determined stored in the balance migration table, no data block in the same group as the second data block to be determined stored in the destination disk, and the number of data blocks in the same group as the second data block to be determined stored in the node to which the destination disk belongs is less than a preset number threshold, then the second data block to be determined is determined as the second data block to be migrated, and the location information of the second data block to be migrated and the disk to be migrated are inserted into the preset balance migration table;

[0257] If the second data block to be migrated stored in the balanced migration table contains a data block in the same group as the second data block to be determined, or if the destination disk contains a data block in the same group as the second data block to be determined, or if the number of data blocks in the same group as the second data block to be determined stored in the node to which the destination disk belongs is greater than or equal to a preset number threshold, then the second data block to be determined is deleted.

[0258] In this embodiment, the management node can determine for each second data block to be determined whether there is a corresponding group of data blocks in the second data block to be migrated stored in the balanced migration table, whether the migration disk stores the corresponding group of data blocks, and whether the number of corresponding group of data blocks stored in the node to which the migration disk belongs is less than a preset number threshold.

[0259] Optionally, the preset number threshold can be set according to the actual application situation. In one possible implementation, the preset number threshold can be consistent with the fault node threshold in the distributed system.

[0260] Alternatively, the migration of the second data block to be migrated can also be achieved in the same way as the migration of the first data block to be migrated by applying a threshold change. Specifically, in Figure 7 On this basis, Figure 8 For another flowchart illustrating the data migration method provided in this application embodiment, please refer to [link / reference]. Figure 8 The above step S12 can also be achieved through the following steps:

[0261] Step S12-1: Obtain the third number of the second data blocks to be migrated according to the balanced migration table;

[0262] Optionally, this third number can be set according to the actual application.

[0263] In this embodiment, the management node can obtain the second data block to be migrated based on the location information of the second data block to be migrated stored in the balanced migration table.

[0264] Understandably, at this time, the second status identifier of the second data to be migrated is the non-migration identifier, indicating that it is still in the state of not entering migration.

[0265] Step S12-2: If the destination disk corresponding to the second data block to be migrated and the node to which the destination disk belongs are online, add the second data block to be migrated to the balanced migration queue, and change the unmigrated flag of the second data block to be migrated to the migration ready flag in the balanced migration table.

[0266] Optionally, the management node can determine, based on the balanced migration table, whether the destination disk corresponding to each second data block to be migrated and whether the node to which the destination disk belongs is online.

[0267] Optionally, if the destination disk corresponding to the second data block to be migrated and the node to which the destination disk belongs are both online, it means that the second data block to be migrated can be prepared for migration. Therefore, the management node can add the second data block to be migrated to the balanced migration queue.

[0268] Understandably, when the second data block to be migrated is added to the migration balance queue, it enters the migration ready state, waiting to be migrated from the migration balance queue to the destination disk. Therefore, the management node can update the second status identifier of this second data block to be migrated in the migration balance table, changing the unmigrated identifier to the migration ready identifier.

[0269] Step S12-3: Obtain the fourth number of the second data blocks to be migrated from the balanced migration queue, and determine whether the destination disk corresponding to the second data block to be migrated and the node to which the destination disk belongs are online;

[0270] Optionally, this fourth number can be set according to the actual application.

[0271] Step S12-4: If online, modify the migration preparation flag of the second data block to be migrated to the migration in progress flag in the balanced migration table, and migrate the first data block to be migrated to the corresponding migration node.

[0272] Optionally, the management node can remove the second data block to be migrated from the balanced migration queue and perform the migration. To improve the migration success rate, after obtaining the fourth number of second data blocks to be migrated from the balanced migration queue, the management node can determine whether the corresponding destination disk and the node to which the destination disk belongs are online for each second data block to be migrated. If they are online, then the second data block to be migrated can be migrated.

[0273] Understandably, if it is online, it means that the second data block to be migrated has entered the migration state. Therefore, the migration preparation flag corresponding to the second data block to be migrated in the balanced migration table can be changed to the migration in progress flag.

[0274] In one possible implementation, the unmigrated flag, the migration ready flag, and the migration in progress flag can be set to numbers, for example, 0 represents the unmigrated flag, 1 represents the migration ready flag, and 2 represents the migration in progress flag.

[0275] Optionally, unlike the handling of failures during threshold change migration, if a failure occurs during capacity balancing migration, there is no need to create a migration failure table. Instead, when a failure occurs and the second data block to be migrated has an unmigrated flag, the second data block to be migrated is deleted. After the capacity balancing migration is completed, it is determined again whether the distributed system is in a capacity balancing state. If the distributed system is still not in a capacity balancing state, the second data block to be migrated is obtained again according to the above method, and the capacity balancing migration is performed again.

[0276] Specifically, the method further includes: if the destination disk corresponding to the second data block to be migrated or the node where the destination disk is located is offline, and the second data block to be migrated is set with a non-migration flag, the information corresponding to the second data block to be migrated is deleted from the balanced migration table; if the second data block to be migrated is set with a migration preparation flag, and the waiting time for the migration of the second data block to be migrated reaches a preset waiting time, the migration preparation flag is modified to a non-migration flag in the balanced migration table; if the second data block to be migrated is set with a migration in progress flag, and the migration time of the second data block to be migrated reaches a preset migration time, the information corresponding to the second data block to be migrated is deleted from the balanced migration table.

[0277] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of a data migration apparatus is given below. Further, please refer to... Figure 9 , Figure 9 This is a functional block diagram of a data migration device provided in an embodiment of this application. It should be noted that the basic principle and technical effects of the data migration device provided in this embodiment are the same as those in the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The data migration device includes: a judgment module 200 and a migration module 210.

[0278] The judgment module 200 is used to determine whether the fault node threshold of the distributed system has changed when the migration triggering conditions are met; the fault node threshold is the maximum number of fault nodes allowed to occur in the distributed system.

[0279] Understandably, the judgment module 200 can also be used to perform the above step S20.

[0280] The migration module 210 is used to perform threshold change migration on data blocks in the distributed system if the threshold of the faulty node changes, and to perform capacity balancing migration on data blocks in the distributed system if the threshold change migration is completed and the distributed system does not meet the capacity balancing conditions.

[0281] Understandably, the migration module 210 can also be used to perform the above step S21.

[0282] The migration module 210 is also used to perform capacity balancing migration of data blocks in the distributed system if the threshold of the faulty node has not changed and the distributed system does not meet the capacity balancing conditions.

[0283] Understandably, the migration module 210 can also be used to perform the above step S22.

[0284] Optionally, the judgment module 200 is further configured to determine that the fault node threshold of the distributed system remains unchanged if the number of nodes in the distributed system remains unchanged when the migration triggering conditions are met; and to determine that the fault node threshold of the distributed system changes if the number of nodes in the distributed system increases and the distributed system meets a preset first threshold change condition or a preset second threshold change condition.

[0285] Understandably, the judgment module 200 can also be used to execute the above steps S20-1 to S0-2.

[0286] Optionally, the migration module 210 is further configured to determine multiple first data blocks to be determined from the correspondence based on preset threshold change migration conditions, insert the location information of the first data blocks to be migrated that meet the first entry conditions and the node information of the migration-in node of the first data blocks to be migrated into the preset threshold change migration table; and migrate the first data blocks to be migrated to the migration-in node corresponding to the first data blocks to be migrated according to the threshold change migration table.

[0287] Understandably, the migration module 210 can also be used to perform the above steps S21-1 to S21-2.

[0288] Optionally, the migration module 210 is further configured to, for each data block in the correspondence relationship, determine whether there is a corresponding group of data blocks on the node where the data block is located; the group of data blocks are data blocks belonging to the same data as the data block; the data blocks with corresponding group of data blocks are determined as the first data blocks to be determined; if the number of the first data blocks to be determined reaches a first preset number, the first data block to be migrated and the migration-in node corresponding to the first data block to be migrated are determined according to the first entry condition and multiple first data blocks to be determined; the location information of the first data block to be migrated and the node information of the migration-in node corresponding to the first data block to be migrated are inserted into the threshold change migration table; if the number of the first data blocks to be migrated in the threshold change migration table does not reach a second preset number, then for each data block in the correspondence relationship, it is continued to determine whether there is a corresponding group of data blocks for the data block; if the number of the first data blocks to be migrated in the threshold change migration table reaches a second preset number, then the determination of whether there is a corresponding group of data blocks for the data block is paused.

[0289] Understandably, the migration module 210 can also be used to perform the above steps S21-1-1 to S21-1-6.

[0290] Optionally, the migration module 210 is further configured to, for each first data block to be determined, if there is no corresponding data block in the same group as the first data block to be determined stored in the threshold change migration table, and there is a node that can be migrated into the newly added nodes of the distributed system, then the first data block to be determined is determined as the first data block to be migrated, and the node with the smallest used capacity among the nodes that can be migrated into the first data block to be migrated is determined as the node to be migrated into the first data block to be migrated; if there is a corresponding data block in the same group as the first data block to be determined stored in the threshold change migration table, or there is no node that can be migrated into the newly added nodes of the distributed system, then the first data block to be determined is deleted; wherein, the nodes that can be migrated into do not store any data blocks in the same group as the first data block to be determined.

[0291] Optionally, the migration module 210 is further configured to: obtain a first number of first data blocks to be migrated according to a threshold change migration table; if the receiving node corresponding to the first data block to be migrated and the disk in the receiving node are online, add the first data block to be migrated to a threshold change migration queue, and modify the unmigrated identifier of the first data block to be migrated to a migration preparation identifier in the threshold change migration table; obtain a second number of first data blocks to be migrated from the threshold change migration queue, and determine whether the receiving node corresponding to the first data block to be migrated and the disk in the receiving node are online; if online, modify the migration preparation identifier of the first data block to be migrated to a migration indicative identifier in the threshold change migration table, and migrate the first data block to be migrated to the corresponding receiving node.

[0292] Understandably, the migration module 210 can also be used to perform the above steps S21-2-1 to S21-2-4.

[0293] Optionally, the migration module 210 is further configured to: if the receiving node or the disk in the receiving node corresponding to the first data block to be migrated is offline, and the first data block to be migrated is set with a non-migration flag, then delete the information corresponding to the first data block to be migrated from the threshold change migration table and add it to the migration failure table; if the first data block to be migrated is set with a migration preparation flag, and the waiting time for the first data block to be migrated reaches a preset waiting time, then modify the migration preparation flag to a non-migration flag in the threshold change migration table; if the first data block to be migrated is set with a migration in progress flag, and the migration time for the first data block to be migrated reaches a preset migration time, then delete the information corresponding to the first data block to be migrated from the threshold change migration table and add it to the migration failure table; and perform threshold change migration on the first data block to be migrated in the migration failure table.

[0294] Optionally, the migration module 210 is further configured to obtain a preset number of second data blocks to be determined from the disk to be migrated; the disk to be migrated is the disk with the largest used capacity among the nodes to be migrated, and the node to be migrated is the node with the largest used capacity in the distributed system; the disk with the smallest used capacity among the nodes with the smallest used capacity in the distributed system is determined as the destination disk, and the location information of the second data blocks to be migrated that meet the second entry conditions and the disk information of the destination disk are inserted into a preset balanced migration table; according to the balanced migration table, the second data blocks to be migrated are migrated to the destination disk corresponding to the second data blocks to be migrated.

[0295] Understandably, the migration module 210 can also be used to perform the above steps S10 to S12.

[0296] Optionally, the migration module 210 is further configured to, for each second data block to be determined, determine the second data block to be migrated as the second data block to be migrated if, in the balanced migration table, there is no corresponding data block in the same group as the second data block to be migrated, in the destination disk, there is no corresponding data block in the same group as the second data block to be migrated, and in the node to which the destination disk belongs, the number of corresponding data blocks in the same group as the second data block to be migrated is less than a preset number threshold; and insert the location information of the second data block to be migrated and the destination disk into the preset balanced migration table. If, in the balanced migration table, there is a corresponding data block in the same group as the second data block to be migrated, or in the destination disk, there is a corresponding data block in the same group as the second data block to be migrated, or in the node to which the destination disk belongs, the number of corresponding data blocks in the same group as the second data block to be migrated is greater than or equal to a preset number threshold, then delete the second data block to be determined.

[0297] Optionally, the migration module 210 is further configured to: obtain a third number of second data blocks to be migrated according to the balanced migration table; if the destination disk corresponding to the second data block to be migrated and the node to which the destination disk belongs are online, add the second data block to be migrated to the balanced migration queue, and modify the unmigrated flag of the second data block to be migrated to the migration preparation flag in the balanced migration table; obtain a fourth number of second data blocks to be migrated from the balanced migration queue, and determine whether the destination disk corresponding to the second data block to be migrated and the node to which the destination disk belongs are online; if online, modify the migration preparation flag of the second data block to be migrated to the migration in progress flag in the balanced migration table, and migrate the first data block to be migrated to the corresponding destination node.

[0298] Understandably, the migration module 210 can also be used to perform the above steps S12-1 to S12-4.

[0299] Optionally, the migration module 210 is further configured to: delete the information corresponding to the second data block to be migrated from the balanced migration table if the destination disk or the node where the destination disk is located is offline and the second data block to be migrated is set with a non-migration flag; modify the migration preparation flag to a non-migration flag in the balanced migration table if the second data block to be migrated is set with a migration preparation flag and the waiting time for migration of the second data block to be migrated reaches a preset waiting time; and delete the information corresponding to the second data block to be migrated from the balanced migration table if the second data block to be migrated is set with a migration in progress flag and the migration time of the second data block to be migrated reaches a preset migration time.

[0300] The data migration apparatus provided in this application, through a judgment module, determines whether the fault node threshold of the distributed system has changed when the migration triggering conditions are met. The fault node threshold is the maximum number of fault nodes allowed in the distributed system. If the fault node threshold changes, the migration module performs threshold change migration on the data blocks in the distributed system. If the threshold change migration is completed and the distributed system does not meet the capacity balancing conditions, the migration module performs capacity balancing migration on the data blocks in the distributed system. Conversely, if the fault node threshold does not change and the distributed system does not meet the capacity balancing conditions, the migration module performs capacity balancing migration on the data blocks in the distributed system. By first determining whether the fault node threshold of the distributed system has changed when data migration is required, and then performing threshold change migration first to adapt the distributed system to the changed fault node threshold if it has changed, and then performing capacity balancing migration only when the distributed system does not meet the capacity balancing conditions after the threshold change migration is completed, the data reliability of the distributed system can be guaranteed.

[0301] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0302] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0303] If a function is implemented as a software module 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 this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0304] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A data migration method, characterized by, The method is applied to a distributed system including a plurality of nodes, and comprises: In the case that the distributed system meets a migration triggering condition, it is determined whether a fault node threshold corresponding to the distributed system changes; the fault node threshold is a maximum value of a number of fault nodes allowed to exist in the distributed system; The case that the distributed system meets the migration triggering condition, it is determined whether the fault node threshold corresponding to the distributed system changes, comprises: In the case that the distributed system meets the migration triggering condition, if the number of nodes in the distributed system does not change, it is determined that the fault node threshold corresponding to the distributed system does not change; if the number of nodes in the distributed system increases and the distributed system meets a preset first threshold change condition or a preset second threshold change condition, it is determined that the fault node threshold corresponding to the distributed system changes; The first threshold change condition comprises that a number of original nodes in the distributed system is less than a number of data blocks into which each data is divided, and a current number of nodes in the distributed system is greater than or equal to the number of data blocks into which each data is divided; the number of data blocks into which each data is divided is a sum of an original number of data blocks into which the data is divided and a number of redundant segments; The second threshold change condition comprises that the number of original nodes in the distributed system is less than the number of data blocks into which each data is divided, and a new fault node threshold corresponding to the distributed system is greater than an original fault node threshold corresponding to the distributed system; The new fault node threshold is calculated according to the original number of data blocks into which each data is divided, the number of redundant segments, and the current number of nodes in the distributed system, and the original fault node threshold is calculated according to the original number of data blocks into which each data is divided, the number of redundant segments, and an original number of nodes in the distributed system; If the fault node threshold changes, threshold change migration is performed on the data blocks in the distributed system, and capacity balance migration is performed on the data blocks in the distributed system in the case that the threshold change migration is completed and the distributed system does not meet a capacity balance condition; If the fault node threshold does not change and the distributed system does not meet the capacity balance condition, capacity balance migration is performed on the data blocks in the distributed system.

2. The method of claim 1, wherein, Each of the nodes includes at least one disk, and the distributed system stores a correspondence between each of the data blocks and a node and a disk where the data block is located; The threshold change migration on the data blocks in the distributed system comprises: According to a preset threshold change migration condition, a plurality of first to-be-determined data blocks are determined from the correspondence, position information of a first to-be-migrated data block in the plurality of first to-be-determined data blocks that meets a first entry condition and node information of a migration-in node of the first to-be-migrated data block are inserted into a preset threshold change migration table; According to the threshold change migration table, the first to-be-migrated data block is migrated to the migration-in node corresponding to the first to-be-migrated data block.

3. The method of claim 2, wherein, The method comprises the following steps: For each data block in the correspondence, determining whether the data block has a corresponding same-group data block on the node where the data block is located; the same-group data block is a data block belonging to the same data as the data block; Determining the data block having the corresponding same-group data block as the first to-be-determined data block; In the case where the number of the first to-be-determined data blocks reaches a first preset number, determining a first to-be-migrated data block and a migration-in node corresponding to the first to-be-migrated data block according to the first table entry condition and the plurality of first to-be-determined data blocks; Inserting the position information of the first to-be-migrated data block and the node information of the migration-in node corresponding to the first to-be-migrated data block into the threshold change migration table; If the number of the first to-be-migrated data blocks in the threshold change migration table does not reach a second preset number, continue to determine whether each data block in the correspondence has a corresponding same-group data block; If the number of the first to-be-migrated data blocks in the threshold change migration table reaches the second preset number, suspend the determination of whether the data block has a corresponding same-group data block.

4. The method of claim 3, wherein, The method comprises the following steps: For each first to-be-determined data block, if the same-group data block corresponding to the first to-be-determined data block does not exist in the first to-be-migrated data blocks stored in the threshold change migration table, and a migratable node corresponding to the first to-be-determined data block exists in the newly added node of the distributed system, the first to-be-determined data block is determined as a first to-be-migrated data block, and the migratable node having the smallest used capacity in the migratable nodes corresponding to the first to-be-determined data block is determined as the migration-in node corresponding to the first to-be-migrated data block; If the same-group data block corresponding to the first to-be-determined data block exists in the first to-be-migrated data blocks stored in the threshold change migration table, or the migratable node corresponding to the first to-be-determined data block does not exist in the newly added node of the distributed system, the first to-be-determined data block is deleted; The migratable node does not store the same-group data block corresponding to the first to-be-determined data block.

5. The method of claim 2, wherein, The method comprises the following steps: According to the threshold change migration table, a first number of first to-be-migrated data blocks are obtained; According to the threshold change migration table, the first to-be-migrated data blocks are migrated to the migration-in nodes corresponding to the first to-be-migrated data blocks; In a case that the migration-in node corresponding to the first to-be-migrated data block and the disk in the migration-in node are online, adding the first to-be-migrated data block to a threshold change migration queue and modifying the non-migration identifier of the first to-be-migrated data block to a migration preparation identifier in the threshold change migration table; acquiring a second number of first to-be-migrated data blocks from the threshold change migration queue and determining whether the migration-in node corresponding to the first to-be-migrated data block and the disk in the migration-in node are online; if so, modifying the migration preparation identifier of the first to-be-migrated data block to a migration-in-progress identifier in the threshold change migration table and migrating the first to-be-migrated data block to the corresponding migration-in node.

6. The method of claim 5, wherein, The method further comprises: if the migration-in node corresponding to the first to-be-migrated data block or the disk in the migration-in node is offline and the first to-be-migrated data block is provided with the non-migration identifier, deleting the information corresponding to the first to-be-migrated data block from the threshold change migration table and adding the information to a migration failure table; if the first to-be-migrated data block is provided with the migration preparation identifier and the waiting migration time length of the first to-be-migrated data block reaches a preset waiting time length, modifying the migration preparation identifier to the non-migration identifier in the threshold change migration table; if the first to-be-migrated data block is provided with the migration-in-progress identifier and the migration time length of the first to-be-migrated data block reaches a preset migration time length, deleting the information corresponding to the first to-be-migrated data block from the threshold change migration table and adding the information to the migration failure table; performing threshold change migration on the first to-be-migrated data in the migration failure table.

7. The method of claim 1, wherein, The capacity balancing migration of the data blocks in the distributed system comprises: acquiring a preset number of second to-be-determined data blocks from to-be-migrated disks; the to-be-migrated disks are the disks with the largest used capacity in to-be-migrated nodes, and the to-be-migrated nodes are the nodes with the largest used capacity in the distributed system; determining a disk with the smallest used capacity in a node with the smallest used capacity in the distributed system as a migration-in disk and inserting the position information of a second to-be-migrated data block meeting a second table entry condition in a plurality of the second to-be-determined data blocks and the disk information of the migration-in disk into a preset balancing migration table; migrating the second to-be-migrated data block to the migration-in disk corresponding to the second to-be-migrated data block according to the balancing migration table.

8. The method of claim 7, wherein, The inserting of the position information of the second to-be-migrated data block meeting the second table entry condition in the plurality of the second to-be-determined data blocks and the disk information of the migration-in disk into the preset balancing migration table comprises: If the same group data block corresponding to the second to-be-determined data block does not exist in the second to-be-migrated data block stored in the balance migration table, the same group data block corresponding to the second to-be-determined data block is not stored in the migrated disk, and the number of the same group data block corresponding to the second to-be-determined data block stored in the node to which the migrated disk belongs is less than the preset number threshold, the second to-be-determined data block is determined as a second to-be-migrated data block, and the position information of the second to-be-migrated data block and the disk insertion of the migrated disk are inserted into the preset balance migration table. If the same group data block corresponding to the second to-be-determined data block exists in the second to-be-migrated data block stored in the balance migration table, or the same group data block corresponding to the second to-be-determined data block is stored in the migrated disk, or the number of the same group data block corresponding to the second to-be-determined data block stored in the node to which the migrated disk belongs is greater than or equal to the preset number threshold, the second to-be-determined data block is deleted.

9. The method of claim 7, wherein, The second to-be-migrated data block is migrated to the corresponding migrated disk according to the balance migration table, including: According to the balance migration table, a third number of second to-be-migrated data blocks are obtained. In the case that the second to-be-migrated data block corresponds to the migrated disk and the node to which the migrated disk belongs are online, the second to-be-migrated data block is added to the balance migration queue, and the un-migrated identifier of the second to-be-migrated data block in the balance migration table is modified to a migration preparation identifier. A fourth number of second to-be-migrated data blocks are obtained from the balance migration queue, and it is determined whether the second to-be-migrated data block corresponds to the migrated disk and the node to which the migrated disk belongs are online. If online, the migration preparation identifier of the second to-be-migrated data block in the balance migration table is modified to a migration-in-progress identifier, and the second to-be-migrated data block is migrated to the corresponding migrated node.

10. The method of claim 9, wherein, The method further comprises: If the second to-be-migrated data block corresponds to the migrated disk or the node to which the migrated disk belongs is offline, and the second to-be-migrated data block is provided with an un-migrated identifier, the information corresponding to the second to-be-migrated data block is deleted from the balance migration table. If the second to-be-migrated data block is provided with a migration preparation identifier, and the waiting migration time length of the second to-be-migrated data block reaches a preset waiting time, the migration preparation identifier in the balance migration table is modified to an un-migrated identifier. If the second to-be-migrated data block is provided with a migration-in-progress identifier, and the migration time length of the second to-be-migrated data block reaches a preset migration time, the information corresponding to the second to-be-migrated data block is deleted from the balance migration table.

11. The method of claim 1, wherein, The capacity balance condition includes that the used capacity difference of any node in the distributed system is less than or equal to a preset node balance threshold, and the used capacity difference of any disk in the distributed system is less than or equal to a preset disk balance threshold. The used capacity difference value of any node is a difference between the used capacity of the node and a mean value of used capacities of nodes in the current distributed system; and the used capacity difference value of any disk is a difference between the used capacity of the disk and a mean value of used capacities of disks in the node to which the disk belongs.

12. A data migration apparatus, characterized by comprising: The device is applied to a distributed system including a plurality of nodes, and comprises: a judging module configured to judge whether a fault node threshold corresponding to the distributed system changes, if the distributed system meets a migration triggering condition; the fault node threshold being a maximum value of a number of fault nodes allowed to exist in the distributed system; the judging module is further configured to determine that the fault node threshold corresponding to the distributed system does not change, if the number of nodes in the distributed system does not change, if the distributed system meets the migration triggering condition; and determine that the fault node threshold corresponding to the distributed system changes, if the number of nodes in the distributed system increases and the distributed system meets a preset first threshold change condition or a preset second threshold change condition; the first threshold change condition includes that a number of original nodes in the distributed system is less than a number of data blocks into which each data is divided, and a current number of nodes in the distributed system is greater than or equal to the number of data blocks into which each data is divided; the number of data blocks into which each data is divided is a sum of an original number of data blocks into which the data is divided and a number of redundant segments; and the second threshold change condition includes that the number of original nodes in the distributed system is less than the number of data blocks into which each data is divided, and a new fault node threshold corresponding to the distributed system is greater than an original fault node threshold corresponding to the distributed system; wherein the new fault node threshold is calculated according to the original number of data blocks into which each data is divided, the number of redundant segments, and the current number of nodes in the distributed system, and the original fault node threshold is calculated according to the original number of data blocks into which each data is divided, the number of redundant segments, and an original number of nodes in the distributed system; a migration module configured to perform threshold change migration on data blocks in the distributed system, if the fault node threshold changes, and perform capacity balance migration on the data blocks in the distributed system, if the threshold change migration is completed and the distributed system does not meet a capacity balance condition; the migration module is further configured to perform the capacity balance migration on the data blocks in the distributed system, if the fault node threshold does not change and the distributed system does not meet the capacity balance condition.

13. A distributed system, characterized by The computer program is executed by the processor to implement the method of any one of claims 1-11.

14. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1-11.

Citation Information

Patent Citations

  • Load balancing method and distributed database system

    CN103593347A

  • Data management method and device, equipment and medium

    CN114489508A