Capacity expansion method and device, distributed storage system and storage medium
By detecting and formatting the expansion space of thick-provisioned volumes in the distributed storage system, the problems of inaccurate and unstable pre-allocation space in the expansion of thick-provisioned volumes are solved, and the availability and data security of the system are improved.
Patent Information
- Application Number
- CN202411178337.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-13
AI Technical Summary
In distributed storage systems, during the expansion of thick-provisioned volumes, inaccurate preallocation space and instability of thick-provisioned volumes lead to unexpected insufficient storage space and reduced system availability.
By receiving the expansion command at the main node, generating the expansion policy information to be processed, detecting whether the expansion volume is a thick provisioned volume, and formatting it to ensure the accuracy and stability of the expansion space, avoiding insufficient pre-allocated space, and improving system availability .
It realizes rapid execution of capacity expansion commands to ensure that the expanded thick-provisioned volume pre-allocated and retain the entire volume capacity space, improves data security and performance stability, avoids the problem of insufficient storage space, and enhances the availability of the system.
Smart Images

Figure CN119127072A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of capacity expansion technology, and in particular to a capacity expansion method, device, distributed storage system and storage medium. Background Art
[0002] With the rapid development of technologies such as big data and cloud computing, distributed storage systems have gradually become the core of data storage and management. Because distributed systems use distributed storage architecture, they can integrate storage resources such as CPU, hard disk, and memory in the system into a logical storage pool, and integrate scattered storage devices into a centralized storage pool to improve the utilization of storage resources.
[0003] In the field of distributed storage, thick-provisioned volumes are an important storage strategy that provides users with data security and reliability, which helps avoid unexpected storage space shortages and improves system availability.
[0004] However, when a thick provisioned volume is expanded, in order to quickly complete the expansion command, the expanded portion is generally not thick-provisioned, which may cause inaccurate pre-allocated space and instability of the thick provisioned volume. Summary of the invention
[0005] In view of this, the present invention provides a capacity expansion method, device, distributed storage system and storage medium to solve the problems in the prior art that lead to inaccurate pre-allocated space and unstable thick provisioned volumes.
[0006] In a first aspect, the present invention provides a capacity expansion method, which is applied to a master node in a distributed storage system, and the method comprises:
[0007] Receive the capacity expansion command input by the user;
[0008] Generate the expansion strategy information to be processed corresponding to the expansion command according to the expansion command;
[0009] According to the capacity expansion policy information to be processed, the volume to be expanded corresponding to the capacity expansion policy information to be processed is expanded to generate expansion space;
[0010] Check whether the volume to be expanded is a thick provisioned volume;
[0011] If the volume to be expanded is a thick provisioned volume, format the expansion space.
[0012] The expansion method provided in the embodiment of the present application receives the expansion command input by the user; according to the expansion command, generates the to-be-processed expansion policy information corresponding to the expansion command, thereby ensuring the accuracy of the generated to-be-processed expansion policy information. According to the to-be-processed expansion policy information, the to-be-expanded volume corresponding to the to-be-processed expansion policy information is expanded to generate the expansion space, thereby ensuring the accuracy of the generated expansion space and ensuring that the generated expansion space can meet the user's needs. It is detected whether the to-be-expanded volume is a thick provisioned volume, so that the expansion space can be processed according to the detection result. If the to-be-expanded volume is a thick provisioned volume, the expansion space is formatted, thereby ensuring the stability of the expansion space. The above method can not only ensure that the expansion command input by the user can be executed quickly, but also ensure that the expanded space after expansion can also be formatted, ensure that the thick provisioned volume after expansion can also pre-allocate and reserve the entire volume capacity space, ensure the security of data and the performance stability of the thick provisioned volume, and the user can also better manage the storage capacity resources. This helps to avoid the problem of unexpected storage space shortage and improves the availability of the system.
[0013] In an optional implementation, the capacity expansion command includes a storage pool identifier, a volume identifier, and a capacity to be expanded corresponding to the volume to be expanded; and according to the capacity expansion command, to-be-processed capacity expansion policy information corresponding to the capacity expansion command is generated, including:
[0014] Generate capacity expansion metadata according to the storage pool ID, volume ID, and capacity to be expanded;
[0015] Get the original capacity of the volume to be expanded;
[0016] Generate the pending expansion policy information corresponding to the expansion command based on the original capacity and expansion metadata;
[0017] The capacity expansion policy information to be processed is stored in a preset location corresponding to the volume to be expanded.
[0018] The expansion method provided in the embodiment of the present application generates expansion metadata according to the storage pool identifier, volume identifier and the capacity to be expanded, thereby ensuring the accuracy of the generated expansion metadata. The original capacity corresponding to the volume to be expanded is obtained; based on the original capacity and the expansion metadata, the to-be-processed expansion policy information corresponding to the expansion command is generated, thereby ensuring the accuracy of the to-be-processed expansion policy information corresponding to the generated expansion command. The to-be-processed expansion policy information is stored in the preset location corresponding to the volume to be expanded, thereby facilitating the search and tracing of the to-be-processed expansion policy information.
[0019] In an optional implementation, after generating the to-be-processed capacity expansion strategy information corresponding to the capacity expansion command, the method further includes:
[0020] A message is returned to the user indicating that the snapshot task corresponding to the expansion command was successfully created.
[0021] The capacity expansion method provided in the embodiment of the present application returns a message to the user indicating that the snapshot task corresponding to the capacity expansion command has been successfully created, so that the user can receive the message indicating that the snapshot task corresponding to the capacity expansion command has been successfully created, and further the user can use the expanded space as soon as possible, thereby improving the user's work efficiency.
[0022] In an optional implementation, according to the to-be-processed expansion policy information, the to-be-processed volume corresponding to the to-be-processed expansion policy information is expanded to generate expansion space, including:
[0023] Periodically obtain the capacity expansion strategy information to be processed;
[0024] Determine the capacity to be expanded according to the expansion strategy information to be processed;
[0025] Based on the thin volume expansion policy and the capacity to be expanded, the volume to be expanded is expanded to generate expansion space.
[0026] The expansion method provided in the embodiment of the present application periodically obtains the expansion policy information to be processed, thereby ensuring that the expansion policy information to be processed is obtained in a timely and accurate manner. According to the expansion policy information to be processed, the capacity to be expanded is determined, and the accuracy of the determined capacity to be expanded is ensured. Based on the thin volume expansion strategy and the capacity to be expanded, the volume to be expanded is expanded, and the expansion space is generated, which ensures the accuracy of the generated expansion space and ensures that the generated expansion space can meet user needs.
[0027] In an optional implementation manner, determining the capacity to be expanded according to the expansion strategy information to be processed includes:
[0028] Get the first current load corresponding to the master node;
[0029] Compare the first current load corresponding to the master node with a preset load threshold;
[0030] If the first current load is less than the preset load threshold, determining the capacity to be expanded according to the capacity expansion strategy information to be processed;
[0031] If the first current load is greater than or equal to the preset load threshold, obtaining a second current load corresponding to each slave node in the distributed storage system that is communicatively connected to the master node;
[0032] Compare the second current loads corresponding to the slave nodes;
[0033] Determine, from among the slave nodes, a slave node with the second smallest current load as a target slave node;
[0034] The to-be-processed expansion strategy information is transmitted to the target slave node, so that the target slave node determines the to-be-processed expansion capacity according to the to-be-processed expansion strategy information, and expands the to-be-expanded volume based on the thin volume expansion strategy and the to-be-expanded capacity to generate expansion space.
[0035] The capacity expansion method provided in the embodiment of the present application obtains the first current load corresponding to the master node; compares the first current load corresponding to the master node with the preset load threshold, thereby ensuring the accuracy of the comparison result. If the first current load is less than the preset load threshold, the capacity to be expanded is determined according to the capacity expansion policy information to be processed, so that the master node can determine the capacity to be expanded according to the capacity expansion policy information to be processed without affecting the normal operation, and then expand the volume to be expanded according to the capacity to be expanded to generate the expansion space. If the first current load is greater than or equal to the preset load threshold, the second current load corresponding to each slave node in the distributed storage system that is communicatively connected to the master node is obtained, thereby ensuring the accuracy of the second current load corresponding to each slave node obtained. Compare the second current loads corresponding to each slave node;
[0036] Determine the slave node with the smallest second current load from each slave node as the target slave node, which ensures that the second current load of the determined target slave node is the smallest, thereby ensuring load balancing. Transmit the pending expansion strategy information to the target slave node, so that the target slave node determines the capacity to be expanded according to the pending expansion strategy information, and expands the volume to be expanded based on the thin volume expansion strategy and the capacity to be expanded, and generates expansion space, thereby avoiding the situation where the generation of expansion space based on the master node affects the normal operation of the master node when the first current load of the master node is greater than or equal to the preset load threshold. Therefore, the above method realizes the generation of expansion space without affecting the normal operation of the master node and each slave node.
[0037] In an optional implementation manner, if the volume to be expanded is a thick provisioned volume, formatting the expansion space includes:
[0038] If the volume to be expanded is a thick provisioned volume, write 0 to the expansion space.
[0039] In the expansion method provided in the embodiment of the present application, if the volume to be expanded is a thick provisioned volume, 0 is written into the expansion space, so that the storage space corresponding to the expansion space can be reserved, thereby ensuring that data can be written immediately when needed without waiting for the dynamic allocation of storage space. This ensures the continuity and stability of data writing. This mechanism reduces the risk of write failure caused by insufficient storage space and provides higher security for data.
[0040] In an optional implementation manner, if the volume to be expanded is a thick provisioned volume, after formatting the expansion space, the method further includes:
[0041] Get the current expansion strategy information again;
[0042] Compare the current expansion strategy information with the pending expansion strategy information;
[0043] If the current capacity expansion policy information is inconsistent with the capacity expansion policy information to be processed, the capacity of the volume to be expanded is expanded again based on the current capacity expansion policy information.
[0044] The expansion method provided in the embodiment of the present application obtains the current expansion policy information again; compares the current expansion policy information with the expansion policy information to be processed, and ensures the accuracy of the comparison result. If the current expansion policy information is inconsistent with the expansion policy information to be processed, the volume to be expanded is expanded again based on the current expansion policy information, so that the volume to be expanded can be expanded multiple times, and the accuracy of the expansion of the volume to be expanded is ensured.
[0045] In a second aspect, the present invention provides a capacity expansion device, which is applied to a master node in a distributed storage system, and the device includes:
[0046] A receiving module, used for receiving a capacity expansion command input by a user;
[0047] A generation module, used to generate to-be-processed expansion strategy information corresponding to the expansion command according to the expansion command;
[0048] The first expansion module is used to expand the to-be-expanded volume corresponding to the to-be-processed expansion policy information according to the to-be-processed expansion policy information, and generate expansion space;
[0049] A detection module is used to detect whether the volume to be expanded is a thick provisioned volume;
[0050] The processing module is used for formatting the expansion space if the volume to be expanded is a thick provisioned volume.
[0051] The expansion device provided in the embodiment of the present application receives the expansion command input by the user; according to the expansion command, generates the to-be-processed expansion policy information corresponding to the expansion command, thereby ensuring the accuracy of the generated to-be-processed expansion policy information. According to the to-be-processed expansion policy information, the to-be-expanded volume corresponding to the to-be-processed expansion policy information is expanded to generate the expansion space, thereby ensuring the accuracy of the generated expansion space and ensuring that the generated expansion space can meet the user's needs. It is detected whether the to-be-expanded volume is a thick provisioned volume, so that the expansion space can be processed according to the detection result. If the to-be-expanded volume is a thick provisioned volume, the expansion space is formatted, thereby ensuring the stability of the expansion space. The above device can not only ensure that the expansion command input by the user can be executed quickly, but also ensure that the expanded space after expansion can also be formatted, ensure that the thick provisioned volume after expansion can also pre-allocate and reserve the entire volume capacity space, ensure the security of data and the performance stability of the thick provisioned volume, and the user can also better manage the storage capacity resources. This helps to avoid the problem of unexpected storage space shortage and improves the availability of the system.
[0052] In a third aspect, the present invention provides a distributed storage system, which includes a master node and a slave node. The master node includes: a memory and a processor. The memory and the processor are communicatively connected to each other. Computer instructions are stored in the memory. The processor executes the expansion method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0053] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the capacity expansion method of the first aspect or any corresponding embodiment thereof.
[0054] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the capacity expansion method of the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0056] Figure 1 is a flowchart of a first capacity expansion method according to an embodiment of the present invention;
[0057] Figure 2is a flow chart of a second capacity expansion method according to an embodiment of the present invention;
[0058] Figure 3 is a schematic flow chart of a third capacity expansion method according to an embodiment of the present invention;
[0059] Figure 4 is a schematic flow chart of a fourth capacity expansion method according to an embodiment of the present invention;
[0060] Figure 5 is a structural block diagram of a first capacity expansion device according to an embodiment of the present invention;
[0061] Figure 6 is a structural block diagram of a first capacity expansion device according to an embodiment of the present invention;
[0062] Figure 7 is a structural block diagram of a first capacity expansion device according to an embodiment of the present invention;
[0063] Figure 8 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0065] With the rapid development of technologies such as big data and cloud computing, distributed storage systems have gradually become the core of data storage and management. Traditional storage systems often use independent storage devices, and storage resources are not only scattered but also have low utilization rates. Because distributed systems use distributed storage architecture, they can integrate storage resources such as CPU, hard disk, and memory in the system into a logical storage pool, and integrate scattered storage devices into a centralized storage pool to improve the utilization rate of storage resources. In recent years, the development of distributed storage has been changing with each passing day, and this field is continuing to lead the revolution in data storage. With the rapid development of technologies such as big data, cloud computing, and artificial intelligence, distributed storage systems continue to break through the limitations of traditional storage and meet the needs of various application scenarios in a more flexible, efficient, and secure way.
[0066] In the field of distributed storage, thick-provisioned volumes are an important storage strategy that provides users with data security and reliability. When thick-provisioned volumes are selected, the entire storage space is actually pre-allocated and reserved when the volume is created, which ensures that data can be written immediately when needed without waiting for the dynamic allocation of storage space. Compared with thin volumes, using post-provisioned volumes has the following advantages: 1. Data security: Thick-provisioned volumes pre-allocate and reserve the entire storage space when they are created, thereby ensuring the continuity and stability of data writing. 2. Performance stability: Thick-provisioned volumes can provide more stable performance by avoiding the dynamic allocation process of storage space. This helps reduce performance fluctuations caused by storage space management, especially in high-load and large data volume scenarios. 3. Predictability: Thick-provisioned volumes specify the size of the storage space when they are created, which allows administrators to more accurately predict and manage the use of storage resources. This helps avoid unexpected storage space shortages and improves system availability.
[0067] In the thick provisioning volume technology, generally only the thick provisioning volume creation technology is considered, that is, when the thick provisioning volume is created, the volume is thick provisioned. When the thick provisioning volume is expanded, in order to quickly complete the expansion command, the expanded part is generally not thick provisioned. This results in that after the thick provisioning volume is expanded, there may be a part of the capacity that is not thick provisioned, which may lead to inaccurate pre-allocated space and instability of the thick provisioning volume.
[0068] In order to ensure that the expanded thick provisioned volume can be thick provisioned after expansion and that the expansion command line can be executed quickly, this paper proposes an expansion method. Receive the expansion command input by the user; generate the pending expansion policy information corresponding to the expansion command according to the expansion command, and ensure the accuracy of the generated pending expansion policy information. According to the pending expansion policy information, expand the volume to be expanded corresponding to the pending expansion policy information to generate the expansion space, and ensure the accuracy of the generated expansion space and ensure that the generated expansion space can meet the user's needs. Detect whether the volume to be expanded is a thick provisioned volume, so that the expansion space can be processed according to the detection result. If the volume to be expanded is a thick provisioned volume, format the expansion space, so as to ensure the stability of the expansion space. The above method can not only ensure that the expansion command input by the user can be executed quickly, but also ensure that the expansion space after expansion can be formatted, and ensure that the thick provisioned volume after expansion can also pre-allocate and reserve the entire volume capacity space, ensure the security of data and the performance stability of the thick provisioned volume, and the user can also better manage storage capacity resources. This helps avoid unexpected low-storage-space issues and increases system availability.
[0069] It should be noted that the method for capacity expansion provided in the embodiment of the present application, its execution subject can be a capacity expansion device, and the capacity expansion device can be implemented as part or all of the master node in the distributed storage system through software, hardware, or a combination of software and hardware, wherein the master node in the distributed storage system can be a server or a terminal, wherein the server in the embodiment of the present application can be a single server or a server cluster composed of multiple servers, and the terminal in the embodiment of the present application can be a smart phone, a personal computer, a tablet computer, a wearable device, and other intelligent hardware devices such as an intelligent robot. In the following method embodiments, the execution subject is taken as an example for explanation.
[0070] According to an embodiment of the present invention, an embodiment of a capacity expansion method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0071] In this embodiment, a capacity expansion method is provided, which can be used for the master node in the above-mentioned distributed storage system. Figure 1 is a flow chart of a capacity expansion method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0072] Step S101: receiving a capacity expansion command input by a user.
[0073] Specifically, the master node may receive a capacity expansion command input by a user.
[0074] Exemplarily, the master node may provide the user with an expansion window, and the user may click an expansion button in the expansion window and then input an expansion command based on the rbd command line, so that the master node may receive the expansion command input by the user.
[0075] Step S102: Generate to-be-processed capacity expansion policy information corresponding to the capacity expansion command according to the capacity expansion command.
[0076] Specifically, the master node may generate to-be-processed expansion policy information corresponding to the expansion command according to the storage pool identifier, volume identifier, and the to-be-expanded capacity corresponding to the to-be-expanded volume included in the expansion hit.
[0077] This step will be described in detail below.
[0078] Step S103: according to the capacity expansion policy information to be processed, the volume to be expanded corresponding to the capacity expansion policy information to be processed is expanded to generate an expansion space.
[0079] Specifically, the master node can identify the expansion policy information to be processed, determine the storage pool identifier, volume identifier and capacity to be expanded corresponding to the volume to be expanded included in the expansion policy information to be processed, expand the volume to be expanded corresponding to the expansion policy information to be processed, and generate expansion space.
[0080] This step will be described in detail below.
[0081] Step S104: Detect whether the volume to be expanded is a thick provisioned volume.
[0082] Specifically, the master node may obtain configuration information corresponding to the volume to be expanded, and then read the configuration information corresponding to the volume to be expanded, and detect whether the volume to be expanded is a thick provisioned volume according to the reading result.
[0083] Step S105: If the volume to be expanded is a thick provisioned volume, formatting the expansion space is performed.
[0084] Specifically, if the volume to be expanded is a thick provisioned volume, the master node formats the expansion space.
[0085] This step will be described in detail below.
[0086] The expansion method provided in the embodiment of the present application receives the expansion command input by the user; according to the expansion command, generates the to-be-processed expansion policy information corresponding to the expansion command, thereby ensuring the accuracy of the generated to-be-processed expansion policy information. According to the to-be-processed expansion policy information, the to-be-expanded volume corresponding to the to-be-processed expansion policy information is expanded to generate the expansion space, thereby ensuring the accuracy of the generated expansion space and ensuring that the generated expansion space can meet the user's needs. It is detected whether the to-be-expanded volume is a thick provisioned volume, so that the expansion space can be processed according to the detection result. If the to-be-expanded volume is a thick provisioned volume, the expansion space is formatted, thereby ensuring the stability of the expansion space. The above method can not only ensure that the expansion command input by the user can be executed quickly, but also ensure that the expanded space after expansion can also be formatted, ensure that the thick provisioned volume after expansion can also pre-allocate and reserve the entire volume capacity space, ensure the security of data and the performance stability of the thick provisioned volume, and the user can also better manage the storage capacity resources. This helps to avoid the problem of unexpected storage space shortage and improves the availability of the system.
[0087] In this embodiment, a capacity expansion method is provided, which can be used for the master node in the above-mentioned distributed storage system. Figure 2 is a flow chart of a capacity expansion method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0088] Step S201: receiving a capacity expansion command input by a user.
[0089] For details about this step, please refer to the above description of step S101, which will not be elaborated here.
[0090] Step S202: Generate to-be-processed capacity expansion policy information corresponding to the capacity expansion command according to the capacity expansion command.
[0091] Specifically, the capacity expansion command includes the storage pool identifier, volume identifier and capacity to be expanded corresponding to the volume to be expanded; the above step S202 may include the following steps:
[0092] Step S2021, generating capacity expansion metadata according to the storage pool identifier, the volume identifier and the capacity to be expanded.
[0093] Specifically, the master node can obtain the storage pool identifier, volume identifier and capacity to be expanded corresponding to the volume to be expanded included in the expansion command based on the rbd command line. Then, the master node generates expansion metadata according to the storage pool identifier, volume identifier and capacity to be expanded corresponding to the volume to be expanded.
[0094] Step S2022, obtaining the original capacity corresponding to the volume to be expanded.
[0095] Specifically, the master node may identify the volume to be expanded and determine the original capacity corresponding to the volume to be expanded.
[0096] Step S2023: Generate to-be-processed capacity expansion policy information corresponding to the capacity expansion command based on the original capacity and the capacity expansion metadata.
[0097] Specifically, the master node generates to-be-processed expansion strategy information corresponding to the expansion command based on the original capacity and the expansion metadata.
[0098] Exemplarily, the master node may add the original capacity to the capacity to be expanded to calculate the expanded capacity corresponding to the volume to be expanded. Then, the master node generates the expansion policy information to be processed based on the expanded capacity corresponding to the volume to be expanded and the expansion metadata.
[0099] Step S2024: store the to-be-processed capacity expansion policy information to a preset location corresponding to the to-be-expanded volume.
[0100] Specifically, the master node may store the to-be-processed capacity expansion policy information in a preset location corresponding to the to-be-expanded volume.
[0101] The preset location may be a specific location in the storage pool corresponding to the volume to be expanded, and the specific location may be set according to user requirements.
[0102] Step S203: Return a message to the user indicating that the snapshot task corresponding to the capacity expansion command has been successfully created.
[0103] Then, the master node can return a message indicating that the snapshot task corresponding to the capacity expansion command has been successfully created to the user through the capacity expansion window based on the management software.
[0104] Step S204: according to the capacity expansion policy information to be processed, the volume to be expanded corresponding to the capacity expansion policy information to be processed is expanded to generate expansion space.
[0105] For details about this step, please refer to the above description of step S103, which will not be elaborated here.
[0106] Step S205: Detect whether the volume to be expanded is a thick provisioned volume.
[0107] For details about this step, please refer to the above description of step S104, which will not be elaborated here.
[0108] Step S206: If the volume to be expanded is a thick provisioned volume, format the expansion space.
[0109] For details about this step, please refer to the above description of step S105, which will not be elaborated here.
[0110] The expansion method provided in this embodiment generates expansion metadata according to the storage pool identifier, volume identifier and the capacity to be expanded, thereby ensuring the accuracy of the generated expansion metadata. The original capacity corresponding to the volume to be expanded is obtained; based on the original capacity and the expansion metadata, the to-be-processed expansion policy information corresponding to the expansion command is generated, thereby ensuring the accuracy of the to-be-processed expansion policy information corresponding to the generated expansion command. The to-be-processed expansion policy information is stored in the preset location corresponding to the volume to be expanded, thereby facilitating the search and tracing of the to-be-processed expansion policy information.
[0111] Then, a message indicating that the snapshot task corresponding to the expansion command is successfully created is returned to the user, so that the user can receive the message indicating that the snapshot task corresponding to the expansion command is successfully created, and the user can use the expanded space as soon as possible, thereby improving the user's work efficiency.
[0112] In this embodiment, a capacity expansion method is provided, which can be used for the master node in the above-mentioned distributed storage system. Figure 3 is a flow chart of a capacity expansion method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0113] Step S301: receiving a capacity expansion command input by a user.
[0114] For details about this step, please refer to the above description of step S201, which will not be elaborated here.
[0115] Step S302: Generate to-be-processed capacity expansion policy information corresponding to the capacity expansion command according to the capacity expansion command.
[0116] For details about this step, please refer to the above description of step S202, which will not be elaborated here.
[0117] Step S303: according to the capacity expansion policy information to be processed, the volume to be expanded corresponding to the capacity expansion policy information to be processed is expanded to generate expansion space.
[0118] Specifically, the above step S303 may include the following steps:
[0119] Step S3031, periodically obtain the capacity expansion strategy information to be processed.
[0120] Specifically, the master node may periodically read the to-be-processed capacity expansion strategy information from a preset storage location corresponding to the to-be-processed capacity expansion strategy information.
[0121] Among them, the reading cycle can be 5 seconds, 3 seconds, 1 second, or other durations. The embodiment of the present application does not specifically limit the reading cycle.
[0122] Step S3032: Determine the capacity to be expanded according to the expansion strategy information to be processed.
[0123] Specifically, the above step S3032 may include the following steps:
[0124] Step a1, obtaining the first current load corresponding to the master node.
[0125] Optionally, the master node may obtain the first current load corresponding to the master node through a system monitoring tool.
[0126] Among them, the system monitoring tool can obtain real-time data of indicators such as CPU usage, memory usage, disk I / O, etc. Common system monitoring tools include performance monitors provided by the operating system, third-party monitoring software, or monitoring services provided by the cloud platform. The embodiments of the present application do not specifically limit the system monitoring tool.
[0127] Optionally, the master node may obtain the first current load corresponding to the master node by checking a system log or an application log of the master node.
[0128] The system log or application log may contain information about the load of the master node. For example, the log may record a peak in CPU usage, a warning of insufficient memory, or other load-related events.
[0129] Step a2: compare the first current load corresponding to the master node with a preset load threshold.
[0130] Optionally, the master node may receive a preset load threshold value input by a user, or may receive a preset load threshold value sent by other devices.
[0131] Optionally, the master node can also determine the total amount of memory and available memory of the master node. Then, obtain the work currently being processed, and determine the current required memory resources based on the work currently being processed. Then, the master node currently requires memory resources, performance requirements, and historical load data to determine a suitable load threshold range. Then, within the load threshold range, select a suitable value as the preset load threshold. Finally, the electronic device can also perform testing and verification to ensure that the system can operate normally under the preset load threshold and make adjustments as needed.
[0132] The embodiment of the present application does not specifically limit the manner in which the master node obtains the preset load threshold.
[0133] Then, the master node compares the first current load corresponding to the master node with the preset load threshold.
[0134] Step a3: if the first current load is less than the preset load threshold, the capacity to be expanded is determined according to the capacity expansion strategy information to be processed.
[0135] Specifically, if the first current load is less than a preset load threshold, the master node determines the capacity to be expanded according to the capacity expansion strategy information to be processed.
[0136] Step a4: If the first current load is greater than or equal to a preset load threshold, then obtaining a second current load corresponding to each slave node in the distributed storage system that is communicatively connected to the master node.
[0137] Specifically, if the first current load is greater than or equal to a preset load threshold, the master node may obtain the second current load corresponding to each slave node based on the communication connection with each slave node in the distributed storage system and based on a system monitoring tool.
[0138] Step a5, comparing the second current loads corresponding to the slave nodes.
[0139] Specifically, the master node compares the second current load corresponding to each slave node.
[0140] Step a6: determine the slave node with the smallest second current load from among the slave nodes as the target slave node.
[0141] Specifically, the master node determines, from among the slave nodes, a slave node with the second smallest current load as the target slave node.
[0142] Step a7, transmitting the capacity expansion strategy information to be processed to the target slave node, so that the target slave node determines the capacity to be expanded according to the capacity expansion strategy information to be processed, and expands the volume to be expanded based on the thin volume expansion strategy and the capacity to be expanded to generate expansion space.
[0143] Specifically, the master node can transmit the pending expansion strategy information to the target slave node, so that the target slave node determines the capacity to be expanded according to the pending expansion strategy information, and expands the volume to be expanded based on the thin volume expansion strategy and the capacity to be expanded to generate expansion space.
[0144] Step S3033: based on the thin volume expansion policy and the capacity to be expanded, the volume to be expanded is expanded to generate expansion space.
[0145] Specifically, the master node expands the volume to be expanded based on the thin volume expansion strategy and the capacity to be expanded, and generates expansion space, that is, the expansion space is a thin volume.
[0146] Step S304: Detect whether the volume to be expanded is a thick provisioned volume.
[0147] For details about this step, please refer to the above description of step S205, which will not be elaborated here.
[0148] Step S305: If the volume to be expanded is a thick provisioned volume, format the expansion space.
[0149] Specifically, the above step S305 may include the following steps:
[0150] Step S3051: If the volume to be expanded is a thick provisioned volume, write 0 into the expansion space.
[0151] Specifically, if the volume to be expanded is a thick provisioned volume, the master node writes 0 into the expansion space.
[0152] Step S306, obtaining the current capacity expansion strategy information again.
[0153] Specifically, the master node may periodically read the current capacity expansion strategy information at a specific location in the storage pool, thereby obtaining the current capacity expansion strategy information.
[0154] Step S307: compare the current capacity expansion strategy information with the capacity expansion strategy information to be processed.
[0155] Specifically, the master node may compare the current expansion strategy information with the to-be-processed expansion strategy information.
[0156] Step S308: If the current capacity expansion policy information is inconsistent with the capacity expansion policy information to be processed, the volume to be expanded is expanded again based on the current capacity expansion policy information.
[0157] Specifically, if the current capacity expansion policy information is inconsistent with the capacity expansion policy information to be processed, the master node will expand the capacity of the volume to be expanded again based on the current capacity expansion policy information.
[0158] In an optional implementation, the master node may also obtain the post-expanded capacity included in the current expansion policy information, and then compare the post-expanded capacity included in the current expansion policy information with the current capacity corresponding to the volume to be expanded. If the post-expanded capacity included in the current expansion policy information is inconsistent with the current capacity corresponding to the volume to be expanded, the volume to be expanded is expanded again based on the current expansion policy information.
[0159] The expansion method provided in the embodiment of the present application periodically obtains the capacity expansion strategy information to be processed, so as to ensure that the capacity expansion strategy information to be processed is obtained in a timely and accurate manner. The first current load corresponding to the master node is obtained; the first current load corresponding to the master node is compared with the preset load threshold to ensure the accuracy of the comparison result. If the first current load is less than the preset load threshold, the capacity to be expanded is determined according to the capacity expansion strategy information to be processed, so that the master node can determine the capacity to be expanded according to the capacity expansion strategy information to be processed without affecting normal operation, and then expand the capacity to be expanded according to the capacity to be expanded to generate expansion space. If the first current load is greater than or equal to the preset load threshold, the second current load corresponding to each slave node in the distributed storage system that is connected to the master node in communication is obtained, ensuring the accuracy of the second current load corresponding to each slave node obtained. The second current loads corresponding to each slave node are compared; the slave node with the smallest second current load is determined from each slave node as the target slave node, ensuring that the second current load of the determined target slave node is the smallest, and thus load balancing can be ensured. The capacity expansion strategy information to be processed is transmitted to the target slave node, so that the target slave node determines the capacity to be expanded according to the capacity expansion strategy information to be processed, and expands the volume to be expanded based on the thin volume expansion strategy and the capacity to be expanded, and generates expansion space, thereby avoiding the situation where the normal operation of the master node is affected by the generation of expansion space based on the master node when the first current load of the master node is greater than or equal to the preset load threshold. Therefore, the above method realizes the generation of expansion space without affecting the normal operation of the master node and each slave node.
[0160] Next, based on the thin volume expansion strategy and the capacity to be expanded, the volume to be expanded is expanded to generate expansion space, which ensures the accuracy of the generated expansion space and ensures that the generated expansion space can meet user needs.
[0161] In addition, if the volume to be expanded is a thick provisioned volume, 0 is written to the expansion space, so that the storage space corresponding to the expansion space can be reserved, and the data can be written immediately when needed without waiting for the dynamic allocation of storage space. This ensures the continuity and stability of data writing. This mechanism reduces the risk of write failure caused by insufficient storage space and provides higher security for data.
[0162] Then, the current expansion policy information is obtained again; the current expansion policy information is compared with the expansion policy information to be processed, and the accuracy of the comparison result is ensured. If the current expansion policy information is inconsistent with the expansion policy information to be processed, the volume to be expanded is expanded again based on the current expansion policy information, so that the volume to be expanded can be expanded multiple times, and the accuracy of the expansion of the volume to be expanded is ensured.
[0163] In an optional embodiment of the present application, as Figure 4 As shown, the embodiment of the present application provides a capacity expansion method. Specifically comprising the following steps:
[0164] 1. The management provides the user with an expansion window. The user can click the expansion button on the management interface. According to the expansion volume size entered by the user, the management interface calls the corresponding rbd command line.
[0165] 2. The rbd layer obtains the storage pool name, volume name, and expansion volume size information from the rbd command line, and first expands the volume. At this time, the volume expansion part is streamlined. After the expansion is completed, it is determined whether the volume was previously a thick provisioned volume. If it is a thick provisioned volume, the storage pool name, volume name, expansion size and other information are assembled into the metadata information of the expansion thick provisioned volume task, and the metadata information is saved to a specific location in the storage pool where the volume is located, and the scheduled snapshot task creation is returned to the management software successfully.
[0166] 3. The main node of the resident daemon service for capacity expansion thick provisioning will schedule the service process to query and read the capacity expansion provisioning policy information at the specified location of the storage pool every 5 seconds. The main node or all capacity expansion provisioning task information is thick. The main node will distribute the task information evenly to other service nodes through load balancing. The service node starts formatting according to the obtained policy information.
[0167] 4. During the background formatting, the user may perform a capacity expansion on the thick provisioned volume. To ensure that all the expanded parts of the thick provisioned volume can be formatted after the expansion, if the expansion is performed during the background formatting, rbd will modify the thick provisioned policy task information to include the size before and after the expansion. After the first background formatting is completed, it will check whether the policy task information has been modified before. If it has been modified, formatting will be performed according to the new size until the policy task information is not modified.
[0168] In this embodiment, a capacity expansion device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0169] This embodiment provides a capacity expansion device, which is applied to a master node in a distributed storage system. Figure 5 As shown, including:
[0170] The receiving module 401 is used to receive a capacity expansion command input by a user;
[0171] A generating module 402 is used to generate to-be-processed capacity expansion strategy information corresponding to the capacity expansion command according to the capacity expansion command;
[0172] The first expansion module 403 is used to expand the to-be-expanded volume corresponding to the to-be-processed expansion policy information according to the to-be-processed expansion policy information, and generate expansion space;
[0173] The detection module 404 is used to detect whether the volume to be expanded is a thick provisioned volume;
[0174] The processing module 405 is used to format the expansion space if the volume to be expanded is a thick provisioned volume.
[0175] In some optional implementations, the capacity expansion command includes the storage pool identifier, volume identifier and capacity to be expanded corresponding to the volume to be expanded; the generation module 402 is specifically used to generate capacity expansion metadata based on the storage pool identifier, volume identifier and capacity to be expanded; obtain the original capacity corresponding to the volume to be expanded; based on the original capacity and the capacity expansion metadata, generate the pending capacity expansion policy information corresponding to the capacity expansion command; and store the pending capacity expansion policy information in a preset position corresponding to the volume to be expanded.
[0176] In some optional embodiments, such as Figure 6 As shown, the above-mentioned capacity expansion device may further include:
[0177] The sending module 406 is used to return a message to the user indicating that the snapshot task corresponding to the capacity expansion command has been successfully created.
[0178] In some optional implementations, the first expansion module 403 is specifically used to periodically obtain the expansion strategy information to be processed; determine the capacity to be expanded according to the expansion strategy information to be processed; expand the volume to be expanded based on the thin volume expansion strategy and the capacity to be expanded to generate expansion space.
[0179] In some optional implementations, the first expansion module 403 is specifically used to obtain a first current load corresponding to the master node; compare the first current load corresponding to the master node with a preset load threshold; if the first current load is less than the preset load threshold, determine the capacity to be expanded according to the expansion strategy information to be processed; if the first current load is greater than or equal to the preset load threshold, obtain the second current load corresponding to each slave node in the distributed storage system that is communicatively connected to the master node; compare the second current load corresponding to each slave node; determine the slave node with the smallest second current load from each slave node as the target slave node; transmit the expansion strategy information to be processed to the target slave node, so that the target slave node determines the capacity to be expanded according to the expansion strategy information to be processed, and expands the volume to be expanded based on the thin volume expansion strategy and the capacity to be expanded to generate expansion space.
[0180] In some optional implementations, the processing module 405 is specifically configured to write 0 into the expansion space if the volume to be expanded is a thick provisioned volume.
[0181] In some optional embodiments, such as Figure 7 As shown, the above-mentioned capacity expansion device may further include:
[0182] The acquisition module 407 is used to obtain the current expansion strategy information again;
[0183] A comparison module 408 is used to compare the current expansion strategy information with the expansion strategy information to be processed;
[0184] The second capacity expansion module 409 is configured to expand the volume to be expanded based on the current capacity expansion policy information again if the current capacity expansion policy information is inconsistent with the capacity expansion policy information to be processed.
[0185] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0186] The expansion device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0187] The embodiment of the present invention also provides a distributed storage system, the distributed storage system includes a master node and a slave node, the master node has the above Figure 5-Figure 7 Expansion device shown.
[0188] See also Figure 8 , Figure 8is a schematic diagram of the structure of a master node in a distributed storage system provided by an optional embodiment of the present invention, such as Figure 8 As shown, the master node includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Each component utilizes different buses to communicate with each other, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the master node, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple slave nodes can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.
[0189] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware integrated circuit. The hardware integrated circuit may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.
[0190] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0191] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the master node, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the master node via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0192] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0193] The master node also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0194] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the master node, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0195] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0196] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0197] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A capacity expansion method, characterized in that: Applied to a master node in a distributed storage system, the method comprises: Receive the capacity expansion command input by the user; Generate, according to the capacity expansion command, capacity expansion strategy information to be processed corresponding to the capacity expansion command; According to the to-be-processed expansion strategy information, the to-be-processed volume corresponding to the to-be-processed expansion strategy information is expanded to generate expansion space; Detecting whether the volume to be expanded is a thick provisioned volume; If the volume to be expanded is the thick provisioned volume, formatting is performed on the expansion space.
2. The method according to claim 1, characterized in that The capacity expansion command includes a storage pool identifier, a volume identifier, and a capacity to be expanded corresponding to the volume to be expanded; and generating, according to the capacity expansion command, the to-be-processed capacity expansion policy information corresponding to the capacity expansion command, including: Generate capacity expansion metadata according to the storage pool identifier, the volume identifier and the capacity to be expanded; Obtaining the original capacity corresponding to the volume to be expanded; Based on the original capacity and the capacity expansion metadata, generating to-be-processed capacity expansion strategy information corresponding to the capacity expansion command; The to-be-processed capacity expansion strategy information is stored in a preset location corresponding to the to-be-expanded volume.
3. The method according to claim 1 or 2, characterized in that: After generating the to-be-processed capacity expansion strategy information corresponding to the capacity expansion command, the method further includes: A message is returned to the user indicating that the snapshot task corresponding to the capacity expansion command is successfully created.
4. The method according to claim 1, characterized in that: The step of expanding the volume to be expanded corresponding to the capacity expansion policy information to be processed to generate expansion space includes: Periodically obtaining the to-be-processed expansion strategy information; Determine the capacity to be expanded according to the expansion strategy information to be processed; Based on the thin volume expansion strategy and the capacity to be expanded, the volume to be expanded is expanded to generate the expansion space.
5. The method according to claim 4, characterized in that The determining the capacity to be expanded according to the to-be-processed expansion strategy information includes: Obtaining a first current load corresponding to the master node; Comparing the first current load corresponding to the master node with a preset load threshold; If the first current load is less than the preset load threshold, determining the capacity to be expanded according to the to-be-processed expansion strategy information; If the first current load is greater than or equal to the preset load threshold, obtaining a second current load corresponding to each slave node in the distributed storage system that is communicatively connected to the master node; Comparing the second current loads corresponding to the slave nodes; Determine, from among the slave nodes, the slave node with the smallest second current load as the target slave node; The to-be-processed expansion strategy information is transmitted to the target slave node, so that the target slave node determines the to-be-processed expansion capacity according to the to-be-processed expansion strategy information, and expands the to-be-expanded volume based on the thin volume expansion strategy and the to-be-expanded capacity to generate the expansion space.
6. The method according to claim 1, characterized in that If the volume to be expanded is the thick provisioned volume, formatting the expansion space includes: If the volume to be expanded is the thick provisioned volume, 0 is written into the expansion space.
7. The method according to claim 1, characterized in that If the volume to be expanded is the thick provisioned volume, after formatting the expansion space, the method further includes: Get the current expansion strategy information again; Comparing the current capacity expansion strategy information with the capacity expansion strategy information to be processed; If the current capacity expansion policy information is inconsistent with the to-be-processed capacity expansion policy information, the to-be-expanded volume is expanded again based on the current capacity expansion policy information.
8. A capacity expansion device, characterized in that: Applied to a master node in a distributed storage system, the device comprises: A receiving module, used for receiving a capacity expansion command input by a user; A generating module, configured to generate to-be-processed capacity expansion strategy information corresponding to the capacity expansion command according to the capacity expansion command; A first expansion module, configured to expand the to-be-expanded volume corresponding to the to-be-processed expansion strategy information according to the to-be-processed expansion strategy information, and generate expansion space; A detection module, used to detect whether the volume to be expanded is a thick provisioned volume; The processing module is used for formatting the expansion space if the volume to be expanded is the thick provisioned volume.
9. A distributed storage system, characterized in that: The distributed storage system includes a master node and a slave node. The master node includes: a memory and a processor. The memory and the processor are communicatively connected to each other. Computer instructions are stored in the memory. The processor executes the expansion method described in any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the capacity expansion method according to any one of claims 1 to 7.
