WO2014101044A1 - 分布式存储系统中的分区平衡方法、装置及服务器 - Google Patents

分布式存储系统中的分区平衡方法、装置及服务器 Download PDF

Info

Publication number
WO2014101044A1
WO2014101044A1 PCT/CN2012/087661 CN2012087661W WO2014101044A1 WO 2014101044 A1 WO2014101044 A1 WO 2014101044A1 CN 2012087661 W CN2012087661 W CN 2012087661W WO 2014101044 A1 WO2014101044 A1 WO 2014101044A1
Authority
WO
WIPO (PCT)
Prior art keywords
partition
migration
node
target node
source node
Prior art date
Application number
PCT/CN2012/087661
Other languages
English (en)
French (fr)
Inventor
高贵举
张烽
王志美
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2012/087661 priority Critical patent/WO2014101044A1/zh
Priority to CN201280002939.0A priority patent/CN103229487B/zh
Publication of WO2014101044A1 publication Critical patent/WO2014101044A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems

Definitions

  • the present invention relates to the field of communications, and in particular, to a partition balancing method, apparatus, and server in a distributed storage system.
  • BACKGROUND OF THE INVENTION With the development of computer technology and network technology, the amount of information has increased in geometric progression, and human data has reached an unprecedented scale. The storage and management of these ultra-large-scale data has become a major challenge in the industry. When managing large-scale data with traditional centralized storage, it cannot provide efficient read and write operations, and cannot meet good scalability and high availability. In this context, various distributed storage systems based on non-relational databases have emerged.
  • the embodiments of the present invention provide a partition balancing method, device, and server in a distributed storage system, which can implement partition balancing of a distributed storage system, that is, implement data recovery and online capacity expansion.
  • an embodiment of the present invention provides a partition balancing method in a distributed storage system, including: determining, when partition balancing is performed, an latest state of each partition;
  • the migration task includes: In the relationship, the source node corresponding to the target node and the migration partition on the source node; the migration task is used to indicate that the target node triggers data migration between the target node and the corresponding source node, and the data migration is to use the source node.
  • the data in the migration partition is migrated to the target node.
  • the partition balancing processing is data recovery processing; and the partition balancing processing according to the latest state of each partition includes:
  • the determining, by the target node corresponding to each migration partition includes:
  • the replica partitions of the same partition are not in the same node, or in the same box, or in the same rack.
  • the partition balancing processing is an online expansion processing; and the partition balancing processing according to the latest state of each partition includes:
  • determine the latest status of each partition including:
  • the latest status of each partition is obtained by updating the partition status table according to the status of each partition currently undergoing balancing processing, and the status of each partition is stored in the partition status table.
  • an embodiment of the present invention provides a partition balancing apparatus in a distributed storage system, including: a determining unit, configured to determine an latest state of each partition when partition balancing is required;
  • a processing unit configured to perform partition balancing processing according to the latest state of each partition, and obtain a correspondence between the source node, the migration partition on the source node, and the target node;
  • a sending unit configured to send a migration task to the target node in the corresponding relationship;
  • the migration task includes: in the corresponding relationship, a source node corresponding to the target node and a migration partition on the source node;
  • the migration task is used to instruct the target node to trigger data migration between the target node and the corresponding source node, and the data migration is to migrate data in the migration partition on the source node to the target node.
  • the zoning balancing process is a data recovery process
  • the processing unit specifically includes:
  • a first determining subunit configured to determine, for each fault partition, a copy partition of the fault partition, and determine, from the copy partition of the fault partition, a copy partition that participates in the allowed state as a migration partition of the fault partition, and the migration partition
  • the second determining subunit is configured to determine a target node corresponding to each migration partition, and obtain a correspondence relationship between the source node, the migration partition on the source node, and the target node.
  • the second determining unit is specifically configured to: determine, according to the following principles, a target node corresponding to each migration partition: a replica partition of the same partition is not in the same node, Or the same box, or the same rack.
  • the zoning balancing process is an online capacity expansion process
  • the processing unit specifically includes:
  • the processing subunit is configured to separately calculate the average number of partitions of the node before and after the expansion, and determine that the newly added node is the target node;
  • a third determining subunit configured to determine a source node and a migration partition corresponding to each target node according to an latest state of the respective partitions and an average number of partitions of the nodes before and after the expansion, to obtain a target node, a source node, and a source node. The correspondence between the migration partitions.
  • the determining unit is specifically configured to: update a partition state table according to a state of each partition that is currently undergoing balancing processing, and obtain an latest state of each partition, where the state of each partition is stored.
  • an embodiment of the present invention provides a control server in a distributed storage system, including: a processor, configured to determine an latest state of each partition when partition balancing is required; and perform partition balancing processing according to an latest state of each partition Obtaining a correspondence between the source node, the migration partition on the source node, and the target node; a transceiver, configured to send a migration task to the target node in the corresponding relationship; the migration task includes: in the corresponding relationship, a source node corresponding to the target node and a migration partition on the source node; The migration task is used to instruct the target node to trigger data migration between the target node and the corresponding source node, and the data migration is to migrate data in the migration partition on the source node to the target node.
  • the partition balancing processing is data recovery processing; the processor is specifically configured to:
  • the processor is specifically configured to: determine, according to the following principles, a target node corresponding to each migration partition: a replica partition of the same partition is not in the same node, Or the same box, or the same rack.
  • the partition balancing processing is an online capacity expansion processing; the processor is specifically configured to:
  • the processor is specifically configured to: update a partition state table according to a state of each partition that is currently undergoing balancing processing, and obtain an latest state of each partition, where the state of each partition is stored in the partition state table.
  • the state of each partition is determined; partition balancing processing is performed according to the state of each partition, and a correspondence relationship between the source node and the migration partition on the source node and the target node is obtained;
  • the target node in the corresponding relationship sends a migration task, so that the target node completes the partition migration according to the migration task.
  • the migration task includes: a source node corresponding to the target node and a migration partition on the source node, thereby implementing distributed Partition balancing of the storage system.
  • FIG. 1A is a schematic structural diagram of a distributed storage system according to the present invention.
  • FIG. 1 is a schematic diagram of a first embodiment of a method for partition balancing in a distributed storage system according to the present invention
  • FIG. 2 is a schematic diagram of a second embodiment of a partition balancing method in a distributed storage system according to the present invention
  • FIG. 3 is a schematic diagram of a third embodiment of a partition balancing method in a distributed storage system according to the present invention.
  • FIG. 4 is a schematic structural diagram of a partition balancing apparatus in a distributed storage system according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of an implementation unit of a processing unit in a partition balancing apparatus according to an embodiment of the present invention
  • FIG. 6 is a schematic diagram of another implementation structure of a processing unit in a partition balancing apparatus according to an embodiment of the present invention
  • Schematic diagram of the control server in the storage system Schematic diagram of the control server in the storage system. detailed description
  • FIG. 1A is a schematic structural diagram of a distributed storage system applied to a partition balancing method according to an embodiment of the present invention, where a distributed network includes a node network 120 composed of a plurality of nodes 110; the node network 120 and a control server 130, the control server 130 can be directly connected to each node 110 in the node network 120 or connected through the node network 120.
  • FIG. 1 is a schematic diagram of a first embodiment of a method for partition balancing in a distributed storage system according to the present invention, the method includes:
  • Step 101 When partition balancing is required, determine the latest status of each partition
  • Step 102 Perform partition balancing processing according to the latest state of each partition, and obtain a correspondence between the source node, the migration partition on the source node, and the target node.
  • the source node refers to a node that migrates data
  • the migration partition refers to a partition on which data is migrated on the source node
  • the target node refers to a node that receives data.
  • Step 103 Send a migration task to the target node in the corresponding relationship.
  • the migration task includes: In the corresponding relationship, the source node corresponding to the target node and the migration partition on the source node; the migration task is used to indicate that the target node triggers data migration between the target node and the source node corresponding to the target node, The data migration is to migrate data in the migration partition on the source node to the target node.
  • the latest state of each partition is determined; partition balancing processing is performed according to the latest state of each partition, and the source node, the migration partition on the source node, and the target node are obtained.
  • Corresponding relationship sending a migration task to the target node in the corresponding relationship; the migration task includes: in the correspondence relationship, a source node corresponding to the target node and a migration partition on the source node; And indicating that the target node triggers data migration between the target node and the source node corresponding to the target node, where the data migration is to migrate data in the migration partition on the source node to the target node.
  • the situation of the partition can be divided according to whether the partition participates in the partition balancing process: Participating in the partition balancing processing and not participating in the partition balancing processing;
  • the partitioning situation may be further divided according to different partition balancing processing, specifically:
  • partition balancing process When the partition balancing process is data recovery processing, it is divided into the following two cases:
  • the first is the migration partition on the source node; at this time, since the migration partition is a replica partition of the faulty partition, the migration partition will not be deleted after the data recovery processing is completed;
  • the second is the partition that receives the data in the target node
  • the migration partition on the source node since the data on the migration partition is converted to the partition on the target node for storage, after the data on the migration partition is all sent to the target node, the migration partition will be Delete
  • the second is the partition that receives the data on the target node.
  • the partition status may be divided into three states according to the above five situations:
  • the first type is the participation permission state, indicating that the data of the partition is complete and can participate in the new partition balancing processing; the state includes the following two situations: one case is that the partition does not participate in the partition balancing processing; the other case is The partition is participating in a data recovery process in one or more partition balancing processes as a migration partition on the source node;
  • the second type is the data incomplete state, indicating that the data of the partition is incomplete and cannot participate in the new partition balancing process; the state includes the following two cases: One case is that the partition is participating in the data recovery process, as the target node Partition for receiving data; another case is that the partition is participating in the online expansion process as a partition for receiving data in the target node;
  • the third type is the status to be deleted, indicating that the partition data is complete, but it cannot participate in the new partition balancing process, and the partition will be deleted after the data is sent.
  • partition status is also described by taking the above division as an example.
  • partition state partitioning can also have other implementations. This is only an example, and does not limit how the partition state is divided.
  • 2 is a schematic diagram of a second embodiment of a method for partition balancing in a distributed storage system according to the present invention.
  • the partition balancing processing is taken as an example of data recovery processing, and the method includes:
  • Step 201 For each node in the distributed storage system, the control server detects that the node status is normal or faulty, and when detecting that the node status is faulty, performing step 202; and detecting that the node status is normal, returning to step 201 to continue. Detection.
  • control server When the control server detects that the node status is faulty, it indicates that data recovery processing needs to be performed on the partition data on the node, and step 202 is performed.
  • Step 202 The control server updates the partition state table according to the state of each partition currently undergoing the balancing process, and obtains the latest state of each partition, where the state of each partition is stored.
  • Step 203 The control server performs data recovery processing according to the latest state of each partition and the node in the fault state, and generates a correspondence relationship between the source node, the migration partition on the source node, and the target node.
  • the data recovery process performed by the control server according to the latest state of each partition and the node in the fault state may specifically include:
  • a fault partition may not have a replica partition that is in the allowed state.
  • the migration partition of the fault partition may be considered as default, and the corresponding partition and target node will not exist in the fault partition.
  • the replica partitions of the same partition are not in the same node, or in the same box, or in the same rack, to meet the security of data; wherein the nodes may be storage devices such as hard disks, and multiple nodes constitute the frame;
  • the frame constitutes the frame.
  • the faulty partition is evenly migrated to other normal nodes; where the average number of partitions of the node is equal to: the total number of partitions / the number of normal nodes.
  • the target node when determining the target node, it is preferable to select a node of the copy partition that does not include the fault partition as the target node corresponding to the migration partition of the fault partition;
  • a migration partition there may be more than one node satisfying the above two principles.
  • one node can be randomly selected as the target node of the migration partition.
  • Step 204 The control server sends a migration task to each target node in the corresponding relationship.
  • the migration task includes: in the correspondence relationship, a source node corresponding to the target node and a migration partition on the source node.
  • Step 205 The target node sends task receiving confirmation information to the control server, and sends a data request to the source node in the migration task according to the migration task, where the data request includes a migration partition on the source node.
  • the data request is for requesting data from the migration partition to the source node.
  • the sending, by the target node, the task receiving confirmation information to the control server is an optional step.
  • Step 206 The source node sends data on the local migration partition to the target node.
  • the control server performs data recovery processing according to the latest state of each partition and the node in the fault state, and generates a correspondence relationship between the source node, the migration partition on the source node, and the target node, to the corresponding
  • the target node in the relationship sends a migration task, so that the target node implements data migration between the migration task and the source node, thereby implementing data recovery processing in the distributed storage system.
  • 3 is a schematic diagram of a second embodiment of a partition balancing method in a distributed storage system according to the present invention.
  • the partition balancing processing is taken as an example of online expansion, and the method includes:
  • Step 301 The control server receives a capacity expansion request, where the capacity expansion request is used to request the control server to perform a capacity expansion process.
  • the capacity expansion request may be sent by a third-party device, or may be implemented by a user using the control server by triggering a capacity expansion function provided by the control server, or may be in a certain preset condition, such as a distributed storage system. When the number of newly added nodes reaches a certain threshold, etc., it is automatically triggered by the control server, which is not limited herein.
  • Step 302 The control server updates the partition status table according to the status of each partition currently undergoing balancing processing, and obtains the latest status of each partition, where the status of each partition is stored.
  • Step 303 The control server performs online capacity expansion processing according to the latest state of each partition, and generates a correspondence relationship between the source node, the migration partition on the source node, and the target node.
  • the online expansion processing performed by the control server according to the latest state of each partition may specifically include:
  • the control server separately calculates the average number of partitions of the node before and after the expansion, and determines that the newly added node is the target node; wherein, the average number of partitions of the node is equal to: the total number of partitions / the number of normal nodes;
  • the control server determines the source node and the migration partition corresponding to each target node according to the latest state of the respective partitions and the average number of partitions of the nodes before and after the expansion, and obtains the source node, the migration partition on the source node, and the target node. Correspondence between them.
  • the control server determines the target node
  • the newly added node in the distributed storage system can be used as the target node.
  • the information on how the control server specifically obtains these newly added nodes is not limited herein.
  • the average number of partitions of the pre-expansion node and the average number of partitions of the expanded node may be used to determine the number of migrated partitions on each node; for example, in one
  • the average number of migration partitions on each node the average number of partitions of the node before capacity expansion, the average number of partitions of the node after expansion; because the migration partition generally needs to be a partition in the participation permission state, therefore, each partition The latest state can be used to determine which partitions on the node can be used as the migration partition.
  • the following two principles can generally be followed: 1.
  • the replica partitions of the same partition are not in the same state. Nodes, or the same chassis, or the same chassis, to meet the security of the data; 2.
  • the partitions are migrated to the target nodes, and the target nodes are The number of partitions is close to or equal to the average number of partitions.
  • control server specifically determines, according to the latest state of the respective partitions, and the average number of partitions of the nodes before and after the expansion, determining corresponding to each target node.
  • the source node and the migration partition are not limited here.
  • Step 304 The control server sends a migration task to each target node in the corresponding relationship.
  • the migration task includes: in the correspondence relationship, a source node corresponding to the target node and a migration partition on the source node.
  • Step 305 The target node sends a task receiving confirmation information to the control server, and sends a data request to the source node in the migration task according to the migration task, where the data request includes a migration partition on the source node.
  • the sending, by the target node, the task receiving confirmation information to the control server is an optional step.
  • Step 306 The source node sends data on the migration partition included in the data request to the target node.
  • the control server performs online capacity expansion processing according to the latest state of each partition and the capacity expansion request, and generates a mapping relationship between the source node, the migration partition on the source node, and the target node, to the target node in the corresponding relationship.
  • the migration task is sent, so that the target node implements data migration between the migration task and the source node, thereby implementing online expansion of the distributed storage system.
  • the embodiment of the present invention further provides a partition balancing device in a distributed storage system. Referring to FIG. 4, the device 400 includes:
  • the determining unit 410 is configured to determine the latest state of each partition when the partition balancing is required; the processing unit 420 is configured to perform partition balancing processing according to the latest state of each partition determined by the determining unit 410, to obtain the migration on the source node and the source node. The correspondence between the partition and the target node;
  • the sending unit 430 is configured to send a migration task to the target node in the correspondence relationship obtained by the processing unit 420.
  • the migration task includes: in the corresponding relationship, the source node corresponding to the target node and the source node
  • the migration task is used to indicate that the target node triggers data migration between the target node and the source node corresponding to the target node, and the data migration is to migrate data in the migration partition on the source node to the target node.
  • the partition balancing process may be a data recovery process.
  • the processing unit 420 may specifically include:
  • the statistical subunit 510 is configured to count the partition on the node in the fault state, and use the statistically obtained partition as the fault partition;
  • the first determining subunit 520 is configured to determine, for each fault partition that is obtained by the statistical subunit 510, a copy partition of the fault partition, and determine a copy of the copy from the copy partition of the fault partition.
  • the zone serves as a migration partition of the faulty partition, and the node where the migration partition is located is used as a source node;
  • the second determining sub-unit 530 is configured to determine a target node corresponding to each migration partition determined by the first determining sub-unit 520, and obtain a correspondence relationship between the source node, the migration partition on the source node, and the target node.
  • the second determining unit 530 is specifically configured to: determine a target node corresponding to each migration partition according to the following principle: the copy partitions of the same partition are not in the same node, or in the same box, or in the same rack.
  • the zoning balancing process may be an online capacity expansion process.
  • the processing unit 420 may specifically include:
  • the processing sub-unit 610 is configured to separately calculate an average number of partitions of the node before and after the expansion, and determine that the newly added node is the target node;
  • the third determining sub-unit 620 is configured to determine a source node and a migration partition corresponding to each target node according to the latest state of the respective partitions and the average number of partitions of the pre-expansion and post-expansion nodes calculated by the processing sub-unit 610, and obtain The correspondence between the target node, the source node, and the migration partition on the source node.
  • the determining unit 410 is specifically configured to: update the partition state table according to the state of each partition currently undergoing the balancing process, and obtain the latest state of each partition, where the state of each partition is stored.
  • the latest state of each partition is determined; partition balancing processing is performed according to the latest state of each partition, and the correspondence relationship between the source node, the migration partition on the source node, and the target node is obtained;
  • the target node in the correspondence relationship sends a migration task.
  • the migration task includes: in the correspondence relationship, a source node corresponding to the target node and a migration partition on the source node; and the migration task is used to indicate the target node.
  • a data migration between a target node corresponding to the target node is triggered, and the data migration is to migrate data in the migration partition on the source node to the target node. This enables partition balancing of distributed storage systems.
  • the embodiment of the present invention further provides a control server in a distributed storage system.
  • the control server 700 includes: a processor 710, a memory 720, a transceiver 730, and a bus. 740;
  • the processor 710, the memory 720, and the transceiver 730 are connected to each other through a bus 740; the bus 740 may be an ISA bus, a PCI bus, or an EISA bus.
  • the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 7, but it does not mean that there is only one bus or one type of bus.
  • the memory 720 is configured to store a program.
  • the program may include program code, and the program code package Includes computer operating instructions.
  • Memory 720 may include high speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
  • the processor 710 executes the program code, when used for partition balancing, determines the latest state of each partition; performs partition balancing processing according to the latest state of each partition, and obtains a source node, a migration partition on the source node, and a target node. Correspondence between the three;
  • the transceiver 730 is used to connect to other devices and to communicate with other devices. Specifically, the transceiver 730 is configured to: send a migration task to the target node in the corresponding relationship; the migration task includes: in the corresponding relationship, the source node corresponding to the target node and the migration on the source node The migration task is used to indicate that the target node triggers data migration between the target node and the source node corresponding to the target node, and the data migration is to migrate data in the migration partition on the source node to the target node.
  • the partition balancing processing is data recovery processing
  • the processor 710 is specifically configured to: determine, according to the following principles, a target node corresponding to each migration zone: the replica partitions of the same partition are not in the same node, or in the same frame, or in the same chassis.
  • the partition balancing process is an online capacity expansion process; the processor 710 is specifically configured to:
  • the processor 710 is specifically configured to implement the determining the latest state of each partition by: updating the partition state table according to the state of each partition currently undergoing balancing processing, obtaining the latest state of each partition, The status of each partition is stored in the partition status table.
  • the latest state of each partition is determined;
  • the latest state performs partition balancing processing to obtain a correspondence relationship between the source node, the migration partition on the source node, and the target node; and sends a migration task to the target node in the corresponding relationship, so that the target node triggers the target node and the target node
  • the data migration between the corresponding source nodes migrates the data in the migration partition on the source node to the target node, thereby realizing the partition balancing of the distributed storage system.
  • the technical solution in the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product, which may be stored in a storage medium such as a ROM/RAM. , a disk, an optical disk, etc., including instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention or portions of the embodiments.
  • a computer device which may be a personal computer, server, or network device, etc.

Abstract

公开一种分布式存储系统中的分区平衡方法、装置及控制服务器,所述方法包括:需要进行分区平衡时,确定各个分区的最新状态;根据各个分区的最新状态进行分区平衡处理,得到源节点、源节点上的迁移分区以及目标节点之间的对应关系;向所述对应关系中的目标节点发送迁移任务;所述迁移任务中包括:在所述对应关系中,所述目标节点对应的源节点以及源节点上的迁移分区;所述迁移任务用于指示目标节点触发目标节点与所述目标节点对应的源节点之间的数据迁移,所述数据迁移是将源节点上迁移分区中的数据迁移至目标节点。本申请能够实现分布式存储系统的分区平衡,也即实现数据恢复和在线扩容。

Description

分布式存储系统中的分区平衡方法、 装置及服务器
技术领域 本发明涉及通信领域,尤其涉及一种分布式存储系统中的分区平衡方法、装置及 服务器。 背景技术 随着计算机技术和网络技术的发展,信息量呈现几何级数的增长, 人类的数据达 到前所未有的规模,对这些超大规模数据的存储和管理已经成为工业界一大挑战。用 传统的集中存储管理超大规模数据时,无法提供高效的读写操作,无法满足良好的扩 展性以及高可用性。在这种背景下, 出现了各种基于非关系型数据库的分布式存储系 统。
只要涉及到数据存储, 就必然存在数据损坏后的恢复操作。在各种基于非关系型 数据库的分布式存储系统中, 因为存储规模庞大, 所以单点故障会成为系统的常态。 所述分布式存储系统中一般都保存有多份副本,所以, 维持数据的副本数量稳定也成 为系统的迫切需求。 另外, 随着人们对存储系统可持续工作需求的日益剧增, 分布式 存储系统的在线扩容也成为系统基本功能的不可或缺部分。那么怎么在系统数据有损 坏的情况下尽快的做好数据恢复、 系统容量不足时如何及时做好系统的在线扩容需 求, 成为当前技术的重点。 所述数据恢复和在线扩容一般被统称为分区平衡。
目前, 没有关于分布式存储系统分区平衡的技术方案公开。 发明内容
本发明实施例提供一种分布式存储系统中的分区平衡方法、装置及服务器, 能够 实现分布式存储系统的分区平衡, 也即实现数据恢复和在线扩容。
为了解决上述技术问题, 本发明实施例公开了如下技术方案:
第一方面, 本发明实施例提供一种分布式存储系统中的分区平衡方法, 包括: 需要进行分区平衡时, 确定各个分区的最新状态;
根据各个分区的最新状态进行分区平衡处理, 得到源节点、源节点上的迁移分区 以及目标节点三者之间的对应关系;
向所述对应关系中的目标节点发送迁移任务; 所述迁移任务中包括: 在所述对应 关系中,所述目标节点对应的源节点以及源节点上的迁移分区; 所述迁移任务用于指 示目标节点触发目标节点与对应的源节点之间的数据迁移,所述数据迁移是将源节点 上迁移分区中的数据迁移至目标节点。
结合上述第一方面, 在第一种可能的实现方式中, 所述分区平衡处理为数据恢复 处理; 所述根据各个分区的最新状态进行分区平衡处理包括:
统计处于故障状态的节点上的分区, 将统计得到的分区作为故障分区; 对于每个故障分区, 确定故障分区的副本分区, 从故障分区的副本分区中确定一 个处于参与允许状态的副本分区作为该故障分区的迁移分区,将所述迁移分区所在的 节点作为源节点;
确定每个迁移分区对应的目标节点, 得到源节点、源节点上的迁移分区以及目标 节点之间的对应关系。
结合上述第一种可能的实现方式, 在第二种可能的实现方式中, 所述确定每个迁 移分区对应的目标节点包括:
根据以下原则确定每个迁移分区对应的目标节点:同一分区的副本分区不在同一 节点、 或同一框、 或同一机架。
结合上述第一方面, 在第三种可能的实现方式中, 所述分区平衡处理为在线扩容 处理; 所述根据各个分区的最新状态进行分区平衡处理包括:
分别计算扩容前和扩容后节点的平均分区数, 并且, 确定新增加的节点为目标节 点;
根据所述各个分区的最新状态以及所述扩容前和扩容后节点的平均分区数确定 各个目标节点对应的源节点和迁移分区,得到目标节点、源节点以及源节点上迁移分 区之间的对应关系。
结合上述第一方面, 和 /或, 第一种可能的实现方式, 和 /或, 第二种可能的实现 方式, 和 /或, 第三种可能的实现方式, 在第四种可能的实现方式中, 确定各个分区 的最新状态包括:
根据当前正在进行平衡处理的各个分区的状态更新分区状态表,得到各个分区的 最新状态, 所述分区状态表中存储有各个分区的状态。
第二方面, 本发明实施例提供一种分布式存储系统中的分区平衡装置, 包括: 确定单元, 用于需要进行分区平衡时, 确定各个分区的最新状态;
处理单元, 用于根据各个分区的最新状态进行分区平衡处理, 得到源节点、源节 点上的迁移分区以及目标节点三者之间的对应关系; 发送单元, 用于向所述对应关系中的目标节点发送迁移任务; 所述迁移任务中包 括: 在所述对应关系中, 所述目标节点对应的源节点以及源节点上的迁移分区; 所述 迁移任务用于指示目标节点触发目标节点与对应的源节点之间的数据迁移,所述数据 迁移是将源节点上迁移分区中的数据迁移至目标节点。
结合上述第二方面, 在第一种可能的实现方式中, 所述分区平衡处理为数据恢复 处理; 所述处理单元具体包括:
统计子单元, 用于统计处于故障状态的节点上的分区, 将统计得到的分区作为故 障分区;
第一确定子单元, 用于对于每个故障分区, 确定故障分区的副本分区, 从故障分 区的副本分区中确定一个处于参与允许状态的副本分区作为该故障分区的迁移分区, 将所述迁移分区所在的节点作为源节点;
第二确定子单元, 用于确定每个迁移分区对应的目标节点, 得到源节点、源节点 上的迁移分区以及目标节点之间的对应关系。
结合上述第一种可能的实现方式, 在第二种可能的实现方式中, 第二确定单元具 体用于: 根据以下原则确定每个迁移分区对应的目标节点: 同一分区的副本分区不在 同一节点、 或同一框、 或同一机架。
结合上述第二方面, 在第三种可能的实现方式中, 所述分区平衡处理为在线扩容 处理; 所述处理单元具体包括:
处理子单元, 用于分别计算扩容前和扩容后节点的平均分区数, 并且, 确定新增 加的节点为目标节点;
第三确定子单元,用于根据所述各个分区的最新状态以及所述扩容前和扩容后节 点的平均分区数确定各个目标节点对应的源节点和迁移分区,得到目标节点、源节点 以及源节点上迁移分区之间的对应关系。
结合上述第二方面, 和 /或, 第一种可能的实现方式, 和 /或, 第二种可能的实现 方式, 和 /或, 第三种可能的实现方式, 在第四种可能的实现方式中, 所述确定单元 具体用于: 根据当前正在进行平衡处理的各个分区的状态更新分区状态表,得到各个 分区的最新状态, 所述分区状态表中存储有各个分区的状态。
第三方面, 本发明实施例提供一种分布式存储系统中的控制服务器, 包括: 处理器, 用于需要进行分区平衡时, 确定各个分区的最新状态; 根据各个分区的 最新状态进行分区平衡处理,得到源节点、源节点上的迁移分区以及目标节点三者之 间的对应关系; 收发器,用于向所述对应关系中的目标节点发送迁移任务;所述迁移任务中包括: 在所述对应关系中,所述目标节点对应的源节点以及源节点上的迁移分区; 所述迁移 任务用于指示目标节点触发目标节点与对应的源节点之间的数据迁移,所述数据迁移 是将源节点上迁移分区中的数据迁移至目标节点。
结合上述第三方面, 在第一种可能的实现方式中, 所述分区平衡处理为数据恢复 处理; 所述处理器具体用于:
统计处于故障状态的节点上的分区, 将统计得到的分区作为故障分区; 对于每个故障分区, 确定故障分区的副本分区, 从故障分区的副本分区中确定一 个处于参与允许状态的副本分区作为该故障分区的迁移分区,将所述迁移分区所在的 节点作为源节点;
确定每个迁移分区对应的目标节点, 得到源节点、源节点上的迁移分区以及目标 节点之间的对应关系。
结合上述第一种可能的实现方式, 在第二种可能的实现方式中, 所述处理器具体 用于: 根据以下原则确定每个迁移分区对应的目标节点: 同一分区的副本分区不在同 一节点、 或同一框、 或同一机架。
结合上述第三方面, 在第三种可能的实现方式中, 所述分区平衡处理为在线扩容 处理; 所述处理器具体用于:
分别计算扩容前和扩容后节点的平均分区数, 并且, 确定新增加的节点为目标节 点;
根据所述各个分区的最新状态以及所述扩容前和扩容后节点的平均分区数确定 各个目标节点对应的源节点和迁移分区,得到目标节点、源节点以及源节点上迁移分 区之间的对应关系。
结合上述第三方面, 和 /或, 第一种可能的实现方式, 和 /或, 第二种可能的实现 方式, 和 /或, 第三种可能的实现方式, 在第四种可能的实现方式中, 所述处理器具 体用于: 根据当前正在进行平衡处理的各个分区的状态更新分区状态表,得到各个分 区的最新状态, 所述分区状态表中存储有各个分区的状态。
本发明实施例中, 需要进行分区平衡时, 确定各个分区的状态; 根据各个分区的 状态进行分区平衡处理,得到源节点以及源节点上的迁移分区与目标节点之间的对应 关系; 向所述对应关系中的目标节点发送迁移任务, 以便目标节点根据所述迁移任务 完成分区迁移; 所述迁移任务中包括: 所述目标节点对应的源节点以及源节点上的迁 移分区, 从而实现了分布式存储系统的分区平衡。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现 有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅 是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前 提下, 还可以根据这些附图获得其他的附图。
图 1A为本发明分布式存储系统结构示意图;
图 1为本发明分布式存储系统中的分区平衡方法第一实施例示意图;
图 2为本发明分布式存储系统中的分区平衡方法第二实施例示意图;
图 3为本发明分布式存储系统中的分区平衡方法第三实施例示意图;
图 4为本发明实施例分布式存储系统中的分区平衡装置结构示意图;
图 5为本发明实施例分区平衡装置中处理单元的一种实现结构示意图; 图 6为本发明实施例分区平衡装置中处理单元的另一种实现结构示意图; 图 7为本发明实施例分布式存储系统中控制服务器的结构示意图。 具体实施方式
为了使本技术领域的人员更好地理解本发明实施例中的技术方案,并使本发明实 施例的上述目的、特征和优点能够更加明显易懂, 下面结合附图对本发明实施例中技 术方案作进一步详细的说明。
参见图 1A,为本发明实施例分区平衡方法所应用的分布式存储系统结构示意图, 其中, 在分布式存储系统中包括由若干个节点 110构成的节点网络 120; 所述节点网 络 120与控制服务器 130连接,所述控制服务器 130可以与节点网络 120中的各个节 点 110直接连接, 或者通过节点网络 120连接。
参见图 1, 为本发明分布式存储系统中的分区平衡方法第一实施例示意图, 该方 法包括:
步骤 101 : 需要进行分区平衡时, 确定各个分区的最新状态;
步骤 102: 根据各个分区的最新状态进行分区平衡处理, 得到源节点、 源节点上 的迁移分区以及目标节点三者之间的对应关系;
其中,所述源节点是指迁出数据的节点;迁移分区是指源节点上迁出数据的分区; 目标节点是指接收数据的节点。
步骤 103 : 向所述对应关系中的目标节点发送迁移任务; 所述迁移任务中包括: 在所述对应关系中,所述目标节点对应的源节点以及源节点上的迁移分区; 所述迁移 任务用于指示目标节点触发目标节点与所述目标节点对应的源节点之间的数据迁移, 所述数据迁移是将源节点上迁移分区中的数据迁移至目标节点。
图 1所示的方法中, 需要进行分区平衡时, 确定各个分区的最新状态; 根据各个 分区的最新状态进行分区平衡处理,得到源节点、源节点上的迁移分区以及目标节点 三者之间的对应关系; 向所述对应关系中的目标节点发送迁移任务; 所述迁移任务中 包括: 在所述对应关系中, 所述目标节点对应的源节点以及源节点上的迁移分区; 所 述迁移任务用于指示目标节点触发目标节点与所述目标节点对应的源节点之间的数 据迁移,所述数据迁移是将源节点上迁移分区中的数据迁移至目标节点。从而实现了 分布式存储系统的分区平衡。 首先对本发明实施例中所述分区的状态进行说明。
首先, 分区所处情况可以根据分区是否参与分区平衡处理划分为: 参与分区平衡 处理和未参与分区平衡处理两种情况;
进一步的, 在分区参与分区平衡处理的情况下, 又可以按照不同的分区平衡处理 对分区所处情况进一步进行划分, 具体为:
当分区平衡处理为数据恢复处理时, 分为以下两种情况:
一是作为源节点上的迁移分区;此时,由于迁移分区是故障分区的一个副本分区, 因此, 数据恢复处理完成后, 该迁移分区不会被删除;
二是作为目标节点中接收数据的分区;
当分区平衡处理为在线扩容处理时, 分为以下两种情况:
一是作为源节点上的迁移分区; 此时, 由于是将迁移分区上的数据转换到目标节 点上的分区进行存储, 因此, 迁移分区上的数据全部发送给目标节点后, 该迁移分区 将被删除;
二是作为目标节点上接收数据的分区。
优选地, 在一种可能的实现方式中, 可以依照以上五种情况, 将分区状态划分为 三种状态:
第一种为参与允许状态, 表示该分区的数据是完整的, 可以参与新的分区平衡处 理; 该状态包含以下两种情况: 一种情况是该分区未参与分区平衡处理; 另一种情况 是该分区正在参与某一个或多个分区平衡处理中的数据恢复过程,作为源节点上的迁 移分区; 第二种为数据不完整状态, 表示该分区的数据不完整, 不可以参与新的分区平衡 处理; 该状态包括以下两种情况: 一种情况是该分区正在参与数据恢复过程, 作为目 标节点中接收数据的分区; 另一种情况是该分区正在参与在线扩容过程, 作为目标节 点中接收数据的分区;
第三种为即将删除状态, 表示该分区数据是完整的, 但是不可以参与新的分区平 衡处理, 且数据发送完毕后该分区将被删除。
在后续的实施例中, 分区状态也以上述的划分为例进行说明。 当然, 在实际应用 中, 分区状态划分也可以有其他的实现方式, 这里仅为示例, 并不对分区状态如何划 分进行限定。 参见图 2, 为本发明分布式存储系统中的分区平衡方法第二实施例示意图, 该方 法中以分区平衡处理为数据恢复处理为例, 该方法包括:
步骤 201 : 对于分布式存储系统中的每一节点, 控制服务器检测该节点状态为正 常或故障, 检测到节点状态为故障时, 执行步骤 202; 检测到节点状态为正常时, 返 回步骤 201继续进行检测。
控制服务器检测节点状态为故障时,表明需要对节点上的分区数据进行数据恢复 处理, 执行步骤 202。
步骤 202: 控制服务器根据当前正在进行平衡处理的各个分区的状态更新分区状 态表, 得到各个分区的最新状态, 所述分区状态表中存储有各个分区的状态。
步骤 203 : 控制服务器根据各个分区的最新状态以及处于故障状态的节点进行数 据恢复处理, 生成源节点、 源节点上的迁移分区以及目标节点三者之间的对应关系。
控制服务器根据各个分区的最新状态以及处于故障状态的节点进行数据恢复处 理具体可以包括:
统计处于故障状态的节点上的分区, 将统计得到的分区作为故障分区; 对于每个故障分区, 确定故障分区的副本分区, 从故障分区的副本分区中确定一 个处于参与允许状态的副本分区作为该故障分区的迁移分区,将所述迁移分区所在的 节点作为源节点;
确定每个迁移分区对应的目标节点, 得到目标节点、源节点以及源节点上迁移分 区三者之间的对应关系。
其中, 每个故障分区的处于参与允许状态的副本分区可能不止一个, 在一种可能 的实现方式中,可以从处于参与允许状态的副本分区中任一选择一个副本分区作为迁 移分区;
或者, 某个故障分区可能不存在处于参与允许状态的副本分区, 此时, 可以认为 该故障分区的迁移分区缺省, 则该故障分区将不存在对应的迁移分区和目标节点。
在一种可能的实现方式中,所述根据所述各个分区的最新状态确定每个迁移分区 的目标节点时, 可以遵从以下两个原则实现:
1、 同一分区的副本分区不在同一节点、 或同一框、 或同一机架, 以满足数据的 安全性; 其中, 所述节点可以为硬盘等存储设备, 而多个节点组成所述框; 多个所述 框构成所述机架。
2、 根据节点的平均分区数, 将故障分区均匀的迁移到其他正常节点; 其中, 节 点的平均分区数等于: 总分区数 /正常节点数。
在第 1个原则下, 在确定目标节点时, 最好选择不包含故障分区的副本分区的节 点作为所述故障分区的迁移分区对应的目标节点;
在第 2个原则下, 在确定目标节点时, 最好选择实际分区数低于所述平均分区数 的正常节点作为目标节点;
对于某个迁移分区, 满足以上两个原则的节点可能有多个, 在一种可能的实现方 式中, 可以从中随机选择一个节点作为该迁移分区的目标节点。
步骤 204: 控制服务器向所述对应关系中的每个目标节点发送迁移任务; 所述迁 移任务中包括: 在所述对应关系中,所述目标节点对应的源节点以及源节点上的迁移 分区。
步骤 205 : 所述目标节点向控制服务器发送任务接收确认信息, 并且, 根据所述 迁移任务, 向所述迁移任务中的源节点发送数据请求,所述数据请求包括源节点上的 迁移分区。
所述数据请求用于向源节点请求所述迁移分区中的数据。
其中, 目标节点向控制服务器发送所述任务接收确认信息为可选步骤。
步骤 206: 所述源节点将本地的迁移分区上的数据发送给目标节点。
本发明实施例中,控制服务器根据各个分区的最新状态以及处于故障状态的节点 进行数据恢复处理, 生成源节点、源节点上的迁移分区以及目标节点三者之间的对应 关系, 向所述对应关系中的目标节点发送迁移任务, 从而所述目标节点根据所述迁移 任务与源节点之间实现数据迁移, 从而实现了分布式存储系统中的数据恢复处理。 参见图 3, 为本发明分布式存储系统中的分区平衡方法第二实施例示意图, 该方 法中以分区平衡处理为在线扩容为例, 该方法包括:
步骤 301 : 控制服务器接收扩容请求, 所述扩容请求用于请求控制服务器进行扩 容处理。
其中, 所述扩容请求可以由第三方设备发送, 或者, 也可以由使用控制服务器的 用户通过触发控制服务器提供的扩容功能实现, 或者, 也可以在满足某些预设条件例 如分布式存储系统中新增加的节点数量达到某一数量阈值等时由控制服务器自动触 发, 这里并不限定。
步骤 302: 控制服务器根据当前正在进行平衡处理的各个分区的状态更新分区状 态表, 得到各个分区的最新状态, 所述分区状态表中存储有各个分区的状态。
步骤 303 :控制服务器根据各个分区的最新状态进行在线扩容处理,生成源节点、 源节点上的迁移分区以及目标节点三者之间的对应关系。
优选地,所述控制服务器根据各个分区的最新状态进行在线扩容处理具体可以包 括:
控制服务器分别计算扩容前和扩容后节点的平均分区数, 并且, 确定新增加的节 点为目标节点; 其中, 节点的平均分区数等于: 总分区数 /正常节点数;
控制服务器根据所述各个分区的最新状态以及所述扩容前和扩容后节点的平均 分区数确定各个目标节点对应的源节点和迁移分区,得到源节点、源节点上的迁移分 区以及目标节点三者之间的对应关系。
其中, 控制服务器确定目标节点时, 可以将分布式存储系统中新增加的节点作为 目标节点。 控制服务器具体如何获取到这些新增加的节点的信息这里并不限定。
其中, 控制服务器确定各个目标节点对应的源节点和迁移分区时, 所述扩容前节 点的平均分区数和扩容后节点的平均分区数可以用于确定各个节点上迁移分区的数 量; 例如, 在一种可能的实现方式中, 平均每个节点上迁移分区的数量 =扩容前节点 的平均分区数一扩容后节点的平均分区数;因为迁移分区一般需要为处于参与允许状 态的分区, 因此,各个分区的最新状态可以用于确定节点上具体哪些分区可以作为迁 移分区; 另外, 在确定目标节点对应的源节点和迁移分区时, 一般还可以遵从以下两 个原则: 1、 同一分区的副本分区不在同一节点、 或同一机框、 或同一机架, 以满足 数据的安全性; 2、 根据扩容前节点的平均分区数和扩容后节点的平均分区数, 将分 区迁移到目标节点, 而使目标节点上的分区数接近或等于平均分区数。
在基于以上条件和说明的基础上,控制服务器具体如何实现所述根据所述各个分 区的最新状态以及所述扩容前和扩容后节点的平均分区数确定各个目标节点对应的 源节点和迁移分区, 这里并不限定。
步骤 304: 控制服务器向所述对应关系中的每个目标节点发送迁移任务; 所述迁 移任务中包括: 在所述对应关系中,所述目标节点对应的源节点以及源节点上的迁移 分区。
步骤 305 : 所述目标节点向控制服务器发送任务接收确认信息, 并且, 根据所述 迁移任务, 向所述迁移任务中的源节点发送数据请求,所述数据请求包括源节点上的 迁移分区;
所述目标节点向控制服务器发送任务接收确认信息为可选步骤。
步骤 306: 所述源节点将所述数据请求中包含的迁移分区上的数据发送给目标节 点。
本发明实施例中,控制服务器根据各个分区的最新状态以及扩容请求进行在线扩 容处理, 生成源节点、源节点上的迁移分区以及目标节点之间的对应关系, 向所述对 应关系中的目标节点发送迁移任务,从而所述目标节点根据所述迁移任务与源节点之 间实现数据迁移, 从而实现分布式存储系统的在线扩容。 与上述方法相对应的,本发明实施例还提供一种分布式存储系统中的分区平衡装 置, 参见图 4, 该装置 400包括:
确定单元 410, 用于需要进行分区平衡时, 确定各个分区的最新状态; 处理单元 420, 用于根据确定单元 410确定的各个分区的最新状态进行分区平衡 处理, 得到源节点、 源节点上的迁移分区以及目标节点三者之间的对应关系;
发送单元 430, 用于向处理单元 420得到的所述对应关系中的目标节点发送迁移 任务; 所述迁移任务中包括: 在所述对应关系中, 所述目标节点对应的源节点以及源 节点上的迁移分区;所述迁移任务用于指示目标节点触发目标节点与所述目标节点对 应的源节点之间的数据迁移,所述数据迁移是将源节点上迁移分区中的数据迁移至目 标节点。
在第一种可能的实现方式中, 所述分区平衡处理可以为数据恢复处理; 参见图 5 所示, 所述处理单元 420具体可以包括:
统计子单元 510, 用于统计处于故障状态的节点上的分区, 将统计得到的分区作 为故障分区;
第一确定子单元 520, 用于对于统计子单元 510统计得到的每个故障分区, 确定 故障分区的副本分区,从故障分区的副本分区中确定一个处于参与允许状态的副本分 区作为该故障分区的迁移分区, 将所述迁移分区所在的节点作为源节点;
第二确定子单元 530, 用于确定第一确定子单元 520所确定的每个迁移分区对应 的目标节点, 得到源节点、 源节点上的迁移分区以及目标节点之间的对应关系。
优选地, 第二确定单元 530具体可以用于: 根据以下原则确定每个迁移分区对应 的目标节点: 同一分区的副本分区不在同一节点、 或同一框、 或同一机架。
在第二种可能的实现方式中,所述分区平衡处理可以为在线扩容处理;参见图 6, 所述处理单元 420具体可以包括:
处理子单元 610, 用于分别计算扩容前和扩容后节点的平均分区数, 并且, 确定 新增加的节点为目标节点;
第三确定子单元 620, 用于根据所述各个分区的最新状态以及处理子单元 610计 算得到的所述扩容前和扩容后节点的平均分区数确定各个目标节点对应的源节点和 迁移分区, 得到目标节点、 源节点以及源节点上迁移分区之间的对应关系。
优选地, 所述确定单元 410具体可以用于: 根据当前正在进行平衡处理的各个分 区的状态更新分区状态表,得到各个分区的最新状态,所述分区状态表中存储有各个 分区的状态。
本实施例中, 需要进行分区平衡时, 确定各个分区的最新状态; 根据各个分区的 最新状态进行分区平衡处理,得到源节点、源节点上的迁移分区以及目标节点之间的 对应关系; 向所述对应关系中的目标节点发送迁移任务; 所述迁移任务中包括: 在所 述对应关系中,所述目标节点对应的源节点以及源节点上的迁移分区; 所述迁移任务 用于指示目标节点触发目标节点与所述目标节点对应的源节点之间的数据迁移,所述 数据迁移是将源节点上迁移分区中的数据迁移至目标节点。从而实现了分布式存储系 统的分区平衡。 与上述方法和装置相对应的,本发明实施例还提供一种分布式存储系统中的控制 服务器, 参见图 7所示, 该控制服务器 700包括: 处理器 710、 存储器 720、 收发器 730和总线 740;
处理器 710、 存储器 720、 收发器 730通过总线 740相互连接; 总线 740可以是 ISA总线、 PCI总线或 EISA总线等。 所述总线可以分为地址总线、 数据总线、 控制 总线等。 为便于表示, 图 7中仅用一条粗线表示, 但并不表示仅有一根总线或一种类 型的总线。
存储器 720, 用于存放程序。 具体地, 程序可以包括程序代码, 所述程序代码包 括计算机操作指令。 存储器 720可能包含高速 RAM存储器, 也可能还包括非易失性 存储器 (non- volatile memory), 例如至少一个磁盘存储器。
所述处理器 710执行所述程序代码, 用于需要进行分区平衡时, 确定各个分区的 最新状态; 根据各个分区的最新状态进行分区平衡处理, 得到源节点、源节点上的迁 移分区以及目标节点三者之间的对应关系;
收发器 730用于连接其他设备, 并与其他设备进行通信。 具体的, 收发器 730用 于: 向所述对应关系中的目标节点发送迁移任务; 所述迁移任务中包括: 在所述对应 关系中,所述目标节点对应的源节点以及源节点上的迁移分区; 所述迁移任务用于指 示目标节点触发目标节点与所述目标节点对应的源节点之间的数据迁移,所述数据迁 移是将源节点上迁移分区中的数据迁移至目标节点。
在第一种可能的实现方式中, 所述分区平衡处理为数据恢复处理; 所述处理器
710具体用于:
统计处于故障状态的节点上的分区, 将统计得到的分区作为故障分区; 对于每个故障分区, 确定故障分区的副本分区, 从故障分区的副本分区中确定一 个处于参与允许状态的副本分区作为该故障分区的迁移分区,将所述迁移分区所在的 节点作为源节点;
确定每个迁移分区对应的目标节点, 得到源节点、源节点上的迁移分区以及目标 节点之间的对应关系。
优选地, 所述处理器 710具体可以用于: 根据以下原则确定每个迁移分区对应的 目标节点: 同一分区的副本分区不在同一节点、 或同一框、 或同一机架。
在第二种可能的实现方式中, 所述分区平衡处理为在线扩容处理; 所述处理器 710具体用于:
分别计算扩容前和扩容后节点的平均分区数, 并且, 确定新增加的节点为目标节 点;
根据所述各个分区的最新状态以及所述扩容前和扩容后节点的平均分区数确定 各个目标节点对应的源节点和迁移分区,得到目标节点、源节点以及源节点上迁移分 区之间的对应关系。
优选地,所述处理器 710具体可以用于通过以下方式实现所述确定各个分区的最 新状态: 根据当前正在进行平衡处理的各个分区的状态更新分区状态表,得到各个分 区的最新状态, 所述分区状态表中存储有各个分区的状态。
本实施例中, 需要进行分区平衡时, 确定各个分区的最新状态; 根据各个分区的 最新状态进行分区平衡处理,得到源节点、源节点上的迁移分区以及目标节点之间的 对应关系; 向所述对应关系中的目标节点发送迁移任务, 从而目标节点触发目标节点 与所述目标节点对应的源节点之间的数据迁移,将源节点上迁移分区中的数据迁移至 目标节点, 从而实现了分布式存储系统的分区平衡。 本领域的技术人员可以清楚地了解到本发明实施例中的技术可借助软件加必需 的通用硬件平台的方式来实现。基于这样的理解,本发明实施例中的技术方案本质上 或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产 品可以存储在存储介质中, 如 ROM/RAM、磁碟、光盘等, 包括若干指令用以使得一 台计算机设备(可以是个人计算机, 服务器, 或者网络设备等)执行本发明各个实施 例或者实施例的某些部分所述的方法。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部 分互相参见即可, 每个实施例重点说明的都是与其他实施例的不同之处。尤其, 对于 系统实施例而言, 由于其基本相似于方法实施例, 所以描述的比较简单, 相关之处参 见方法实施例的部分说明即可。
以上所述的本发明实施方式, 并不构成对本发明保护范围的限定。任何在本发明 的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明的保护范围之 内。

Claims

权 利 要 求
1、 一种分布式存储系统中的分区平衡方法, 其特征在于, 包括: 需要进行分区平衡时, 确定各个分区的最新状态;
根据各个分区的最新状态进行分区平衡处理, 得到源节点、源节点上的迁移 分区以及目标节点三者之间的对应关系;
向所述对应关系中的目标节点发送迁移任务; 所述迁移任务中包括: 在所述 对应关系中, 所述目标节点对应的源节点以及源节点上的迁移分区; 所述迁移任 务用于指示目标节点触发目标节点与对应的源节点之间的数据迁移,所述数据迁 移是将源节点上迁移分区中的数据迁移至目标节点。
2、 根据权利要求 1所述的方法, 其特征在于, 所述分区平衡处理为数据恢 复处理; 所述根据各个分区的最新状态进行分区平衡处理包括:
统计处于故障状态的节点上的分区, 将统计得到的分区作为故障分区; 对于每个故障分区, 确定故障分区的副本分区, 从故障分区的副本分区中确 定一个处于参与允许状态的副本分区作为该故障分区的迁移分区,将所述迁移分 区所在的节点作为源节点;
确定每个迁移分区对应的目标节点, 得到源节点、源节点上的迁移分区以及 目标节点之间的对应关系。
3、 根据权利要求 2所述的方法, 其特征在于, 所述确定每个迁移分区对应 的目标节点包括:
根据以下原则确定每个迁移分区对应的目标节点:同一分区的副本分区不在 同一节点、 或同一框、 或同一机架。
4、 根据权利要求 1所述的方法, 其特征在于, 所述分区平衡处理为在线扩 容处理; 所述根据各个分区的最新状态进行分区平衡处理包括:
分别计算扩容前和扩容后节点的平均分区数, 并且, 确定新增加的节点为目 标节点;
根据所述各个分区的最新状态以及所述扩容前和扩容后节点的平均分区数 确定各个目标节点对应的源节点和迁移分区, 得到目标节点、源节点以及源节点 上迁移分区之间的对应关系。
5、 根据权利要求 1至 4任一项所述的方法, 其特征在于, 确定各个分区的 最新状态包括:
根据当前正在进行平衡处理的各个分区的状态更新分区状态表,得到各个分 区的最新状态, 所述分区状态表中存储有各个分区的状态。
6、 一种分布式存储系统中的分区平衡装置, 其特征在于, 包括: 确定单元, 用于需要进行分区平衡时, 确定各个分区的最新状态; 处理单元, 用于根据各个分区的最新状态进行分区平衡处理, 得到源节点、 源节点上的迁移分区以及目标节点三者之间的对应关系;
发送单元, 用于向所述对应关系中的目标节点发送迁移任务; 所述迁移任务 中包括: 在所述对应关系中, 所述目标节点对应的源节点以及源节点上的迁移分 区;所述迁移任务用于指示目标节点触发目标节点与对应的源节点之间的数据迁 移, 所述数据迁移是将源节点上迁移分区中的数据迁移至目标节点。
7、 根据权利要求 6所述的装置, 其特征在于, 所述分区平衡处理为数据恢 复处理; 所述处理单元具体包括:
统计子单元, 用于统计处于故障状态的节点上的分区, 将统计得到的分区作 为故障分区;
第一确定子单元, 用于对于每个故障分区, 确定故障分区的副本分区, 从故 障分区的副本分区中确定一个处于参与允许状态的副本分区作为该故障分区的 迁移分区, 将所述迁移分区所在的节点作为源节点;
第二确定子单元, 用于确定每个迁移分区对应的目标节点, 得到源节点、 源 节点上的迁移分区以及目标节点之间的对应关系。
8、 根据权利要求 7所述的装置, 其特征在于, 第二确定单元具体用于: 根 据以下原则确定每个迁移分区对应的目标节点:同一分区的副本分区不在同一节 点、 或同一框、 或同一机架。
9、 根据权利要求 6所述的装置, 其特征在于, 所述分区平衡处理为在线扩 容处理; 所述处理单元具体包括:
处理子单元, 用于分别计算扩容前和扩容后节点的平均分区数, 并且, 确定 新增加的节点为目标节点;
第三确定子单元,用于根据所述各个分区的最新状态以及所述扩容前和扩容 后节点的平均分区数确定各个目标节点对应的源节点和迁移分区, 得到目标节 点、 源节点以及源节点上迁移分区之间的对应关系。
10、 根据权利要求 6至 9任一项所述的装置, 其特征在于, 所述确定单元具 体用于: 根据当前正在进行平衡处理的各个分区的状态更新分区状态表, 得到各 个分区的最新状态, 所述分区状态表中存储有各个分区的状态。
11、 一种分布式存储系统中的控制服务器, 其特征在于, 包括:
处理器, 用于需要进行分区平衡时, 确定各个分区的最新状态; 根据各个分 区的最新状态进行分区平衡处理, 得到源节点、源节点上的迁移分区以及目标节 点三者之间的对应关系;
收发器, 用于向所述对应关系中的目标节点发送迁移任务; 所述迁移任务中 包括:在所述对应关系中,所述目标节点对应的源节点以及源节点上的迁移分区; 所述迁移任务用于指示目标节点触发目标节点与对应的源节点之间的数据迁移, 所述数据迁移是将源节点上迁移分区中的数据迁移至目标节点。
12、 根据权利要求 11所述的控制服务器, 其特征在于, 所述分区平衡处理 为数据恢复处理; 所述处理器具体用于:
统计处于故障状态的节点上的分区, 将统计得到的分区作为故障分区; 对于每个故障分区, 确定故障分区的副本分区, 从故障分区的副本分区中确 定一个处于参与允许状态的副本分区作为该故障分区的迁移分区,将所述迁移分 区所在的节点作为源节点;
确定每个迁移分区对应的目标节点, 得到源节点、源节点上的迁移分区以及 目标节点之间的对应关系。
13、 根据权利要求 12所述的控制服务器, 其特征在于, 所述处理器具体用 于: 根据以下原则确定每个迁移分区对应的目标节点: 同一分区的副本分区不在 同一节点、 或同一框、 或同一机架。
14、 根据权利要求 11所述的控制服务器, 其特征在于, 所述分区平衡处理 为在线扩容处理; 所述处理器具体用于:
分别计算扩容前和扩容后节点的平均分区数, 并且, 确定新增加的节点为目 标节点;
根据所述各个分区的最新状态以及所述扩容前和扩容后节点的平均分区数 确定各个目标节点对应的源节点和迁移分区, 得到目标节点、源节点以及源节点 上迁移分区之间的对应关系。
15、 根据权利要求 11至 14任一项所述的控制服务器, 其特征在于, 所述处 理器具体用于: 根据当前正在进行平衡处理的各个分区的状态更新分区状态表, 得到各个分区的最新状态, 所述分区状态表中存储有各个分区的状态。
PCT/CN2012/087661 2012-12-27 2012-12-27 分布式存储系统中的分区平衡方法、装置及服务器 WO2014101044A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2012/087661 WO2014101044A1 (zh) 2012-12-27 2012-12-27 分布式存储系统中的分区平衡方法、装置及服务器
CN201280002939.0A CN103229487B (zh) 2012-12-27 2012-12-27 分布式存储系统中的分区平衡方法、装置及服务器

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/087661 WO2014101044A1 (zh) 2012-12-27 2012-12-27 分布式存储系统中的分区平衡方法、装置及服务器

Publications (1)

Publication Number Publication Date
WO2014101044A1 true WO2014101044A1 (zh) 2014-07-03

Family

ID=48838362

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/087661 WO2014101044A1 (zh) 2012-12-27 2012-12-27 分布式存储系统中的分区平衡方法、装置及服务器

Country Status (2)

Country Link
CN (1) CN103229487B (zh)
WO (1) WO2014101044A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108270851A (zh) * 2017-12-29 2018-07-10 广东南华工商职业学院 一种数据存储方法及装置

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103229487B (zh) * 2012-12-27 2015-09-09 华为技术有限公司 分布式存储系统中的分区平衡方法、装置及服务器
CN103718533B (zh) 2013-06-29 2015-06-10 华为技术有限公司 一种分区平衡子任务下发方法、装置与系统
CN104932986A (zh) * 2014-03-19 2015-09-23 中国移动通信集团公司 一种数据重分布方法及装置
CN104202435B (zh) * 2014-09-28 2017-10-31 北京奇虎科技有限公司 数据拖取的方法和装置
CN104199992B (zh) * 2014-09-28 2018-03-09 北京奇虎科技有限公司 数据拖取的方法和装置
CN104216803A (zh) * 2014-09-29 2014-12-17 北京奇艺世纪科技有限公司 一种退服节点的数据备份方法及装置
CN105338109B (zh) * 2015-11-20 2018-10-12 小米科技有限责任公司 分片调度方法、装置及分布式服务器系统
CN105653630B (zh) * 2015-12-25 2019-12-24 北京奇虎科技有限公司 分布式数据库的数据迁移方法与装置
CN105760431A (zh) * 2016-01-29 2016-07-13 杭州华三通信技术有限公司 一种文件块的迁移方法和装置
CN106407308A (zh) * 2016-08-31 2017-02-15 天津南大通用数据技术股份有限公司 一种分布式数据库的扩容方法及装置
CN108804018A (zh) * 2017-04-26 2018-11-13 华为技术有限公司 一种数据分区的方法及装置
CN107295063B (zh) * 2017-05-11 2018-09-04 腾讯科技(深圳)有限公司 在对等分布式系统中新增节点的方法及对等分布式系统
CN107948248A (zh) * 2017-11-01 2018-04-20 平安科技(深圳)有限公司 分布式存储方法、控制服务器及计算机可读存储介质
CN110213326B (zh) * 2019-04-15 2022-03-01 浙江大华技术股份有限公司 元数据节点集群的扩容方法、系统、设备和存储介质
CN110457167A (zh) * 2019-08-20 2019-11-15 北京博睿宏远数据科技股份有限公司 副本处理方法、装置、设备和介质
CN111580959B (zh) * 2020-04-26 2023-02-28 Oppo(重庆)智能科技有限公司 一种数据写入方法、数据写入装置、服务器及存储介质
CN111596868B (zh) * 2020-07-24 2020-10-09 南京鹏云网络科技有限公司 基于段单元的分布式存储系统的负载均衡方法和系统
CN112256433B (zh) * 2020-10-30 2022-04-05 上海哔哩哔哩科技有限公司 基于Kafka集群的分区迁移方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101013387A (zh) * 2007-02-09 2007-08-08 华中科技大学 基于对象存储设备的负载平衡方法
CN101442435A (zh) * 2008-12-25 2009-05-27 华为技术有限公司 分布式系统的业务数据管理方法、装置及分布式系统
CN102819535A (zh) * 2011-06-10 2012-12-12 戴尔产品有限公司 数据块迁移
CN103229487A (zh) * 2012-12-27 2013-07-31 华为技术有限公司 分布式存储系统中的分区平衡方法、装置及服务器

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7474618B2 (en) * 2005-03-02 2009-01-06 Objective Interface Systems, Inc. Partitioning communication system
CN101420326B (zh) * 2008-12-02 2011-02-16 华为技术有限公司 实现故障恢复和数据备份的方法、系统和装置
US8560628B2 (en) * 2011-01-11 2013-10-15 International Business Machines Corporation Supporting autonomous live partition mobility during a cluster split-brained condition
CN102664923A (zh) * 2012-03-30 2012-09-12 浪潮电子信息产业股份有限公司 一种利用Linux全局文件系统实现共享存储池的方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101013387A (zh) * 2007-02-09 2007-08-08 华中科技大学 基于对象存储设备的负载平衡方法
CN101442435A (zh) * 2008-12-25 2009-05-27 华为技术有限公司 分布式系统的业务数据管理方法、装置及分布式系统
CN102819535A (zh) * 2011-06-10 2012-12-12 戴尔产品有限公司 数据块迁移
CN103229487A (zh) * 2012-12-27 2013-07-31 华为技术有限公司 分布式存储系统中的分区平衡方法、装置及服务器

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108270851A (zh) * 2017-12-29 2018-07-10 广东南华工商职业学院 一种数据存储方法及装置
CN108270851B (zh) * 2017-12-29 2021-06-18 广东南华工商职业学院 一种数据存储方法及装置

Also Published As

Publication number Publication date
CN103229487B (zh) 2015-09-09
CN103229487A (zh) 2013-07-31

Similar Documents

Publication Publication Date Title
WO2014101044A1 (zh) 分布式存储系统中的分区平衡方法、装置及服务器
TWI307035B (en) Method and system for backing up remote mirror data on internet
US9405590B2 (en) Method, apparatus, and system for issuing partition balancing subtask
US9934242B2 (en) Replication of data between mirrored data sites
CN109995813B (zh) 一种分区扩展方法、数据存储方法及装置
WO2016070375A1 (zh) 一种分布式存储复制系统和方法
JP6434131B2 (ja) 分散処理システム、タスク処理方法、記憶媒体
KR20120018178A (ko) 객체 저장부들의 네트워크상의 스웜-기반의 동기화
CN105493474B (zh) 用于支持用于同步分布式数据网格中的数据的分区级别日志的系统及方法
JP4671399B2 (ja) データ処理システム
JP2011175357A5 (ja) 管理装置及び管理プログラム
CN105706056A (zh) 现代硬件上的故障域
CN113010496B (zh) 一种数据迁移方法、装置、设备和存储介质
CN107463342B (zh) 一种cdn边缘节点文件的存储方法及装置
US11768624B2 (en) Resilient implementation of client file operations and replication
WO2019148841A1 (zh) 一种分布式存储系统、数据处理方法和存储节点
CN107301090B (zh) 在存储服务器中为应用设置数据处理路径的方法及装置
KR101527634B1 (ko) 샤딩 서비스를 제공하는 방법 및 장치
JP6059558B2 (ja) 負荷分散判定システム
CN111124283A (zh) 一种存储空间管理方法、系统、电子设备及存储介质
JP2014229088A (ja) データ処理システム、データ処理装置および記憶媒体
Yu et al. Granary: A sharing oriented distributed storage system
US11099767B2 (en) Storage system with throughput-based timing of synchronous replication recovery
EP4198701A1 (en) Active-active storage system and data processing method based on same
KR101748913B1 (ko) 분산 저장 환경에서 게이트웨이를 선택하기 위한 클러스터 관리 방법 및 데이터 저장 시스템

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12890831

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12890831

Country of ref document: EP

Kind code of ref document: A1