WO2020000817A1 - 一种归置组所属硬盘分配方法、系统、装置及存储介质 - Google Patents

一种归置组所属硬盘分配方法、系统、装置及存储介质 Download PDF

Info

Publication number
WO2020000817A1
WO2020000817A1 PCT/CN2018/112052 CN2018112052W WO2020000817A1 WO 2020000817 A1 WO2020000817 A1 WO 2020000817A1 CN 2018112052 W CN2018112052 W CN 2018112052W WO 2020000817 A1 WO2020000817 A1 WO 2020000817A1
Authority
WO
WIPO (PCT)
Prior art keywords
hard disk
placement group
allocated
spare
placement
Prior art date
Application number
PCT/CN2018/112052
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 US16/981,708 priority Critical patent/US11314426B2/en
Publication of WO2020000817A1 publication Critical patent/WO2020000817A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0632Configuration or reconfiguration of storage systems by initialisation or re-initialisation of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0683Plurality of storage devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0683Plurality of storage devices
    • G06F3/0689Disk arrays, e.g. RAID, JBOD

Definitions

  • the present application relates to the technical field of data balanced distribution, and in particular, to a hard disk allocation method, system, device, and computer-readable storage medium to which a placement group belongs.
  • a distributed storage system consists of multiple storage pools, and each storage pool has its corresponding data distribution rules, such as copy rules or erasure rules.
  • the copy rule is to form exactly the same copy data as the original data file, that is, the complete data file is used for backup storage; taking the 4 + 2 erasure rule as an example, it means that a complete data is divided into different 4 According to the 4 data, according to the fixed erasure algorithm, calculate 2 redundant data, and then save the 6 data. After that, as long as you can read any 4 data from the 6 data at any time , You can restore the original data.
  • metadata is usually stored in a copy storage pool formed based on copy rules due to its small amount of data and high importance, while complete data files are stored in erasure pools.
  • the general storage pool is also divided into multiple placement groups (PGs), and each placement group contains several hard disks according to copy rules or erasure rules. For example, 4 + 2 erasure rules need to save 6 copies of data, usually 6 hard disks are needed to save the 6 copies of data, that is, each placement group will contain 6 hard disks.
  • the distribution of the placement group on the hard disk directly determines whether the data is evenly distributed in the cluster.
  • the current strategy for allocating hard disks for each placement group is generally to select the required hard disk according to a random algorithm, but the random algorithm can only guarantee the randomness of the placement group on the hard disk to a certain extent.
  • the uniformity of data distribution corresponding to the hard disk allocation method based on random algorithms can no longer meet the current requirements, so the uniformity of data distribution needs to be further improved.
  • the purpose of this application is to provide a hard disk allocation method to which a placement group belongs.
  • the concept of count of allocated placement groups is newly introduced, that is, each time a hard disk is allocated to a placement group, the corresponding allocated disk is assigned.
  • the set count is increased by one count unit, and an allocated placement group count table reflecting the respective allocated placement group counts of all candidate hard disks is established based on this to select a certain number of counts in ascending order.
  • Target hard disks These target hard disks have a smaller allocated placement group count compared to other spare hard disks, which means that the number of placement groups carried on these hard disks is smaller, because they are more suitable as component hard disks for the new placement group.
  • the placement group is more evenly distributed on the hard disk, which in turn makes the data distribution more uniform.
  • Another object of the present application is to provide a hard disk allocation system, device, and computer-readable storage medium to which a placement group belongs.
  • the present application provides a hard disk allocation method to which a placement group belongs, including:
  • the number of the allocated placement group counts is selected in ascending order from the allocated placement group count table, and the same number of spare hard disks as the number of hard disks required by the target placement group are obtained to obtain Target hard drives, including:
  • the hard disk allocation method to which the placement group belongs further includes:
  • the spare hard disk pool joining rule includes at least: the last increase of the allocated placement group count from the current time is greater than the preset time, the The allocated placement group count is less than the upper limit of the count, and at least one of the current storage space occupancy of each hard disk is less than the occupancy threshold;
  • the hard disk allocation method to which the placement group belongs further includes:
  • the present application also provides a hard disk allocation system to which a placement group belongs, including:
  • a spare hard disk allocated placement group count obtaining unit is used to obtain the allocated placement group count of each spare hard disk in the spare hard disk pool; where each hard disk is allocated to a placement group, the corresponding allocated placement group is allocated. Increase by one count unit;
  • An allocated placement group count table establishing unit configured to establish, according to each of the allocated placement group counts, an allocated placement group count table describing a correspondence between a hard disk and an allocated placement group count;
  • Small placement group count hard disk selecting unit for selecting the assigned placement group count value in ascending order from the allocated placement group count table to select the hard disk required for the target placement group Count the same number of spare hard disks to get the target hard disk;
  • a target hard disk allocation unit is configured to allocate the target hard disk to the target placement group.
  • the smaller placement group counting hard disk selecting unit includes:
  • Two consecutive spare hard disk selection subunits are used to select two consecutive spare hard disks from the allocated placement group count table each time in ascending order until the number of target hard disks and the The number of required hard disks is the same;
  • the same storage device determination subunit is used to determine whether two consecutive spare hard disks are on the same storage device
  • Non-identical storage device processing subunits configured to use the two spare hard disks on different storage devices as the target hard disk when two consecutive hard disks are on different storage devices, respectively;
  • the same storage device processing subunit is configured to select any one of the two spare hard disks on the same storage device as the target hard disk when two consecutive spare hard disks are on the same storage device.
  • the hard disk allocation system to which the placement group belongs further includes:
  • a spare hard disk judging unit is configured to determine whether each hard disk meets a preset spare hard disk pool joining rule; wherein the spare hard disk pool joining rule includes at least: a time period between the last increase of the allocated placement group count and the current time More than a preset duration, the allocated placement group count is less than the upper limit of the count, and at least one of the current storage space occupancy of each hard disk is less than the occupancy threshold;
  • a spare hard disk determining unit is configured to add a corresponding hard disk as the spare hard disk to the spare hard disk pool when the hard disk meets the spare hard disk pool joining rule.
  • the hard disk allocation system to which the placement group belongs further includes:
  • Hard disk replacement determination unit configured to determine a hard disk having a maximum allocated placement group count in each of the placement groups when a new hard disk is added to the storage system, to obtain the replacement disks in each of the placement groups. hard disk;
  • the replacement unit is configured to replace the hard disk to be replaced in each of the placement groups with the new hard disk.
  • the present application further provides a hard disk allocation device to which a placement group belongs, including:
  • a processor configured to implement the steps of the hard disk allocation method to which the placement group belongs as described above when executing the computer program.
  • the present application also provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the placement group as described above is implemented.
  • the steps of the own hard disk allocation method are also provided.
  • the hard disk allocation method provided by the placement group provided in this application obtaining the allocated placement group count of each spare hard disk in the spare hard disk pool; where each hard disk is assigned to a placement group, the corresponding allocated placement group is assigned The count is increased by one count unit; an allocated placement group count table describing the correspondence between the hard disk and the allocated placement group count is established according to each of the allocated placement group counts; and the value of the allocated placement group count is Select the spare hard disks in the order of as few as the number of hard disks required by the target placement group from the allocated placement group count table to obtain the target hard disks; assign the target hard disks to the target placement group .
  • the method newly introduces the concept of allocated placement group counts, that is, each time a hard disk is allocated to a placement group, the corresponding allocated placement group count is increased by one count unit, and based on this,
  • An allocated placement group count table that reflects the respective allocated placement group counts of all candidate hard disks, to select a certain number of target hard disks in ascending order, and these target hard disks have more
  • a small allocated placement group count means that the number of placement groups carried on these hard disks is smaller, because it is more suitable as a constituent hard disk for the new placement group. Since the placement group is more evenly distributed on the hard disks, the corresponding It also makes the data distribution more uniform.
  • the present application also provides a hard disk allocation system, device, and computer-readable storage medium to which the placement group belongs, which have the above-mentioned beneficial effects, and are not repeated here.
  • FIG. 1 is a flowchart of a hard disk allocation method to which a placement group belongs according to an embodiment of the present application
  • FIG. 2 is a flowchart of a method for selecting a spare hard disk with a smaller allocated group count in a hard disk allocation method to which a placement group belongs according to an embodiment of the present application;
  • FIG. 3 is a flowchart of a method for judging whether a hard disk satisfies joining a spare hard disk pool as a spare hard disk in the hard disk allocation method to which a placement group belongs according to an embodiment of the present application;
  • FIG. 4 is a structural block diagram of a hard disk allocation system to which a placement group belongs according to an embodiment of the present application.
  • the core of this application is to provide a hard disk allocation method to which a placement group belongs.
  • the concept of count of allocated placement groups is newly introduced, that is, each time a hard disk is allocated to a placement group, the corresponding allocated hard disk is assigned.
  • the set count is increased by one count unit, and an allocated placement group count table reflecting the respective allocated placement group counts of all candidate hard disks is established based on this to select a certain number of counts in ascending order.
  • Target hard disks These target hard disks have a smaller allocated placement group count compared to other spare hard disks, which means that the number of placement groups carried on these hard disks is smaller, because they are more suitable as component hard disks for the new placement group.
  • the placement group is more evenly distributed on the hard disk, which in turn makes the data distribution more uniform.
  • the present application also provides a hard disk distribution system, device, and computer-readable storage medium to which the placement group belongs, which has the above-mentioned beneficial effects.
  • FIG. 1 is a flowchart of a hard disk allocation method to which a placement group belongs according to an embodiment of the present application, which specifically includes the following steps:
  • S101 Obtain the allocated placement group count of each spare hard disk in the spare hard disk pool; where each hard disk is assigned to a placement group, increase the corresponding allocated placement group count by one count unit;
  • This application newly introduces the concept of "allocated placement group count".
  • this concept refers to the number of hard disks assigned to different placement groups, that is, each time a hard disk is assigned to a placement group, The hard disk's allocated placement group count is incremented by one count.
  • the purpose of this step is to obtain the respective allocated placement group counts of each spare hard disk in the spare hard disk pool, where the spare hard disk pool is a collection of all spare hard disks, and the spare hard disk can also be understood as a hard disk in a state to be allocated. It is assigned to the newly created placement group for data storage.
  • a spare hard disk judging mechanism can be set, and whether each hard disk can be added to the spare hard disk pool as a spare hard disk has been subjected to subsequent allocation processing operations.
  • the main purpose of setting the discriminating mechanism of the spare hard disk is to make the data distribution more uniform. Under the guidance of this purpose, you can have different solutions, and you can flexibly choose according to the actual situation, and will not repeat them here.
  • S102 Establish an allocated placement group count table describing the corresponding relationship between the hard disk and the allocated placement group counts according to the allocated placement group counts;
  • this step aims to establish an assigned placement group count table describing the correspondence between each hard disk and each assigned placement group count, that is, one end of each correspondence is the identification identifier of the hard disk, and the other end is The identification mark corresponds to the assigned placement group count of the hard disk.
  • the assigned placement group count is manifested in a variety of forms, which can appear directly as a digital number, or can exist as a binary code, etc. The reason is that the number of placement groups to which the corresponding hard disk has been allocated can be determined according to the allocated placement group count.
  • the attribute information of each hard disk can also be linked, which can include information about which storage device it belongs to, production date, time of joining the cluster, logs, and so on, so that it can be based on
  • the additional link information determines other status information of a hard disk, and makes other judgments accordingly.
  • S103 selecting the number of allocated placement group counts in ascending order from the allocated placement group count table to select the same number of spare hard disks as the number of hard disks required by the target placement group to obtain the target hard disk;
  • the purpose of this step is to select a preset number of spare hard disks from the allocated placement group count table and use them as target hard disks to be allocated to the target placement group.
  • the selection criteria follow to select a spare hard disk with a small allocated placement group count, because it is necessary to allocate the hard disk to which the target placement group belongs, and to make the data distribution as uniform as possible, so it is necessary Select some spare hard disks with a small allocated placement group count instead of randomly selecting or choosing some spare hard disks with a large allocated placement group count as the target hard disk.
  • the spare hard disk mentioned here with a small allocated placement group count can be understood by the following example:
  • the allocated placement group count table contains the value of the allocated placement group count of 20 spare hard disks, and the number of hard disks required by the target placement group is 5, which means that 5 spare disks need to be allocated to the target placement group. Select hard disks to form this placement group. At this time, select 5 out of the assigned count of the assigned placement group in ascending order. The reason is not to select the spare corresponding to the 5 smallest assigned placement group count. Hard disk, because the word "most" usually means only one of them, that is, there is only one smallest among the five selected, and the five selected from small to large are the smaller of the twenty in the table. No other five spares have a smaller assigned placement group count than they have.
  • a certain number of spare hard disks can be randomly selected according to a certain selection algorithm, instead of counting each time the allocated placement group including all the spare hard disks is counted. Select the smallest one in the information table. For example, you can pick out three spare hard disks from the table each time, and choose the smallest one from these three. This will sacrifice a certain degree of data distribution uniformity, but will save selection time. Whether to choose in this way can be flexibly selected according to the actual requirements for the degree of uniformity of data distribution and the specific requirements for time-consuming, which are not specifically limited here.
  • the online storage devices are generally not based on hard disks, but are storage devices containing multiple hard disks, such as disk arrays, storage servers, and so on. For a single disk array or storage server, a large number of hard disks are included. On the basis that all the hard disks that make up a placement group are different hard disks on the same storage device, when the storage device fails, the entire placement group may become unavailable due to a single node failure. According to the hard disk attribute information mentioned in S102, it is possible to determine and select a spare hard disk belonging to a different storage device, but the general principle is to select a hard disk with a smaller allocated placement group count. A person skilled in the art can obtain multiple implementation manners under this guideline, and details are not described herein again.
  • this step aims to determine a good target hard disk to assign to the target placement group.
  • it can specifically include all target hard disks assigned to the target placement group at one time. Method, and assign a target hard disk to the target placement group at a time until the number meets the needs of the target placement group.
  • the target placement group cannot formally undertake the data storage task until the target hard disks have the same number of target hard disks as required.
  • the allocated placement group count is 0
  • the first placement group consists of 6 hard disks.
  • the hard disk with the largest allocated placement group count is hard disk 003.
  • the second placement group consists of 5 hard disks.
  • the hard disk with the largest allocated placement group count is hard disk 006, so a new hard disk replacement method for each hard disk with the largest allocated placement group count is: using a new hard disk (020 No. 003 is replaced by the first placement group, and the 003 hard disk is released from the first placement group.
  • the new hard disk (No. 020) is replaced by the second placement group by replacing the 006 hard disk.
  • the hard disk No. 006 is released from the allocation relationship with the second placement group.
  • the replacement of the original hard disks will also release a lot of the allocation relationship with different placement groups, resulting in an increase and decrease of the original allocation of the replaced original hard disks.
  • the group count is less than the allocated placement group count of the new hard disk. Due to the principle of making the data distribution as uniform as possible, in this case, you can strictly follow the value of the allocated placement group count to determine which hard disk to replace. Which hard disk, of course, because the new hard disk's data is more stable and stable, you can also properly allocate new hard disks to more placement groups based on this consideration. There are many other practical factors that need to be considered in specific practical situations, and a suitable method can be flexibly selected according to the actual situation, which is not specifically limited here.
  • a hard disk allocation method belonging to a placement group newly introduces the concept of allocated placement group count, that is, each time a hard disk is allocated to a placement group, The corresponding allocated placement group count is increased by one count unit, and an allocated placement group count table reflecting the respective allocated placement group counts of all candidate hard disks is established accordingly, so that the count values are in ascending order Select a certain number of target hard disks.
  • These target hard disks have a smaller allocated placement group count than other spare hard disks, which means that the number of placement groups carried on these hard disks is smaller, because it is more suitable as a new placement group. Because the placement groups are more evenly distributed on the hard disks, the corresponding data also makes the data distribution more uniform.
  • FIG. 2 is a flowchart of a method for selecting a spare hard disk with a smaller allocated group count in a hard disk allocation method to which a placement group belongs according to an embodiment of the present application. This embodiment is intended to consider the actual situation There may be problems in which each target hard disk is on the same storage device, which causes a serious failure when a single node failure occurs:
  • S201 Select two consecutive hard disks from the allocated placement group count table each time in ascending order until the number of target hard disks is the same as the number of required hard disks;
  • S204 Select any one of the two spare hard disks on the same storage device as the target hard disk.
  • two consecutive spare hard disks are selected from the allocated placement group count table each time in ascending order, that is, whether the two spare hard disks are on the same storage is determined in a pairwise comparison manner. If both are on different storage devices, both spare hard disks can be used as the target hard disk, that is, the target hard disk count is increased by 2; if the two spare hard disks are two different hard disks on the same storage device, then from Either one is used as the target hard disk, that is, the count of the target hard disk is increased by 1 until the count of the target hard disk is equal to the required number of hard disks.
  • FIG. 3 is a flowchart of a method for determining whether a hard disk satisfies joining a spare hard disk pool as a spare hard disk in a hard disk allocation method to which a placement group belongs according to an embodiment of the present application.
  • the backup hard disk pool joining rule includes at least: the last increase of the allocated placement group count from the current time is longer than the preset time, the allocated placement group count is less than the upper limit, and the current storage space occupancy of each hard disk is less than At least one of the occupancy thresholds.
  • judgment rules can be added according to the actual situation, and each rule can be used independently to reach a judgment conclusion, or multiple combinations can be flexibly obtained to obtain a more responsible and more realistic judgment mode.
  • the goal is to improve the uniformity of the data distribution as much as possible.
  • S302 Cannot join the spare hard disk pool as a spare hard disk
  • This step is based on the judgment result of S301 that a hard disk does not meet the spare hard disk pool joining rules.
  • the last time that the increase in the allocated placement group count from the current time is greater than the preset time length is taken as an example.
  • the last time allocated to a placement group is not longer than the preset time, so it is determined that the hard disk is not suitable for joining the spare hard disk pool as a spare hard disk.
  • This step is based on the judgment result of S301 that a hard disk meets the rules for adding a spare hard disk pool, and the last increase in the allocated placement group count from the current time to the previous time is taken as an example.
  • the time last allocated to a placement group is longer than the preset time, so it is determined that the hard disk is suitable to be added to the spare hard disk pool as a spare hard disk.
  • S304 Obtain the allocated placement group count of each spare hard disk in the spare hard disk pool; where each hard disk is assigned to a placement group, the corresponding allocated placement group count is increased by one count unit.
  • this embodiment can determine whether each hard disk is suitable for being assigned to a placement group by setting a join rule for the spare hard disk, which can better improve the uniformity of data distribution and data stability. .
  • each PG is cyclically traversed, and each time a disk with the most PG distribution among all the hard disks of the PG is selected to be replaced with a new one One of the hard disks, so that each PG replaces one hard disk at a time and gradually replaces it until the number of PGs distributed on the newly added hard disk is equal to the number of PGs distributed on the existing hard disk.
  • FIG. 4 is a structural block diagram of a hard disk allocation system to which a placement group belongs according to an embodiment of the present application.
  • the hard disk allocation system to which the placement group belongs may include:
  • the spare hard disk allocated placement group count obtaining unit 100 is used to obtain the allocated placement group count of each spare hard disk in the spare hard disk pool; where each hard disk is assigned to a placement group, the corresponding allocated placement is placed. Group count is increased by one count unit;
  • the allocated placement group count table establishing unit 200 is configured to establish an allocated placement group count table describing the corresponding relationship between the hard disk and the allocated placement group count according to each allocated placement group count;
  • the small placement group count hard disk selecting unit 300 is configured to select the spare hard disks of the same number of hard disks required by the target placement group from the allocated placement group count table in ascending order to obtain the target hard disks;
  • the target hard disk allocation unit 400 is configured to allocate a target hard disk to a target placement group.
  • the smaller placement group counting hard disk selecting unit 300 may include:
  • Two consecutive spare hard disk selection sub-units are used to select two consecutive spare hard disks from the allocated placement group count table each time in ascending order until the number of target hard disks is the same as the required number of hard disks;
  • the same storage device determination subunit is used to determine whether two consecutive spare hard disks are on the same storage device
  • Non-identical storage device processing subunits are used when two consecutive spare hard disks are on different storage devices, and the two spare hard disks on different storage devices are used as target hard disks;
  • the same storage device processing subunit is used to select any one of the two spare hard disks on the same storage device as the target hard disk when two consecutive spare hard disks are on the same storage device.
  • the hard disk allocation system to which the placement group belongs may further include:
  • a spare hard disk judging unit is used to determine whether each hard disk meets a preset spare hard disk pool joining rule.
  • the spare hard disk pool joining rule includes at least: the last increase of the allocated placement group count from the current time is longer than the preset time. , The allocated placement group count is less than the upper limit of the count, and at least one of the current storage space occupancy of each hard disk is less than the occupancy threshold;
  • a spare hard disk determining unit is configured to add a corresponding hard disk as a spare hard disk to the spare hard disk pool when the hard disk meets a spare hard disk pool joining rule.
  • the hard disk allocation system to which the placement group belongs may further include:
  • Hard disk replacement unit for determining when there is a new hard disk added to the storage system, the hard disk having the largest allocated placement group count in each placement group is obtained to obtain the hard disk to be replaced in each placement group;
  • the replacement unit is used to replace the hard disk to be replaced in each placement group with a new hard disk.
  • the present application also provides a hard disk allocation device to which a placement group belongs.
  • the device may include a memory and a processor, where a computer program is stored in the memory, and the processor calls the computer program in the memory.
  • the steps provided by the above embodiments can be implemented.
  • the device can also include various necessary network interfaces, power supplies, and other components.
  • the present application also provides a computer-readable storage medium on which a computer program is stored.
  • the storage medium may include: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory (ROM)), a random access memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, which can store program codes.
  • ROM Read-Only Memory
  • RAM Random Access Memory

Abstract

本申请公开了一种归置组所属硬盘分配方法,新引入了已分配归置组计数这一概念,即每当一个硬盘被分配给一个归置组时就将其对应的已分配归置组计数增加一个计数单位,并据此建立起反映所有备选硬盘各自的已分配归置组计数的已分配归置组计数表,以将计数数值按从小到大的顺序选取出一定数量的目标硬盘,这些目标硬盘相对其他备用硬盘具有较小的已分配归置组计数,即说明这些硬盘上承载的归置组的数量较少,因为更合适作为组成新归置组的组成硬盘,由于归置组在硬盘上的分布更加均匀,相应的也使得数据分布的均匀程度更高。本申请还同时公开了一种归置组所属硬盘分配系统、装置及计算机可读存储介质,具有上述有益效果。

Description

一种归置组所属硬盘分配方法、系统、装置及存储介质
本申请要求于2018年06月28日提交中国专利局、申请号201810689442.X、发明名称为“一种归属组所属硬盘分配方法、系统、装置及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据均衡分布技术领域,特别涉及一种归置组所属硬盘分配方法、系统、装置及计算机可读存储介质。
背景技术
分布式存储系统由多个存储池组成,每个存储池都有其对应的数据分布规则,比如副本规则或者纠删规则。其中,副本规则是形成与原数据文件完全相同的副本数据,即以完整的数据文件进行备份存储;以4+2的纠删规则为例,表示将一份完整的数据分成互不相同的4份,再根据这4份数据,按固定的纠删算法计算出2份冗余数据出来,然后保存这6份数据,之后在任何时候只要能从6份数据中读取出任意4份数据来,就能恢复出原始的数据。
一般来说元数据由于其数据量较小、重要度高,通常保存在基于副本规则形成的副本存储池中,而完整的数据文件则保存在纠删池中。为了方便管理数据分布,一般存储池还会划分成多个归置组(Placement Group,PG),每个归置组按副本规则或者纠删规则包含若干块硬盘。比如4+2的纠删规则要保存6份数据,通常就需要6块硬盘来分别保存这6份数据,即每个归置组就会包含6块硬盘。归置组在硬盘上的分布情况直接决定了数据在集群中到底是不是均匀分布的。
当前为每个归置组分配所属硬盘的策略一般都是按某种随机算法来选择所需的硬盘的,但随机算法只能在一定程度上保证归置组在硬盘上分布的随机性,随着要求的提高,基于随机算法的硬盘分配方式对应的数据分布均匀度已经无法满足当前的要求,因此需要进一步提升数据分布的均匀程度。
因此,如何克服现有归置组所属硬盘分配方法存在的各项技术缺陷,提供一种所属硬盘分配更加科学、合理,使得数据分布均匀程度更高的归置组所属硬盘分配机制是本领域技术人员亟待解决的问题。
发明内容
本申请的目的是提供一种归置组所属硬盘分配方法,新引入了已分配归置组计数这一概念,即每当一个硬盘被分配给一个归置组时就将其对应的已分配归置组计数增加一个计数单位,并据此建立起反映所有备选硬盘各自的已分配归置组计数的已分配归置组计数表,以将计数数值按从小到大的顺序选取出一定数量的目标硬盘,这些目标硬盘相对其他备用硬盘具有较小的已分配归置组计数,即说明这些硬盘上承载的归置组的数量较少,因为更合适作为组成新归置组的组成硬盘,由于归置组在硬盘上的分布更加均匀,相应的也使得数据分布的均匀程度更高。
本申请的另一目的在于提供了一种归置组所属硬盘分配系统、装置及计算机可读存储介质。
为实现上述目的,本申请提供一种归置组所属硬盘分配方法,包括:
获取备用硬盘池中各备用硬盘的已分配归置组计数;其中,一个硬盘每被分配给一个归置组就将对应的已分配归置组计数增加一个计数单位;
根据各所述已分配归置组计数建立描述硬盘与已分配归置组计数间对应关系的已分配归置组计数表;
将所述已分配归置组计数的数值按小到大的顺序从所述已分配归置组计数表中选取出与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘;
将所述目标硬盘分配给所述目标归置组。
可选的,将所述已分配归置组计数的数值按小到大的顺序从所述已分配归置组计数表中选取出与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘,包括:
按照从小到大的顺序每次从所述已分配归置组计数表中选取出连续的两块备用硬盘,直至所述目标硬盘的数量与所述所需硬盘数相同;
判断连续的两块备用硬盘是否处于相同的存储设备上;
若否,则将处于不同存储设备上两块备用硬盘均作为所述目标硬盘;
若是,则选择处于相同存储设备上的两块备用硬盘中的任一块作为所述目标硬盘。
可选的,该归置组所属硬盘分配方法还包括:
判断每个硬盘是否满足预设的备用硬盘池加入规则;其中,所述备用硬盘池加入规则至少包括:上一次增加所述已分配归置组计数距当前时间的时长大于预设时长、所述已分配归置组计数小于所述计数上限、各硬盘的当前存储空间占用率中小于占用率阈值的至少一项;
若是,则将对应的硬盘作为所述备用硬盘加入所述备用硬盘池。
可选的,该归置组所属硬盘分配方法还包括:
当有新硬盘添加进存储系统时,确定每个所述归置组中拥有最大已分配归置组计数的硬盘,得到每个所述归置组中的待替换硬盘;
利用所述新硬盘替换每个所述归置组中的待替换硬盘。
为实现上述目的,本申请还提供了一种归置组所属硬盘分配系统,包括:
备用硬盘已分配归置组计数获取单元,用于获取备用硬盘池中各备用硬盘的已分配归置组计数;其中,一个硬盘每被分配给一个归置组就将对应的已分配归置组计数增加一个计数单位;
已分配归置组计数表建立单元,用于根据各所述已分配归置组计数建立描述硬盘与已分配归置组计数间对应关系的已分配归置组计数表;
较小归置组计数硬盘选取单元,用于将所述已分配归置组计数的数值按小到大的顺序从所述已分配归置组计数表中选取出与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘;
目标硬盘分配单元,用于将所述目标硬盘分配给所述目标归置组。
可选的,所述较小归置组计数硬盘选取单元包括:
连续两块备用硬盘选取子单元,用于按照从小到大的顺序每次从所述已分配归置组计数表中选取出连续的两块备用硬盘,直至所述目标硬盘的数量与所述所需硬盘数相同;
相同存储设备判断子单元,用于判断连续的两块备用硬盘是否处于相同的存储设备上;
非相同存储设备处理子单元,用于当连续的两块备用硬盘分别处于不同的存储设备上时,将处于不同存储设备上两块备用硬盘均作为所述目标硬盘;
相同存储设备处理子单元,用于当连续的两块备用硬盘处于相同的存储设备上时,选择处于相同存储设备上的两块备用硬盘中的任一块作为所述目标硬盘。
可选的,该归置组所属硬盘分配系统还包括:
备用硬盘判断单元,用于判断每个硬盘是否满足预设的备用硬盘池加入规则;其中,所述备用硬盘池加入规则至少包括:上一次增加所述已分配归置组计数距当前时间的时长大于预设时长、所述已分配归置组计数小于所述计数上限、各硬盘的当前存储空间占用率中小于占用率阈值的至少一项;
备用硬盘确定单元,用于当硬盘满足所述备用硬盘池加入规则时,将对应的硬盘作为所述备用硬盘加入所述备用硬盘池。
可选的,该归置组所属硬盘分配系统还包括:
待替换硬盘确定单元,用于当有新硬盘添加进存储系统时,确定每个所述归置组中拥有最大已分配归置组计数的硬盘,得到每个所述归置组中的待替换硬盘;
替换单元,用于利用所述新硬盘替换每个所述归置组中的待替换硬盘。
为实现上述目的,本申请还提供了一种归置组所属硬盘分配装置,包括:
存储器,用于存储计算机程序;
处理器,用于执行所述计算机程序时实现如上述内容所描述的归置组所属硬盘分配方法的步骤。
为实现上述目的,本申请还提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述内容所描述的归置组所属硬盘分配方法的步骤。
本申请所提供的归置组所属硬盘分配方法:获取备用硬盘池中各备用硬盘的已分配归置组计数;其中,一个硬盘每被分配给一个归置组就将对应的已分配归置组计数增加一个计数单位;根据各所述已分配归置组计数建立描述硬盘与已分配归置组计数间对应关系的已分配归置组计数表;将所述已分配归置组计数的数值按小到大的顺序从所述已分配归置组计数表中选取出与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘;将所述目标硬盘分配给所述目标归置组。
显然,该方法新引入了已分配归置组计数这一概念,即每当一个硬盘被分配给一个归置组时就将其对应的已分配归置组计数增加一个计数单位,并据此建立起反映所有备选硬盘各自的已分配归置组计数的已分配归置组计数表,以将计数数值按从小到大的顺序选取出一定数量的目标硬盘,这些目标硬盘相对其他备用硬盘具有较小的已分配归置组计数,即说明这些硬盘上承载的归置组的数量较少,因为更合适作为组成新归置组的组成硬盘,由于归置组在硬盘上的分布更加均匀,相应的也使得数据分布的均匀程度更高。本申请同时还提供了一种归置组所属硬盘分配系统、装置及计算机可读存储介质,具有上述有益效果,在此不再赘述。
附图说明
图1为本申请实施例提供的一种归置组所属硬盘分配方法的流程图;
图2为本申请实施例提供的归置组所属硬盘分配方法中一种较小已分配归置组计数的备用硬盘选取方法的流程图;
图3为本申请实施例提供的归置组所属硬盘分配方法中一种判断硬盘是否满足加入备用硬盘池作为备用硬盘的方法的流程图;
图4为本申请实施例所提供的一种归置组所属硬盘分配系统的结构框图。
具体实施方式
本申请的核心是提供一种归置组所属硬盘分配方法,新引入了已分配归置组计数这一概念,即每当一个硬盘被分配给一个归置组时就将其对应的已分配归置组计数增加一个计数单位,并据此建立起反映所有备选硬盘各自的已分配归置组计数的已分配归置组计数表,以将计数数值按从小到大的顺序选取出一定数量的目标硬盘,这些目标硬盘相对其他备用硬盘具有较小的已分配归置组计数,即说明这些硬盘上承载的归置组的数量较少,因为更合适作为组成新归置组的组成硬盘,由于归置组在硬盘上的分布更加均匀,相应的也使得数据分布的均匀程度更高。本申请还同时提供了一种归置组所属硬盘分配系统、装置及计算机可读存储介质,具有上述有益效果。
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述, 显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。
实施例一
以下结合图1,图1为本申请实施例提供的一种归置组所属硬盘分配方法的流程图,其具体包括以下步骤:
S101:获取备用硬盘池中各备用硬盘的已分配归置组计数;其中,一个硬盘每被分配给一个归置组就将对应的已分配归置组计数增加一个计数单位;
本申请新引入了“已分配归置组计数”的概念,顾名思义,这个概念指的是一个硬盘被分配给不同归置组的个数,即一个硬盘每被分配给一个归置组就将该硬盘的已分配归置组计数增加一个计数单位。
本步骤旨在获取处于备用硬盘池中每个备用硬盘各自的已分配归置组计数,其中,该备用硬盘池是所有备用硬盘的集合,备用硬盘也可以理解为处于待分配状态的硬盘,可以被分配给新创立的归置组做数据存储用。
进一步的,可以设定一个备用硬盘判别机制,对每个硬盘是否可以作为备用硬盘加入备用硬盘池已进行后续的待分配处理操作,具体方式有很多,可以基于不同的原则来实现,例如为了防止短时间内频繁将一个硬盘分配给多个归置组,可以设定将其分配给不同的归置组的时间间隔,即必须从上一次将其分配给一个归置组经过该时间间隔后才能将其再分配给另一个归置组;也可以设定一定时间段内最大分配给不同归置组的个数;还可以根据一个硬盘的当前状态是否处于异常状态等等,此处并不做具体限定,设定备用硬盘判别机制的主要目的还是要使数据分布均匀程度更高,在此目的的指导下可以拥有不同的解决方案,可根据实际情况灵活选择,在此不再一一赘述。
S102:根据各已分配归置组计数建立描述硬盘与已分配归置组计数间对应关系的已分配归置组计数表;
在S101的基础上,本步骤旨在建立描述各硬盘与各已分配归置组计数间对应关系的已分配归置组计数表,即每条对应关系的一端是硬盘的识别标识,另一端是该识别标识对应硬盘的已分配归置组计数,具体的,已分配归置组 计数的表现形式多种多样,可以直接采用数字编号的形式出现,也可以按照二进制代码的方式存在等等,目的在于可以根据该已分配归置组计数判别出相应硬盘已经被分配给了多少个归置组。
进一步的,在本步骤提供的对应关系的基础上,还可以再链接每个硬盘的属性信息,可以包括具体所属哪台存储设备、生产日期、加入集群的时间、日志等等信息,以便能够根据额外链接的信息判断出一个硬盘的其它状态信息,并据此做出其它判断。
S103:将已分配归置组计数的数值按小到大的顺序从已分配归置组计数表中选取出与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘;
在S102的基础上,本步骤旨在从该已分配归置组计数表中选取出预设数量的备用硬盘,并将其作为待分配给目标归置组的目标硬盘使用。其中,选取的标准遵循为选取拥有较小的已分配归置组计数的备用硬盘,因为要为目标归置组分配其所属的硬盘,且尽可能的使数据分布均匀程度更高,因此有必要选取一些拥有较小已分配归置组计数的备用硬盘,而不是随机选取或选取一些拥有较大已分配归置组计数的备用硬盘作为目标硬盘。
此处所说的拥有较小已分配归置组计数的备用硬盘可通过下面这个例子来理解:
假定该已分配归置组计数表中包含20个备用硬盘的已分配归置组计数的数值,而目标归置组所需硬盘数为5,也就是说需要分配给目标归置组5个备选硬盘构成这个归置组,此时则按照各已分配归置组计数的数值从小到大的顺序选取5个出来,之所以不说是选取5个最小的已分配归置组计数对应的备用硬盘,是因为通常“最”一词仅表示其中一个,即在选出的5个中也仅存在一个最小的,而按照从小到大选取出的5个则是表中20个中较小,选不出另外5个比他们拥有更小已分配归置组计数的备用硬盘了。
当然,具体如何选取出与目标归置组所需硬盘数相同数量的备用硬盘的方式多种多样,上面给出的例子仅作为其中一次性选出所需硬盘的方式存在,还可以每次选择一个拥有当前最小已分配归置组计数的备用硬盘,在下次选择时出于选择不同硬盘的基础要求,就会再次找到一个拥有最小已分配归置组计数的备用硬盘,依次类推直至选取得到与所需硬盘数相同数量的备用硬 盘作为目标硬盘。进一步的,在每次为目标归置组选取一块合适的目标硬盘时,可以按照一定的选取算法随机选取一定数量的备用硬盘,而非每次都在包含全部备用硬盘的已分配归置组计数信息的表中选取最小的那个,比如可以每次从表中挑出3个备用硬盘,并从这3个中选取最小的,这样虽然会牺牲一定的数据分布均匀程度,但会节省选取时间,是否按照此种方式进行选择可根据实际情况对数据分布均匀程度的具体要求和对耗时的具体要求灵活选择,此处并不做具体限定。
更进一步的,实际上上线的存储设备一般都不是以硬盘为单位,而是包含多个硬盘的存储设备,例如磁盘阵列、存储服务器等等,对于一个磁盘整列或存储服务器都会包含数量众多的硬盘,在组成一个归置组的所有硬盘都是同一存储设备上不同硬盘的基础上,可能会因该存储设备出现故障时,因单节点故障造成该归置组整体不可用的现象,因此在还可以根据S102中提及的硬盘属性信息判断选取分属不同存储设备上的备用硬盘,但总体原则还是要选取拥有较小已分配归置组计数的硬盘。在此指导思想下本领域技术人员可得到多种实现方式,在此不再赘述。
S104:将目标硬盘分配给目标归置组。
在S103的基础上,本步骤旨在确定好的目标硬盘分配给目标归置组,根据S103中阐述的选取目标硬盘的不同方式,可具体包括一次性将所有目标硬盘都分配目标归置组的方式,和每次将一块目标硬盘分配给目标归置组,直至数量满足该目标归置组所需。当然,在采用后一种分配方式时,目标归置组在未得到与所需硬盘数相同数量的目标硬盘之前,还无法正式承接数据的存储任务。
进一步的,存储系统每添加进一块新硬盘(已分配归置组计数为0)时,为了使集群内数据分布的均匀程度更高,还可以使用该新硬盘替换每个归置组中拥有最大已分配归置组计数的硬盘,直至已将该新硬盘分配了与之前已有硬盘数量一致的归置组。
举例如下:当前存储系统内有两个归置组,第一归置组由6个硬盘组成,其中拥有最大已分配归置组计数的硬盘为003号硬盘,第二归置组由5个硬盘组成,其中拥有最大已分配归置组计数的硬盘为006号硬盘,因此一种采用新 硬盘替换每个归置组中拥有最大已分配归置组计数的硬盘的方式为:使用新硬盘(020号)替换003号硬盘被分配给第一归置组,003号硬盘被解除与第一归置组的分配关系;使用新硬盘(020号)替换006号硬盘被分配给第二归置组,006号硬盘被解除与第二归置组的分配关系。
当然,当归置组数量众多时,还会出现替换下来的原有硬盘会解除很多与不同归置组的分配关系,致使在一增一减的情况下出现替换下来的原硬盘的已分配归置组计数小于新硬盘的已分配归置组计数,出于使数据分布尽可能均匀的原则,可以再出现此种情况下严格按照已分配归置组计数的数值大小来判断要使用哪块硬盘替换哪块硬盘,当然,由于新硬盘的数据稳定存储稳定性更高,还可以出于此种考虑适当使新硬盘被分配给更多的归置组。具体实际情况下还有很多其它需要考虑的实际因素,可根据实际情景灵活选择合适的方式,此处并不做具体限定。
基于上述技术方案,本申请实施例提供的一种归置组所属硬盘分配方法,新引入了已分配归置组计数这一概念,即每当一个硬盘被分配给一个归置组时就将其对应的已分配归置组计数增加一个计数单位,并据此建立起反映所有备选硬盘各自的已分配归置组计数的已分配归置组计数表,以将计数数值按从小到大的顺序选取出一定数量的目标硬盘,这些目标硬盘相对其他备用硬盘具有较小的已分配归置组计数,即说明这些硬盘上承载的归置组的数量较少,因为更合适作为组成新归置组的组成硬盘,由于归置组在硬盘上的分布更加均匀,相应的也使得数据分布的均匀程度更高。
实施例二
以下结合图2,图2为本申请实施例提供的归置组所属硬盘分配方法中一种较小已分配归置组计数的备用硬盘选取方法的流程图,本实施例旨在考虑实际情况下可能存在的各目标硬盘都处于相同存储设备上致使单节点故障出现时导致严重故障的问题:
S201:按照从小到大的顺序每次从已分配归置组计数表中选取出连续的两块备用硬盘,直至目标硬盘的数量与所需硬盘数相同;
S202:判断连续的两块备用硬盘是否处于相同的存储设备上;
S203:将处于不同存储设备上两块备用硬盘均作为目标硬盘;
S204:选择处于相同存储设备上的两块备用硬盘中的任一块作为目标硬盘。
本实施例每次按照从小到大的顺序每次从已分配归置组计数表中选取出连续的两块备用硬盘,即通过两两比对的方式判断这两块备用硬盘是否处于相同存储上,若分别处于不同的存储设备上,则这两块备用硬盘都可以被作为目标硬盘使用,即目标硬盘的计数加2;若两块备用硬盘为同一存储设备上的两块不同硬盘,则从中任选其一作为目标硬盘使用,即目标硬盘的计数加1,直至目标硬盘的计数与所需硬盘数相等。
当然,本实施例仅以连续的两块硬盘做判断,还会出现第一次选取的两块硬盘与第二次选取的两块硬盘依然处于同一存储设备的情况,即本实施例只能够在一定程度上防止单节点故障的出现,但基于此指导思想只需要再进行一次判断即可,本领域技术人员可据此轻易得到一个效果更佳的实现方式,以尽可能在提高数据分布均匀程度的基础上避免单节点故障导致的严重问题出现,在此不一一赘述。
实施例三
以下结合图3,图3为本申请实施例提供的归置组所属硬盘分配方法中一种判断硬盘是否满足加入备用硬盘池作为备用硬盘的方法的流程图。
S301:判断每个硬盘是否满足预设的备用硬盘池加入规则;
其中,该备用硬盘池加入规则至少包括:上一次增加已分配归置组计数距当前时间的时长大于预设时长、已分配归置组计数小于计数上限、各硬盘的当前存储空间占用率中小于占用率阈值中的至少一项。
当然也不仅仅包括这些参数,可根据实际情况自行加入其它种类的判别规则,且各规则可单独使用得出判断结论,也可以灵活的进行多项组合得到更加负责、更符合实际情况的判断方式,目的都在于尽可能的提高数据分布的均匀程度。
S302:不能够作为备用硬盘加入备用硬盘池;
本步骤建立在S301的判断结果为一个硬盘不满足备用硬盘池加入规则的 基础上,以上一次增加已分配归置组计数距当前时间的时长大于预设时长为例,则经过判断发现将该硬盘上一次分配给一个归置组的时间距今的时长不大于该预设时长,因此判定该硬盘不适合作为备用硬盘加入备用硬盘池。
S303:将对应的硬盘作为备用硬盘加入备用硬盘池;
本步骤建立在S301的判断结果为一个硬盘满足备用硬盘池加入规则的基础上,依然以上一次增加已分配归置组计数距当前时间的时长大于预设时长为例,则经过判断发现将该硬盘上一次分配给一个归置组的时间距今的时长大于该预设时长,因此判定该硬盘适合作为备用硬盘加入备用硬盘池。
S304:获取备用硬盘池中各备用硬盘的已分配归置组计数;其中,一个硬盘每被分配给一个归置组就将对应的已分配归置组计数增加一个计数单位。
基于上述任一实施例,本实施例通过为备用硬盘设置加入规则,能够先判断一次每个硬盘是否适合被分配给一个归置组,能够更好地提高数据分布的均匀程度和数据的稳定性。
实施例四
本实施就一个具体应用场景提供一种适用于该场景下的实现方案:
PG分布均衡性的优化方法的具体实施过程如下:
(1)为PG分配每块硬盘时,都按随机性算法一次选择出若干块盘(比如选出3块盘,个数适当即可,不需太多);
(2)从选出的若干块盘中选择分布PG个数最少的一个硬盘作为最终选择结果,并将该盘的PG分布个数加1;
(3)循环上述选择,直到为该PG分配完所需个数的硬盘,且保证每次选择出的目标硬盘与之前选择出的所有目标硬盘均属于不同的存储设备;
(4)当有硬盘故障退出集群时,以上述方法为该盘上分布的PG重新分配一块硬盘即可;
(5)当有新盘加入时(比如扩容,或者某个节点上插入新盘),则循环遍历每个PG,每次选择该PG的所有硬盘中PG分布最多的一块盘来替换成新加入的硬盘中的某一块,这样每个PG每次替换一块硬盘并逐步替换,直 到新加入的硬盘上分布的PG和已有硬盘上分布的PG个数相当为止。
因为情况复杂,无法一一列举进行阐述,本领域技术人员应能意识到根据本申请提供的基本方法原理结合实际情况可以存在很多的例子,在不付出足够的创造性劳动下,应均在本申请的保护范围内。
下面请参见图4,图4为本申请实施例所提供的一种归置组所属硬盘分配系统的结构框图,该归置组所属硬盘分配系统可以包括:
备用硬盘已分配归置组计数获取单元100,用于获取备用硬盘池中各备用硬盘的已分配归置组计数;其中,一个硬盘每被分配给一个归置组就将对应的已分配归置组计数增加一个计数单位;
已分配归置组计数表建立单元200,用于根据各已分配归置组计数建立描述硬盘与已分配归置组计数间对应关系的已分配归置组计数表;
较小归置组计数硬盘选取单元300,用于按照从小到大的顺序从已分配归置组计数表中选取与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘;
目标硬盘分配单元400,用于将目标硬盘分配给目标归置组。
其中,较小归置组计数硬盘选取单元300可以包括:
连续两块备用硬盘选取子单元,用于按照从小到大的顺序每次从已分配归置组计数表中选取出连续的两块备用硬盘,直至目标硬盘的数量与所需硬盘数相同;
相同存储设备判断子单元,用于判断连续的两块备用硬盘是否处于相同的存储设备上;
非相同存储设备处理子单元,用于当连续的两块备用硬盘分别处于不同的存储设备上时,将处于不同存储设备上两块备用硬盘均作为目标硬盘;
相同存储设备处理子单元,用于当连续的两块备用硬盘处于相同的存储设备上时,选择处于相同存储设备上的两块备用硬盘中的任一块作为目标硬盘。
进一步的,该归置组所属硬盘分配系统还可以包括:
备用硬盘判断单元,用于判断每个硬盘是否满足预设的备用硬盘池加入规则;其中,备用硬盘池加入规则至少包括:上一次增加已分配归置组计数 距当前时间的时长大于预设时长、已分配归置组计数小于计数上限、各硬盘的当前存储空间占用率中小于占用率阈值的至少一项;
备用硬盘确定单元,用于当硬盘满足备用硬盘池加入规则时,将对应的硬盘作为备用硬盘加入备用硬盘池。
进一步的,该归置组所属硬盘分配系统还可以包括:
待替换硬盘确定单元,用于当有新硬盘添加进存储系统时,确定每个归置组中拥有最大已分配归置组计数的硬盘,得到每个归置组中的待替换硬盘;
替换单元,用于利用新硬盘替换每个归置组中的待替换硬盘。
基于上述实施例,本申请还提供了一种归置组所属硬盘分配装置,该装置可以包括存储器和处理器,其中,该存储器中存有计算机程序,该处理器调用该存储器中的计算机程序时,可以实现上述实施例所提供的步骤。当然,该装置还可以包括各种必要的网络接口、电源以及其它零部件等。
本申请还提供了一种计算机可读存储介质,其上存有计算机程序,该计算机程序被执行终端或处理器执行时可以实现上述实施例所提供的步骤。该存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想。对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范围内。
还需要说明的是,在本说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其它变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其它要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、物品或者设备中还存在另外的相同要素。

Claims (10)

  1. 一种归置组所属硬盘分配方法,包括:
    获取备用硬盘池中各备用硬盘的已分配归置组计数;其中,一个硬盘每被分配给一个归置组就将对应的已分配归置组计数增加一个计数单位;
    根据各所述已分配归置组计数建立描述硬盘与已分配归置组计数间对应关系的已分配归置组计数表;
    将所述已分配归置组计数的数值按小到大的顺序从所述已分配归置组计数表中选取出与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘;
    将所述目标硬盘分配给所述目标归置组。
  2. 根据权利要求1所述方法,将所述已分配归置组计数的数值按小到大的顺序从所述已分配归置组计数表中选取出与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘,包括:
    按照从小到大的顺序每次从所述已分配归置组计数表中选取出连续的两块备用硬盘,直至所述目标硬盘的数量与所述所需硬盘数相同;
    判断连续的两块备用硬盘是否处于相同的存储设备上;
    若否,则将处于不同存储设备上两块备用硬盘均作为所述目标硬盘;
    若是,则选择处于相同存储设备上的两块备用硬盘中的任一块作为所述目标硬盘。
  3. 根据权利要求1或2所述方法,所述方法还包括:
    判断每个硬盘是否满足预设的备用硬盘池加入规则;其中,所述备用硬盘池加入规则至少包括:上一次增加所述已分配归置组计数距当前时间的时长大于预设时长、所述已分配归置组计数小于所述计数上限、各硬盘的当前存储空间占用率中小于占用率阈值的至少一项;
    若是,则将对应的硬盘作为所述备用硬盘加入所述备用硬盘池。
  4. 根据权利要求3所述方法,所述方法还包括:
    当有新硬盘添加进存储系统时,确定每个所述归置组中拥有最大已分配归置组计数的硬盘,得到每个所述归置组中的待替换硬盘;
    利用所述新硬盘替换每个所述归置组中的待替换硬盘。
  5. 一种归置组所属硬盘分配系统,包括:
    备用硬盘已分配归置组计数获取单元,用于获取备用硬盘池中各备用硬盘的已分配归置组计数;其中,一个硬盘每被分配给一个归置组就将对应的已分配归置组计数增加一个计数单位;
    已分配归置组计数表建立单元,用于根据各所述已分配归置组计数建立描述硬盘与已分配归置组计数间对应关系的已分配归置组计数表;
    较小归置组计数硬盘选取单元,用于将所述已分配归置组计数的数值按小到大的顺序从所述已分配归置组计数表中选取出与目标归置组所需硬盘数相同数量的备用硬盘,得到目标硬盘;
    目标硬盘分配单元,用于将所述目标硬盘分配给所述目标归置组。
  6. 根据权利要求5所述系统,所述较小归置组计数硬盘选取单元包括:
    连续两块备用硬盘选取子单元,用于按照从小到大的顺序每次从所述已分配归置组计数表中选取出连续的两块备用硬盘,直至所述目标硬盘的数量与所述所需硬盘数相同;
    相同存储设备判断子单元,用于判断连续的两块备用硬盘是否处于相同的存储设备上;
    非相同存储设备处理子单元,用于当连续的两块备用硬盘分别处于不同的存储设备上时,将处于不同存储设备上两块备用硬盘均作为所述目标硬盘;
    相同存储设备处理子单元,用于当连续的两块备用硬盘处于相同的存储设备上时,选择处于相同存储设备上的两块备用硬盘中的任一块作为所述目标硬盘。
  7. 根据权利要求5或6所述系统,所述系统还包括:
    备用硬盘判断单元,用于判断每个硬盘是否满足预设的备用硬盘池加入规则;其中,所述备用硬盘池加入规则至少包括:上一次增加所述已分配归置组计数距当前时间的时长大于预设时长、所述已分配归置组计数小于所述计数上限、各硬盘的当前存储空间占用率中小于占用率阈值的至少一项;
    备用硬盘确定单元,用于当硬盘满足所述备用硬盘池加入规则时,将对应的硬盘作为所述备用硬盘加入所述备用硬盘池。
  8. 根据权利要求7所述系统,所述系统还包括:
    待替换硬盘确定单元,用于当有新硬盘添加进存储系统时,确定每个所 述归置组中拥有最大已分配归置组计数的硬盘,得到每个所述归置组中的待替换硬盘;
    替换单元,用于利用所述新硬盘替换每个所述归置组中的待替换硬盘。
  9. 一种归置组所属硬盘分配装置,包括:
    存储器,用于存储计算机程序;
    处理器,用于执行所述计算机程序时实现如权利要求1至4任一项所述的归置组所属硬盘分配方法的步骤。
  10. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至4任一项所述的归置组所属硬盘分配方法的步骤。
PCT/CN2018/112052 2018-06-28 2018-10-26 一种归置组所属硬盘分配方法、系统、装置及存储介质 WO2020000817A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/981,708 US11314426B2 (en) 2018-06-28 2018-10-26 Method, system, and apparatus for allocating hard disks to placement group, and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810689442.X 2018-06-28
CN201810689442.XA CN109002259B (zh) 2018-06-28 2018-06-28 一种归置组所属硬盘分配方法、系统、装置及存储介质

Publications (1)

Publication Number Publication Date
WO2020000817A1 true WO2020000817A1 (zh) 2020-01-02

Family

ID=64602158

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/112052 WO2020000817A1 (zh) 2018-06-28 2018-10-26 一种归置组所属硬盘分配方法、系统、装置及存储介质

Country Status (3)

Country Link
US (1) US11314426B2 (zh)
CN (1) CN109002259B (zh)
WO (1) WO2020000817A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109933285A (zh) * 2019-02-26 2019-06-25 新华三技术有限公司成都分公司 分布式存储的数据均衡方法及装置
CN109960470B (zh) * 2019-03-28 2022-07-29 新华三技术有限公司 数据处理方法、装置及领导节点
CN110018799B (zh) * 2019-04-12 2020-07-03 苏州浪潮智能科技有限公司 一种存储池pg主确定方法、装置、设备及可读存储介质
CN110018800A (zh) * 2019-04-12 2019-07-16 苏州浪潮智能科技有限公司 分布式存储系统中归置组选主方法、装置、设备和介质
CN110427160A (zh) * 2019-08-09 2019-11-08 济南浪潮数据技术有限公司 归置组分布的均衡方法及装置
CN111708486B (zh) * 2020-05-24 2023-01-06 苏州浪潮智能科技有限公司 一种主放置组均衡优化的方法、系统、设备及介质
CN114489515B (zh) * 2022-02-11 2022-08-16 北京中电兴发科技有限公司 一种基于流存储的数据写入方法
CN115202589B (zh) * 2022-09-14 2023-02-24 浪潮电子信息产业股份有限公司 放置组成员选择方法、装置、设备及可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110153917A1 (en) * 2009-12-17 2011-06-23 Hitachi, Ltd. Storage apparatus and its control method
US20140297982A1 (en) * 2013-03-15 2014-10-02 Arris Group, Inc. Multi-Tier Storage for Delivery of Services
CN106055277A (zh) * 2016-05-31 2016-10-26 重庆大学 一种去中心化的分布式异构存储系统数据分布方法
CN107977319A (zh) * 2016-10-24 2018-05-01 爱思开海力士有限公司 存储系统及其操作方法

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3371044B2 (ja) * 1994-12-28 2003-01-27 株式会社日立製作所 ディスクアレイのための領域割り当て方法およびディスクアレイアクセス方法
US7664913B2 (en) * 2003-03-21 2010-02-16 Netapp, Inc. Query-based spares management technique
US8838889B2 (en) * 2010-01-19 2014-09-16 Infinidat Ltd. Method of allocating raid group members in a mass storage system
US9785372B2 (en) * 2013-05-17 2017-10-10 Hitachi, Ltd. Storage device and method for configuring raid group
KR102166924B1 (ko) * 2013-12-26 2020-10-16 삼성전자주식회사 저장 장치의 구동 방법
KR20170075835A (ko) * 2015-12-23 2017-07-04 에스케이하이닉스 주식회사 메모리 시스템 및 메모리 시스템의 동작 방법
CN107391039B (zh) * 2017-07-27 2020-05-15 苏州浪潮智能科技有限公司 一种数据对象存储方法和装置
CN108052655B (zh) * 2017-12-28 2020-11-10 新华三技术有限公司 数据写入及读取方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110153917A1 (en) * 2009-12-17 2011-06-23 Hitachi, Ltd. Storage apparatus and its control method
US20140297982A1 (en) * 2013-03-15 2014-10-02 Arris Group, Inc. Multi-Tier Storage for Delivery of Services
CN106055277A (zh) * 2016-05-31 2016-10-26 重庆大学 一种去中心化的分布式异构存储系统数据分布方法
CN107977319A (zh) * 2016-10-24 2018-05-01 爱思开海力士有限公司 存储系统及其操作方法

Also Published As

Publication number Publication date
CN109002259B (zh) 2021-03-09
CN109002259A (zh) 2018-12-14
US11314426B2 (en) 2022-04-26
US20210365192A1 (en) 2021-11-25

Similar Documents

Publication Publication Date Title
WO2020000817A1 (zh) 一种归置组所属硬盘分配方法、系统、装置及存储介质
US11487618B2 (en) Data storage method, apparatus, and system
US10019192B2 (en) Policy-based hierarchical data protection in distributed storage
US9952930B2 (en) Reallocation in a dispersed storage network (DSN)
US11157186B2 (en) Distributed object storage system with dynamic spreading
JP2010182302A (ja) メタデータグルーピングにより効率的なデータ重複削除を行なう方法と装置
US10789113B2 (en) Data storage system durability using hardware failure risk indicators
US20100161897A1 (en) Metadata server and disk volume selecting method thereof
US11442827B2 (en) Policy-based hierarchical data protection in distributed storage
WO2020035086A3 (en) Data security of shared blockchain data storage based on error correction code
CN110046160B (zh) 一种基于条带的一致性哈希存储系统构建方法
US11106376B2 (en) Method of storage allocation, electronic device, storage system and computer program product
CN111596868B (zh) 基于段单元的分布式存储系统的负载均衡方法和系统
CN111694517B (zh) 分布式数据迁移方法、系统和电子设备
EP3442201A1 (en) Cloud platform construction method and cloud platform
US20190004844A1 (en) Cloud platform construction method and cloud platform
CN112306692B (zh) 一种分布式存储系统的归置组均衡方法和装置
WO2020094134A1 (zh) 磁盘分配方法、装置和可读存储介质
CN111459399A (zh) 一种数据写入方法、数据读取方法及装置
CN110750219B (zh) 存储集群的业务处理方法、装置、设备及可读存储介质
US10599520B2 (en) Meta-copysets for fault-tolerant data storage
CN115756955A (zh) 一种数据备份、数据恢复的方法、装置及计算机设备
CN114546265A (zh) 一种快速容量均衡的方法、系统、设备和存储介质
CN111324668A (zh) 数据库数据同步处理方法、装置及存储介质
CN111124260B (zh) 管理独立盘冗余阵列的方法、电子设备和计算机程序产品

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: 18923820

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: 18923820

Country of ref document: EP

Kind code of ref document: A1