Storage resource allocation method and device, storage medium, and electronic device

By allocating storage resources on demand, the problem of resource waste in POD hard disk allocation is solved. OpenEBs and custom scheduler are adopted to achieve flexible allocation and efficient utilization of hard disk resources, and improve the performance and stability of database services.

CN115826845BActive Publication Date: 2025-08-22BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111101613.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-18
Publication Date
2025-08-22
Estimated Expiration
2041-09-18

AI Technical Summary

Technical Problem

In the prior art, there is a problem of wasting storage resources when allocating hard disks for PODs, especially resource waste caused by the mismatch between the fixed hard disk capacity and the demand.

Method used

By receiving business requests, determine the available storage resources of the target physical hard disk, and allocate some storage resources to the POD as needed to ensure that the allocated storage capacity is not less than the service requirements. Use custom CSI and custom scheduler, use OpenEBs as the PV provider, and divide the hard disk directory as needed for multiple PODs.

Benefits of technology

It realizes flexible allocation of storage resources, avoids waste of hard disk resources, improves the utilization efficiency and stability of storage resources, and improves the performance of database services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115826845B_ABST
    Figure CN115826845B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for allocating storage resources, a storage medium, and an electronic device. The method includes: receiving a business request from a requesting party, wherein the business request is used by the requesting party to request that storage resources be allocated for a first service; determining a target physical hard disk of a target device on a device cluster, wherein the available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD; allocating part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, wherein the storage capacity of part of the storage resources is not less than the required capacity of the first service. The present application solves the technical problem in the related art that allocating hard disks to PODs causes waste of storage resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of databases, and more specifically, to a method and device for allocating storage resources, a storage medium, and an electronic device. Background Art

[0002] Tidb is an open-source distributed relational database. It's a hybrid distributed database product that supports both online transaction processing and online analytical processing (HTAP). It offers database features such as horizontal scalability, financial-grade high availability, real-time HTAP, and cloud-native distribution. The Tidb database platform uses Container Service to provide compute nodes (Worker Nodes). Container Service natively provides two types of storage: cloud storage such as Elastic Block Store (EBS) and local disks on the physical machines where the workers reside.

[0003] In related technical solutions, due to the insufficient performance and stability of EBS, cloud hard drives are not suitable for database services as backend storage. When using the local disk storage of the physical machine where the worker is located, an allocation scheme is used in which a POD (POD is the smallest and simplest unit that can be created and deployed in Kubernetes) is mounted with an entire hard drive. The problem is that the hard drive storage capacity is fixed, while the storage requirements of different PODs are not fixed, which causes the allocation scheme to be incompatible with the POD requirements. For example, if the capacity of a single hard drive is 1T and the user's requirement is 500G, then allocating an entire hard drive to it will result in a waste of 500G. If the user's requirement is 1600G, allocating one hard drive is obviously not enough, and two hard drives need to be allocated to it, which still results in a waste of 400G.

[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0005] The embodiments of the present application provide a method and device for allocating storage resources, a storage medium, and an electronic device to at least solve the technical problem in the related art of wasting storage resources when allocating hard disks to PODs.

[0006] According to one aspect of an embodiment of the present application, a method for allocating storage resources is provided, including: receiving a business request from a requesting party, wherein the business request is used by the requesting party to request allocation of storage resources for a first service; determining a target physical hard disk of a target device on a device cluster, wherein the available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD; allocating part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, wherein the storage capacity of the part of the storage resources is not less than the required capacity of the first service.

[0007] According to another aspect of an embodiment of the present application, a storage resource allocation device is also provided, including: a receiving unit for receiving a business request from a requesting party, wherein the business request is used by the requesting party to request allocation of storage resources for a first service; a determining unit for determining a target physical hard disk of a target device on a device cluster, wherein the available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD; an allocating unit for allocating part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, wherein the storage capacity of part of the storage resources is not less than the required capacity of the first service.

[0008] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above method is executed when the program is run.

[0009] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above method through the computer program.

[0010] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of any of the above-described method embodiments.

[0011] In an embodiment of the present application, a business request from a requesting party is received, wherein the business request is used by the requesting party to request allocation of storage resources for a first service; a target physical hard disk of a target device on a device cluster is determined, wherein the available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD; part of the storage resources on the target physical hard disk are allocated to the first POD for use by the first computing node, wherein the storage capacity of part of the storage resources is not less than the required capacity of the first service, thereby solving the technical problem in the related art of wasting storage resources when allocating hard disks to PODs. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0013] Figure 1 is a schematic diagram of a hardware environment for a storage resource allocation method according to an embodiment of the present application;

[0014] Figure 2 is a flowchart of an optional method for allocating storage resources according to an embodiment of the present application;

[0015] Figure 3 is a schematic diagram of an optional storage resource allocation solution according to an embodiment of the present application;

[0016] Figure 4 is a schematic diagram of an optional storage resource allocation device according to an embodiment of the present application;

[0017] Figure 5 This is a structural block diagram of a terminal according to an embodiment of the present application. DETAILED DESCRIPTION

[0018] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0019] 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 sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0020] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretations:

[0021] Kubernetes, or K8s for short, is an abbreviation formed by replacing the eight characters "ubernete" with "8." It is an open-source platform for managing containerized applications across multiple hosts in a cloud platform. Kubernetes aims to make deploying containerized applications simple and powerful, providing a mechanism for application deployment, planning, updating, and maintenance.

[0022] According to one aspect of the embodiment of the present application, a method embodiment of a method for allocating storage resources is provided. The allocation method can be applied to Figure 1 In the hardware environment shown in FIG. 1 , a user terminal 101 and a device cluster 103 are formed. Figure 1 As shown, the device cluster 103 is connected to the user terminal 101 via a network, and can be used to provide storage services for the terminal or the client installed on the terminal. A database 105 can be set on the device of the device cluster (which can be a physical machine or a virtual machine) or on a device independent of the device cluster to provide data storage services for the device cluster 103. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, etc.

[0023] The storage resource allocation method of the embodiment of the present application can be executed on the device cluster 103, for example, by a server that manages all devices in the device cluster. Figure 2This is a flowchart of an optional storage resource allocation method according to an embodiment of the present application. After receiving a service request from a requesting party, part of the storage resources on the target physical hard disk can be allocated to the first POD according to the capacity required by the requesting party for use by the first computing node. That is, storage resources are allocated according to needs, which can solve the technical problem of waste of storage resources when allocating hard disks to PODs in related technologies, thereby achieving the technical effect of saving storage resources. Figure 2 As shown, the method may include the following steps:

[0024] Step S1: A server receives a service request triggered by a requester at a user terminal. The service request is used by the requester to request allocation of storage resources for a first service.

[0025] Many companies (i.e., requesters) need to store large amounts of user data, media data, and other data, but they do not build their own storage systems. Instead, they use storage services provided by third-party companies to meet their own needs. At this time, a business request can be triggered on the user terminal to request the call of the third-party storage service.

[0026] Optionally, the technical solution of this application can be applied to the following two scenarios:

[0027] One is to allocate storage on demand when the first POD is created. In this case, the received service request can be a creation request sent by the requesting party. In order to indicate the service requesting party's needs, the required capacity of the first service can be indicated in the creation request so that storage resources can be allocated according to the required capacity. For example, when a user purchases 500GB of storage capacity on a third-party company's platform, the above service request will be triggered. After receiving the service request, the server will allocate at least 500GB of capacity in a physical hard disk for the user to use when creating the first POD.

[0028] The second is to adjust the capacity of the storage resources allocated to the first POD according to user needs during use. At this time, the business request received can be a resource request sent by the requester. In order to indicate the needs of the business requester, information indicating the required capacity of the first service can be added to the resource request. For example, when a user purchases 500G storage capacity on a third-party company's platform and finds that the purchased storage capacity cannot meet his or her business needs, he or she can purchase more storage capacity.

[0029] In step S2, the server determines the target physical hard disk of the target device on the device cluster. The available storage resources (i.e., the remaining capacity) of the target physical hard disk are not less than the required capacity of the first service. A first POD is created on the target device, and the first computing node providing the first service is located in a container within the first POD.

[0030] For third-party companies, they can use clusters to provide services to the outside world, such as using K8s clusters. POD is the smallest and simplest unit that can be created and deployed in K8s. A POD represents a process running in the cluster. In the K8s architecture, POD is used as a basic unit for scheduling and use. POD encapsulates application containers (in some cases, several containers), which together form a whole for operation. The containers inside the POD naturally have a loose coupling relationship with each other, and ultimately provide an interface for external calls for external calls. At this time, POD is equivalent to the computing node Worker Node provided to the outside world. The computing node mainly provides logic related to data storage, data reading, and data proofreading.

[0031] Continuing to illustrate with two scenarios applicable to this application, when the technical solution of this application is applied to on-demand allocation when creating a POD, step S2 can be implemented as shown in the following steps S21 to S24:

[0032] In step S21, before finding a suitable device, the server obtains the available storage resources of each physical hard disk of the candidate device in the device cluster. If a device is loaded with multiple hard disks, the server needs to obtain the available storage resources of each of the multiple hard disks.

[0033] Step S22: Compare the available storage resources of each hard disk of the candidate device with the required capacity.

[0034] Step S23: If there is no physical hard disk in the candidate device whose available storage resources are not less than the required capacity of the first service, continue to obtain the available storage resources of each physical hard disk of the new candidate device from the device cluster until a candidate device is found where there is a physical hard disk whose available storage resources are not less than the required capacity of the first service.

[0035] Step S24: If there is a physical hard disk in the candidate device whose available storage resources are not less than the required capacity of the first service, the candidate device is used as the target device, and the physical hard disk in the candidate device whose available storage resources are not less than the required capacity of the first service is used as the target physical hard disk.

[0036] For example, when a user purchases 500G storage capacity on a third-party company's platform, the above-mentioned business request will be triggered. After receiving the business request, the server will check the remaining capacity of hard disk 1 of device 1. If it is less than 500G, it will continue to check the remaining hard disks of device 1. If the remaining capacity of the remaining hard disks is less than 500G, it will check the remaining capacity of hard disk 1 of device 2. If it reaches 500G, it will be determined that device 2 is the target device and hard disk 1 of device 2 is the target physical hard disk.

[0037] Optionally, after the candidate device is used as the target device, a first POD is created on the target device, and a first computing node of the requester is run through a container in the first POD to provide services to the user of the requester by running the first computing node.

[0038] When the technical solution of the present application is applied to on-demand allocation during POD operation, step S2 can be implemented by the following steps S21 to S25:

[0039] In step S21 , when a user of the first POD sends a service request, the first device where the first POD is located is found in the device cluster.

[0040] In step S22, when there is a physical hard disk in the first device whose available storage resources are not less than the target capacity, the first device is used as the target device, and the physical hard disk in the first device whose available storage resources are not less than the target capacity is used as the target physical hard disk, the target device includes the first device, and the target capacity is the difference between the required capacity and the allocated capacity of the first service.

[0041] In step S23, if there is no physical hard disk in the first device whose available storage resources are not less than the target capacity, it is necessary to adjust the device that carries the service, and obtain the available storage resources of each physical hard disk of the second device in the device cluster. The second device is different from the first device.

[0042] In step S24, if there is no physical hard disk in the second device whose available storage resources are not less than the required capacity of the first service, continue to search for devices in the device cluster whose available storage resources are not less than the required capacity of the first service until a device is found where there is a physical hard disk with available storage resources not less than the required capacity of the first service.

[0043] In step S25, if there is a physical hard disk in the second device whose available storage resources are not less than the required capacity of the first service, the second device is used as the target device, and the physical hard disk in the second device whose available storage resources are not less than the required capacity of the first service is used as the target physical hard disk.

[0044] For example, if a user purchases 500GB of storage capacity from a third-party company's platform and finds that it doesn't meet their business needs, they increase their purchase to 800GB. At this point, 500GB is already allocated in the system, and only 300GB needs to be allocated. If a hard drive with 300GB of remaining capacity exists on device 1, the requester will be allocated 300GB of storage capacity. If not, the requester will be checked to see if a hard drive with 800GB of remaining capacity exists on another device. If so, the requester will be allocated 800GB of storage capacity.

[0045] Optionally, after taking the second device as the target device, a first POD is created on the second device, and the first computing node providing the first service is set in the container of the first POD, and the data generated by the first POD during operation stored on the first device is transferred to the second device for storage, and the second device is used to replace the first device to provide services to the requesting party.

[0046] In step S3, the server allocates part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, and the storage capacity of the part of the storage resources is not less than the required capacity of the first service. This can be achieved through the following steps S31-S32:

[0047] Step S31: Create a first directory on the target physical hard disk, and the storage capacity of the storage resources under the first directory is not less than the required capacity of the first service.

[0048] Step S32: Mount the first directory as a first virtual hard disk on the first POD. The first virtual hard disk is used to store data generated during the operation of the first POD.

[0049] The above solution is a process of allocating storage on demand for a user. For any user, it can be implemented in the same way. On each device on the cluster side, the data of multiple users can be stored: there are multiple directories on each hard disk of the device. For example, the data of user 1 is stored in directory 1, the data of user 2 is stored in directory 2, and so on.

[0050] When saving data, it is necessary to find the corresponding directory and then save it. For example, when there is data that needs to be saved on the first POD, the data is saved in the first directory of multiple directories. The multiple directories also include a second directory created for the second POD on the target physical hard disk. The second POD is created on the target device, and the second computing node that provides the second service is located in the container within the second POD. The second directory is used as a virtual hard disk of the second POD.

[0051] As an optional embodiment, in the technical solution of the present application, computing resources can be placed in the vpc of a dedicated account. For example, the solution can be implemented based on K8S, and computing resources (computing resources can be cloud physical machines, cloud hosts) can be placed under the vpc network. When a customer applies for a tidb instance (equivalent to issuing a business request), a tidb instance will be applied for in the K8s of the dedicated account. The tidb instance will declare the storage size requirement in the configuration. Since the openebs service is installed in the container service, this service can be used to divide the disk under the same computing node Worker Node into directories, and different directories can be mounted as a virtual hard disk on the POD to provide data isolation. The following is combined with Figure 3 Further details of the technical solution of this application:

[0052] 1) In the dedicated VPC (such as virtual network VNET 1) of the service provider, the dedicated network VPC (full name is Virtual Private Cloud) service, load balancing service SLB (full name is Server Load Balancing), dedicated link service PLS (private link server), K8s container service, tidb service (such as tidb-operator, tidb), etc. are used. The nodes can be bare metal servers (Bare Metal Server), cloud hosts, etc. The customer's VPC uses load balancing, listeners, etc. The entire network architecture is as follows Figure 3 shown.

[0053] kube-proxy is a core component of K8s and is deployed on each Worker Node. It is an important component for implementing the communication and load balancing mechanism of K8sService. Kube-proxy is responsible for creating proxy services for PODs, obtaining all server information, and creating proxy services based on the server information to implement request routing and forwarding from server to POD, thereby realizing a virtual forwarding network at the K8s level.

[0054] Kube-proxy supports both iptables and ipvs modes. In this application, ipvs mode is used. ipvs uses IP tables for packet filtering, SNAT, and masquared. ipvs uses ipset to store the source or destination addresses of traffic that needs to be dropped or masquared.

[0055] In such Figure 3 In the data flow shown, CIP represents the IP address of the server, PODIP represents the IP address of the client POD, RIP refers to the IP address of the Worker Node, and VIP refers to the IP address of the client. The address before the symbol “→” represents the source IP address, and the address after it represents the destination IP address. For example, “CIP→PODIP” means that the source IP address of the message data is CIP and the destination IP address is PODIP.

[0056] 2) Comparison between network storage and local storage: Network storage uses cloud hard drives, which suffer from insufficient performance and stability. Related local storage solutions use the local PV model, where each pod occupies an entire hard drive, resulting in significant resource waste. This solution, based on openebs-hostpath, creates different directories on demand on a single hard drive, storing data from different pods in these directories. Compared to network storage, this solution offers better performance and stability because data transmission and access occurs locally, unaffected by network factors. Furthermore, compared to local PV, a single hard drive can be allocated to multiple users on demand, avoiding the resource waste that occurs when a single user occupies the entire drive.

[0057] 3) Because OpenEBS is unaware of the actual hard disk size of the compute node (Worker Node), a custom extended resource, bc / real_disk, is introduced as an identifier for the actual disk purchase amount. When a customer purchases resources, such as an instance with a 10GB disk, OpenEBS first uses abc / real_disk to determine which compute nodes (Worker Nodes) have more than 10GB of disk space. After scheduling, OpenEBS creates a pv directory on the WorkerNode dedicated to the database service's POD. All data written to the database service's POD will be placed in this directory. If the abc / real_disk resource is insufficient, no tasks will be scheduled to create on that compute node.

[0058] In related technical solutions, due to the insufficient performance and stability of EBS, cloud hard drives are not currently suitable for database services as backend storage. Using local disks on worker nodes also presents the problem of inflexible allocation, where a POD may mount an entire hard drive, or the inability to allocate disk size on demand.

[0059] This solution uses a custom CSI + custom scheduler approach, similar to OpenEBS development. OpenEBS serves as the PV provider for the TiDB database service platform, and custom extended resources are used as the standard for calculating disk purchases for compute nodes. Using OpenEBS as the PV provider, when a user purchases an instance, it searches for a compute node that can be created according to the specified size. This solves the problem of the existing OpenEBS and LocalPV approaches being unaware of the actual disk space on the compute node. By partitioning a disk into multiple directories, a single disk can provide data storage for multiple PODs, resolving the issue of the LocalPV approach's low resource utilization, which occupies the entire disk. Compared to the EBS approach, OpenEBS offers superior performance and stability.

[0060] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0061] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0062] According to another aspect of the embodiments of the present application, a storage resource allocation device for implementing the above storage resource allocation method is also provided. Figure 4 is a schematic diagram of an optional storage resource allocation device according to an embodiment of the present application, such as Figure 4 As shown, the device may include:

[0063] The receiving unit 41 is configured to receive a service request from a requester, wherein the service request is for the requester to request allocation of storage resources for a first service;

[0064] A determining unit 43 is configured to determine a target physical hard disk of a target device in the device cluster, wherein available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD;

[0065] The allocating unit 45 is configured to allocate part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, wherein the storage capacity of the part of the storage resources is not less than the required capacity of the first service.

[0066] It should be noted that the receiving unit 41 in this embodiment can be used to execute step S1 in the embodiment of the present application, the determining unit 43 in this embodiment can be used to execute step S2 in the embodiment of the present application, and the allocating unit 45 in this embodiment can be used to execute step S3 in the embodiment of the present application.

[0067] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. Figure 1 In the hardware environment shown, it can be implemented by software or by hardware.

[0068] Through the above module, a business request from the requesting party is received, wherein the business request is used by the requesting party to request allocation of storage resources for the first service; a target physical hard disk of a target device on a device cluster is determined, wherein the available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD; part of the storage resources on the target physical hard disk are allocated to the first POD for use by the first computing node, wherein the storage capacity of part of the storage resources is not less than the required capacity of the first service, which can solve the technical problem in the related art of wasting storage resources when allocating hard disks to PODs.

[0069] Optionally, when allocating part of the storage resources on the target physical hard disk to the first POD, the allocation unit is also used to: create a first directory on the target physical hard disk, wherein the storage capacity of the storage resources under the first directory is not less than the required capacity of the first service; mount the first directory as a first virtual hard disk on the first POD, wherein the first virtual hard disk is used to store data generated by the first POD during operation.

[0070] Optionally, after mounting the first directory as the first virtual hard disk on the first POD, the allocation unit is further used to: when there is data that needs to be saved on the first POD, save the data in the first directory of multiple directories, wherein the multiple directories also include a second directory created for the second POD on the target physical hard disk, the second POD is created on the target device, the second computing node providing the second service is located in a container within the second POD, and the second directory is used as a virtual hard disk of the second POD.

[0071] Optionally, the receiving unit is further used to: receive a creation request sent by the requester, wherein the creation request is used by the requester to request to create a POD for the first service and allocate storage resources according to the required capacity of the first service, and the business request includes the creation request.

[0072] Optionally, the determination unit is also used to: obtain the available storage resources of each physical hard disk of the candidate device in the device cluster; if there is a physical hard disk in the candidate device whose available storage resources are not less than the required capacity of the first service, use the candidate device as the target device, and use the physical hard disk in the candidate device whose available storage resources are not less than the required capacity of the first service as the target physical hard disk; if there is no physical hard disk in the candidate device whose available storage resources are not less than the required capacity of the first service, continue to obtain the available storage resources of each physical hard disk of the new candidate device from the device cluster until a candidate device is found where a physical hard disk with available storage resources is not less than the required capacity of the first service.

[0073] Optionally, the allocation unit is also used to: before allocating part of the storage resources on the target physical hard disk to the first POD, the method also includes: after taking the candidate device as the target device, creating the first POD on the target device; and setting the first computing node providing the first service in the container of the first POD.

[0074] Optionally, the receiving unit is further configured to: receive a resource request sent by a requester, wherein the resource request is used by the requester to indicate a required capacity of the first service, and the service request includes the resource request.

[0075] Optionally, the determination unit is further used to: search for the first device where the first POD is located in the device cluster; if there is a physical hard disk with available storage resources not less than the target capacity in the first device, use the first device as the target device, and use the physical hard disk with available storage resources not less than the target capacity in the first device as the target physical hard disk, wherein the target device includes the first device, and the target capacity is the difference between the required capacity of the first service and the allocated capacity; if there is no physical hard disk with available storage resources not less than the target capacity in the first device, obtain the available storage resources of each physical hard disk of the second device in the device cluster, wherein the second device is different from the first device; if there is a physical hard disk with available storage resources not less than the required capacity of the first service in the second device, use the second device as the target device, and use the physical hard disk with available storage resources not less than the required capacity of the first service in the second device as the target physical hard disk; if there is no physical hard disk with available storage resources not less than the required capacity of the first service in the second device, continue to search for devices with available storage resources not less than the required capacity of the first service in the device cluster until a device with a physical hard disk with available storage resources not less than the required capacity of the first service is found.

[0076] Optionally, the allocation unit is also used to: before allocating part of the storage resources on the target physical hard disk to the first POD, after taking the second device as the target device, create the first POD on the second device, and set the first computing node providing the first service in the container of the first POD; after allocating part of the storage resources on the target physical hard disk to the first POD, transfer the data generated by the first POD during operation stored on the first device to the second device for storage; and use the second device to replace the first device to provide the first service.

[0077] Optionally, the apparatus of the present application may further include: a configuration unit, configured to deploy a target plug-in in the device cluster before receiving a service request from the requester, wherein the target plug-in is used to serve as a PV provider of the database service.

[0078] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. Figure 1 The hardware environment shown can be implemented through software or hardware, wherein the hardware environment includes a network environment.

[0079] According to another aspect of the embodiments of the present application, a server or terminal for implementing the above-mentioned storage resource allocation method is also provided.

[0080] Figure 5is a structural block diagram of a terminal according to an embodiment of the present application, such as Figure 5 As shown, the terminal may include: one or more ( Figure 5 (only one is shown) processor 501, memory 503, and transmission device 505, as shown Figure 5 As shown, the terminal may further include input and output devices 507 .

[0081] Among them, the memory 503 can be used to store software programs and modules, such as the program instructions / modules corresponding to the storage resource allocation method and device in the embodiment of the present application. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 503, that is, realizing the above-mentioned storage resource allocation method. The memory 503 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 503 may further include a memory remotely arranged relative to the processor 501, and these remote memories can be connected to the terminal 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 a combination thereof.

[0082] The above-mentioned transmission device 505 is used to receive or send data via a network, and can also be used for data transmission between a processor and a memory. Specific examples of the above-mentioned network may include wired networks and wireless networks. In one embodiment, the transmission device 505 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one embodiment, the transmission device 505 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0083] Specifically, the memory 503 is used to store application programs.

[0084] The processor 501 may call the application stored in the memory 503 through the transmission device 505 to perform the following steps:

[0085] receiving a service request from a requesting party, wherein the service request is for the requesting party to request allocation of storage resources for a first service;

[0086] Determining a target physical hard disk of a target device on the device cluster, wherein available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD;

[0087] Allocate part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, wherein the storage capacity of the part of the storage resources is not less than the required capacity of the first service.

[0088] According to an embodiment of the present application, a business request from a requesting party is received, wherein the business request is used by the requesting party to request allocation of storage resources for a first service; a target physical hard disk of a target device on a device cluster is determined, wherein the available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD; part of the storage resources on the target physical hard disk are allocated to the first POD for use by the first computing node, wherein the storage capacity of the part of the storage resources is not less than the required capacity of the first service, thereby solving the technical problem in the related art of wasting storage resources when allocating hard disks to PODs.

[0089] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0090] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only, and the terminal may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 5 It does not limit the structure of the above electronic device. For example, the terminal may also include Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 5 Different configurations shown.

[0091] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0092] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to execute the program code of the method for allocating storage resources.

[0093] Optionally, in this embodiment, the above-mentioned storage medium may be located on at least one network device among the multiple network devices in the network shown in the above-mentioned embodiment.

[0094] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0095] receiving a service request from a requesting party, wherein the service request is for the requesting party to request allocation of storage resources for a first service;

[0096] Determining a target physical hard disk of a target device on the device cluster, wherein available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD;

[0097] Allocate part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, wherein the storage capacity of the part of the storage resources is not less than the required capacity of the first service.

[0098] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0099] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0100] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0101] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present application, 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 and includes several instructions for enabling one or more computer devices (which can be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application.

[0102] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0103] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, and can be electrical or other forms.

[0104] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0105] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0106] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for allocating storage resources, characterized in that: include: receiving a service request from a requesting party, wherein the service request is for the requesting party to request allocation of storage resources for a first service; Determining a target physical hard disk of a target device on the device cluster, wherein available storage resources of the target physical hard disk are not less than the required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD; Allocate part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, wherein the storage capacity of the part of the storage resources is not less than the required capacity of the first service; The step of determining a target physical hard disk of a target device on a device cluster includes: In a case where the business request is a create request, the available storage resources of each physical hard disk of the candidate devices in the device cluster are obtained; in a case where there is a physical hard disk whose available storage resources are not less than the required capacity of the first service in the candidate devices, the candidate device is used as the target device, and the physical hard disk whose available storage resources are not less than the required capacity of the first service in the candidate device is used as the target physical hard disk; in a case where there is no physical hard disk whose available storage resources are not less than the required capacity of the first service in the candidate devices, the available storage resources of each physical hard disk of new candidate devices are continuously obtained from the device cluster until a candidate device where a physical hard disk whose available storage resources are not less than the required capacity of the first service is found is found, and the create request is used by the requester to request to create a POD for the first service and allocate storage resources according to the required capacity of the first service; and / or If the service request is a resource request, the device cluster searches for a first device where the first POD is located. If the first device contains a physical hard disk with available storage resources not less than a target capacity, the first device is used as the target device, and the physical hard disk in the first device with available storage resources not less than the target capacity is used as the target physical hard disk. The target device includes the first device, and the target capacity is the difference between the required capacity of the first service and the allocated capacity. If the first device does not contain a physical hard disk with available storage resources not less than the target capacity, the available storage resources of each physical hard disk of a second device in the device cluster are obtained, where the second device is different from the first device. If the second device contains a physical hard disk with available storage resources not less than the required capacity of the first service, the second device is used as the target device, and the physical hard disk in the second device with available storage resources not less than the required capacity of the first service is used as the target physical hard disk. If the second device does not contain a physical hard disk with available storage resources not less than the required capacity of the first service, the device cluster continues to search for devices with available storage resources not less than the required capacity of the first service until a device with a physical hard disk with available storage resources not less than the required capacity of the first service is found. The resource request is used by the requester to indicate the required capacity of the first service.

2. The method according to claim 1, characterized in that Allocating part of the storage resources on the target physical hard disk to the first POD includes: Creating a first directory on the target physical hard disk, wherein the storage capacity of the storage resources under the first directory is not less than the required capacity of the first service; The first directory is mounted on the first POD as a first virtual hard disk, wherein the first virtual hard disk is used to store data generated during the operation of the first POD.

3. The method according to claim 2, characterized in that After mounting the first directory as a first virtual hard disk on the first POD, the method further includes: When there is data that needs to be saved on the first POD, the data is saved in the first directory among multiple directories, wherein the multiple directories also include a second directory created for the second POD on the target physical hard disk, the second POD is created on the target device, the second computing node providing the second service is located in a container within the second POD, and the second directory is used as a virtual hard disk of the second POD.

4. The method according to claim 1, wherein Before allocating part of the storage resources on the target physical hard disk to the first POD, the method further includes: after taking the candidate device as the target device, creating the first POD on the target device; and setting the first computing node providing the first service in a container of the first POD.

5. The method according to claim 1, wherein Before allocating part of the storage resources on the target physical hard disk to the first POD, the method further includes: after setting the second device as the target device, creating the first POD on the second device, and placing a first computing node providing the first service in a container of the first POD; After allocating part of the storage resources on the target physical hard disk to the first POD, the method further includes: transferring data generated by the first POD during operation and stored on the first device to the second device for storage; and using the second device to replace the first device in providing the first service.

6. The method according to any one of claims 1 to 5, characterized in that The device cluster is used to provide a database service, wherein before receiving a service request from a requester, the method further includes: A target plug-in is deployed in the device cluster, wherein the target plug-in is used to serve as a PV provider for the database service.

7. A storage resource allocation device, characterized in that: include: A receiving unit, configured to receive a service request from a requester, wherein the service request is used by the requester to request allocation of storage resources for a first service; a determining unit, configured to determine a target physical hard disk of a target device on the device cluster, wherein available storage resources of the target physical hard disk are not less than a required capacity of the first service, a first POD is created on the target device, and a first computing node providing the first service is located in a container within the first POD; an allocating unit, configured to allocate part of the storage resources on the target physical hard disk to the first POD for use by the first computing node, wherein the storage capacity of the part of the storage resources is not less than the required capacity of the first service; The determining unit is further configured to: In a case where the business request is a create request, the available storage resources of each physical hard disk of the candidate devices in the device cluster are obtained; in a case where there is a physical hard disk whose available storage resources are not less than the required capacity of the first service in the candidate devices, the candidate device is used as the target device, and the physical hard disk whose available storage resources are not less than the required capacity of the first service in the candidate device is used as the target physical hard disk; in a case where there is no physical hard disk whose available storage resources are not less than the required capacity of the first service in the candidate devices, the available storage resources of each physical hard disk of new candidate devices are continuously obtained from the device cluster until a candidate device where a physical hard disk whose available storage resources are not less than the required capacity of the first service is found is found, and the create request is used by the requester to request to create a POD for the first service and allocate storage resources according to the required capacity of the first service; and / or If the service request is a resource request, the device cluster searches for a first device where the first POD is located. If the first device contains a physical hard disk with available storage resources not less than a target capacity, the first device is used as the target device, and the physical hard disk in the first device with available storage resources not less than the target capacity is used as the target physical hard disk. The target device includes the first device, and the target capacity is the difference between the required capacity of the first service and the allocated capacity. If the first device does not contain a physical hard disk with available storage resources not less than the target capacity, the available storage resources of each physical hard disk of a second device in the device cluster are obtained, where the second device is different from the first device. If the second device contains a physical hard disk with available storage resources not less than the required capacity of the first service, the second device is used as the target device, and the physical hard disk in the second device with available storage resources not less than the required capacity of the first service is used as the target physical hard disk. If the second device does not contain a physical hard disk with available storage resources not less than the required capacity of the first service, the device cluster continues to search for devices with available storage resources not less than the required capacity of the first service until a device with a physical hard disk with available storage resources not less than the required capacity of the first service is found. The resource request is used by the requester to indicate the required capacity of the first service.

8. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 6 when executed.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: The processor executes the method according to any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • Kubernetes-based computing device sharing method, apparatus and device and storage medium

    CN112231049A

  • Micro-service scheduling method and device, computer equipment and storage medium

    CN113382077A