Disk Management Method, Device, Equipment and Storage Medium
By using hash table comparison of cluster identification, node identification and disk identification in large-scale distributed cluster systems, the problem of missed detection in disk management is solved, fast and accurate disk resource management is achieved, and disk capacity utilization is improved.
Patent Information
- Application Number
- CN202210933253.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-04
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2042-08-04
AI Technical Summary
In the existing technology, it is difficult to accurately identify and manage disks in large-scale distributed cluster systems, especially when disk plugging and adding, it is impossible to effectively manage disk resources in a unified manner. The traditional method relies on many computing resources, slow processing speed and low efficiency.
By obtaining the cluster identity, node identity and disk identity of the disk, the preset disk identity hash table is used for comparison and index management, ensuring that the disk identity is associated with the index, and realizing the determination of disk global management information and resource loading.
It improves disk capacity utilization, realizes fast and accurate disk management, and can identify and manage disk resources uniformly. It is suitable for scenarios of disk position transformation and joining in distributed storage systems.
Smart Images

Figure CN115309334B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a disk management method, device, equipment and storage medium. Background Art
[0002] In large-scale distributed cluster systems, the number of disks can typically reach hundreds. These disks are used to create storage pools based on different distributed storage system strategies (correction and erasure). This inevitably requires the insertion and removal of existing disks and the addition of new disks. For distributed systems, metadata is distributed on each disk. This management method requires pre-loading metadata for each disk, which requires the correct identification of existing and newly added disks, and the unified management of disks.
[0003] In the related art, RAID (Redundant Arrays of Independent Disks) is used to identify whether it has its own metadata to manage disks, but it is impossible to directly operate the disks; or a corresponding configuration file is generated based on the number of disks and disk IDs, and disk management operations are performed based on the configuration file. However, the configuration files of such solutions are easily lost and tampered with, resulting in inaccurate information. None of the above solutions can solve the subsequent management problems of the disks, and cannot achieve both disk identification and disk resource management. Summary of the Invention
[0004] In view of the shortcomings of the existing technology mentioned above, the purpose of the present invention is to provide a disk management method, device, equipment and storage medium to solve the problems of false detection and missed detection in disk management of two-dimensional images in related technologies. Traditional three-dimensional reconstruction relies on the processing of point cloud data sets, requires a lot of computing resources, has slow processing speed, low processing efficiency and is not suitable for disk management. Technical problems.
[0005] In view of the above problems, the present invention provides a disk management method, which includes:
[0006] Obtaining disk identity information of the disk to be managed, wherein the disk identity information includes a cluster identifier, a node identifier, and a disk identifier;
[0007] If the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier, the disk identifier is first compared with a preset disk identifier hash table;
[0008] If there is a disk index corresponding to the disk identifier in the preset disk identifier hash table, the disk management information of the disk to be managed is determined as the disk global management information associated with the disk index to manage the disk to be managed, and the disk management information includes at least one of disk basic information, disk global metadata information, and disk status.
[0009] In one embodiment of the present invention, after the disk identifier is first compared with a preset disk identifier hash table, if a disk index corresponding to the disk identifier exists in the preset disk identifier hash table, the disk management information of the disk to be managed is determined as the disk global management information associated with the disk index to manage the disk to be managed, and before the disk to be managed is managed, the method further includes:
[0010] If the disk index corresponding to the disk identifier does not exist in the preset disk identifier hash table, assigning a valid disk index to the disk to be managed;
[0011] Adding the correspondence between the disk index and the disk identifier to the preset disk identifier hash table;
[0012] The disk identifier is compared with the added preset disk identifier hash table for a second time.
[0013] In one embodiment of the present invention, allocating a valid disk index to the disk to be managed includes:
[0014] Obtaining disk slot information, disk serial information, and disk letter information of the disk to be managed;
[0015] The valid disk index is determined based on the disk slot information, the disk serial information, and the disk drive letter information.
[0016] In one embodiment of the present invention, before obtaining the disk identity information of the disk to be managed, the method further includes:
[0017] If the disk to be managed is added to the target disk system, resources are loaded into the disk to be managed through a preset private file system;
[0018] If the loading is successful, obtain the disk identity information of the disk to be managed;
[0019] If the loading fails, it will prompt that the disk to be managed is faulty.
[0020] In one embodiment of the present invention, after obtaining the disk identity information of the disk to be managed, if the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier, before performing a first comparison between the disk identifier and a preset disk identifier hash table, the method further includes:
[0021] Performing cluster comparison on the cluster identifier with a plurality of preset cluster identifiers in a preset cluster identifier set;
[0022] If the cluster identifier is successfully compared, performing node comparison on the node identifier and multiple preset node identifiers in the preset node identifier set;
[0023] If the node identifier comparison is successful, the cluster identifier is determined to be a legal cluster identifier, and the node identifier is determined to be a legal node identifier.
[0024] In one embodiment of the present invention, if the cluster identifier is empty or the cluster identifier comparison fails, the disk to be managed is formatted with a private file system to obtain a configuration cluster identifier, a configuration node identifier, and a configuration disk identifier;
[0025] Storing the configuration cluster identifier, the configuration node identifier, and the configuration disk identifier in the disk to be managed;
[0026] Allocating a valid disk index to the disk to be managed;
[0027] Adding the correspondence between the disk index and the disk identifier to the preset disk identifier hash table;
[0028] The disk management information of the disk to be managed is determined as the disk global management information associated with the disk index, so as to manage the disk to be managed.
[0029] In one embodiment of the present invention, if the node identification comparison fails, it is prompted that the disk to be managed is not a disk of the current node.
[0030] In one embodiment of the present invention, determining the disk management information of the disk to be managed as the disk global management information associated with the disk index includes:
[0031] Updating the disk global management module information under the disk index with at least one of the disk basic information and the disk status, wherein the disk basic information includes at least one of the disk letter, disk identifier, disk resource identifier, disk index, slot number, serial number, and disk physical type;
[0032] The disk metadata hash table is updated with the disk global metadata information, and the disk metadata hash table is identified by the disk index.
[0033] An embodiment of the present invention further provides a disk management device, the device comprising:
[0034] An acquisition module is used to acquire disk identity information of a disk to be managed, wherein the disk identity information includes a cluster identifier, a node identifier, and a disk identifier;
[0035] A comparison module, configured to, if the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier, perform a first comparison between the disk identifier and a preset disk identifier hash table;
[0036] An information update module is used to determine the disk management information of the disk to be managed as the disk global management information associated with the disk index if there is a disk index corresponding to the disk identifier in the preset disk identifier hash table, so as to manage the disk to be managed, wherein the disk management information includes at least one of the basic disk information, global disk metadata information, and disk status.
[0037] An embodiment of the present invention further provides an electronic device, including a processor, a memory, and a communication bus;
[0038] The communication bus is used to connect the processor and the memory;
[0039] The processor is configured to execute the computer program stored in the memory to implement the method as described in any one of the above embodiments.
[0040] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is used to enable the computer to execute the method as described in any one of the above embodiments.
[0041] As described above, the disk management method, apparatus, device, and storage medium provided by the present invention have the following beneficial effects:
[0042] The method obtains disk identity information of a disk to be managed. If the cluster identifier is a legal cluster identifier and the node identifier is a legal node identifier, the disk identifier is compared with a preset disk identifier hash table for the first time. If a disk index corresponding to the disk identifier exists in the preset disk identifier hash table, the disk management information of the disk to be managed is determined as the disk global management information associated with the disk index. To manage the disk to be managed, the disk only needs to store three pieces of information: the cluster identifier, the node identifier, and the disk identifier, thereby improving disk capacity utilization. Hash mapping is performed between the disk identifier and the disk index in the disk global resource management table. Subsequently, the corresponding disk index can be found by hashing the disk identifier, and then all resource information of the disk can be obtained, thereby achieving the purpose of disk resource management. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a flowchart of a disk management method shown in an exemplary embodiment of the present application;
[0044] Figure 2 This is a flowchart of a specific disk management method shown in an exemplary embodiment of the present application.
[0045] Figure 3 is a flowchart of a specific disk management method shown in another exemplary embodiment of the present application;
[0046] Figure 4 is a flowchart of another specific disk management method shown in an exemplary embodiment of the present application;
[0047] Figure 5 is a block diagram of a disk management device shown in an exemplary embodiment of the present application;
[0048] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment. DETAILED DESCRIPTION
[0049] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0050] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.
[0051] See also Figure 1 , Figure 1 FIG. 1 is a flowchart of a disk management method according to an exemplary embodiment of the present application. Figure 1 As shown, in an exemplary embodiment, the disk management method includes at least steps S101 to S103, which are described in detail as follows:
[0052] Step S101: Obtain disk identity information of a disk to be managed.
[0053] The disk to be managed can be a newly online disk in the disk system, the disk can be an original disk in the disk system that has been offline and then brought online again, or it can be a new disk added online to the disk system.
[0054] Among them, the disk identity information includes but is not limited to the cluster identifier, node identifier and disk identifier. The cluster identifier is a unique identifier in this cluster, which is used to distinguish whether it is a disk in this cluster or another cluster disk; the node identifier is a node unique identifier, which is used to distinguish different nodes in the same cluster; the disk identifier is a self-managed unique identifier used to represent the disk in this device node, which is used to distinguish other disks in this node, and the disk index is found through the disk ID hash, and then the global metadata of the disk is obtained, which facilitates the management of all data on the disk. The disk to be managed may have at least part of the disk identification information pre-written in it, or it may not have the disk identification information stored in it. When at least one of the cluster identifier, node identifier and disk identifier is not stored in the disk to be managed, it means that the disk to be managed is a newly launched disk. At this time, at least one of the cluster identifier, node identifier and disk identifier is empty. In other words, if the disk identifier is not obtained, the disk identifier will be recorded as empty at this time. The processing method of the other two identifiers is similar and will not be repeated here.
[0055] In one embodiment, before obtaining the disk identity information of the disk to be managed, the method further includes:
[0056] If the disk to be managed is added to the target disk system, resources are loaded to the disk to be managed through the preset private file system;
[0057] If the loading is successful, obtain the disk identity information of the disk to be managed;
[0058] If the loading fails, it will prompt that the disk to be managed is faulty.
[0059] The preset private file system can be any private file system known to those skilled in the art. The disk to be managed is loaded using the preset private file system. If the loading is successful, it indicates that the disk to be managed is normal and can be used. If the loading fails, it indicates that the disk to be managed is abnormal, and the disk to be managed can be reported to indicate a failure. For example, relevant information about the disk to be managed, such as the disk location, can be reported to the operation and maintenance interface, so that relevant personnel can know which disk has failed by viewing the operation and maintenance interface.
[0060] By preloading newly inserted disks to be managed in the target disk system, it is possible to pre-determine whether the disk status is normal and pre-screen the disks, saving disk judgment time and resources. This avoids discovering disk anomalies during subsequent data writing, resulting in online failures and wasted time and resources.
[0061] Step S102: If the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier, the disk identifier is first compared with a preset disk identifier hash table.
[0062] In one embodiment, after obtaining the disk identity information of the disk to be managed, if the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier, before performing a first comparison between the disk identifier and a preset disk identifier hash table, the method further includes:
[0063] Perform cluster comparison on the cluster identifier with multiple preset cluster identifiers in the preset cluster identifier set;
[0064] If the cluster identifier is successfully matched, the node identifier is compared with multiple preset node identifiers in the preset node identifier set;
[0065] If the node identifier comparison is successful, the cluster identifier is determined to be a legal cluster identifier, and the node identifier is determined to be a legal node identifier.
[0066] In the above embodiment, if the cluster identifier is empty (i.e., no cluster identifier is loaded), or the cluster identifier comparison fails (i.e., the cluster identifier does not match the preset cluster identifier), the disk to be managed is formatted with a private file system to obtain a configuration cluster identifier, a configuration node identifier, and a configuration disk identifier;
[0067] The configuration cluster identifier, the configuration node identifier, and the configuration disk identifier are stored in the disk to be managed, the configuration cluster identifier is used as the cluster identifier of the disk to be managed, the configuration node identifier is used as the node identifier of the disk to be managed, and the configuration disk identifier is used as the disk identifier of the disk to be managed;
[0068] Assign a valid disk index to the disk to be managed;
[0069] Add the correspondence between disk index and disk ID to the preset disk ID hash table;
[0070] The disk management information of the disk to be managed is determined as the disk global management information associated with the disk index, so as to manage the disk to be managed.
[0071] In the above embodiment, if the node identification comparison fails, it is prompted that the disk to be managed is not a disk of the current node.
[0072] That is, in the process of confirming the identity of the disk to be managed, the cluster ID is first compared. If the cluster ID comparison passes, it means that the disk may be an offline disk in the target disk system. If the cluster ID comparison fails, the valid cluster ID cannot be read from the disk to be managed or the obtained cluster ID is inconsistent with the preset cluster ID in the configuration file. At this time, it means that the disk to be managed does not belong to the target disk system, and the disk is directly formatted with a private file system, and a new configuration cluster ID, configuration node ID and configuration disk ID are configured for it and stored in the disk to be managed. The configuration cluster ID is used as the cluster ID of the disk to be managed, the configuration node ID is used as the node ID of the disk to be managed, and the configuration disk ID is used as the disk ID of the disk to be managed.
[0073] After the cluster ID of the disk to be managed is successfully compared, the node ID of the disk to be managed is compared. If the node ID comparison is successful, that is, there is an object consistent with the node ID in the preset node ID in the configuration file, it means that the disk to be managed belongs to the node on which it is online. Otherwise, it means that the disk to be managed does not belong to the node on which it is online, and the disk online fails. At this time, an alarm can be triggered, and it is prompted that the disk to be managed is not a disk of this node.
[0074] If both the cluster ID and node ID of the disk to be managed are successfully compared, a first comparison can be performed based on the disk ID of the disk to be managed with a preset disk ID hash table. The preset disk ID hash table stores multiple sets of preset mappings between disk IDs and disk indexes. If the disk index corresponding to the disk to be managed is obtained through the first comparison between the disk ID and the preset disk ID hash table, step S103 is executed.
[0075] Step S103 : If a disk index corresponding to the disk identifier exists in the preset disk identifier hash table, the disk management information of the disk to be managed is determined as the disk global management information associated with the disk index, so as to manage the disk to be managed.
[0076] Disk management information includes at least one of basic disk information, global disk metadata, and disk status. Basic disk information includes, but is not limited to, at least one of the following: disk letter, disk ID, disk resource ID, disk index, disk slot position, disk sequence, and disk physical type. Disk status includes, but is not limited to, offline, online, or faulty.
[0077] In one embodiment, after the disk identifier is first compared with a preset disk identifier hash table, if a disk index corresponding to the disk identifier exists in the preset disk identifier hash table, the disk management information of the disk to be managed is determined as the disk global management information associated with the disk index, before managing the disk to be managed, the method further includes:
[0078] If the disk index corresponding to the disk ID does not exist in the preset disk ID hash table, a valid disk index is assigned to the disk to be managed;
[0079] Add the correspondence between disk index and disk ID to the preset disk ID hash table;
[0080] The disk ID is compared with the added preset disk ID hash table for the second time.
[0081] By assigning a disk index to the disk to be managed for which no disk index is found, and adding the correspondence between the assigned disk index and the disk identifier to the preset disk identifier hash table, it is helpful to find the disk to be managed in a timely manner in the subsequent process of disk management. For example, when disk management is required, as long as the disk identifier is known, the corresponding disk index can be found through the preset disk identifier hash table, and then the basic disk information of the disk to be managed, such as the drive letter, slot number, serial number, disk physical type, etc., can be obtained. The disk resource identifier can also be found to know what resources are stored in the disk, obtain the global metadata information of the disk, and obtain the disk status. The above information can be used to implement relevant operation management of the disk to be managed.
[0082] The valid disk indexes allocated to the disks to be managed include:
[0083] Obtain the disk slot information, disk serial information, and disk letter information of the disk to be managed;
[0084] A valid disk index is determined based on the disk slot information, disk serial information, and disk drive letter information.
[0085] In one embodiment, determining the disk management information of the disk to be managed as the disk global management information associated with the disk index includes:
[0086] Updating at least one of the basic disk information and the disk status in the disk global management module information under the disk index, the basic disk information including at least one of the disk letter, the disk identifier, the disk resource identifier, the disk index, the slot number of the disk slot, the serial number of the disk serial, and the physical type of the disk;
[0087] The disk metadata hash table is updated with the disk global metadata information. The disk metadata hash table is identified by the disk index.
[0088] The disk management method provided in the above embodiment obtains the disk identity information of the disk to be managed. If the cluster identifier is a legal cluster identifier and the node identifier is a legal node identifier, the disk identifier is compared with the preset disk identifier hash table for the first time. If a disk index corresponding to the disk identifier exists in the preset disk identifier hash table, the disk management information of the disk to be managed is determined to be the disk global management information associated with the disk index. To manage the disk to be managed, the disk only needs to store three pieces of information: the cluster identifier, the node identifier, and the disk identifier, thereby improving the utilization rate of the disk capacity. By performing hash mapping between the disk identifier and the disk index in the disk global resource management table, the corresponding disk index can be subsequently found by hashing the disk identifier, and then all resource information of the disk can be obtained, thereby achieving the purpose of disk resource management. For example, the disk can be managed online and offline and the disk can be identified based on the cluster identifier, the node identifier, and the disk identifier. Each business module can also access the disk-related resources through the disk identifier, thereby performing disk resource management.
[0089] In the related art, disk identification information, cluster identification information corresponding to the disk identification information, node identification information and mounting location information are pre-stored on the disk, and the purpose of identifying the disk is achieved by comparing different information layer by layer, thereby achieving the purpose of enabling the distributed storage system to correctly identify the disk even when the disk position changes or is installed out of order. The disadvantages of this solution are: 1. Four types of information need to be stored on the disk, and the disk capacity utilization rate is low; 2. The data on the disk cannot be managed uniformly subsequently.
[0090] To solve the above problems, an embodiment of the present application provides a disk management method that can be applied to a distributed storage system, so as to realize arbitrary exchange of disk positions and addition of new disks in the distributed storage system, so that the distributed storage system can correctly identify whether the disk is an original offline disk or a newly added disk, and uniformly manage all disks in memory, so that it can quickly and accurately complete data operations on the corresponding disks.
[0091] The method provided in the embodiment of the present application can not only correctly identify the disk but also manage the disk quickly and accurately by storing the cluster identifier (cluster ID), node identifier (node ID) and disk identifier (disk ID) in the disk. The cluster identifier is a unique identifier in the cluster, which is used to distinguish between the disk of this cluster and other cluster disks. The node identifier is a node unique identifier, which is used to distinguish different nodes in the same cluster. The disk identifier is a self-managed unique identifier used to represent the disk in the device node, which is used to distinguish other disks in the node. The disk index is found through the disk ID hash, and then the global metadata of the disk is obtained, which facilitates the management of all data on the disk.
[0092] The disk management method provided in the above embodiment is further illustrated below by using a specific embodiment. Figure 2 , Figure 2 This is a flowchart of a specific disk management method shown in an exemplary embodiment of the present application. Figure 2 As shown, in an exemplary embodiment, the specific disk management method is described in detail as follows:
[0093] After the disk (disk to be managed) is online, it is first loaded through the private file system; if the load is successful, the cluster ID, node ID, and disk ID in the file system are read. The cluster ID is compared with the cluster ID in the node configuration file. If they are inconsistent (no), it is considered that the disk is not in this cluster, and it is automatically formatted with the private file system, and the cluster ID, node ID, and disk ID are re-stored in the disk. That is, the disk is formatted again through the private file system and a valid cluster ID, node ID, and disk ID are stored. If the cluster ID is consistent with the cluster ID in the node configuration file, the node ID in the disk and the node ID in the configuration file are continued to be compared. If they are inconsistent, the disk is considered to be a disk in this cluster but not a disk belonging to this node. The disk fails to go online and triggers an alarm to prompt that the disk does not belong to this node (that is, it prompts that the disk is not a disk of this node). If the node ID is consistent with the node ID in the node configuration file, the disk ID in the disk is obtained, and the disk index is searched through the disk ID hash. If the disk index is obtained, it is considered that this disk is the disk that is back online after the original node goes offline. It is only necessary to update the metadata in the disk to the memory. If a valid disk index cannot be obtained, it is necessary to obtain an available index from the global disk management module and map this disk ID and index relationship to the disk hash table. After obtaining the valid disk index, all the metadata on the scanned disk will be loaded into the hash table on the corresponding disk index, that is, the hash mapping of the disk ID and disk-related information is updated. In this way, the corresponding disk index, disk letter, resource ID and other disk information can be found directly through the disk ID, and related operations can be performed on the disk through the disk information. In other words, it is possible to manage disk information and other disk-related resources through the disk ID.
[0094] The disk management method provided in the above embodiment is further illustrated below by another specific embodiment. Figure 3 , Figure 3 FIG. 1 is a flowchart of a specific disk management method shown in another exemplary embodiment of the present application. Figure 3 As shown, in another exemplary embodiment, the specific disk management method is described in detail as follows:
[0095] Step S301: The disk goes online.
[0096] Step S302: Loading the private file system.
[0097] After the disk is inserted into the system, resources are first loaded into the disk through the private file system. If the loading fails, it is considered that the disk is abnormal. Step S309 is executed to report the disk to the operation and maintenance interface, indicating that the disk is faulty.
[0098] Step S303: Obtain the cluster ID, disk ID, and node ID in the disk.
[0099] After loading successfully, read the cluster ID, node ID, and disk ID from the disk.
[0100] Step S304: Determine whether the cluster belongs to the current cluster based on the cluster ID.
[0101] If the disk fails to obtain a valid cluster ID or the obtained cluster ID is inconsistent with the configuration file, the disk is considered not to belong to the current cluster. Step 310 is executed to format the disk with a private file system. The cluster ID, node ID, and disk ID in the node configuration file are stored on the disk, and the process proceeds to step S311:
[0102] Step S305: Determine whether it belongs to this node by using the node ID.
[0103] When the cluster ID obtained from the disk is consistent with the node configuration file, the node ID is then judged to be consistent with the configuration file. If they are not consistent, it is considered that the disk does not belong to this node. Step S313 is executed, the disk fails to go online, and an alarm is triggered to prompt that this disk is not a disk of this node.
[0104] Step S306: Check whether a disk index can be found by performing a hash search using the disk ID.
[0105] If the cluster ID and node ID are consistent with those in the node configuration file, a disk hash table search is performed on the disk ID. If valid disk index data is found, indicating that the previously offline disk is back online, the disk index corresponding to the disk ID is returned, and the process proceeds to step S307.
[0106] If no valid disk index is obtained for the disk, step S311 is executed, and a valid disk index is assigned to the disk by the disk global management module. The index assignment is obtained by combining information such as the disk slot number, disk serial number, and disk drive letter. After obtaining a valid disk index, step S312 is executed, and the disk ID and disk index are hash-mapped and added to the disk hash table. The process then continues with step S307.
[0107] Step S307: storing disk related information (disk ID, drive letter, resource ID and status, etc.) into the disk global management module under the disk index.
[0108] The obtained basic disk information, including parameters such as the disk letter, disk ID, disk resource ID, and disk index, is used to update the disk global management module information under the disk index.
[0109] Step S308: Load the metadata information of the disk into a disk metadata hash table with the disk index as the index.
[0110] Read the metadata information from the disk and update it into the disk metadata hash table with the disk index as the index.
[0111] In order to quickly find all the disks corresponding to the data and read and write data to a specific disk, the subsequent disk mainly performs a hash search on the disk ID. Figure 4 , Figure 4 FIG. 1 is a schematic diagram of another disk management method according to an exemplary embodiment of the present application. Figure 4 As shown, in an exemplary embodiment, the disk index is found by hashing the disk ID and the disk hash table (preset disk identification hash table), and then the disk resource ID, disk global metadata information, disk status (offline, online, faulty) and disk inherent information (basic disk information) such as disk letter, disk slot number, serial number, disk physical type, etc. are obtained. After obtaining the specific disk information, relevant operations on the disk can be implemented.
[0112] The method provided by the above embodiment can be used to manage disk online and offline based on the cluster ID, node ID, and disk ID in the disk, and can correctly identify the disk. Each business module accesses the disk-related resources through the disk ID, and then performs disk resource management. The disk only needs to store three pieces of information: cluster ID, node ID, and disk ID. Compared with the original technology, the disk capacity utilization rate is improved. The disk ID and the disk index in the disk global resource management table are hashed and mapped. The corresponding disk index can be subsequently found by hashing the disk ID, and then all the resource information of the disk can be obtained, thereby achieving the purpose of disk resource management.
[0113] See also Figure 5 , Figure 5 FIG. 1 is a block diagram of a disk management device shown in an exemplary embodiment of the present application. Figure 5 As shown, this embodiment provides a disk management device 500, which includes:
[0114] An acquisition module 501 is used to acquire disk identity information of a disk to be managed, where the disk identity information includes a cluster identifier, a node identifier, and a disk identifier;
[0115] Comparison module 502, configured to perform a first comparison between the disk identifier and a preset disk identifier hash table if the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier;
[0116] The information update module 503 is used to determine the disk management information of the disk to be managed as the disk global management information associated with the disk index if there is a disk index corresponding to the disk identifier in the preset disk identifier hash table, so as to manage the disk to be managed. The disk management information includes at least one of the disk basic information, disk global metadata information, and disk status.
[0117] In one embodiment, the apparatus further comprises:
[0118] An index allocation module, configured to allocate a valid disk index to the disk to be managed if the disk index corresponding to the disk identifier does not exist in the preset disk identifier hash table;
[0119] A hash table update module, used for adding the correspondence between the disk index and the disk identifier to a preset disk identifier hash table;
[0120] This comparison module is used to perform a second comparison of the disk ID with the added preset disk ID hash table. If the second comparison determines that a disk index corresponding to the disk ID exists in the preset disk ID hash table, the disk management information of the disk to be managed is determined as the global disk management information associated with the disk index, so that the disk to be managed can be managed.
[0121] In one embodiment, the index allocation module includes:
[0122] The index information acquisition module is used to obtain the disk slot information, disk serial information, and disk letter information of the disk to be managed;
[0123] The effective index determination module is used to determine the effective disk index based on the disk slot information, disk serial information and disk drive letter information.
[0124] In one embodiment, the apparatus further comprises:
[0125] The loading module is used to load resources of the disk to be managed through a preset private file system before obtaining the disk identity information of the disk to be managed, if the disk to be managed is added to the target disk system;
[0126] The identity information acquisition module is used to obtain the disk identity information of the disk to be managed if the loading is successful;
[0127] The fault prompt module is used to prompt that the managed disk is faulty if loading fails.
[0128] In one embodiment, the apparatus further comprises:
[0129] A cluster identifier comparison module, configured to perform cluster comparison on the cluster identifier with a plurality of preset cluster identifiers in a preset cluster identifier set;
[0130] A node identification comparison module is used to compare the node identification with a plurality of preset node identifications in a preset node identification set if the cluster identification comparison is successful;
[0131] The legitimacy determination module is used to determine that the cluster identifier is a legal cluster identifier and the node identifier is a legal node identifier if the node identifier comparison is successful.
[0132] In one embodiment, the apparatus further comprises:
[0133] The formatting module is used to format the private file system of the managed disk if the cluster identifier is empty or the cluster identifier comparison fails, and obtain the configuration cluster identifier, configuration node identifier and configuration disk identifier;
[0134] A storage module, used for storing the configuration cluster identifier, the configuration node identifier, and the configuration disk identifier in the disk to be managed;
[0135] An allocation module is used to allocate a valid disk index to the disk to be managed;
[0136] A hash table update module (having the same function as the hash table update module in the above embodiment), configured to add the correspondence between the disk index and the disk identifier to a preset disk identifier hash table;
[0137] The management module is used to determine the disk management information of the disk to be managed as the disk global management information associated with the disk index, so as to manage the disk to be managed.
[0138] In one embodiment, the apparatus further comprises:
[0139] The node abnormality prompt module is used to prompt that the disk to be managed is not the disk of this node if the node identification comparison fails.
[0140] In one embodiment, the management module includes:
[0141] a first updating module, configured to update the disk global management module information under the disk index with at least one of the basic disk information and the disk status, the basic disk information including at least one of the disk letter, the disk identifier, the disk resource identifier, the disk index, the disk slot position, the disk sequence, and the disk physical type;
[0142] The second updating module is used to update the disk metadata hash table with the disk global metadata information, where the disk metadata hash table is identified by the disk index.
[0143] In this embodiment, the device is essentially provided with multiple modules for executing the method in any of the above embodiments. The specific functions and technical effects can be referred to the above embodiments and will not be repeated here.
[0144] See also Figure 6 , an embodiment of the present invention further provides an electronic device 600, including a processor 601, a memory 602 and a communication bus 603;
[0145] The communication bus 603 is used to connect the processor 601 and the memory 602;
[0146] The processor 601 is configured to execute the computer program stored in the memory 602 to implement one or more of the methods described in the above embodiments.
[0147] The embodiment of the present invention further provides a computer-readable storage medium, characterized in that a computer program is stored thereon.
[0148] The computer program is used to enable a computer to execute the method described in any one of the above-mentioned embodiments.
[0149] An embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute the instructions (instructions) of the steps included in embodiment 1 of the embodiment of the present application.
[0150] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0151] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0152] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0153] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0154] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.
Claims
1. A disk management method, characterized in that: The method comprises: Obtaining disk identity information of the disk to be managed, wherein the disk identity information includes a cluster identifier, a node identifier, and a disk identifier; If the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier, the disk identifier is first compared with a preset disk identifier hash table; If there is a disk index corresponding to the disk identifier in the preset disk identifier hash table, the disk management information of the disk to be managed is determined as the disk global management information associated with the disk index to manage the disk to be managed, and the disk management information includes at least one of disk basic information, disk global metadata information, and disk status.
2. The disk management method according to claim 1, wherein: After first comparing the disk identifier with a preset disk identifier hash table, if a disk index corresponding to the disk identifier exists in the preset disk identifier hash table, determining the disk management information of the disk to be managed as the disk global management information associated with the disk index to manage the disk to be managed, the method further includes: If the disk index corresponding to the disk identifier does not exist in the preset disk identifier hash table, assigning a valid disk index to the disk to be managed; Adding the correspondence between the disk index and the disk identifier to the preset disk identifier hash table; The disk identifier is compared with the added preset disk identifier hash table for a second time.
3. The disk management method according to claim 2, wherein: Allocating a valid disk index to the disk to be managed includes: Obtaining disk slot information, disk serial information, and disk letter information of the disk to be managed; The valid disk index is determined based on the disk slot information, the disk serial information, and the disk drive letter information.
4. The disk management method according to claim 1, wherein: Before obtaining the disk identity information of the disk to be managed, the method further includes: If the disk to be managed is added to the target disk system, resources are loaded into the disk to be managed through a preset private file system; If the loading is successful, obtain the disk identity information of the disk to be managed; If the loading fails, it will prompt that the disk to be managed is faulty.
5. The disk management method according to claim 4, wherein: After obtaining the disk identity information of the disk to be managed, if the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier, before performing a first comparison between the disk identifier and a preset disk identifier hash table, the method further includes: Performing cluster comparison on the cluster identifier with a plurality of preset cluster identifiers in a preset cluster identifier set; If the cluster identifier is successfully compared, performing node comparison on the node identifier and multiple preset node identifiers in the preset node identifier set; If the node identifier comparison is successful, the cluster identifier is determined to be a legal cluster identifier, and the node identifier is determined to be a legal node identifier.
6. The disk management method according to claim 5, wherein: If the cluster identifier is empty or the cluster identifier comparison fails, the disk to be managed is formatted with a private file system to obtain a configuration cluster identifier, a configuration node identifier, and a configuration disk identifier; Storing the configuration cluster identifier, the configuration node identifier, and the configuration disk identifier in the disk to be managed; Allocating a valid disk index to the disk to be managed; Adding the correspondence between the disk index and the disk identifier to the preset disk identifier hash table; The disk management information of the disk to be managed is determined as the disk global management information associated with the disk index, so as to manage the disk to be managed.
7. The disk management method according to claim 5, wherein: If the node identification comparison fails, it is prompted that the disk to be managed is not a disk of the current node.
8. The disk management method according to any one of claims 1 to 7, wherein: Determining the disk management information of the disk to be managed as the disk global management information associated with the disk index includes: Updating the disk global management module information under the disk index with at least one of the disk basic information and the disk status, wherein the disk basic information includes at least one of the disk letter, disk identifier, disk resource identifier, disk index, slot number, serial number, and disk physical type; The disk metadata hash table is updated with the disk global metadata information, and the disk metadata hash table is identified by the disk index.
9. A disk management device, characterized in that: The device comprises: An acquisition module is used to acquire disk identity information of a disk to be managed, wherein the disk identity information includes a cluster identifier, a node identifier, and a disk identifier; A comparison module, configured to, if the cluster identifier is a valid cluster identifier and the node identifier is a valid node identifier, perform a first comparison between the disk identifier and a preset disk identifier hash table; An information update module is used to determine the disk management information of the disk to be managed as the disk global management information associated with the disk index if there is a disk index corresponding to the disk identifier in the preset disk identifier hash table, so as to manage the disk to be managed, wherein the disk management information includes at least one of the basic disk information, global disk metadata information, and disk status.
10. An electronic device, characterized in that: Includes processor, memory and communication bus; The communication bus is used to connect the processor and the memory; The processor is configured to execute the computer program stored in the memory to implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that A computer program is stored thereon, The computer program is used to cause the computer to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Disk management method of distributed file system
CN105278882A
Construction method of index system and method and device of achieving search
CN107203532A