Cluster expansion methods, devices, and readable storage media
By determining the mapping relationship of PGs during the expansion of the distributed storage cluster, efficient expansion of the target cluster is achieved, solving the data migration and reconstruction problems caused by topology changes in existing technologies, and ensuring the balance and consistency of cluster data after expansion.
Patent Information
- Application Number
- CN202311133828.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-09-04
AI Technical Summary
Existing technologies suffer from poor expansion efficiency when scaling up distributed storage clusters due to changes in PG mapping caused by changes in node topology, resulting in a large amount of data migration and reconstruction.
By obtaining expansion messages, the mapping relationship between multiple PGs is determined, and the target cluster is expanded multiple times according to the mapping relationship. This ensures that the final mapping relationship is referenced during each expansion, avoiding the impact of topology changes on expanded nodes and achieving a balanced distribution of PGs.
It improves the efficiency of cluster expansion, ensures the balance and consistency of cluster data after expansion, and reduces unnecessary data migration.
Smart Images

Figure CN119561841B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a cluster expansion method, apparatus, and readable storage medium. Background Technology
[0002] When expanding the distributed storage (hereinafter referred to as the cluster), the topology of the cluster data nodes changes, which in turn causes changes in the Placement Group (PG) mapping. Changes in the PG mapping will cause the migration and reconstruction of cluster data. Some cluster data will be migrated from the old nodes to the newly expanded nodes, eventually achieving a state of data balance among the nodes.
[0003] The cluster data storage pool consists of multiple nodes, each node comprises multiple object-based storage devices (OSDs), and each OSD contains multiple placeholder objects (PGs). When the number of nodes and the number of OSDs within a node are fixed, the distribution of PGs is unique and fixed. When the number of nodes or the number of OSDs within a node changes, the distribution of PGs changes. When multiple nodes need to be expanded online, typically only one node is expanded at a time, and the next node is expanded only after the reconstruction is complete. However, when expanding the second node, the topology of the cluster data nodes changes again, causing changes in the PG mapping. Furthermore, some of the data recently migrated from the first node needs to be migrated to the second node, and so on. This expansion method causes multiple changes in the PG mapping, resulting in a large amount of redundant data migration and poor expansion efficiency. Summary of the Invention
[0004] This application provides a cluster expansion method, apparatus, and readable storage medium to improve the efficiency of expanding a target cluster.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, a cluster expansion method is provided, comprising: obtaining an expansion message, the expansion message including multiple expansion OSDs; the expansion message being used to expand a target cluster; the target cluster including multiple original OSDs, each original OSD including multiple placement groups (PGs); determining the mapping relationship between the multiple PGs, the mapping relationship including the original position and the expanded position of each PG; and performing multiple expansions on the target cluster according to the mapping relationship, the target cluster after multiple expansions including multiple original OSDs and multiple expansion OSDs, the multiple PGs being evenly distributed among the multiple original OSDs and multiple expansion OSDs.
[0007] Optionally, the target cluster is expanded according to the mapping relationship, including: expanding the first expanded OSD to the target cluster; the first expanded OSD is any one of multiple expanded OSDs; migrating the target PG to the first expanded OSD according to the mapping relationship; the target PG is the PG located in the first expanded OSD after expansion in the mapping relationship; iterating the above steps until multiple expanded OSDs are expanded to the target cluster.
[0008] Optionally, expanding the first expanded OSD to the target cluster includes: determining a first service bandwidth and a second service bandwidth, wherein the first service bandwidth is the average service bandwidth during the period between a first time and the current time, and the second service bandwidth is the average service bandwidth during the period between a second time and the current time; the first time is before the second time; determining the decrease in the first service bandwidth based on the first service bandwidth and the second service bandwidth, and expanding the first expanded OSD to the target cluster if the decrease is less than or equal to a decrease threshold.
[0009] Optionally, the target PG is migrated to the first expanded OSD according to the mapping relationship, including: determining a first number according to the mapping relationship, the first number being the total number of target PGs; determining the service pressure level of the cluster, the service pressure level being positively correlated with the first service bandwidth; and allocating the target number of target PGs to the first expanded OSD according to the service pressure level, until the first number of target PGs are allocated.
[0010] Optionally, the method further includes: determining the allocated bandwidth of the first expanded OSD; if the decrease is less than or equal to a decrease threshold, making a first adjustment to the allocated bandwidth, wherein the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment; and if the decrease is greater than the decrease threshold, making a second adjustment to the allocated bandwidth, wherein the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
[0011] Optionally, the mapping relationship of multiple PGs is determined, including: creating a temporary crush map, which includes the topology of multiple original OSDs and multiple expanded OSDs; generating a temporary OSD map based on the temporary crush map; and determining the mapping relationship of multiple PGs based on the temporary OSD map and the load balancing script tool.
[0012] Based on the technical solution provided in this application, the mapping relationship of multiple PGs can be determined, and the target cluster can be expanded according to the mapping relationship of multiple PGs. Since the mapping relationship of multiple PGs includes the original position and the position after expansion of each PG, the PGs allocated to the expanded OSDs during each expansion refer to the mapping relationship generated when the final expansion is completed. Therefore, the cluster topology changes generated during each expansion will not affect the expanded OSDs that have been expanded to the target cluster, and there will be no unnecessary data migration, thus improving the expansion efficiency of the target cluster. At the same time, after the expansion is completed, the PG mapping of the target cluster is consistent with the pre-calculated mapping relationship, ensuring the balance of cluster data in the target cluster.
[0013] Secondly, a cluster expansion device is provided, comprising: an acquisition unit, a determination unit, and an expansion unit; the acquisition unit is used to acquire expansion messages, the expansion messages including multiple expansion OSDs; the expansion messages are used to expand a target cluster; the target cluster includes multiple original OSDs, each original OSD including multiple placement groups (PGs); the determination unit is used to determine the mapping relationship of the multiple PGs, the mapping relationship including the original position and the expanded position of each PG; the expansion unit is used to perform multiple expansions on the target cluster according to the mapping relationship, the target cluster after multiple expansions includes multiple original OSDs and multiple expansion OSDs, the multiple PGs being evenly distributed among the multiple original OSDs and multiple expansion OSDs.
[0014] Optionally, the expansion unit is specifically used for: expanding a first expanded OSD to the target cluster; the first expanded OSD is any one of multiple expanded OSDs; migrating a target PG to the first expanded OSD according to the mapping relationship; the target PG is the PG located in the first expanded OSD after expansion in the mapping relationship; iterating the above steps until multiple expanded OSDs are expanded to the target cluster.
[0015] Optionally, the expansion unit is further configured to: determine a first service bandwidth and a second service bandwidth, wherein the first service bandwidth is the average service bandwidth during the period between a first time and the current time, and the second service bandwidth is the average service bandwidth during the period between a second time and the current time; the first time is prior to the second time; determine the decrease in the first service bandwidth based on the first service bandwidth and the second service bandwidth, and if the decrease is less than or equal to a decrease threshold, expand the first expansion OSD to the target cluster.
[0016] Optionally, the expansion unit is further used to: determine a first quantity based on the mapping relationship, the first quantity being the total number of target PGs; determine the service pressure level of the cluster, the service pressure level being positively correlated with the first service bandwidth; and allocate the target number of target PGs to the first expansion OSD based on the service pressure level, until the first number of target PGs has been allocated.
[0017] Optionally, the determining unit is further configured to determine the allocated bandwidth of the first expanded OSD; the expansion unit is further configured to perform a first adjustment on the allocated bandwidth when the decrease is determined to be less than or equal to the decrease threshold, wherein the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment; the expansion unit is further configured to perform a second adjustment on the allocated bandwidth when the decrease is determined to be greater than the decrease threshold, wherein the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
[0018] Optionally, the unit is determined, specifically for: creating a temporary crush map, which includes the topology of multiple original OSDs and multiple expanded OSDs; generating a temporary OSD map based on the temporary crush map; and determining the mapping relationship of multiple PGs based on the temporary OSD map and the balancing script tool.
[0019] Thirdly, a cluster expansion device is provided, which can realize the functions performed by the cluster expansion device in the above aspects or possible designs. The functions can be implemented by hardware. For example, in one possible design, the cluster expansion device may include a processor and a communication interface. The processor can be used to support the cluster expansion device in realizing the functions involved in the first aspect or any possible design of the first aspect.
[0020] In another possible design, the cluster expansion device may further include a memory for storing necessary computer execution instructions and data. When the cluster expansion device is running, the processor executes the computer execution instructions stored in the memory to cause the cluster expansion device to perform the first aspect or any of the possible cluster expansion methods described above.
[0021] Fourthly, a computer-readable storage medium is provided, which may be a readable non-volatile storage medium storing computer instructions or programs that, when executed on a computer, enable the computer to perform the first aspect or any of the possible cluster expansion methods described above.
[0022] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, enables the computer to execute the cluster expansion method of the first aspect or any possible design of the above aspects.
[0023] A sixth aspect provides an electronic device comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, including computer instructions, which, when executed by the one or more processors, cause the electronic device to perform a cluster expansion method as described in the first aspect or any possible design of the first aspect.
[0024] In a seventh aspect, a chip system is provided, including a processor and a communication interface, which can be used to implement the functions performed by the cluster expansion device in the first aspect or any possible design of the first aspect. In one possible design, the chip system further includes a memory for storing program instructions and / or data. The chip system can be composed of chips or may include chips and other discrete devices, without limitation. Attached Figure Description
[0025] Figure 1 A schematic diagram of the topology of a cluster data node provided in an embodiment of this application;
[0026] Figure 2 This is a schematic diagram of the structure of a cluster expansion system provided in an embodiment of this application;
[0027] Figure 3 This is a schematic diagram of the structure of a cluster expansion device provided in an embodiment of this application;
[0028] Figure 4 A flowchart illustrating a cluster expansion method provided in an embodiment of this application;
[0029] Figure 5 A flowchart illustrating another cluster expansion method provided in this application embodiment;
[0030] Figure 6 A flowchart illustrating another cluster expansion method provided in this application embodiment;
[0031] Figure 7 This is a schematic diagram of another cluster expansion device provided in the embodiments of this application. Detailed Implementation
[0032] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0033] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0034] It should also be understood that the term "comprising" indicates the presence of the described feature, whole, step, operation, element and / or component, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements and / or components.
[0035] When a cluster is expanded, the topology of the cluster data nodes changes, causing changes in the PG mapping. These changes trigger data migration and reconstruction, with some cluster data migrating from old nodes to the newly expanded nodes, ultimately achieving a balanced data distribution across all nodes. When the number of nodes and the number of OSDs within each node are fixed, the PG distribution is uniquely fixed. When the number of nodes or the number of OSDs within each node changes, the PG distribution will change.
[0036] For example, Figure 1 This is a schematic diagram of a cluster data node topology provided in an embodiment of this application. Figure 1 As shown, the cluster data storage pool consists of multiple nodes, each node consists of multiple OSDs, and each OSD contains multiple PGs. When a PG consists of 3 replicas (members), for example, PG1.0 has members [0, 2, 5], meaning PG1.0 exists on OSD.0, OSD.2, and OSD.5. If node 4 (OSD.6, OSD.7) is added, the topology changes, and the PGs on the original OSDs need to be migrated to the newly added OSDs, resulting in a change in the PG distribution.
[0037] When multiple nodes need to be expanded online, if multiple nodes are expanded at the same time, a large number of PG mappings will change, the amount of data that needs to be migrated will be huge, and a large amount of reconstruction will affect performance (such as increased system latency, slower response, etc.).
[0038] Therefore, typically only one node is expanded at a time, and the next node is expanded only after the reconstruction is completed. However, when expanding the second node, the topology of the cluster data nodes changes, which will cause the PG mapping to change again. In addition, some of the data that was just migrated in from the first node needs to be migrated to the second node, and so on. This expansion method will cause multiple changes in the PG mapping, resulting in a large amount of redundant data migration and poor expansion efficiency.
[0039] In view of this, embodiments of this application provide a cluster expansion method, including:
[0040] Obtain expansion messages, which include multiple expansion OSDs; expansion messages are used to expand the target cluster; the target cluster includes multiple original OSDs, and each original OSD includes multiple placement groups (PGs); determine the mapping relationship between the multiple PGs, which includes the original position and the expanded position of each PG; expand the target cluster according to the mapping relationship, and the expanded target cluster includes multiple original OSDs and multiple expansion OSDs, with the multiple PGs evenly distributed among the multiple original OSDs and multiple expansion OSDs.
[0041] The methods provided in the embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0042] It should be noted that the network system described in the embodiments of this application is for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and does not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of network systems and the emergence of other network systems, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0043] Figure 2 The diagram shown is a schematic representation of a cluster expansion system 10 provided in an embodiment of this application. Figure 2 As shown, the cluster expansion system 10 may include a server 11 and a terminal device 12. The server 11 is connected to the terminal device 12. For example, the server 11 and the terminal device 12 can be connected wirelessly.
[0044] In the embodiments of this application, server 11 is used to adjust the storage capacity of the target cluster. For example, it can be a monitor server for a distributed file system. Server 11 can be a single server or a server cluster consisting of multiple servers. In some embodiments, the server cluster can also be a distributed cluster. The embodiments of this application do not limit the specific technology, quantity, or device form of server 11.
[0045] Terminal device 12 is a device that provides network communication services and can be used to request expansion of the target cluster. In the embodiments of this application, terminal device 12 can also be referred to as a terminal, mobile station (MS), mobile terminal (MT), etc., and is a device that provides voice and / or data connectivity to users. For example, terminal device 12 can be a handheld device with wireless connectivity, in-vehicle device, etc. Specifically, it can be a smartphone, pocket personal computer (PPC), handheld computer, personal digital assistant (PDA), laptop computer, tablet computer, wearable device, or in-vehicle device, etc. The embodiments of this application do not limit the specific technology, quantity, or form of terminal device 12.
[0046] It should be noted that Figure 2 This is just an example framework diagram. Figure 2 The names of the various devices included are unrestricted, and except for Figure 2 In addition to the functional nodes shown, other nodes may also be included, but this application embodiment does not limit this.
[0047] In practical implementation, Figure 2 Each device in the process can be adopted Figure 3 The shown composition structure, or including Figure 3 The components shown. Figure 3 This is a schematic diagram illustrating the composition of a cluster expansion device 200 provided in an embodiment of this application. The cluster expansion device 200 can be a server, or it can be a chip or system-on-a-chip within a server. Figure 3 As shown, the cluster expansion device 200 includes a processor 201, a communication interface 202, and a communication line 203.
[0048] Furthermore, the cluster expansion device 200 may also include a memory 204. The processor 201, memory 204, and communication interface 202 can be connected via a communication line 203.
[0049] The processor 201 can be a CPU, a general-purpose processor, a network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The processor 201 can also be other devices with processing capabilities, such as circuits, devices, or software modules, without limitation.
[0050] Communication interface 202 is used to communicate with other devices or other communication networks. Communication interface 202 can be a module, circuit, communication interface, or any device capable of enabling communication.
[0051] Communication line 203 is used to transmit information between the components included in the cluster expansion device 200.
[0052] Memory 204 is used to store instructions. These instructions can be computer programs.
[0053] The memory 204 can be a read-only memory (ROM) or other type of static storage device that can store static information and / or instructions; it can also be a random access memory (RAM) or other type of dynamic storage device that can store information and / or instructions; it can also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, etc., without limitation.
[0054] It should be noted that the memory 204 can exist independently of the processor 201 or can be integrated with the processor 201. The memory 204 can be used to store instructions, program code, or some data, etc. The memory 204 can be located inside or outside the cluster expansion device 200, without limitation. The processor 201 is used to execute the instructions stored in the memory 204 to implement the cluster expansion method provided in the following embodiments of this application.
[0055] In one example, processor 201 may include one or more CPUs, for example, Figure 3 CPU0 and CPU1 in the CPU.
[0056] As an optional implementation, the cluster expansion device 200 includes multiple processors, for example, besides Figure 3 In addition to processor 201, it may also include processor 205.
[0057] It should be pointed out that, Figure 3 The composition shown does not constitute a basis for this. Figure 2 The limitations of each device in the process, except Figure 3 In addition to the components shown, Figure 2 The various devices in can include compared to Figure 3 More or fewer components, or combinations of certain components, or different arrangements of components.
[0058] In this embodiment of the application, the chip system may be composed of chips or may include chips and other discrete devices.
[0059] Furthermore, the actions, terms, etc., involved in the various embodiments of this application can be referenced interchangeably without limitation. The message names or parameter names in the messages between the various devices in the embodiments of this application are merely examples, and other names may be used in specific implementations without limitation.
[0060] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0061] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0062] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0063] The following is combined with Figure 2 The cluster expansion system shown herein describes the cluster expansion method provided in the embodiments of this application.
[0064] Figure 4 This application provides a cluster expansion method, applicable to servers, but also to devices within servers, such as chips. For example, the server can be... Figure 2 Server 11 in the example. This application uses an application to a server as an example for illustration, such as... Figure 4 As shown, the method includes the following steps S301-S303:
[0065] S301, Get expansion message.
[0066] The expansion message includes multiple expansion OSDs; the expansion message is used to expand the target cluster; the target cluster includes multiple original OSDs, and each original OSD includes multiple placement groups (PGs).
[0067] As one possible implementation, the terminal device can respond to control commands and send an expansion message to the server. Correspondingly, the server receives the expansion message sent by the terminal device.
[0068] It should be noted that control commands can refer to instructions generated in response to control operations performed by an operator. For example, control commands can be control instructions input by the operator through the input device (such as a keyboard) of a terminal device.
[0069] In practical applications, multiple original OSDs can be evenly distributed across nodes in different target clusters.
[0070] S302. Determine the mapping relationship between multiple PGs.
[0071] The mapping relationship includes the original location and the expanded location of each PG.
[0072] Combination Figure 1The source location of PG1.0 is located at OSD.0, OSD.2, and OSD.5. For example, in the case of multiple expanded OSDs including OSD.6, OSD.7, and OSD.8, the expanded location of PG1.0 can be located at OSD.6, OSD.2, and OSD.5.
[0073] As one possible implementation, the server can create a temporary crush map and generate a temporary OSD map based on the temporary crush map; further, the mapping relationship between multiple PGs can be determined based on the temporary OSD map and the leveling script tool.
[0074] It should be noted that the temporary crush map includes topology information for multiple original OSDs and multiple expanded OSDs.
[0075] For example, the server can copy a crush map of the target cluster (including the original OSD and PG locations of the target cluster) and add multiple expanded OSDs from the newly expanded nodes into the crush map to obtain a temporary crush map.
[0076] Furthermore, an OSD map is generated based on the temporary crush map, and the mapping relationship between multiple PGs is determined based on the temporary OSD map and the balancing script tool.
[0077] For example, the server can determine the locations of the original OSDs and the expanded OSDs based on a temporary crush map, thus obtaining a temporary OSD map. Furthermore, a data balancing script tool is used to redistribute the multiple PGs within the temporary OSD map to achieve data balance, i.e., to obtain the mapping relationship between the multiple PGs. This solves the data redistribution process caused by the addition of multiple expanded OSDs.
[0078] In practical applications, the number of PGs in each original OSD after expansion and each expanded OSD can be the same or different.
[0079] S303. Expand the target cluster multiple times according to the mapping relationship.
[0080] The target cluster after multiple expansions includes multiple original OSDs and multiple expanded OSDs, with multiple PGs evenly distributed among the original OSDs and expanded OSDs. For example, when the total number of original OSDs and expanded OSDs is 3 and the total number of PGs is 6, each of the original OSDs and expanded OSDs can include 2 PGs.
[0081] In some embodiments, if multiple PGs cannot be evenly distributed across multiple original OSDs and multiple expanded OSDs, the server may randomly reduce the number of PGs allocated to one OSD. For example, if the total number of original OSDs and expanded OSDs is 3 and the total number of PGs is 5, the multiple original OSDs and multiple expanded OSDs may each include 2 PGs, 2 PGs, and 1 PG, respectively.
[0082] As one possible implementation, the server can expand the first expanded OSD to the target cluster, and migrate the target PG to the first expanded OSD according to the mapping relationship. Further, the above steps are iterated until multiple expanded OSDs are expanded to the target cluster.
[0083] It should be noted that the first expanded OSD is any one of multiple expanded OSDs, and the target PG is the PG located in the first expanded OSD after expansion in the mapping relationship.
[0084] In some embodiments, the speed at which the target cluster is expanded can be adjusted according to the business pressure level of the target cluster. For details, please refer to the following sections of the specification, which will not be elaborated here.
[0085] In some embodiments, the server can control the terminal device to display the expansion progress of the target cluster. For example, the expansion progress may include the number of OSDs that have been expanded into the target cluster, the number of OSDs that are being expanded into the storage pool, the number of OSDs that have not yet been expanded, and the percentage of expansion completion.
[0086] Based on the technical solution provided in this application, the mapping relationship of multiple PGs can be determined, and the target cluster can be expanded multiple times according to the mapping relationship. Since the mapping relationship includes the original position and the expanded position of each PG, the PG allocated to the expanded OSD during each expansion refers to the mapping relationship generated when the final expansion is completed. Therefore, the cluster topology changes generated during each expansion will not affect the expanded OSDs that have been expanded to the target cluster, thus avoiding unnecessary data migration and improving the expansion efficiency of the target cluster. At the same time, after the expansion, the PG mapping of the target cluster is consistent with the pre-calculated mapping relationship, ensuring the balance of cluster data in the target cluster.
[0087] One possible implementation, such as Figure 5 As shown, in order to expand the target cluster according to the mapping relationship, the cluster expansion method of this application may also include the following S401-S403.
[0088] S401. Expand the first expanded OSD to the target cluster.
[0089] The first expansion OSD can be any one of multiple expansion OSDs.
[0090] As one possible implementation, the server can determine the first service bandwidth and the second service bandwidth, determine the decrease range of the first service bandwidth based on the first service bandwidth and the second service bandwidth, and if the decrease range is less than or equal to the decrease threshold, expand the first expansion OSD to the target cluster.
[0091] It should be noted that the first service bandwidth is the average service bandwidth during the period between the first time point and the current time point, and the second service bandwidth is the average service bandwidth during the period between the second time point and the current time point; the first time point is located before the second time point.
[0092] The first time point, the second time point, and the decline threshold can be set as needed. For example, the first time point can be 1 hour before the current time, the second time point can be 5 minutes before the current time, and the decline threshold can be 10%.
[0093] In some embodiments, if the decrease is determined to be greater than a decrease threshold, the server may stop expanding the first expanded OSD to the target cluster.
[0094] In practical applications, the server can count the business bandwidth of the most recent five minutes and the business bandwidth of the past hour every five minutes. If the decrease is greater than 10%, the expansion will be paused; otherwise, the expansion of OSDs will continue to be extended to the target cluster.
[0095] S402. Based on the mapping relationship, migrate the target PG to the first expanded OSD.
[0096] The target PG is the PG located in the first expanded OSD after expansion in the mapping relationship.
[0097] As one possible implementation, the server can determine the first number and the business pressure level of the cluster based on the mapping relationship, and allocate the target number of target PGs to the first expansion OSD according to the business pressure level and a preset frequency, until the first number of target PGs are allocated.
[0098] For example, the business stress levels include Level 1, Level 2, and Level 3. A server can allocate 50% of the target PG to the first expanded OSD when the business stress level is Level 1; 30% of the target PG to the first expanded OSD when the business stress level is Level 2; and 15% of the target PG to the first expanded OSD when the business stress level is Level 3.
[0099] It should be noted that the first quantity refers to the total number of target PGs. The service pressure level is positively correlated with the first service bandwidth. For example, the correspondence between service pressure level and first service bandwidth is shown in Table 1 below.
[0100] Table 1. Schematic Diagram of Business Pressure Levels
[0101] Business pressure level First service bandwidth Level 1 <500 Mbps Level 2 [500, 1000] megaseconds Level 3 (1000, 1500) megaseconds
[0102] It should be noted that Table 1 is only an illustrative example, and the correspondence between the service pressure level and the first service bandwidth can be adjusted according to user needs.
[0103] As another possible implementation, the server can allocate the target number of target PGs to the first expansion OSD according to the frequency corresponding to the decrease in the first service bandwidth, until the first number of target PGs has been allocated.
[0104] For example, if the drop exceeds 10%, the server can reduce the number of PGs allocated in the next allocation (e.g., reduce it by 50% based on the previous allocation).
[0105] In practical applications, the initial quantity can be between 100 and 200. The preset frequency can be 5 minutes.
[0106] S403. Iterate through the above steps until multiple expanded OSDs are expanded to the target cluster.
[0107] In this way, the progress of OSD expansion can be adjusted according to the level of business pressure, reducing the impact of OSD expansion on the normal business of the target cluster.
[0108] One possible implementation, such as Figure 6 As shown, in order to control the reconstruction speed of the first expanded OSD, the cluster expansion method of this application may also include the following S501-S503.
[0109] S501. Determine the allocated bandwidth for the first expanded OSD.
[0110] The allocated bandwidth is used to reconstruct the first expanded OSD, and the speed of reconstructing the first expanded OSD is positively correlated with the size of the allocated bandwidth of the first expanded OSD.
[0111] As one possible implementation, the server can obtain the network logs of the target cluster from the cluster system, parse the network logs, and obtain the allocated bandwidth for the first expanded OSD.
[0112] In one example, the allocated bandwidth could be 50 Mbps, 100 Mbps, etc.
[0113] S502. If the decrease is determined to be less than or equal to the decrease threshold, the allocated bandwidth shall be adjusted first.
[0114] The allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment.
[0115] As one possible implementation, the server can make a first adjustment to the allocated bandwidth according to a first preset step size.
[0116] The first preset step size can be set as needed. For example, it can be -5 Mbps, -10 Mbps, etc.
[0117] In one example, if the allocated bandwidth before the first adjustment is 50 Mbps and the first preset step size is -5 Mbps, then the allocated bandwidth after the first adjustment is 5 Mbps.
[0118] S503. If the decrease is determined to be greater than the decrease threshold, a second adjustment is made to the allocated bandwidth.
[0119] The allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
[0120] As one possible implementation, the server can make a first adjustment to the allocated bandwidth according to a second preset step size.
[0121] The second preset step size can be set as needed. For example, it can be 5 Mbps, 10 Mbps, etc.
[0122] In one example, if the allocated bandwidth before the first adjustment is 50 Mbps and the first preset step size is 5 Mbps, then the allocated bandwidth after the first adjustment is 55 Mbps.
[0123] This avoids allocating too much bandwidth to the first expansion OSD when the allocated bandwidth is sufficient to meet the expansion bandwidth requirements, thus preventing idle bandwidth and improving bandwidth utilization.
[0124] The various solutions in the above embodiments of this application can be combined without contradiction.
[0125] This application embodiment can divide the cluster expansion device into functional modules or functional units according to the above method example. For example, each function can be divided into a separate functional module or functional unit, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or in software functional modules or functional units. The module or unit division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0126] When dividing each function into modules according to its corresponding function. Figure 7 A schematic diagram of a cluster expansion device 700 is shown. The cluster expansion device can be a server or a chip applied in a server. The cluster expansion device 700 can be used to perform the functions of the server involved in the above embodiments. Figure 7The cluster expansion device 700 shown may include: an acquisition unit 701, a determination unit 702, and an expansion unit 703; the acquisition unit 701 is used to acquire expansion messages, which include multiple expansion OSDs; the expansion messages are used to expand the target cluster; the target cluster includes multiple original OSDs, and each original OSD includes multiple placement groups (PGs); the determination unit 702 is used to determine the mapping relationship of the multiple PGs, which includes the original position and the expanded position of each PG; the expansion unit 703 is used to perform multiple expansions on the target cluster according to the mapping relationship, and the target cluster after multiple expansions includes multiple original OSDs and multiple expanded OSDs, with the multiple PGs evenly distributed among the multiple original OSDs and multiple expanded OSDs.
[0127] Optionally, the expansion unit 703 is specifically used for: expanding a first expansion OSD to the target cluster; the first expansion OSD is any one of multiple expansion OSDs; migrating a target PG to the first expansion OSD according to the mapping relationship; the target PG is the PG located in the first expansion OSD after expansion in the mapping relationship; iterating the above steps until multiple expansion OSDs are expanded to the target cluster.
[0128] Optionally, the expansion unit 703 is further configured to: determine a first service bandwidth and a second service bandwidth, wherein the first service bandwidth is the average service bandwidth during the period between a first time and the current time, and the second service bandwidth is the average service bandwidth during the period between a second time and the current time; the first time is prior to the second time; determine the decrease in the first service bandwidth based on the first service bandwidth and the second service bandwidth, and if the decrease is less than or equal to a decrease threshold, expand the first expansion OSD to the target cluster.
[0129] Optionally, the expansion unit 703 is further configured to: determine a first quantity based on the mapping relationship, wherein the first quantity is the total number of target PGs; determine the service pressure level of the cluster, wherein the service pressure level is positively correlated with the first service bandwidth; and allocate the target number of target PGs to the first expansion OSD based on the service pressure level, until the first number of target PGs has been allocated.
[0130] Optionally, the determining unit 702 is further configured to determine the allocated bandwidth of the first expanded OSD; the expansion unit 703 is further configured to perform a first adjustment on the allocated bandwidth when the decrease amplitude is determined to be less than or equal to the decrease threshold, wherein the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment; the expansion unit 703 is further configured to perform a second adjustment on the allocated bandwidth when the decrease amplitude is determined to be greater than the decrease threshold, wherein the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
[0131] Optionally, unit 702 is specifically used for: creating a temporary crush map, which includes the topology of multiple original OSDs and multiple expanded OSDs; generating a temporary OSD map based on the temporary crush map; and determining the mapping relationship of multiple PGs based on the temporary OSD map and the balancing script tool.
[0132] This application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be implemented by a computer program instructing related hardware. This program can be stored in the computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The computer-readable storage medium can be an internal storage unit of the cluster expansion device (including a data transmitter and / or a data receiver) of any of the foregoing embodiments, such as the hard disk or memory of the cluster expansion device. The computer-readable storage medium can also be an external storage device of the terminal device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the terminal device. Further, the computer-readable storage medium can include both the internal storage unit of the cluster expansion device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the cluster expansion device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0133] It should be noted that the terms "first" and "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0134] It should be understood that in this application, "at least one (item)" means one or more, "more than one" means two or more, "at least two (items)" means two or three or more, and "and / or" is used to describe the relationship between related objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the related objects before and after are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0135] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0136] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0137] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0138] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0139] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0140] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A cluster expansion method, characterized in that, The method includes: Obtain an expansion message, which includes multiple expansion object storage OSDs; the expansion message is used to expand the target cluster; the target cluster includes multiple original OSDs, and each original OSD includes multiple placement groups (PGs); Determine the mapping relationship between the multiple PGs, the mapping relationship including the original position and the expanded position of each PG; The target cluster is expanded multiple times according to the mapping relationship. The target cluster after multiple expansions includes the multiple original OSDs and the multiple expanded OSDs. The multiple PGs are evenly distributed among the multiple original OSDs and the multiple expanded OSDs. The step of scaling up the target cluster multiple times according to the mapping relationship includes: The first expanded OSD is expanded to the target cluster; the first expanded OSD is any one of the plurality of expanded OSDs; The target PG is migrated to the first expanded OSD according to the mapping relationship; the target PG is the PG located in the first expanded OSD after expansion according to the mapping relationship; Iterate through the above steps until the multiple expanded OSDs are expanded to the target cluster; Expanding the first expanded OSD to the target cluster includes: Determine a first service bandwidth and a second service bandwidth, wherein the first service bandwidth is the average service bandwidth during the period between a first time point and the current time point, and the second service bandwidth is the average service bandwidth during the period between a second time point and the current time point; the first time point is located before the second time point. The decrease in the first service bandwidth is determined based on the first service bandwidth and the second service bandwidth. If the decrease is less than or equal to the decrease threshold, the first expanded OSD is expanded to the target cluster. The step of migrating the target PG to the first expanded OSD according to the mapping relationship includes: A first quantity is determined based on the mapping relationship, and the first quantity is the total number of the target PG; Determine the service pressure level of the cluster, wherein the service pressure level is positively correlated with the first service bandwidth; Based on the business pressure level, the target number of target PGs is allocated to the first expanded OSD until the first number of target PGs is allocated.
2. The method according to claim 1, characterized in that, The method further includes: Determine the allocated bandwidth for the first expanded OSD; If it is determined that the decrease is less than or equal to the decrease threshold, the allocated bandwidth is adjusted first, and the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment. If the decrease is determined to be greater than the decrease threshold, the allocated bandwidth is adjusted a second time, and the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
3. The method according to claim 1, characterized in that, Determining the mapping relationship of the multiple PGs includes: Create a temporary crush map, which includes the topology of the multiple original OSDs and the multiple expanded OSDs; A temporary OSD map is generated based on the temporary crush map; The mapping relationship of the multiple PGs is determined based on the temporary OSD map and the load balancing script tool.
4. A cluster expansion device, characterized in that, The device includes: an acquisition unit, a determination unit, and a capacity expansion unit; The acquisition unit is used to acquire expansion messages, which include multiple expansion object storage OSDs; the expansion messages are used to expand the target cluster; the target cluster includes multiple original OSDs, and each original OSD includes multiple placement groups (PGs); The determining unit is used to determine the mapping relationship of the plurality of PGs, the mapping relationship including the original position and the expanded position of each PG; The expansion unit is used to expand the target cluster multiple times according to the mapping relationship. The target cluster after multiple expansions includes the multiple original OSDs and the multiple expanded OSDs. The multiple PGs are evenly distributed among the multiple original OSDs and the multiple expanded OSDs. The expansion unit is specifically used for: The first expanded OSD is expanded to the target cluster; the first expanded OSD is any one of the plurality of expanded OSDs; The target PG is migrated to the first expanded OSD according to the mapping relationship; the target PG is the PG located in the first expanded OSD after expansion according to the mapping relationship; The expansion unit is further used for: Determine a first service bandwidth and a second service bandwidth, wherein the first service bandwidth is the average service bandwidth during the period between a first time point and the current time point, and the second service bandwidth is the average service bandwidth during the period between a second time point and the current time point; the first time point is located before the second time point. The decrease in the first service bandwidth is determined based on the first service bandwidth and the second service bandwidth. If the decrease is less than or equal to the decrease threshold, the first expanded OSD is expanded to the target cluster. The expansion unit is further used for: A first quantity is determined based on the mapping relationship, and the first quantity is the total number of the target PG; Determine the service pressure level of the cluster, wherein the service pressure level is positively correlated with the first service bandwidth; Based on the business pressure level, the target number of target PGs is allocated to the first expanded OSD until the first number of target PGs is allocated.
5. The apparatus according to claim 4, characterized in that: The determining unit is further configured to determine the allocated bandwidth of the first expanded OSD; The expansion unit is further configured to perform a first adjustment on the allocated bandwidth when it is determined that the decrease is less than or equal to the decrease threshold, wherein the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment. The expansion unit is further configured to perform a second adjustment to the allocated bandwidth when it is determined that the decrease is greater than the decrease threshold, wherein the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
6. The apparatus according to claim 4, characterized in that, The determining unit is specifically used for: Create a temporary crush map, which includes the topology of the multiple original OSDs and the multiple expanded OSDs; A temporary OSD map is generated based on the temporary crush map; The mapping relationship of the multiple PGs is determined based on the temporary OSD map and the load balancing script tool.
7. A computer-readable storage medium, characterized in that, The readable storage medium stores instructions that, when executed, implement the method as described in any one of claims 1-3.
8. A cluster expansion device, characterized in that, include: The processor, memory, and communication interface; wherein the communication interface is used for communication between the cluster expansion device and other devices or networks; The memory is used to store one or more programs, which include computer-executable instructions. When the cluster expansion device is running, the processor executes the computer-executable instructions stored in the memory to cause the cluster expansion device to perform the method of any one of claims 1-3.
Citation Information
Patent Citations
Cluster capacity expansion method, device and storage medium
CN113271323A
Distributed storage automatic capacity expansion method and distributed storage system
CN115981556A