Distributed hard disk management method, system, electronic device and readable storage medium

By using service clusters in distributed databases to generate hardware IDs and monitoring hard disk tables, and updating the total hard disk table, the complex problem of hard disk management in distributed databases is solved, and flexible and efficient management of hard disks are achieved.

CN114968095BActive Publication Date: 2024-09-17CHONGQING UNISINSIGHT TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202210513901.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2024-09-17
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

The high degree of coupling between servers and hard disks in existing distributed databases makes hard disk management complex and inconvenient for capacity expansion and reduction, making it difficult to achieve flexible hard disk management.

Method used

By obtaining service clusters connected to multiple distributed hard disks, using the main service and listening service to generate hardware IDs and listening hard disk tables, updating the total hard disk table, simplifying hard disk identification allocation rules, and reducing the coupling between servers and hard disks.

Benefits of technology

It realizes flexible management of distributed hard disks, simplifies identification allocation rules, improves management efficiency, and supports the rapid addition, ejection and drift of hard disks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968095B
    Figure CN114968095B
Patent Text Reader

Abstract

The present invention relates to the technical field of hardware management, and discloses a distributed hard disk management method, system, electronic device and readable storage medium. The method obtains a service cluster connected to multiple distributed hard disks, obtains a listening service ID corresponding to a listening service in the service cluster, generates a hardware ID corresponding to each listening hard disk based on the listening service ID, monitors the listening hard disk, generates a listening hard disk table corresponding to the listening hard disk according to the listening result and the hardware ID, updates a total hard disk table corresponding to the distributed hard disk according to the listening hard disk table through a main service in the service cluster, identifies the listening service through the listening service ID, identifies physical information of the distributed hard disk according to the hardware ID including the listening service ID, and updates the total hard disk table of the main service according to the listening hard disk table of the listening service, thereby simplifying the identification allocation rules of the distributed hard disks, reducing the coupling between the server and the distributed hard disks, and facilitating the management of the distributed hard disks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hardware management, and in particular to a distributed hard disk management method, system, electronic device and readable storage medium. Background Art

[0002] Distributed databases usually use smaller server systems. Each server can be placed in a separate place. Each server may have a complete copy or a partial copy of the DBMS (Database Management System) and its own local database. Many servers located in different locations are interconnected through the network to form a complete, global, logically centralized, and physically distributed large database.

[0003] At present, a distributed database is a storage system with a complex layout, in which the relationship between its servers and hard disks is relatively rigid and highly coupled, making it inconvenient to expand or reduce the capacity of the hard disks in the distributed database, which in turn makes hard disk management more difficult and is not conducive to the use of the distributed database. Summary of the invention

[0004] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0005] In view of the above-mentioned shortcomings of the prior art, the present invention discloses a distributed hard disk management method, system, electronic device and readable storage medium to reduce the coupling between the server and the hard disk, thereby facilitating the management of the hard disk.

[0006] The present invention discloses a distributed hard disk management method, comprising: obtaining a service cluster connected to multiple distributed hard disks, wherein the service cluster includes a main service and a monitoring service; obtaining a monitoring service ID (Identity Document) corresponding to the monitoring service, and generating a hardware ID corresponding to each monitoring hard disk based on the monitoring service ID, wherein the monitoring hard disk includes at least one distributed hard disk; using the monitoring service to monitor the monitoring hard disk, and generating a monitoring hard disk table corresponding to the monitoring hard disk according to the monitoring result and the hardware ID; using the main service to obtain a total hard disk table corresponding to the distributed hard disk, and updating the total hard disk table according to the monitoring hard disk table.

[0007] Optionally, the main service obtains the total hard disk table through the following method: the main service assigns a name ID to each distributed hard disk, and determines the hard disk status information corresponding to each distributed hard disk as an offline state; and generates a total hard disk table corresponding to the distributed hard disk based on the name ID and the hard disk status information.

[0008] Optionally, after using the main service to obtain the total hard disk table corresponding to the distributed hard disk, the method also includes: the distributed hard disk includes multiple hard disk data blocks and a data block ID corresponding to each of the hard disk data blocks; if the main service receives a data block application request corresponding to a target data block, it generates a data block address corresponding to the target data block, wherein the target data block is any of the hard disk data blocks, and the data block address includes the name ID of the distributed hard disk where the target data block is located, and the data block ID corresponding to the target data block; if the main service receives a data block access request corresponding to the target address, it determines the hardware ID corresponding to the name ID in the target address as the target ID, and in the distributed hard disk corresponding to the target ID, accesses the hard disk data block corresponding to the data block ID in the target address, wherein the target address is any data block address.

[0009] Optionally, after using the main service to obtain the total hard disk table corresponding to the distributed hard disk, the method also includes: if the main service receives a hard disk deletion instruction corresponding to the hard disk to be deleted, the main service deletes the status information corresponding to the hard disk to be deleted from the total hard disk table, wherein the hard disk to be deleted is any distributed hard disk; deletes the hard disk configuration information corresponding to the hard disk to be deleted from the database end, and adds the name ID corresponding to the hard disk to be deleted to the preset hard disk deletion table.

[0010] Optionally, after using the main service to obtain the total hard disk table corresponding to the distributed hard disk, the method also includes: if the monitoring service includes multiple, use any two monitoring services as the first service and the second service respectively, and determine any monitoring hard disk corresponding to the first service as the first hard disk; if the first service cannot connect to the first hard disk, the first service generates a first hard disk table and sends the first hard disk table to the main service, wherein the current hard disk status corresponding to the first hard disk in the first hard disk table is an offline state; the main service receives the first hard disk table, and determines the hard disk status information corresponding to the first hard disk in the total hard disk table as an offline state according to the first hard disk table; if the second service is connected to the first hard disk, the second service generates a second hard disk table and sends the second hard disk table to the main service, wherein the current hard disk status corresponding to the first hard disk in the second hard disk table is an online state; the main service receives the second hard disk table, determines the hard disk status information corresponding to the first hard disk in the total hard disk table as an online state according to the second hard disk table, and updates the hardware ID corresponding to the first hard disk according to the monitoring service ID corresponding to the second service.

[0011] Optionally, after the main service updates the preset total hard disk table according to the listening hard disk table, the method also includes: the main service determines the updated total hard disk table as the new total hard disk table; every time a first preset time period passes, the listening service generates a listening hard disk table, and sends the generated listening hard disk table to the main service, wherein the listening hard disk table includes listening version information, and the current hard disk status corresponding to each of the listening hard disks; if the main service receives the listening hard disk table sent by the listening service within a second preset time period, obtains the historical version information corresponding to the listening service, and compares the listening version information with the historical version information; if the comparison result is the same, the total hard disk table is not updated; if the comparison result is different, based on the current hard disk status, the hard disk status information corresponding to each of the listening hard disks in the total hard disk table is updated, and the historical version information corresponding to the listening service is updated based on the listening version information; if the main service does not receive the listening hard disk table sent by the listening service within the second preset time period, the hard disk status information corresponding to each of the listening hard disks in the total hard disk table is determined as an offline state.

[0012] Optionally, a service cluster is obtained in the following manner: a server side and a database side are obtained, and a connection is established between the server side and the database side, wherein the database side includes multiple distributed hard disks, and the server side includes multiple metadata services and multiple master control services; the metadata service and the master control service are configured according to preset cluster information, any metadata service is determined as a main service, and at least a part of the master control services are determined as monitoring services; a connection is established between the main service and the monitoring service to obtain a service cluster including the main service and the monitoring service.

[0013] Optionally, obtaining the listening service ID corresponding to the listening service includes: the listening service determines whether the listening service is in an initialization state according to a preset status ID; if the listening service is in an initialization state, the listening service sends a listening service ID request to the main service, triggering the main service to determine whether the listening service and the main service belong to the same cluster according to the cluster information; if the listening service and the main service belong to the same cluster, the main service assigns a listening service ID to the listening service, and sends the listening service ID to the listening service; if the listening service and the main service do not belong to the same cluster, returning a request failure to the listening service; if the listening service is not in an initialization state, determining the status ID as the listening service ID corresponding to the listening service.

[0014] Optionally, a hardware ID corresponding to each monitoring hard disk is generated based on the monitoring service ID, including: numbering each of the monitoring hard disks to obtain a hard disk serial number corresponding to each of the monitoring hard disks; and generating a hardware ID corresponding to each of the monitoring hard disks, wherein the hardware ID of the monitoring hard disk includes the monitoring service ID corresponding to the monitoring service, and the hard disk serial number corresponding to the monitoring hard disk.

[0015] The present invention discloses a distributed hard disk management system, comprising: an acquisition module, used to acquire a service cluster connected to multiple distributed hard disks, wherein the service cluster includes a main service and a monitoring service; a generation module, used to acquire a monitoring service ID corresponding to the monitoring service, and generate a hardware ID corresponding to each monitoring hard disk based on the monitoring service ID, wherein the monitoring hard disk includes at least one distributed hard disk; a monitoring module, used to monitor the monitoring hard disk using the monitoring service, and generate a monitoring hard disk table corresponding to the monitoring hard disk according to the monitoring result and the hardware ID; an updating module, used to acquire a total hard disk table corresponding to the distributed hard disk using the main service, and update the total hard disk table according to the monitoring hard disk table.

[0016] The present invention discloses an electronic device, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above method.

[0017] The present invention discloses a computer-readable storage medium, on which a computer program is stored: when the computer program is executed by a processor, the above method is implemented.

[0018] Beneficial effects of the present invention:

[0019] Obtain a service cluster connected to multiple distributed hard disks, obtain a listening service ID corresponding to a listening service in the service cluster, generate a hardware ID corresponding to each listening hard disk based on the listening service ID, and listen to the listening hard disk, generate a listening hard disk table corresponding to the listening hard disk according to the listening result and the hardware ID, and update the total hard disk table corresponding to the distributed hard disk according to the listening hard disk table through the main service in the service cluster. In this way, the listening service is identified by the listening service ID, the physical information of the distributed hard disk is identified according to the hardware ID including the listening service ID, and the total hard disk table of the main service is updated according to the listening hard disk table of the listening service, which simplifies the identification allocation rules of the distributed hard disks, reduces the coupling between the server and the distributed hard disks, and facilitates the management of the distributed hard disks. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flow chart of a distributed hard disk management method in an embodiment of the present invention;

[0021] Figure 2 It is a structural diagram of a distributed hard disk management method implementation system in an embodiment of the present invention;

[0022] Figure 3 is a structural diagram of a distributed hard disk management system in an embodiment of the present invention;

[0023] Figure 4 It is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0024] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and sub-samples in the embodiments can be combined with each other without conflict.

[0025] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being 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 complicated.

[0026] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0027] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0028] Unless otherwise stated, the term "plurality" means two or more.

[0029] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.

[0030] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.

[0031] Combination Figure 1 As shown, the embodiment of the present disclosure provides a distributed hard disk management method, including:

[0032] Step S101, obtaining a service cluster connected to multiple distributed hard disks;

[0033] Among them, the service cluster includes the main service and the monitoring service;

[0034] Step S102, obtaining a monitoring service ID corresponding to the monitoring service, and generating a hardware ID corresponding to each monitoring hard disk based on the monitoring service ID;

[0035] Wherein, the monitoring hard disk includes at least one distributed hard disk;

[0036] Step S103, monitoring the monitoring hard disk using the monitoring service, and generating a monitoring hard disk table corresponding to the monitoring hard disk according to the monitoring result and the hardware ID;

[0037] Step S104: using the main service to obtain the total hard disk table corresponding to the distributed hard disks, and updating the total hard disk table according to the monitored hard disk table.

[0038] The distributed hard disk management method provided by the embodiment of the present disclosure is adopted to obtain a service cluster connected to multiple distributed hard disks, obtain the listening service ID corresponding to the listening service in the service cluster, generate the hardware ID corresponding to each listening hard disk based on the listening service ID, and listen to the listening hard disk, generate the listening hard disk table corresponding to the listening hard disk according to the listening result and the hardware ID, and update the total hard disk table corresponding to the distributed hard disk according to the listening hard disk table through the main service in the service cluster. In this way, the listening service is identified by the listening service ID, the physical information of the distributed hard disk is identified according to the hardware ID including the listening service ID, and the total hard disk table of the main service is updated according to the listening hard disk table of the listening service, which simplifies the identification allocation rules of the distributed hard disk, reduces the coupling between the server and the distributed hard disk, and facilitates the management of the distributed hard disk.

[0039] Optionally, a service cluster is obtained in the following manner: a server side and a database side are obtained, and a connection is established between the server side and the database side, wherein the database side includes multiple distributed hard disks, and the server side includes multiple metadata services and multiple master control services; metadata services and master control services are configured according to preset cluster information, any metadata service is determined as a main service, and at least part of the master control services are determined as monitoring services; a connection is established between the main service and the monitoring service to obtain a service cluster including the main service and the monitoring service.

[0040] Optionally, the database end includes a distributed database, and the server end and the database end respectively include at least one of a server, a computer, a smart phone, a tablet computer, and a notebook.

[0041] Optionally, the database side also includes multiple database servers, and the database servers are connected to at least one distributed hard disk; each master control service is connected to at least one distributed hard disk through any database server, and the minimum unit of the number of distributed hard disks connected to the master control service through the database server is pieces, for example, one, three, five, etc.

[0042] In some embodiments, the metadata service includes an MD (Metadata) server process, and the master control service includes a PD (Placement Driver) server process, wherein the PD server process is a management module for managing the I / O (input / output) ports of the distributed database.

[0043] Optionally, before configuring the metadata service and the master control service according to the preset cluster information, the method further includes: installing distributed storage system software on the server side.

[0044] Optionally, the cluster information includes one or more of a monitoring service ID, service process configuration information, a cluster name, and the like.

[0045] Optionally, establishing a connection between the main service and the monitoring service includes: the main service allocating a virtual IP (Internet Protocol) address; and the monitoring service establishing a TCP (Transmission Control Protocol) connection corresponding to the virtual IP address.

[0046] Optionally, obtaining the listening service ID corresponding to the listening service includes: the listening service determines whether the listening service is in an initialization state according to a preset status ID; if the listening service is in the initialization state, the listening service sends a listening service ID request to the main service, triggering the main service to determine whether the listening service and the main service belong to the same cluster according to the cluster information; if the listening service and the main service belong to the same cluster, the main service assigns a listening service ID to the listening service, and sends the listening service ID to the listening service; if the listening service and the main service do not belong to the same cluster, returning a request failure to the listening service; if the listening service is not in the initialization state, determining the status ID as the listening service ID corresponding to the listening service.

[0047] In this way, the main service allocates a listening service ID for identifying the listening service or database server. The listening service ID is not recorded on the database side, but is stored by the listening service. The distributed hard disk corresponding to a single database server is managed by the listening service, and all distributed hard disks are managed by the main service, which reduces the coupling between the server and the distributed hard disk and facilitates the management of the distributed hard disk.

[0048] Optionally, if the monitoring service ID of the monitoring service is lost, the monitoring service sends a monitoring service ID request to the main service, triggering the main service to determine whether the monitoring service and the main service belong to the same cluster based on the cluster information; if the monitoring service and the main service belong to the same cluster, the main service assigns a monitoring service ID to the monitoring service and sends the monitoring service ID to the monitoring service.

[0049] In some embodiments, if the status ID of the listening service is 0, the listening service sends a listening service ID request to the main service; the main service compares its own cluster name with that of the listening service to see if they are the same. If they are the same, it means that the listening service ID of the listening service is manually added to the cluster information. The main service assigns a listening service ID to the listening service and sends the listening service ID to the listening service. If they are different, it means that the listening service ID of the listening service is not manually added to the cluster information, the main service and the listening service are not in the same service cluster, and the main service returns a request failure to the listening service. If the status ID of the listening service is not 0, it means that the listening service uses old cluster information and uses the status ID as cluster information.

[0050] Optionally, a hardware ID corresponding to each monitoring hard disk is generated based on the monitoring service ID, including: numbering each monitoring hard disk to obtain a hard disk serial number corresponding to each monitoring hard disk; and generating a hardware ID corresponding to each monitoring hard disk respectively, wherein the hardware ID of the monitoring hard disk includes the monitoring service ID corresponding to the monitoring service, and the hard disk serial number corresponding to the monitoring hard disk.

[0051] In some embodiments, the hard disk serial number of each monitoring hard disk increases sequentially.

[0052] Optionally, the hardware ID corresponding to the monitored hard disk is generated by the following rules: shift the monitoring service ID left by 16 bits, and use the left-shifted monitoring service ID as the first field, and determine the hard disk serial number as the second field; combine the first field and the second field to obtain the hardware ID corresponding to the monitored hard disk, for example, (monitoring service ID)<<16|(hard disk serial number).

[0053] Optionally, monitoring the monitoring hard disk by using the monitoring service includes: the monitoring service establishes a monitoring connection with each monitoring hard disk based on Netlink (socket); and monitoring each monitoring hard disk through the monitoring connection.

[0054] Optionally, the main service obtains the total hard disk table by the following method: the main service assigns a name ID to each distributed hard disk, and determines the hard disk status information corresponding to each distributed hard disk as offline; generates a total hard disk table corresponding to the distributed hard disk based on the name ID and hard disk status information.

[0055] Optionally, the method further includes: the main service generating a total server table according to each database server.

[0056] Optionally, the monitoring hard disk table includes current status information corresponding to each hardware ID, and the total hard disk table includes hard disk status information corresponding to each name ID.

[0057] In this way, the hardware ID is composed of the monitoring service ID and the hard disk serial number. The hardware ID is used to monitor the physical information of the distributed hard disk by the monitoring service, and the name ID is used to identify the addressing address of the file storage of the main service, separating the hard disk in hardware management and file management, thereby facilitating the rapid addition, kicking, and drifting of distributed hard disks.

[0058] In some embodiments, the main service assigns a name ID to each distributed hard disk. At this time, the hard disk status information of the distributed hard disk is offline, and the main service waits for the monitoring service to upload the monitoring hard disk table; if the main service receives the monitoring hard disk table uploaded by the monitoring service, the hard disk status information corresponding to the name ID is updated to online or offline status according to the monitoring hard disk table.

[0059] Optionally, after the main service updates the preset total hard disk table according to the listening hard disk table, the method also includes: the main service determines the updated total hard disk table as the new total hard disk table; after each first preset time period, the listening service generates a listening hard disk table, and sends the generated listening hard disk table to the main service, wherein the listening hard disk table includes listening version information, and the current hard disk status corresponding to each listening hard disk; if the main service receives the listening hard disk table sent by the listening service within a second preset time period, the historical version information corresponding to the listening service is obtained, and the listening version information and the historical version information are compared; if the comparison result is the same, the total hard disk table is not updated; if the comparison result is different, based on the current hard disk status, the hard disk status information corresponding to each listening hard disk in the total hard disk table is updated, and the historical version information corresponding to the listening service is updated based on the listening version information; if the main service does not receive the listening hard disk table sent by the listening service within the second preset time period, the hard disk status information corresponding to each listening hard disk in the total hard disk table is determined as offline.

[0060] In this way, the monitoring service sends the monitoring hard disk table generated after the first preset time period to the main service, triggering the main service to update the total hard disk table in real time according to the monitoring hard disk table, which is timely and not only realizes the management of distributed hard disks, but also improves management efficiency.

[0061] Optionally, the first preset time period includes 0.5-2s, and the second preset time period includes 5-10s.

[0062] Optionally, the listening service sends the generated listening hard disk table to the main service and sends the cluster name corresponding to the listening service to the main service; if the cluster name of the main service and the cluster name of the listening service are different, it means that the main service and the listening service are not in the same service cluster, and the main service ignores the listening hard disk table sent by the listening service.

[0063] In some embodiments, when the metadata service is started, it elects a master service. The master service loads the configuration information of the database server and the distributed hard disk from the distributed database to generate a total server table and a total hard disk table. After the listening service is started, the listening hard disk table is sent to the master service. The master service updates the total server table and the total hard disk table according to the listening hard disk table. The listening service sends the listening hard disk table to the master service every 1 second. If the listening version information of the listening hard disk table is different from the historical version information, the master service updates the total server table and the total hard disk table, otherwise it does not update. If the master service does not receive the listening hard disk table uploaded by the listening service within 5 seconds, the listening hard disk connected to the listening service in the total hard disk table is set to an offline state. If the master service receives the listening hard disk table uploaded by the listening service again, it continues to update the total server table and the total hard disk table. In the case of hard disk deletion or hard disk drift, the master service updates the total server table and the total hard disk table.

[0064] Optionally, after using the main service to obtain the total hard disk table corresponding to the distributed hard disk, the method also includes: the distributed hard disk includes multiple hard disk data blocks and a data block ID corresponding to each hard disk data block; if the main service receives a data block application request corresponding to the target data block, it generates a data block address corresponding to the target data block, wherein the target data block is any hard disk data block, and the data block address includes the name ID of the distributed hard disk where the target data block is located, and the data block ID corresponding to the target data block; if the main service receives a data block access request corresponding to the target address, the hardware ID corresponding to the name ID in the target address is determined as the target ID, and in the distributed hard disk corresponding to the target ID, the hard disk data block corresponding to the data block ID in the target address is accessed, wherein the target address is any data block address.

[0065] In some embodiments, when applying for a file data block, the allocated data block address is identified by a name ID and a data block ID; the hard disk ID recorded in the database for the file data block only has a name ID and no hardware ID, and the name ID is the unique addressing ID of the file; after applying for the data block, the data is written to the data block on the hard disk whose name ID corresponds to the hardware ID.

[0066] In some embodiments, when accessing a file data block, the hard disk information is first found according to the name ID, the hardware ID of the hard disk is obtained, and data is read from the hard disk corresponding to the hardware ID.

[0067] Optionally, after using the main service to obtain the total hard disk table corresponding to the distributed hard disks, the method also includes: if the main service receives a hard disk deletion instruction corresponding to the hard disk to be deleted, the main service deletes the status information corresponding to the hard disk to be deleted from the total hard disk table, wherein the hard disk to be deleted is any distributed hard disk; deletes the hard disk configuration information corresponding to the hard disk to be deleted from the database end, and adds the name ID corresponding to the hard disk to be deleted to the preset hard disk deletion table.

[0068] In some embodiments, the name ID corresponding to the hard disk to be deleted is added to a preset hard disk deletion table to facilitate the use of the hard disk deletion table in other processes, such as data recovery, and after data recovery, the name ID is deleted from the hard disk deletion table.

[0069] Optionally, after using the main service to obtain the total hard disk table corresponding to the distributed hard disk, the method also includes: if the main service receives a service deletion instruction corresponding to the service to be deleted, the main service deletes all monitoring hard disks corresponding to the service to be deleted from the total hard disk table, wherein the service to be deleted is any monitoring service; deletes the hard disk configuration information corresponding to the service to be deleted from the database end; and deletes the service to be deleted from the service cluster.

[0070] Optionally, after using the main service to obtain the total hard disk table corresponding to the distributed hard disk, the method also includes: if the monitoring service includes multiple, use any two monitoring services as the first service and the second service respectively, and determine any monitoring hard disk corresponding to the first service as the first hard disk; if the first service cannot connect to the first hard disk, the first service generates a first hard disk table, and sends the first hard disk table to the main service, wherein the current hard disk status corresponding to the first hard disk in the first hard disk table is an offline status; the main service receives the first hard disk table, and determines the hard disk status information corresponding to the first hard disk in the total hard disk table as an offline status according to the first hard disk table; if the second service is connected to the first hard disk, the second service generates a second hard disk table, and sends the second hard disk table to the main service, wherein the current hard disk status corresponding to the first hard disk in the second hard disk table is an online status; the main service receives the second hard disk table, and determines the hard disk status information corresponding to the first hard disk in the total hard disk table as an online status according to the second hard disk table, and updates the hardware ID corresponding to the first hard disk according to the monitoring service ID corresponding to the second service.

[0071] In this way, when the first hard disk is uninstalled from the database server corresponding to the first service and inserted into the database server corresponding to the second service, the main service searches for the corresponding hardware ID based on the total hard disk table and the hardware ID and then through the fixed name ID. This not only realizes the drift of distributed hard disks, but also realizes the dynamic addressing of distributed disks. Compared with finding fixed addresses, it improves the flexibility of distributed hard disk management.

[0072] like Figure 2As shown, the embodiment of the present disclosure provides a distributed hard disk management method implementation system, including a server side 201 and a database side 202, wherein the server side 201 includes multiple metadata services 2011 and multiple master control services 2012, and the database side 202 includes multiple database servers 2021 and one or more distributed hard disks 2022 connected to each database server; each master control service is connected to the distributed hard disk through a database server; a main service 2013 is elected from the metadata service, and the master control service is determined as a monitoring service; a connection between the main service and each database server is established, and a connection between the main service and each monitoring service is established; the monitoring service is used to obtain a monitoring service ID, generate a hardware ID corresponding to each monitoring hard disk based on the monitoring service ID, monitor the monitoring hard disk, and generate a monitoring hard disk table corresponding to the monitoring hard disk according to the monitoring result and the hardware ID; the main service is used to assign a name ID to each distributed hard disk, and determine the hard disk status information corresponding to each distributed hard disk as an offline state, generate a total hard disk table corresponding to the distributed hard disk according to the name ID and the hard disk status information, and update the total hard disk table according to the monitoring hard disk table.

[0073] By adopting the distributed hard disk management method provided by the embodiment of the present disclosure, a service cluster connected to multiple distributed hard disks is obtained, a monitoring service ID corresponding to a monitoring service in the service cluster is obtained, a hardware ID corresponding to each monitoring hard disk is generated based on the monitoring service ID, and the monitoring hard disk is monitored. A monitoring hard disk table corresponding to the monitoring hard disk is generated according to the monitoring result and the hardware ID, and a master service in the service cluster updates a total hard disk table corresponding to the distributed hard disk according to the monitoring hard disk table. The advantages are as follows:

[0074] First, the monitoring service is identified by the monitoring service ID, the physical information of the distributed hard disk is identified according to the hardware ID including the monitoring service ID, and the total hard disk table of the main service is updated according to the monitoring hard disk table of the monitoring service, which simplifies the identification allocation rules of the distributed hard disk and reduces the coupling between the server and the distributed hard disk, making it easier to manage the distributed hard disk;

[0075] Second, the main service allocates a monitoring service ID for identifying the monitoring service or database server. The monitoring service ID is not recorded on the database side, but is stored by the monitoring service. The distributed hard disk corresponding to a single database server is managed through the monitoring service, and all distributed hard disks are managed through the main service, which reduces the coupling between the server and the distributed hard disk and facilitates the management of the distributed hard disk.

[0076] Third, the hardware ID is composed of the monitoring service ID and the hard disk serial number. The hardware ID is used by the monitoring service to identify the physical information of the distributed hard disk. The name ID corresponding to the distributed hard disk is generated through the main service. The name ID is used by the main service to identify the addressing address of the file storage, which separates the hard disk from the hardware management and file management, thereby facilitating the rapid addition, kicking and drifting of distributed hard disks.

[0077] Fourth, the monitoring service sends the monitoring hard disk table generated after the first preset time period to the main service, triggering the main service to update the total hard disk table in real time according to the monitoring hard disk table, which is time-effective and not only realizes the management of distributed hard disks, but also improves management efficiency;

[0078] Fifth, when the first hard disk is uninstalled from the database server corresponding to the first service and inserted into the database server corresponding to the second service, the main service searches for the corresponding hardware ID based on the total hard disk table and the hardware ID and then through the fixed name ID, which not only realizes the drift of distributed hard disks, but also realizes the dynamic addressing of distributed disks. Compared with finding fixed addresses, the flexibility of distributed hard disk management is improved.

[0079] Combination Figure 3 As shown, the embodiment of the present disclosure provides a distributed hard disk management system, including an acquisition module 301, a generation module 302, a monitoring module 303 and an update module 304; the acquisition module 301 is used to acquire a service cluster connected to multiple distributed hard disks, wherein the service cluster includes a main service and a monitoring service; the generation module 302 is used to acquire a monitoring service ID corresponding to the monitoring service, and generate a hardware ID corresponding to each monitoring hard disk based on the monitoring service ID, wherein the monitoring hard disk includes at least one distributed hard disk; the monitoring module 303 is used to monitor the monitoring hard disk using the monitoring service, and generate a monitoring hard disk table corresponding to the monitoring hard disk according to the monitoring result and the hardware ID; the update module 304 is used to acquire the total hard disk table corresponding to the distributed hard disk using the main service, and update the total hard disk table according to the monitoring hard disk table.

[0080] The distributed hard disk management system provided by the embodiment of the present disclosure is adopted to obtain a service cluster connected to multiple distributed hard disks, obtain a listening service ID corresponding to the listening service in the service cluster, generate a hardware ID corresponding to each listening hard disk based on the listening service ID, and listen to the listening hard disk, generate a listening hard disk table corresponding to the listening hard disk according to the listening result and the hardware ID, and update the total hard disk table corresponding to the distributed hard disk according to the listening hard disk table through the main service in the service cluster. In this way, the listening service is identified by the listening service ID, the physical information of the distributed hard disk is identified according to the hardware ID including the listening service ID, and the total hard disk table of the main service is updated according to the listening hard disk table of the listening service, which simplifies the identification allocation rules of the distributed hard disk, reduces the coupling between the server and the distributed hard disk, and facilitates the management of the distributed hard disk.

[0081] Combination Figure 4 As shown, an embodiment of the present disclosure provides an electronic device, including: a processor (processor) 400 and a memory (memory) 401; the memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory, so that the terminal executes any one of the methods in this embodiment. Optionally, the electronic device may also include a communication interface (Communication Interface) 402 and a bus 403. Among them, the processor 400, the communication interface 402, and the memory 401 can communicate with each other through the bus 403. The communication interface 402 can be used for information transmission. The processor 400 can call the logic instructions in the memory 401 to execute the method in the above embodiment.

[0082] In addition, the logic instructions in the memory 401 described above may be implemented in the form of software functional units and when sold or used as independent products, may be stored in a computer-readable storage medium.

[0083] The memory 401 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the methods in the embodiments of the present disclosure. The processor 400 executes functional applications and data processing by running the program instructions / modules stored in the memory 401, that is, implementing the methods in the above embodiments.

[0084] The memory 401 may include a program storage area and a database file area, wherein the program storage area may store an operating system and an application required for at least one function; the database file area may store data created according to the use of the terminal device, etc. In addition, the memory 401 may include a high-speed random access memory and may also include a non-volatile memory.

[0085] The electronic device provided by the embodiment of the present disclosure is used to obtain a service cluster connected to multiple distributed hard disks, obtain a listening service ID corresponding to the listening service in the service cluster, generate a hardware ID corresponding to each listening hard disk based on the listening service ID, and listen to the listening hard disk. A listening hard disk table corresponding to the listening hard disk is generated according to the listening result and the hardware ID, and the main service in the service cluster updates the total hard disk table corresponding to the distributed hard disk according to the listening hard disk table. In this way, the listening service is identified by the listening service ID, the physical information of the distributed hard disk is identified according to the hardware ID including the listening service ID, and the total hard disk table of the main service is updated according to the listening hard disk table of the listening service, which simplifies the identification allocation rules of the distributed hard disks, reduces the coupling between the server and the distributed hard disks, and facilitates the management of the distributed hard disks.

[0086] The embodiments of the present disclosure further provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any one of the methods in the embodiments is implemented.

[0087] The computer-readable storage medium in the embodiments of the present disclosure can be understood by ordinary technicians in the field: all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the execution includes the steps of the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

[0088] The electronic device disclosed in this embodiment includes a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store computer programs, the communication interface is used to communicate, and the processor and the transceiver are used to run the computer program so that the electronic device executes each step of the above method.

[0089] In this embodiment, the memory may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0090] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0091] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation can be changed. Parts and sub-samples of some embodiments may be included in or replace parts and sub-samples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device including the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0092] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0093] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

[0094] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.

Claims

1. A distributed hard disk management method, characterized in that: include: Acquire a service cluster connected to multiple distributed hard disks, wherein the service cluster includes a main service and a monitoring service; Obtaining a monitoring service ID corresponding to the monitoring service, and generating a hardware ID corresponding to each monitoring hard disk based on the monitoring service ID, wherein the monitoring hard disk includes at least one distributed hard disk; Using the monitoring service to monitor the monitoring hard disk, and generating a monitoring hard disk table corresponding to the monitoring hard disk according to the monitoring result and the hardware ID; Using the main service to obtain a total hard disk table corresponding to the distributed hard disk, and updating the total hard disk table according to the monitoring hard disk table; The main service obtains the total hard disk table by the following method: the main service assigns a name ID to each of the distributed hard disks, and determines the hard disk status information corresponding to each of the distributed hard disks as an offline state; and generates the total hard disk table corresponding to the distributed hard disk according to the name ID and the hard disk status information; The monitoring hard disk table includes the current status information corresponding to each hardware ID, and the total hard disk table includes the hard disk status information corresponding to each name ID; The hardware ID is used to monitor the physical information of the distributed hard disk of the service identification, and the name ID is used to identify the addressing address of the file storage of the main service identification.

2. The method according to claim 1, characterized in that After obtaining the total hard disk table corresponding to the distributed hard disk by using the main service, the method further includes: The distributed hard disk includes a plurality of hard disk data blocks and a data block ID corresponding to each of the hard disk data blocks; If the master service receives a data block application request corresponding to a target data block, a data block address corresponding to the target data block is generated, wherein the target data block is any of the hard disk data blocks, and the data block address includes the name ID of the distributed hard disk where the target data block is located, and the data block ID corresponding to the target data block; If the main service receives a data block access request corresponding to the target address, the hardware ID corresponding to the name ID in the target address is determined as the target ID, and the hard disk data block corresponding to the data block ID in the target address is accessed in the distributed hard disk corresponding to the target ID, wherein the target address is any data block address.

3. The method according to claim 1, characterized in that After obtaining the total hard disk table corresponding to the distributed hard disk by using the main service, the method further includes: If the monitoring service includes multiple services, any two monitoring services are respectively used as the first service and the second service, and any monitoring hard disk corresponding to the first service is determined as the first hard disk; If the first service cannot connect to the first hard disk, the first service generates a first hard disk table, and sends the first hard disk table to the main service, wherein the current hard disk state corresponding to the first hard disk in the first hard disk table is an offline state; The main service receives the first hard disk table, and determines hard disk status information corresponding to the first hard disk in the total hard disk table as an offline state according to the first hard disk table; If the second service is connected to the first hard disk, the second service generates a second hard disk table, and sends the second hard disk table to the main service, wherein the current hard disk state corresponding to the first hard disk in the second hard disk table is an online state; The main service receives the second hard disk table, determines the hard disk status information corresponding to the first hard disk in the total hard disk table as an online state according to the second hard disk table, and updates the hardware ID corresponding to the first hard disk according to the monitoring service ID corresponding to the second service.

4. The method according to claim 1, characterized in that: After the main service updates the preset total hard disk table according to the monitored hard disk table, the method further includes: The main service determines the updated total hard disk table as a new total hard disk table; After each first preset time period, the monitoring service generates a monitoring hard disk table, and sends the generated monitoring hard disk table to the main service, wherein the monitoring hard disk table includes monitoring version information and a current hard disk status corresponding to each of the monitoring hard disks; If the main service receives the monitoring hard disk table sent by the monitoring service within the second preset time period, obtaining the historical version information corresponding to the monitoring service, and comparing the monitoring version information with the historical version information; If the comparison result is the same, the total hard disk table will not be updated; If the comparison result is different, based on the current hard disk status, the hard disk status information corresponding to each of the monitoring hard disks in the total hard disk table is updated, and the historical version information corresponding to the monitoring service is updated based on the monitoring version information; If the main service does not receive the monitoring hard disk table sent by the monitoring service within the second preset time period, the hard disk status information corresponding to each of the monitoring hard disks in the total hard disk table is determined as an offline state.

5. The method according to any one of claims 1 to 4, characterized in that: Get the service cluster by: Acquire a server end and a database end, and establish a connection between the server end and the database end, wherein the database end includes a plurality of distributed hard disks, and the server end includes a plurality of metadata services and a plurality of master control services; Configure the metadata service and the master control service according to preset cluster information, determine any metadata service as a main service, and determine at least part of the master control service as a monitoring service; A connection is established between the main service and the monitoring service to obtain a service cluster including the main service and the monitoring service.

6. The method according to claim 5, characterized in that After obtaining the total hard disk table corresponding to the distributed hard disk by using the main service, the method further includes: If the main service receives a hard disk deletion instruction corresponding to a hard disk to be deleted, the main service deletes the status information corresponding to the hard disk to be deleted from the total hard disk table, wherein the hard disk to be deleted is any distributed hard disk; The hard disk configuration information corresponding to the hard disk to be deleted is deleted from the database end, and the name ID corresponding to the hard disk to be deleted is added to a preset hard disk deletion table.

7. The method according to claim 5, characterized in that Obtaining the monitoring service ID corresponding to the monitoring service includes: The monitoring service determines whether the monitoring service is in an initialization state according to a preset state ID; If the monitoring service is in the initialization state, the monitoring service sends a monitoring service ID request to the main service, triggering the main service to determine whether the monitoring service and the main service belong to the same cluster according to the cluster information; If the monitoring service and the main service belong to the same cluster, the main service assigns a monitoring service ID to the monitoring service and sends the monitoring service ID to the monitoring service; If the monitoring service and the main service do not belong to the same cluster, a request failure is returned to the monitoring service; If the monitoring service is not in an initialized state, the state ID is determined to be a monitoring service ID corresponding to the monitoring service.

8. The method according to claim 5, characterized in that Generating a hardware ID corresponding to each monitoring hard disk based on the monitoring service ID includes: Numbering each of the monitoring hard disks to obtain a hard disk serial number corresponding to each of the monitoring hard disks; A hardware ID corresponding to each of the monitoring hard disks is generated respectively, wherein the hardware ID of the monitoring hard disk includes a monitoring service ID corresponding to the monitoring service and a hard disk serial number corresponding to the monitoring hard disk.

9. A distributed hard disk management system, characterized in that: include: An acquisition module, used to acquire a service cluster connected to multiple distributed hard disks, wherein the service cluster includes a main service and a monitoring service; A generation module, used to obtain a monitoring service ID corresponding to the monitoring service, and generate a hardware ID corresponding to each monitoring hard disk based on the monitoring service ID, wherein the monitoring hard disk includes at least one distributed hard disk; A monitoring module, used to monitor the monitoring hard disk by using the monitoring service, and generate a monitoring hard disk table corresponding to the monitoring hard disk according to the monitoring result and the hardware ID; An updating module, configured to obtain a total hard disk table corresponding to the distributed hard disk by using the main service, and update the total hard disk table according to the monitoring hard disk table; The main service obtains the total hard disk table by the following method: the main service assigns a name ID to each of the distributed hard disks, and determines the hard disk status information corresponding to each of the distributed hard disks as an offline state; and generates the total hard disk table corresponding to the distributed hard disk according to the name ID and the hard disk status information; The monitoring hard disk table includes the current status information corresponding to each hardware ID, and the total hard disk table includes the hard disk status information corresponding to each name ID; The hardware ID is used to monitor the physical information of the distributed hard disk of the service identification, and the name ID is used to identify the addressing address of the file storage of the main service identification.

10. An electronic device, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Storage card array architecture based hard disk implementation method

    CN104991737A

  • Physical hard disk management method and device under distributed storage system

    CN111857577A

  • Hard disk migration method, distributed storage cluster system and storage medium

    CN111880751A

  • Management system, management apparatus and management method

    US20080072042A1

  • Storage system, load distribution management method, and storage medium

    US20100131705A1