Cluster capacity expansion method and device and readable storage medium
By determining and utilizing the mapping relationship of PG during cluster expansion, multiple data migration problems caused by topological changes in cluster expansion are solved, improving capacity expansion efficiency and ensuring data balance.
Patent Information
- Application Number
- CN202311133828.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2043-09-04
AI Technical Summary
During the cluster expansion process, the placement group (PG) mapping changes due to changes in the topology of data nodes, causing multiple data migrations, and the expansion efficiency is poor.
By obtaining the expansion message, the mapping relationship of multiple PGs is determined, including the original location of each PG and the expanded location, and the target cluster is expanded multiple times according to this mapping relationship to ensure the balanced distribution of PGs during each expansion.
It reduces the migration of redundant data caused by topological changes, improves the efficiency of cluster expansion, and ensures the balance of cluster data after the expansion is completed.
Smart Images

Figure CN119561841A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular to a cluster expansion method, device, and readable storage medium. Background Art
[0002] When the distributed storage (hereinafter referred to as the cluster) is expanded, the topological structure of the cluster data nodes changes, which causes the placement group (PG) mapping to change. The change in PG mapping will cause the migration and reconstruction of cluster data. Part of the cluster data will be migrated from the old node to the new expanded node, and finally the data of each node will be balanced.
[0003] The storage pool of cluster data consists of multiple nodes, each node consists of multiple object storage devices (OSDs), and each OSD has multiple PGs distributed in it. When the number of nodes is determined and the number of OSDs in a node is determined, the distribution of PGs is unique and fixed. When the number of nodes or the number of OSDs in a node changes, the distribution of PGs will change. When multiple nodes need to be expanded online, usually only one node is expanded at a time, and the next node is expanded after the reconstruction is completed. When the second node is expanded, the topology of the cluster data node changes, which will cause the PG mapping to change again. In addition, part of the data that has just been migrated to the first node that has been expanded needs to be migrated to the second node that has been expanded, 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. Summary of the invention
[0004] The present application provides a cluster expansion method, device and readable storage medium, which are used to improve the efficiency of expanding a target cluster.
[0005] In order to achieve the above objectives, this application adopts the following technical solutions:
[0006] In a first aspect, a cluster expansion method is provided, the method comprising: obtaining an expansion message, the expansion message comprising multiple expansion OSDs; the expansion message is used to expand a target cluster; the target cluster comprises multiple original OSDs, each original OSD comprises multiple placement group PGs; determining a mapping relationship among multiple PGs, the mapping relationship comprising an original position and an expanded position of each PG; expanding the target cluster multiple times according to the mapping relationship, the target cluster after the multiple expansions comprises multiple original OSDs and multiple expansion OSDs, and the multiple PGs are evenly distributed among the multiple original OSDs and the 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 business bandwidth and a second business bandwidth, the first business bandwidth being an average of the business bandwidths in a period between a first moment and a current moment, and the second business bandwidth being an average of the business bandwidths in a period between a second moment and the current moment; the first moment is before the second moment; determining a decrease in the first business bandwidth based on the first business bandwidth and the second business bandwidth, and when it is determined that the decrease is less than or equal to a decrease threshold, expanding the first expanded OSD to the target cluster.
[0009] Optionally, the target PG is migrated to the first expanded OSD according to the mapping relationship, including: determining a first quantity according to the mapping relationship, the first quantity being the total number of target PGs; determining the business pressure level of the cluster, the business pressure level being positively correlated with the first business bandwidth; according to the business pressure level, allocating a target number of target PGs to the first expanded OSD until the first number of target PGs are allocated.
[0010] Optionally, the method also includes: determining the allocated bandwidth of the first expanded OSD; when it is determined that the decline is less than or equal to the decline threshold, making a first adjustment to the allocated bandwidth, and the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment; when it is determined that the decline is greater than the decline threshold, making a second adjustment to the allocated bandwidth, and the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
[0011] Optionally, determining the mapping relationship of multiple PGs includes: creating a temporary crush map, the temporary crush map including the topological structure of multiple original OSDs and multiple expanded OSDs; generating a temporary OSD map based on the temporary crush map; determining the mapping relationship of multiple PGs based on the temporary OSD map and the balancing script tool.
[0012] Based on the technical solution provided in the present 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, in this way, the PG allocated to the expanded OSD at each expansion refers to the mapping relationship generated when the expansion is finally completed. Therefore, the cluster topology structure changes generated at each expansion will not affect the expanded OSD that has been expanded to the target cluster, and no unnecessary data migration will be generated, thereby 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, which ensures the balance of cluster data in the target cluster.
[0013] In the second aspect, a cluster expansion device is provided, the device comprising: an acquisition unit, a determination unit, and an expansion unit; the acquisition unit is used to acquire an expansion message, the expansion message includes multiple expansion OSDs; the expansion message is used to expand the target cluster; the target cluster includes multiple original OSDs, each original OSD includes multiple placement groups PG; the determination unit is used to determine the mapping relationship between the multiple PGs, the mapping relationship includes the original position and the position after expansion 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 multiple original OSDs and multiple expansion OSDs, and the multiple PGs are located evenly distributed in the multiple original OSDs and the multiple expansion OSDs.
[0014] Optionally, the expansion unit is specifically used to: expand the first expanded OSD to the target cluster; the first expanded OSD is any one of multiple expanded OSDs; migrate 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; iterate the above steps until multiple expanded OSDs are expanded to the target cluster.
[0015] Optionally, the expansion unit is further used to: determine a first business bandwidth and a second business bandwidth, the first business bandwidth being an average of the business bandwidths in a period between a first moment and a current moment, and the second business bandwidth being an average of the business bandwidths in a period between a second moment and the current moment; the first moment is before the second moment; determine a decrease in the first business bandwidth based on the first business bandwidth and the second business bandwidth, and when it is determined that the decrease is less than or equal to a decrease threshold, expand the first expanded OSD to the target cluster.
[0016] Optionally, the expansion unit is further used to: determine a first quantity based on a mapping relationship, the first quantity being the total number of target PGs; determine a business pressure level of the cluster, the business pressure level being positively correlated with the first business bandwidth; and according to the business pressure level, allocate a target number of target PGs to a first expansion OSD until the first number of target PGs are allocated.
[0017] Optionally, the determination unit is further used to determine the allocated bandwidth of the first expanded OSD; the expansion unit is further used to make a first adjustment to the allocated bandwidth when it is determined that the decline is less than or equal to the decline threshold, and the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment; the expansion unit is further used to make a second adjustment to the allocated bandwidth when it is determined that the decline is greater than the decline threshold, and the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
[0018] Optionally, a determination unit is specifically used to: create a temporary crush map, the temporary crush map includes a topological structure of multiple original OSDs and multiple expanded OSDs; generate a temporary OSD map according to the temporary crush map; determine the mapping relationship of multiple PGs according to the temporary OSD map and the balancing script tool.
[0019] In a third aspect, a cluster expansion device is provided, which can implement the functions performed by the cluster expansion device in the above-mentioned aspects or possible designs. The functions can be implemented through hardware, such as: in one possible design, the cluster expansion device may include: a processor and a communication interface, and the processor can be used to support the cluster expansion device to implement the functions involved in the above-mentioned first aspect or any possible design of the first aspect.
[0020] In another possible design, the cluster expansion device may further include a memory, the memory being used to store computer execution instructions and data necessary for the cluster expansion device. When the cluster expansion device is running, the processor executes the computer execution instructions stored in the memory, so that the cluster expansion device executes the first aspect or any possible cluster expansion method of the first aspect.
[0021] In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium may be a readable non-volatile storage medium. The computer-readable storage medium stores computer instructions or programs. When the computer-readable storage medium is run on a computer, the computer can execute the first aspect or any possible cluster expansion method of the above aspects.
[0022] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the cluster expansion method according to the first aspect or any possible design of the above aspects.
[0023] In a sixth aspect, an electronic device is provided, the 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, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the 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, the chip system including a processor and a communication interface, the chip system 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 also includes a memory, the memory is used to store program instructions and / or data. The chip system can be composed of a chip, or it can include a chip and other discrete devices, without limitation. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of a topological structure of a cluster data node provided in an embodiment of the present application;
[0026] Figure 2 A schematic diagram of the structure of a cluster expansion system provided in an embodiment of the present application;
[0027] Figure 3 A schematic diagram of the structure of a cluster expansion device provided in an embodiment of the present application;
[0028] Figure 4 A schematic diagram of a cluster expansion method provided in an embodiment of the present application;
[0029] Figure 5 A flowchart of another cluster expansion method provided in an embodiment of the present application;
[0030] Figure 6 A flowchart of another cluster expansion method provided in an embodiment of the present application;
[0031] Figure 7 A schematic diagram of the structure of another cluster capacity expansion device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0034] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.
[0035] When the cluster is expanded, the topology of the cluster data nodes changes, which in turn causes changes in the PG mapping. Changes in the PG mapping will cause the migration and reconstruction of cluster data. Part of the cluster data will be migrated from the old node to the newly expanded node, and eventually the data on each node will be balanced. When the number of nodes is determined and the number of OSDs in a node is determined, the distribution of PG is unique and fixed. When the number of nodes or the number of OSDs in a node changes, the distribution of PG will change.
[0036] For example, Figure 1 A schematic diagram of a topological structure of a cluster data node provided in an embodiment of the present application. Figure 1 As shown in the figure, the storage pool of cluster data consists of multiple nodes, each node consists of multiple OSDs, and each OSD has multiple PGs. When PG consists of 3 replicas (members), if the members of PG1.0 are [0,2,5], that is, PG1.0 is available on OSD.0, OSD.2, and OSD.5. Assuming that the capacity is expanded to node 4 (OSD.6, OSD.7), the topology structure will change, and the PG on the original OSD needs to be migrated to the newly expanded OSD, which will also cause changes in the PG distribution.
[0037] When multiple nodes need to be expanded online, if multiple nodes are expanded at once, a large number of PG mappings will change, and the amount of data that needs to be migrated will be huge. A large amount of reconstruction will affect performance (such as increased system latency, slower response, etc.).
[0038] Therefore, usually only one node is expanded at a time, and the next node is expanded after the reconstruction is completed. Then, when the second node is expanded, the topology of the cluster data nodes changes, which will cause the PG mapping to change again. In addition, part of the data that has just been migrated to the first node that was expanded needs to be migrated to the second node that was expanded, 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, an embodiment of the present application provides a cluster expansion method, including:
[0040] Get an expansion message, the expansion message includes multiple expansion OSDs; the expansion message is used to expand the target cluster; the target cluster includes multiple original OSDs, each original OSD includes multiple placement group PGs; determine the mapping relationship of multiple PGs, the mapping relationship includes the original position and the expanded position of each PG; expand the target cluster according to the mapping relationship, the expanded target cluster includes multiple original OSDs and multiple expansion OSDs, and the multiple PGs are evenly distributed to multiple original OSDs and multiple expansion OSDs.
[0041] The method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0042] It should be noted that the network system described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of network systems and the emergence of other network systems, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0043] Figure 2 FIG. 1 is a schematic diagram of a cluster expansion system 10 provided in an embodiment of the present 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 may be connected wirelessly, and the server 11 and the terminal device 12 may also be connected wirelessly.
[0044] Among them, the server 11 involved in the embodiment of the present application is used to adjust the storage capacity of the target cluster. For example, it can be a Monitor server of a distributed file system. The server 11 can be a single server, or it can be a server cluster composed of multiple servers. In some implementations, the server cluster can also be a distributed cluster. The embodiment of the present application does not limit the specific technology, specific number and specific device form of the server 11.
[0045] The terminal device 12 is a device that provides network communication services, and the terminal device 12 can be used to request the expansion of the target cluster. Among them, the terminal device 12 involved in the embodiments of the present application can also be called a terminal, a mobile station (mobilestation, MS), a mobile terminal (mobile terminal, MT), etc., which is a device that provides voice and / or data connectivity to users. For example, the terminal device 12 can be a handheld device with a wireless connection function, a vehicle-mounted device, etc. Specifically, it can be: a smart phone (mobile phone), a pocket personal computer (pocket personal computer, PPC), a handheld computer, a personal digital assistant (personal digital assistant, PDA), a laptop, a tablet computer, a wearable device, or a vehicle-mounted device, etc. The embodiments of the present application do not limit the specific technology, specific number, and specific device form adopted by the terminal device 12.
[0046] It should be noted that Figure 2 This is just an exemplary framework diagram. Figure 2 The names of the individual devices included in the Figure 2 In addition to the functional nodes shown, other nodes may also be included, which is not limited in the embodiments of the present application.
[0047] When implementing it specifically, Figure 2 Each device in the Figure 3 The structure shown, or including Figure 3 Parts shown. Figure 3 The present invention provides a schematic diagram of a cluster expansion device 200, which may be a server, or a chip or system on chip in 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 further include a memory 204 . The processor 201 , the memory 204 and the communication interface 202 may be connected via a communication line 203 .
[0049] The processor 201 is a CPU, a general 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 may also be other devices with processing functions, such as circuits, devices, or software modules, without limitation.
[0050] The communication interface 202 is used to communicate with other devices or other communication networks. The communication interface 202 can be a module, a circuit, a communication interface or any device capable of implementing communication.
[0051] The communication line 203 is used to transmit information between the components included in the cluster expansion device 200 .
[0052] The memory 204 is used to store instructions, where the instructions may be computer programs.
[0053] The memory 204 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or 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 disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, 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 or program codes or some data, etc. The memory 204 can be located in the cluster expansion device 200, or can be located 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 the present application.
[0055] In one example, the processor 201 may include one or more CPUs, for example, Figure 3 CPU0 and CPU1 in.
[0056] As an optional implementation, the cluster expansion device 200 includes multiple processors, for example, Figure 3 In addition to the processor 201, a processor 205 may also be included.
[0057] It should be pointed out that Figure 3 The composition shown in the Figure 2 The limitations of each device in Figure 3 In addition to the parts shown, Figure 2 The individual devices in the Figure 3 More or fewer components, or combinations of certain components, or different arrangements of components.
[0058] In the embodiment of the present application, the chip system may be composed of a chip, or may include a chip and other discrete devices.
[0059] In addition, the actions, terms, etc. involved in the various embodiments of the present application can refer to each other without limitation. The message name or parameter name in the message exchanged between the various devices in the embodiments of the present application is only an example, and other names can also be used in the specific implementation without limitation.
[0060] In order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference.
[0061] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0062] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers 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, c can be single or multiple.
[0063] Combine the following Figure 2 The cluster expansion system shown describes the cluster expansion method provided in the embodiment of the present application.
[0064] Figure 4 The present application provides a cluster expansion method, which is applied to a server and can also be applied to devices in the server, such as chips. For example, the server can be Figure 2 The server 11 in the present application is described by taking the application to the server as an example. Figure 4 As shown, the method includes the following S301-S303:
[0065] S301. Obtain capacity expansion information.
[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 PG.
[0067] As a possible implementation, the terminal device may respond to the control instruction and send a capacity expansion message to the server. Correspondingly, the server receives the capacity expansion message sent by the terminal device.
[0068] It should be noted that the control instruction may refer to an instruction generated in response to a control operation of an operator. For example, the control instruction may be a control instruction input by an operator through an input device (such as a keyboard) of a terminal device.
[0069] In actual applications, multiple original OSDs can be evenly distributed among the nodes of different target clusters.
[0070] S302: Determine the mapping relationship between multiple PGs.
[0071] The mapping relationship includes the original position and the position after expansion of each PG.
[0072] Combination Figure 1, the source position of PG1.0 is located at OSD.0, OSD.2, and OSD.5. For example, when the multiple expanded OSDs include OSD.6, OSD.7, and OSD.8, the expanded position of PG1.0 can be located at OSD.6, OSD.2, and OSD.5.
[0073] As a possible implementation method, the server can create a temporary crush map and generate a temporary OSD map based on the temporary crush map; further determine the mapping relationship of multiple PGs based on the temporary OSD map and the balancing script tool.
[0074] It should be noted that the temporary crush map includes topological information of 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 position and PG position of the target cluster), and add multiple expanded OSDs in the newly expanded node to the crush map to obtain a temporary crush map.
[0076] Furthermore, an OSD map is generated based on the temporary crush map, and a mapping relationship among multiple PGs is determined based on the temporary OSD map and the balancing script tool.
[0077] For example, the server can determine the positions of the original OSD and the expanded OSD based on the temporary crush map to obtain the temporary OSDmap. Further, the balancing script tool is used to redistribute multiple PGs in the temporary OSD map to achieve data balance, that is, to obtain the mapping relationship of multiple PGs. In this way, the data redistribution process caused by the addition of multiple expanded OSDs can be solved.
[0078] In actual applications, the number of PGs in each original OSD and each expanded OSD after expansion 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, and multiple PGs are evenly distributed among the multiple original OSDs and multiple expanded OSDs. For example, when the total number of original OSDs and expanded OSDs is 3 and the total number of PGs is 6, the multiple original OSDs and multiple expanded OSDs may each include 2 PGs.
[0081] In some embodiments, when multiple PGs cannot be evenly distributed among multiple original OSDs and multiple expanded OSDs, the server can randomly reduce the PGs allocated to one OSD. For example, when the total number of original OSDs and expanded OSDs is 3 and the total number of PGs is 5, the multiple original OSDs and the multiple expanded OSDs can include 2 PGs, 2 PGs, and 1 PG, respectively.
[0082] As a possible implementation method, 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, and further iterate the above steps until multiple expanded OSDs are expanded to the target cluster.
[0083] It should be noted that the first expanded OSD is any one of the 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 of expanding the target cluster may also be adjusted according to the service pressure level of the target cluster. For details, please refer to the subsequent description of the specification, which will not be described in detail 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 been expanded, and the progress percentage of the expansion completion.
[0086] Based on the technical solution provided by the present 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 position after expansion of each PG, the PG allocated to the expanded OSD at each expansion refers to the mapping relationship generated when the expansion is finally completed. Therefore, the cluster topology structure changes generated at each expansion will not affect the expanded OSD that has been expanded to the target cluster, and no unnecessary data migration will be generated, thereby 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, which ensures the balance of cluster data in the target cluster.
[0087] A possible embodiment is as follows Figure 5 As shown, in order to expand the target cluster according to the mapping relationship, the cluster expansion method of the present application may further include the following S401-S403.
[0088] S401. Expand the first expanded OSD to the target cluster.
[0089] The first expanded OSD is any one of the multiple expanded OSDs.
[0090] As a possible implementation method, the server can determine the first business bandwidth and the second business bandwidth, determine the decrease in the first business bandwidth based on the first business bandwidth and the second business bandwidth, and expand the first expansion OSD to the target cluster when it is determined that the decrease is less than or equal to the decrease threshold.
[0091] It should be noted that the first service bandwidth is the average service bandwidth in the period between the first moment and the current moment, and the second service bandwidth is the average service bandwidth in the period between the second moment and the current moment; the first moment is before the second moment.
[0092] The first time, the second time and the decreasing threshold can be set as needed. For example, the first time can be 1 hour before the current time, the second time can be 5 minutes before the current time, and the decreasing threshold can be 10%.
[0093] In some embodiments, when it is determined that the decrease is greater than a decrease threshold, the server may stop expanding the first expanded OSD to the target cluster.
[0094] In actual applications, the server can count the business bandwidth of the last five minutes and the business bandwidth of the past hour every five minutes. If the decline is greater than 10%, the expansion is suspended; otherwise, the OSD is continued to be expanded to the target cluster.
[0095] S402. Migrate the target PG to the first expanded OSD according to the mapping relationship.
[0096] Among them, the target PG is the PG located in the first expanded OSD after expansion in the mapping relationship.
[0097] As a possible implementation method, the server can determine the first quantity and the business pressure level of the cluster based on the mapping relationship, and according to the business pressure level, allocate the target number of target PGs to the first expanded OSD at a preset frequency until the allocation of the first number of target PGs is completed.
[0098] For example, the business pressure levels include level 1, level 2, and level 3. The server can allocate 50% of the target PG to the first expansion OSD when the business pressure level is level 1; allocate 30% of the target PG to the first expansion OSD when the business pressure level is level 2; and allocate 15% of the target PG to the first expansion OSD when the business pressure level is level 3.
[0099] It should be noted that the first number is the total number of target PGs. The business pressure level is positively correlated with the first business bandwidth. For example, the corresponding relationship between the business pressure level and the first business bandwidth is shown in Table 1 below.
[0100] Table 1 Schematic diagram of business pressure levels
[0101] Business stress level First service bandwidth Level 1 <500M / s Level 2 [500,1000]M / s Level 3 (1000,1500]M / s
[0102] It should be noted that Table 1 is only an exemplary description, and the corresponding relationship between the service pressure level and the first service bandwidth can also be adjusted according to user needs.
[0103] As another possible implementation, the server may allocate the target number of target PGs to the first expanded OSD according to the decrease in the first service bandwidth and at a frequency corresponding to the decrease until the first number of target PGs are allocated.
[0104] For example, if the decrease exceeds 10%, the server may reduce the number of PGs to be allocated next time (eg, reduce it by 50% based on the last allocation).
[0105] In practical applications, the first number may be between 100 and 200. The preset frequency may be 5 minutes.
[0106] S403, iterate the above steps until multiple expanded OSDs are expanded to the target cluster.
[0107] In this way, the progress of OSD expansion can be regulated according to the business pressure level, reducing the impact of OSD expansion on the normal business of the target cluster.
[0108] A possible embodiment is as follows Figure 6 As shown, in order to control the reconstruction speed of the first expanded OSD, the cluster expansion method of the present application may further include the following S501-S503.
[0109] S501: Determine the allocated bandwidth of the first expanded OSD.
[0110] The allocated bandwidth is used to reconstruct the first capacity expansion OSD, and the speed of reconstructing the first capacity expansion OSD is positively correlated with the size of the allocated bandwidth of the first capacity expansion OSD.
[0111] As a possible implementation manner, the server may obtain the network log of the target cluster from the cluster system, and parse the network log to obtain the allocated bandwidth of the first expanded OSD.
[0112] In one example, the allocated bandwidth may be 50 Mbps, 100 Mbps, etc.
[0113] S502: When it is determined that the decrease amplitude is less than or equal to the decrease threshold, perform a first adjustment on the allocated bandwidth.
[0114] The allocated bandwidth after the first adjustment is smaller than the allocated bandwidth before the first adjustment.
[0115] As a possible implementation manner, the server may perform a first adjustment on the allocated bandwidth according to a first preset step size.
[0116] The first preset step size can be set as needed, for example, -5 megabytes, -10 megabytes, etc.
[0117] In an example, if the allocated bandwidth before the first adjustment is 50 Mbps and the first preset step is -5 Mbps, the allocated bandwidth after the first adjustment is 5 Mbps.
[0118] S503: When it is determined that the decrease amplitude is greater than the decrease threshold, perform a second adjustment on the allocated bandwidth.
[0119] The allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
[0120] As a possible implementation manner, the server may perform a first adjustment on the allocated bandwidth according to a second preset step size.
[0121] The second preset step size can be set as needed, for example, 5 megabytes, 10 megabytes, etc.
[0122] In an example, if the allocated bandwidth before the first adjustment is 50 Mbps and the first preset step size is 5 Mbps, the allocated bandwidth after the first adjustment is 55 Mbps.
[0123] In this way, it can be avoided that when the first capacity expansion OSD can meet the bandwidth demand of capacity expansion with a smaller allocated bandwidth, the allocated bandwidth is too large, resulting in idle allocated bandwidth, thereby improving bandwidth utilization.
[0124] The various solutions in the above embodiments of the present application can be combined without contradiction.
[0125] The embodiment of the present application can divide the cluster expansion device into functional modules or functional units according to the above method example. For example, each functional module or functional unit can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules or functional units. Among them, the division of modules or units in the embodiment of the present application is schematic, which is only a logical functional division. There may be other division methods in actual implementation.
[0126] In the case of dividing each functional module into corresponding functional modules, Figure 7 A schematic structural diagram of a cluster expansion device 700 is shown. The cluster expansion device may be a server or a chip used in a server. The cluster expansion device 700 may be used to execute 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 obtain an expansion message, and 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 PG; the determination unit 702 is used to determine the mapping relationship between multiple PGs, and the mapping relationship includes the original position and the position after expansion of each PG; the expansion unit 703 is used to expand the target cluster multiple times according to the mapping relationship, and the target cluster after multiple expansions includes multiple original OSDs and multiple expansion OSDs, and the multiple PGs are located evenly distributed in the multiple original OSDs and the multiple expansion OSDs.
[0127] Optionally, the expansion unit 703 is specifically used to: expand the first expanded OSD to the target cluster; the first expanded OSD is any one of multiple expanded OSDs; migrate 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; iterate the above steps until multiple expanded OSDs are expanded to the target cluster.
[0128] Optionally, the expansion unit 703 is further specifically used to: determine a first business bandwidth and a second business bandwidth, the first business bandwidth being an average of the business bandwidths in a period between a first moment and a current moment, and the second business bandwidth being an average of the business bandwidths in a period between a second moment and the current moment; the first moment is before the second moment; determine a decrease in the first business bandwidth based on the first business bandwidth and the second business bandwidth, and when it is determined that the decrease is less than or equal to a decrease threshold, expand the first expanded OSD to the target cluster.
[0129] Optionally, the expansion unit 703 is further specifically used to: determine a first quantity based on a mapping relationship, the first quantity being the total number of target PGs; determine a business pressure level of the cluster, the business pressure level being positively correlated with the first business bandwidth; and according to the business pressure level, allocate a target number of target PGs to the first expansion OSD until the first number of target PGs are allocated.
[0130] Optionally, the determination unit 702 is further used to determine the allocated bandwidth of the first expanded OSD; the expansion unit 703 is further used to make a first adjustment to the allocated bandwidth when it is determined that the decline is less than or equal to the decline threshold, and the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment; the expansion unit 703 is further used to make a second adjustment to the allocated bandwidth when it is determined that the decline is greater than the decline threshold, and the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
[0131] Optionally, the determination unit 702 is specifically used to: create a temporary crush map, the temporary crush map includes a topological structure of multiple original OSDs and multiple expanded OSDs; generate a temporary OSD map according to the temporary crush map; determine the mapping relationship of multiple PGs according to the temporary OSDmap and the balancing script tool.
[0132] The embodiment of the present application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be completed by a computer program to instruct the relevant hardware, and the program can be stored in the above computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The computer-readable storage medium can be an internal storage unit of the cluster expansion device (including a data sending end and / or a data receiving end) of any of the above embodiments, such as a hard disk or memory of the cluster expansion device. The above computer-readable storage medium can also be an external storage device of the above terminal device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the above terminal device. Further, the above computer-readable storage medium can also include both the internal storage unit of the above cluster expansion device and an external storage device. The above computer-readable storage medium is used to store the above computer program and other programs and data required by the above cluster expansion device. The above computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0133] It should be noted that the terms "first" and "second" in the specification, claims and drawings of the present application are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0134] It should be understood that in the present application, "at least one (item)" means one or more, "more than one" means two or more, "at least two (items)" means two or three and more than three, and "and / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one 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, c can be single or multiple.
[0135] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned 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 the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0137] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0138] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0139] If the integrated unit is implemented in the form of 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 solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.
[0140] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A cluster expansion method, characterized in that: The method comprises: Acquire a capacity expansion message, the capacity expansion message includes multiple capacity expansion object storage OSDs; the capacity expansion message is used to expand the target cluster; the target cluster includes multiple original OSDs, each original OSD includes multiple placement groups PGs; Determine a mapping relationship among the multiple PGs, wherein the mapping relationship includes an original position and a position after expansion of each PG; The target cluster is expanded multiple times according to the mapping relationship. The target cluster after the 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.
2. The method according to claim 1, characterized in that The step of expanding the target cluster multiple times according to the mapping relationship includes: Expanding a first expansion OSD to the target cluster; the first expansion OSD is any one of the multiple expansion OSDs; Migrate 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; The above steps are iterated until the multiple expanded OSDs are expanded to the target cluster.
3. The method according to claim 2, characterized in that The step of 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 an average value of the service bandwidths in a period between a first moment and a current moment, and the second service bandwidth is an average value of the service bandwidths in a period between a second moment and the current moment; the first moment is before the second moment; A decrease range of the first service bandwidth is determined according to the first service bandwidth and the second service bandwidth, and when it is determined that the decrease range is less than or equal to a decrease threshold, the first expansion OSD is expanded to the target cluster.
4. The method according to claim 2, characterized in that: The migrating the target PG to the first expanded OSD according to the mapping relationship includes: Determine a first quantity according to the mapping relationship, where the first quantity is the total quantity of the target PGs; Determining a service pressure level of the cluster, wherein the service pressure level is positively correlated with a first service bandwidth; According to 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 method according to claim 3, characterized in that: The method further comprises: Determining the allocated bandwidth of the first expanded OSD; In a case where it is determined that the decrease amplitude is less than or equal to the decrease threshold, a first adjustment is performed on the allocated bandwidth, wherein the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment; In the case where it is determined that the decrease amplitude is greater than the decrease threshold, a second adjustment is performed on the allocated bandwidth, and the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
6. The method according to claim 1, characterized in that The determining the mapping relationship between the multiple PGs includes: Creating a temporary crush map, wherein the temporary crush map includes a topological structure of the multiple original OSDs and the multiple expanded OSDs; Generate a temporary OSD map according to the temporary crush map; The mapping relationship between the multiple PGs is determined according to the temporary OSD map and the balancing script tool.
7. A cluster expansion device, characterized in that: The device comprises: an acquisition unit, a determination unit, and a capacity expansion unit; The acquisition unit is used to acquire a capacity expansion message, wherein the capacity expansion message includes multiple capacity expansion object storage OSDs; the capacity expansion message is used to expand the target cluster; the target cluster includes multiple original OSDs, each original OSD includes multiple placement groups PGs; The determining unit is used to determine a mapping relationship between the multiple PGs, where the mapping relationship includes an original position and a position after expansion of each PG; The expansion unit is used to expand the target cluster multiple times according to the mapping relationship, the target cluster after the multiple expansions includes the multiple original OSDs and the multiple expanded OSDs, and the multiple PGs are evenly distributed in the multiple original OSDs and the multiple expanded OSDs; The above steps are iterated until the multiple expanded OSDs are expanded to the target cluster.
8. The device according to claim 7, characterized in that The expansion unit is specifically used for: Expanding a first expansion OSD to the target cluster; the first expansion OSD is any one of the multiple expansion OSDs; Migrate 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; The above steps are iterated until the multiple expanded OSDs are expanded to the target cluster.
9. The device according to claim 8, characterized in that The expansion unit is further specifically used for: Determine a first service bandwidth and a second service bandwidth, wherein the first service bandwidth is an average value of the service bandwidths in a period between a first moment and a current moment, and the second service bandwidth is an average value of the service bandwidths in a period between a second moment and the current moment; the first moment is before the second moment; A decrease range of the first service bandwidth is determined according to the first service bandwidth and the second service bandwidth, and when it is determined that the decrease range is less than or equal to a decrease threshold, the first expansion OSD is expanded to the target cluster.
10. The device according to claim 8, characterized in that The expansion unit is further specifically used for: Determine a first quantity according to the mapping relationship, where the first quantity is the total quantity of the target PGs; Determining a service pressure level of the cluster, wherein the service pressure level is positively correlated with a first service bandwidth; According to 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.
11. The device according to claim 9, characterized in that: The determining unit is further configured to determine the allocated bandwidth of the first expanded OSD; The capacity expansion unit is further configured to, when it is determined that the decrease amplitude is less than or equal to the decrease threshold, perform a first adjustment on the allocated bandwidth, wherein the allocated bandwidth after the first adjustment is less than the allocated bandwidth before the first adjustment; The capacity expansion unit is further configured to, when it is determined that the decrease amplitude is greater than the decrease threshold, perform a second adjustment on the allocated bandwidth, wherein the allocated bandwidth after the second adjustment is greater than the allocated bandwidth before the first adjustment.
12. The device according to claim 7, characterized in that The determining unit is specifically configured to: Creating a temporary crush map, wherein the temporary crush map includes a topological structure of the multiple original OSDs and the multiple expanded OSDs; Generate a temporary OSD map according to the temporary crush map; The mapping relationship between the multiple PGs is determined according to the temporary OSD map and the balancing script tool.
13. A computer-readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 6 is implemented.
14. A cluster expansion device, characterized in that: include: Processor, memory and communication interface; wherein the communication interface is used for the cluster expansion device to communicate with 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 enable the cluster expansion device to perform any one of claims 1-6.
Citation Information
Patent Citations
Cluster capacity expansion method, device and storage medium
CN113271323A
Distributed storage automatic capacity expansion method and distributed storage system
CN115981556A
Storage system and storage management method
US20210181958A1