Hard disk isolation method and electronic device
Patent Information
- Application Number
- CN202611327570.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-28
- Publication Date
- 2026-10-09
AI Technical Summary
[0003]本申请提供了一种硬盘隔离方法和电子设备,以至少解决相关技术中分布式存储系统的硬盘在隔离运维过程中,无法兼顾业务连续性、数据安全性与资源利用效率的问题
[0007]本申请还提供了一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,其中,计算机程序被处理器执行时实现上述任一种硬盘隔离方法的步骤。
Smart Images

Figure CN122884778A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of distributed storage technology, and in particular to a hard disk isolation method and electronic device. Background Technology
[0002] In distributed storage systems, operations such as changing hard drive slots or upgrading firmware require temporarily isolating the target hard drive from the system. Existing hard drive isolation solutions typically employ either full data migration or a unified pause on data read / write operations. However, the full migration solution performs a complete migration of all data objects on the isolated hard drive, consuming additional network bandwidth and storage resources, and the isolation operation is time-consuming. The unified pause on read / write operation solution results in the inability to respond to business requests normally, violating the high availability design principles of distributed clusters. Moreover, for data with only a single copy, if read / write operations are paused directly without timely processing, a hard drive failure during the isolation period will lead to permanent data loss. Therefore, it is evident that related technologies in distributed storage systems cannot simultaneously address business continuity, data security, and resource utilization efficiency during hard drive isolation and maintenance. Summary of the Invention
[0003] This application provides a hard disk isolation method and electronic device to at least solve the problem in the related art that the hard disks in the distributed storage system cannot simultaneously take into account business continuity, data security and resource utilization efficiency during the isolation operation and maintenance process.
[0004] This application provides a hard disk isolation method applied to a distributed storage system, the distributed storage system including multiple hard disks, comprising: responding to an isolation command for a target hard disk among the multiple hard disks, performing a status check on the target hard disk; after confirming that the status check passes, generating an isolation task order, wherein the isolation task order includes a hard disk identifier and an isolation time period for the target hard disk; traversing multiple data objects stored on the target hard disk according to the hard disk identifier, querying the replica distribution information of the multiple data objects in the distributed storage system, and determining the object type of the multiple data objects based on the replica distribution information, the object type including multi-replica data objects and single-replica data objects; applying different read / write strategies to the multi-replica data objects and the single-replica data objects for read / write operations during the isolation time period; after the isolation time period ends, performing a data recovery operation on the data objects stored on the target hard disk, and releasing the isolation of the target hard disk after the recovery operation is completed.
[0005] This application also provides a hard disk isolation device, comprising: a generation module, configured to, in response to an isolation command for a target hard disk among a plurality of hard disks, perform a status detection on the target hard disk, and generate an isolation task order after determining that the status detection is passed, wherein the isolation task order includes a hard disk identifier of the target hard disk and an isolation time period; a determination module, configured to, based on the hard disk identifier, traverse a plurality of data objects stored on the target hard disk, query the replica distribution information of the plurality of data objects in the distributed storage system, and determine the object type of the plurality of data objects based on the replica distribution information, wherein the object type includes multi-replica data objects and single-replica data objects; an application module, configured to, during the isolation time period, apply different read / write strategies to the multi-replica data objects and the single-replica data objects for read / write operations; and a recovery module, configured to, after the isolation time period ends, perform a data recovery operation on the data objects stored on the target hard disk, and release the isolation of the target hard disk after the recovery operation is completed.
[0006] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the above-described hard disk isolation methods when executing the computer program.
[0007] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described hard disk isolation methods.
[0008] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described hard disk isolation methods.
[0009] This application generates an isolation task order after performing status checks on the target hard drive of a distributed storage system. It then iterates through the data objects stored on the target hard drive, queries their replica distribution information, and classifies the data objects into multi-replica data objects and single-replica data objects. During the isolation period, different read / write strategies are applied to the two types of data objects. After the isolation ends, data consistency is restored and the isolation is lifted. This solves the technical problem of balancing business continuity, data security, and resource utilization efficiency during the isolation and maintenance of hard drives in a distributed storage system. It achieves the technical effect of ensuring storage business continuity while reducing the risk of unnecessary data migration and data loss. Attached Figure Description
[0010] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a hardware structure block diagram of a hard disk isolation method according to an embodiment of this application;
[0012] Figure 2 This is a schematic flowchart of an optional hard disk isolation method according to an embodiment of this application;
[0013] Figure 3 This is a schematic diagram of an optional hard disk isolation process according to an embodiment of this application;
[0014] Figure 4 This is a structural block diagram of an optional hard disk isolation device according to an embodiment of this application. Detailed Implementation
[0015] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0016] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0017] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0018] The specific application environment architecture or specific hardware architecture on which the execution of the hard disk isolation method depends is described here.
[0019] The methods and embodiments provided in this application can be executed on a server device or a similar computing device. Taking running on a server device as an example, Figure 1This is a hardware structure block diagram of the hard disk isolation method according to an embodiment of this application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the image. A processor 102 (which may include, but is not limited to, a central processing unit (CPU), microprocessor (MCU), or programmable logic device (FPGA), etc.) and a memory 104 for storing data are also shown. The server device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the server equipment described above. For example, the server equipment may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0020] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the hard disk isolation method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to server devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0021] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the server device. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0022] Figure 2 This is a flowchart illustrating an optional hard disk isolation method according to an embodiment of this application, as shown below. Figure 2 As shown, the process of this method may include the following steps:
[0023] Step S202: In response to the isolation command for the target hard drive among the plurality of hard drives, the status of the target hard drive is checked. After the status check is confirmed to be passed, an isolation task order is generated, wherein the isolation task order includes the hard drive identifier of the target hard drive and the isolation time period.
[0024] Step S204: Traverse the multiple data objects stored on the target hard disk according to the hard disk identifier, query the replica distribution information of the multiple data objects in the distributed storage system, and determine the object type of the multiple data objects based on the replica distribution information. The object type includes multi-replica data objects and single-replica data objects.
[0025] Step S206: During the isolation period, different read / write strategies are applied to the multi-replica data object and the single-replica data object for read / write operations.
[0026] Step S208: After the isolation period ends, perform a data recovery operation on the data object stored on the target hard disk, and release the isolation of the target hard disk after the recovery operation is completed.
[0027] Optionally, in the above steps, for example, when a target hard drive in a distributed storage system needs maintenance due to slot replacement or firmware upgrade, the system first responds to the received isolation command by performing a pre-emptive status check on the target hard drive. This includes checking whether the hard drive is online and its workload. Only when the hard drive is online and under normal load is an isolation task order generated, specifying the hard drive identifier to be isolated and the planned isolation period. Subsequently, based on the hard drive identifier, the system iterates through all data objects stored on that hard drive in the metadata server and queries the replica distribution of each data object in the cluster, such as the total number of replicas, the hard drive locations of other replicas, and their health status. Based on this information, the system classifies the data objects into multi-replica data objects (i.e., objects with other healthy replicas besides the target hard drive) and single-replica data objects (i.e., only the replica on the target hard drive is healthy). During the subsequent isolation period, the system implements differentiated read / write strategies for these two types of data objects to ensure business continuity and data security. Once the isolation period ends, i.e. the maintenance operation is completed, the system will restore the data on the target hard drive, such as synchronizing inconsistent multiple copies of data, and finally bring the hard drive back online to remove the isolation.
[0028] Through the above steps, after performing status checks on the target hard drives of the distributed storage system, an isolation task order is generated. The data objects stored on the target hard drives are then traversed, their replica distribution information is queried, and the data objects are divided into multi-replica data objects and single-replica data objects. During the isolation period, different read / write strategies are applied to the two types of data objects. After the isolation ends, data consistency is restored and the isolation is lifted. This solves the technical problem of balancing business continuity, data security, and resource utilization efficiency during the isolation and maintenance of hard drives in distributed storage systems. It achieves the technical effect of ensuring storage business continuity while reducing the risk of unnecessary data migration and data loss.
[0029] In an exemplary embodiment, the target hard drive undergoes a status check. After the status check is passed, an isolation task order is generated. This includes: if the target hard drive is detected to be offline, pausing the execution of the isolation command; if the target hard drive is detected to be online and the service load exceeds a preset threshold, returning an alarm message to the operations and maintenance (O&M) terminal and determining whether to execute the isolation command based on the O&M terminal's response; if the target hard drive is detected to be online and the service load does not exceed the preset threshold, determining that the status check is passed and generating the isolation task order.
[0030] Optionally, in the above embodiments, to ensure the security and feasibility of the isolation operation, a strict pre-test is performed before executing the isolation process. First, the online status of the target hard drive is detected. If the hard drive is detected to be offline, the system immediately suspends the execution of the isolation command to avoid performing invalid operations on a faulty hard drive. Second, if the hard drive is online, its service load is further determined to see if it exceeds a preset threshold (e.g., excessively high read / write operations per second or bandwidth utilization). If the load is too high, the system will return an alarm message to the maintenance terminal, reminding the user that the current hard drive service is busy, the isolation operation may take a long time or affect the service, and wait for confirmation from the maintenance personnel. The process will only continue after receiving confirmation from the maintenance personnel to continue execution. Finally, when the target hard drive is detected to be online and the service load is below the preset threshold, the system determines that the status test has passed, and officially generates an isolation task order to start the subsequent hard drive isolation process.
[0031] In the above embodiments, refined pre-detection avoids forced isolation when the hard drive is offline or the business pressure is too high, effectively preventing operation failure and business interruption. The offline detection mechanism eliminates invalid operations on faulty hard drives; the load threshold judgment combined with the manual confirmation mechanism gives maintenance personnel full operational decision-making power, enabling them to choose immediate execution or delayed execution based on business importance, significantly improving the reliability and flexibility of isolation operations.
[0032] In an exemplary embodiment, querying the replica distribution information of the plurality of data objects in the distributed storage system and determining the object type of the plurality of data objects based on the replica distribution information includes: obtaining the total number of replicas of each data object, the hard disk where each replica is located, and the availability status of each replica; if it is determined that the total number of replicas of the target data object is greater than a preset number, and at least one replica with an available status is located outside the target hard disk, the object type of the target data object is determined to be the multi-replica data object; if it is determined that the target data object has only a replica with an available status on the target hard disk, the object type of the target data object is determined to be the single-replica data object.
[0033] Optionally, in the above embodiments, the data replica determination module obtains detailed replica distribution information for each data object from the metadata server, including the total number of replicas of the object, the hard drive location of each replica, and the availability status of each replica (e.g., healthy or faulty). Assume the system default replica count is 3, and the preset count is 1. For a target data object, if the query shows a total of 3 replicas, and in addition to the replica on the target hard drive, at least one replica is located on another hard drive and is in a healthy state, then the system classifies it as a multi-replica data object. Conversely, if the query results show that the data object has only one healthy replica on the target hard drive, while other replicas either do not exist (single replica) or, although they exist, are all faulty, then the system classifies it as a single-replica data object.
[0034] The above embodiments achieve accurate identification of data object redundancy status. It considers not only the total number of replicas but also the availability status of the replicas, accurately reflecting the risk level of data under isolation conditions. This refined classification avoids a one-size-fits-all approach, enabling the system to adopt the most appropriate isolation strategy based on the actual security redundancy of the data, laying the foundation for subsequent resource conservation and business continuity.
[0035] In one exemplary embodiment, different read / write strategies are applied to the multi-replica data object and the single-replica data object for read / write operations, including: for the multi-replica data object, redirecting a first read / write request to a first replica in an available state located outside the target hard disk, and executing the first read / write request on the first replica; if it is determined that the first read / write request includes a write request, recording the multi-replica data object to which the write operation is performed to a list to be restored; for the single-replica data object, after receiving a second read / write request, copying the single-replica data object to a hard disk outside the target hard disk to obtain a copied data object, and executing the second read / write request on the copied data object.
[0036] Optionally, in the above embodiments, during isolation, the read / write policy control module is responsible for executing differentiated read / write control. For example, when a read request or write request (i.e., the first read / write request) points to a multi-replica data object, the system will redirect the request to another healthy replica located outside the target hard drive for execution, completely bypassing the isolated hard drive. In particular, if the request is a write request, in addition to writing data to all other healthy replicas, the system will also record the identifier of the data object in the list to be recovered so that data consistency verification can be performed after the isolation ends. For a single-replica data object, since its only usable replica is located on the hard drive to be isolated, when the system receives any read / write request (i.e., the second read / write request), it will first trigger a data copy process to copy the data object to another hard drive, generating a usable replicated data object, and then perform read / write operations on this newly generated replicated data object, thereby ensuring uninterrupted business access.
[0037] In the above embodiments, a differentiated read / write strategy achieves an optimal balance between resource utilization and business continuity. For multi-replica data objects, costly data copying is avoided through simple read / write redirection, saving network bandwidth and storage resources while ensuring high business availability. For single-replica data objects, a copy-then-read mechanism ensures that business data will not be lost even if the original hard drive fails during isolation, eliminating data security risks.
[0038] In one exemplary embodiment, copying the single-copy data object to a hard drive other than the target hard drive includes: selecting at least one free hard drive that meets a free capacity threshold from the distributed storage system; determining a backup hard drive from the free hard drives based on the network topology location of the free hard drive and the target hard drive; transferring the single-copy data object from the target hard drive to the backup hard drive; and updating the hard drive location information of the single-copy data object in the metadata information of the distributed storage system after the transfer is completed.
[0039] Optionally, in the above embodiments, firstly, all hard drives with remaining capacity greater than a preset threshold are selected from the idle hard drive resource pool of the distributed cluster to ensure that there is still some redundancy after accommodating the data to be copied. Then, in order to improve copying efficiency and reduce network overhead, the system will further select hard drives located on the same storage node or in the same rack as the hard drive to be isolated, based on network topology location, for example, as the final backup hard drive. Taking a firmware upgrade scenario as an example, the system will select the idle hard drive with the closest physical location to the target hard drive and transfer the single-copy data object there through a high-speed channel (such as RDMA protocol). After each data object is successfully transferred, the system will send an update request to the metadata server to record the new copy location information of the data object (i.e., the identifier of the backup hard drive) in the metadata to ensure that subsequent read and write requests can be correctly addressed.
[0040] In the above embodiments, the efficiency and reliability of single-copy data copying are significantly improved through intelligent target hard drive selection strategies. Capacity threshold selection ensures the feasibility of copying operations; and the network topology location-based optimization mechanism minimizes data transmission latency and cross-switch bandwidth consumption.
[0041] In an optional embodiment, copying the single-copy data object to a hard drive other than the target hard drive includes: using an incremental copy mechanism to only transmit data blocks in the single-copy data object that have changed compared to the transmitted data; if an interruption occurs during transmission, the transmission of the unfinished data blocks continues from the breakpoint after the connection is restored.
[0042] In the above embodiments, the incremental copy mechanism significantly reduces the amount of data transferred during single-copy data copying, especially in scenarios with large amounts of data or frequent updates, which can significantly shorten copying time and save network bandwidth. The breakpoint resume mechanism enhances the fault tolerance and robustness of the copying process, avoiding copying task failures or the need for full retransmissions due to network jitter or temporary faults, thus improving the overall success rate and efficiency of disk isolation operations.
[0043] In an exemplary embodiment, performing a data recovery operation on the data object stored on the target hard disk includes: transferring the single-copy data object on the backup hard disk from the backup hard disk to the target hard disk; and after the transfer is completed, updating the hard disk location information of the single-copy data object in the metadata information of the distributed storage system.
[0044] Optionally, in the above embodiments, after the isolation maintenance operation is completed and the target hard drive becomes available again, the system will perform a data recovery operation to restore the original data distribution of the system. For single-copy data objects that were copied during isolation, the data recovery module will perform a reverse copy operation. Specifically, it will copy the single-copy data objects previously stored on the backup hard drive back to the target hard drive that has been maintained via a high-speed transmission channel. After the transmission is completed, the system will update the metadata server again, redirecting the hard drive location information of the data objects from the backup hard drive to the target hard drive, thus restoring the data distribution to the state before isolation. At the same time, temporary data copies on the backup hard drive can be marked as reclaimable, thereby releasing storage resources.
[0045] In the above embodiments, a reverse copy mechanism enables the complete restoration of the system data distribution, ensuring that the original data layout plan is not disrupted. After restoration, metadata is updated promptly and temporary copies on the backup hard drive are released, ensuring the reuse of storage resources and avoiding waste. The entire process is transparent to upper-layer business logic, guaranteeing data consistency and a clean system state.
[0046] In an optional embodiment, performing a data recovery operation on the data object stored on the target hard disk includes: after the target hard disk is maintained, marking the single-copy data object stored on the target hard disk as pending deletion; confirming the single-copy data object on the backup hard disk as the only valid copy of the single-copy data object, and updating the hard disk location information of the single-copy data object in the metadata information of the distributed storage system to the backup hard disk; after the metadata information is updated, deleting the single-copy data object marked as pending deletion on the target hard disk.
[0047] In another implementation, to simplify the recovery process and avoid the additional overhead of data migration, the system adopts a data recovery strategy of discarding the old and using the new. Taking a hard drive slot replacement scenario as an example, after the target hard drive completes maintenance and comes back online, the data recovery module no longer performs a reverse copy operation, but directly switches at the metadata level. Specifically, the system first marks the original single-copy data object on the target hard drive as pending deletion, ensuring that it is no longer accessed by upper-layer services. Subsequently, the system confirms the data object copied to the backup hard drive during isolation as the only valid copy of the data, and updates the record in the metadata server, changing the hard drive location information of the data object from the original target hard drive to the backup hard drive. After completing the metadata update, the system triggers a background cleanup task to delete the data object marked as pending deletion on the target hard drive, freeing up storage space. At this point, the copy on the backup hard drive officially becomes the new primary copy of the data object, and the system does not need to perform any data migration operation.
[0048] The above-mentioned alternative solutions avoid the process of migrating single-copy data back from the backup hard drive to the original target hard drive, saving the network bandwidth and time overhead consumed by reverse copying. This is particularly suitable for scenarios where the target hard drive's performance may degrade after maintenance or where operations personnel wish to adjust the data layout, enabling rapid data recovery and business redirection. Furthermore, by updating metadata first and then deleting the old copy, the security and accessibility of data are ensured throughout the process, preventing service interruptions due to data loss. In addition, this solution simplifies the recovery process, reduces the number of system state changes, and lowers the risk of failures that may be introduced by multiple data migrations.
[0049] In an exemplary embodiment, performing a data recovery operation on the data objects stored on the target hard disk includes: reading the list to be recovered and obtaining the multi-copy data objects to be recovered recorded in the list to be recovered; for the multi-copy data objects to be recovered, comparing whether the multi-copy data objects on the target hard disk are consistent with the multi-copy data objects to be recovered; if it is determined that they are inconsistent, synchronizing the multi-copy data objects on the target hard disk according to the multi-copy data objects to be recovered.
[0050] Optionally, in the above embodiments, the data recovery process for multi-replica data objects focuses on data consistency verification. After maintenance is completed, the data recovery module first reads the list to be recovered. This list records all multi-replica data objects that were written to during isolation. Then, for each data object in the list, the system compares the data on the current target hard drive with other healthy copies (i.e., the multi-replica data objects to be recovered). For example, by comparing data hash values or version numbers. If the comparison results are consistent, no additional operation is required. If inconsistency is found, for example, if other write requests updated other copies during isolation, the system initiates a data synchronization process to synchronize the latest data of other healthy copies to the copy on the target hard drive, ensuring that all copy data is eventually consistent. After synchronization is completed, the system removes the read and write restrictions on the data object on the target hard drive.
[0051] In the above embodiments, the pending recovery list mechanism accurately identifies the multi-replica data objects that need to be processed, avoiding the performance overhead of full scans. Through consistency comparison and incremental synchronization, it ensures that the data on the isolated hard drive is eventually consistent with other healthy replicas, completely eliminating data fork issues that may be caused by write requests during isolation and maintaining the strong consistency characteristics of the distributed storage system.
[0052] In one exemplary embodiment, releasing the isolation of the target hard disk after the recovery operation is completed includes: bringing the target hard disk back online and marking it as available; and synchronizing the resource information of the target hard disk to the resource management pool of the distributed storage system.
[0053] Optionally, in the above embodiments, after completing the recovery operations for all data objects and ensuring data consistency, the system enters the final isolation release phase. For example, the system marks the target hard drive that has completed maintenance as online and available, and resynchronizes its resource information (such as capacity, performance indicators, etc.) to the resource management pool of the entire distributed storage system. This allows the hard drive to be included in subsequent data distribution and load balancing scheduling. For example, new data writing or data rebalancing tasks can reselect the hard drive as the storage target, and the system as a whole returns to its normal operating state.
[0054] In the above embodiments, a seamless transition of the hard drive from an isolated state to an available state is achieved through a standardized re-online and resource synchronization process. Synchronizing the hard drive resource information to the resource management pool ensures the real-time accuracy of the system resource view, enabling the hard drive to immediately participate in system data scheduling and load balancing, thereby improving the overall resource utilization efficiency of the cluster.
[0055] In one exemplary embodiment, the method further includes: saving the data object processing records and read / write request records of the target hard disk during the isolation process to a log database; and feeding back the result information of the isolation maintenance completion to the operation and maintenance terminal, wherein the result information includes operation time and data processing volume.
[0056] Optionally, in the above embodiments, to facilitate operation and maintenance auditing and problem tracing, the method also includes a comprehensive logging and result feedback mechanism. The system records all key events throughout the entire isolation lifecycle, such as data replica determination results, data objects recorded in the recovery list, start and end times and completion status of single-replica data copying, and all read and write request logs redirected during isolation, and archives them uniformly in the log database. After the isolation maintenance is completed, the system will also proactively provide an operation result report to the operation and maintenance terminal. This report includes key performance indicators such as the total time spent on this isolation maintenance operation, the total number of data objects processed, and the amount of data copied, helping operation and maintenance personnel clearly understand the entire process and impact of the operation.
[0057] In the above embodiments, the system's observability and operational efficiency are greatly improved through end-to-end log archiving and result feedback. Detailed log records provide complete data support for post-event auditing, troubleshooting, and performance analysis. Proactive operation result reports enable operations personnel to intuitively assess the scope and extent of the impact of isolation operations on the system, providing a basis for subsequent operations decisions and capacity planning.
[0058] The following describes an optional hard disk isolation method according to an embodiment of this application, with reference to optional embodiments. In one optional embodiment, such as... Figure 3 As shown, the hard disk isolation process includes the following steps:
[0059] Step 1: Disk isolation.
[0060] The operations and maintenance personnel send an isolation command to the isolation trigger module through the operations and maintenance terminal. The command includes the unique identifier of the target hard drive, "HDD-001," and the operations and maintenance scenario, "firmware upgrade." Upon receiving the command, the isolation trigger module first performs a status check on the target hard drive. The check confirms that HDD-001 is currently online and the business load is below a preset threshold, thus passing the status check. The isolation trigger module then generates an isolation task order, which records the hard drive identifier "HDD-001," the isolation period "March 20, 2025, 02:00:00 to 02:30:00," and other relevant information. Subsequently, the isolation trigger module marks the target hard drive HDD-001 as pending isolation and notifies the system that subsequent read / write requests to this hard drive will enter a differentiated processing procedure.
[0061] Step 2: IO request.
[0062] During the isolation period, the distributed storage system continuously receives I / O requests from the upper-layer application. Assume the system receives two I / O requests: the first is a write operation to data object A, and the second is a read operation to data object B. Both data objects are stored on the target hard disk HDD-001. The system then hands these two I / O requests over to the read / write policy control module for processing.
[0063] Step 3: Copy determination.
[0064] Upon receiving an I / O request, the read / write policy control module first calls the data replica determination module to determine the replica status of the data objects involved in the request. The data replica determination module queries the metadata server for the replica distribution information of each data object. For data object A, the query results show that its total number of replicas is 3. Besides the replica on HDD-001, the other two replicas are located on hard drives HDD-002 and HDD-003 respectively, and both are in healthy condition. Therefore, data object A is classified as a "multi-replica data object". For data object B, the query results show that its total number of replicas is only 1, stored only on HDD-001. Therefore, data object B is classified as a "single-replica data object". After the replica determination is completed, the data replica determination module returns the classification results to the read / write policy control module.
[0065] Step 4: Single copy data object.
[0066] For data object B, which is classified as a single-copy data object, the read / write policy control module identifies that its only available copy is located on the hard disk HDD-001 to be isolated. Directly suspending read / write operations would lead to business interruption and data loss risks. Therefore, the module decides to implement a "copy first, then append read / write" strategy for this data object, proceeding to step 5.
[0067] Step 5: Copy first, then append and read / write.
[0068] The read / write policy control module triggers the single-replica copy module to perform a copy operation on data object B. The single-replica copy module first filters the target hard drive from the idle hard drive resource pool of the distributed cluster, selecting HDD-004, which is located on the same storage node as HDD-001, as the backup hard drive. Subsequently, the module uses an incremental copy mechanism to copy data object B to HDD-004 via a high-speed transmission channel, implementing a resume function during transmission. After transmission is complete, the module calculates the hash value of the received data and compares it with the hash value of the source data to confirm data integrity. Finally, the module sends an update request to the metadata server, updating the replica location information of data object B from HDD-001 to HDD-004, and sends a copy completion signal to the read / write policy control module. After the copy is complete, the read / write policy control module redirects read requests originally intended for data object B to the new replica on HDD-004 for execution, allowing business access to continue.
[0069] Step 6: Multiple replica data objects.
[0070] For data object A, which is classified as a multi-copy data object, the read / write policy control module identifies that there are other healthy copies besides HDD-001. Therefore, there is no need to copy the data, and steps 7 and 8 are executed directly.
[0071] Step 7: Read and write other copies outside the isolated hard drive.
[0072] The read / write policy control module redirects write requests for data object A to the other healthy replicas on hard drives HDD-002 and HDD-003 for write operations, prohibiting writes to the hard drive to be isolated, HDD-001. Simultaneously, read requests for data object A are also redirected to replicas on HDD-002 or HDD-003 to ensure uninterrupted service access.
[0073] Step 8: Add the data object to the list to be restored.
[0074] Since the write request updated the copies on HDD-002 and HDD-003, but the copy on HDD-001 was not updated synchronously, in order to ensure data consistency after the isolation period ends, the read / write policy control module records the identifier of data object A in the "list to be restored" for subsequent processing.
[0075] Step 9: Exit quarantine.
[0076] After all single-copy data objects have been copied, the isolation maintenance module receives a ready signal and then performs logical isolation on the target hard drive HDD-001, removing it from the system's read / write schedule. Maintenance personnel then perform a firmware upgrade on HDD-001, during which the system continuously monitors the maintenance process. After the upgrade is complete, the isolation maintenance module performs an availability test on HDD-001. Once its status is confirmed to be normal, it officially exits the isolation state and sends a maintenance completion signal to the data recovery module.
[0077] Step 10: Data recovery.
[0078] After receiving the maintenance completion signal, the data recovery module first reads the "list to be recovered," retrieves the multi-copy data A recorded therein, compares the data copy on HDD-001 with the healthy copy on HDD-002, and finds that the copy data on HDD-001 is outdated. It then initiates a data synchronization process to synchronize the latest data from HDD-002 to HDD-001. After synchronization, read and write restrictions on data object A on HDD-001 are lifted. For single-copy data B, the data recovery module marks the original data object B on HDD-001 as pending deletion, confirms the copy on HDD-004 as the only valid copy, and updates the metadata information, changing the hard drive location information of data object B from HDD-001 to HDD-004. Subsequently, a background cleanup task deletes the data marked as pending deletion on HDD-001. After completing the recovery operations for all data objects, the data recovery module re-marks the maintained hard drive HDD-001 as online and available, and synchronizes its resource information to the resource management pool of the distributed cluster. At this point, the isolation and maintenance work on hard drive HDD-001 is complete, and the system has resumed normal operation. Simultaneously, the system archives the operation logs of the entire isolation-maintenance-recovery process to the log database and reports the operation results to the maintenance terminal, including information such as operation time of 30 minutes, total number of data objects processed (10,000), and data copy volume of 50GB.
[0079] Through the coordinated execution of the above steps, this embodiment performs only read / write redirection on multi-copy data objects during hard disk firmware upgrades, avoiding the waste of network bandwidth and storage resources caused by full data migration; it executes a copy-then-read strategy on single-copy data objects, eliminating the risk of data loss due to hard disk failure during isolation; and it ensures eventual consistency of multi-copy data through a pending recovery list mechanism. The entire isolation process achieves efficient, secure, and uninterrupted execution of distributed cluster hard disk operation and maintenance.
[0080] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (e.g., read-only memory (ROM) / random access memory (RAM), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0081] According to another aspect of the embodiments of this application, a hard disk isolation device is also provided, which can be used to implement the hard disk isolation method provided in the above embodiments, and will not be repeated hereafter. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0082] Figure 4 This is a structural block diagram of an optional hard disk isolation device according to an embodiment of this application, such as... Figure 4 As shown, the hard disk isolation device includes:
[0083] The generation module 42 is used to perform status detection on the target hard drive in response to the isolation command for the target hard drive among the plurality of hard drives, and generate an isolation task form after determining that the status detection is passed. The isolation task form includes the hard drive identifier of the target hard drive and the isolation time period.
[0084] The determination module 44 is used to traverse multiple data objects stored on the target hard disk according to the hard disk identifier, query the replica distribution information of the multiple data objects in the distributed storage system, and determine the object type of the multiple data objects based on the replica distribution information. The object type includes multi-replica data objects and single-replica data objects.
[0085] Application module 46 is used to perform read and write operations on the multi-replica data object and the single-replica data object by applying different read and write strategies during the isolation period.
[0086] The recovery module 48 is used to perform data recovery operations on the data objects stored on the target hard disk after the isolation period ends, and to release the isolation of the target hard disk after the recovery operation is completed.
[0087] The disk isolation device provided in this application performs status checks on the target disks of the distributed storage system, generates an isolation task order, and iterates through the data objects stored on the target disks to query their replica distribution information, dividing the data objects into multi-replica data objects and single-replica data objects. During the isolation period, different read and write strategies are applied to the two types of data objects. After the isolation ends, data consistency is restored and the isolation is lifted. This solves the technical problem of being unable to balance business continuity, data security, and resource utilization efficiency during the isolation operation and maintenance of disks in distributed storage systems, achieving the technical effect of ensuring storage business continuity while reducing the risk of unnecessary data migration and data loss.
[0088] In an exemplary embodiment, the generation module 42 is configured to: suspend the execution of the isolation command when the target hard drive is detected to be offline; return alarm information to the operation and maintenance terminal when the target hard drive is detected to be online and the service load exceeds a preset threshold, and determine whether to execute the isolation command based on the response from the operation and maintenance terminal; and determine that the status detection is passed and generate the isolation task order when the target hard drive is detected to be online and the service load does not exceed the preset threshold.
[0089] In an exemplary embodiment, the determining module 44 is configured to obtain the total number of replicas of each data object, the hard disk where each replica is located, and the availability status of each replica; if it is determined that the total number of replicas of the target data object is greater than a preset number, and at least one replica with an available status is located outside the target hard disk, the object type of the target data object is determined to be the multi-replica data object; if it is determined that the target data object has only a replica with an available status on the target hard disk, the object type of the target data object is determined to be the single-replica data object.
[0090] In an exemplary embodiment, application module 46 is configured to, for the multi-copy data object, redirect a first read / write request to a first copy located in an available state outside the target hard disk, and execute the first read / write request on the first copy; if it is determined that the first read / write request includes a write request, record the multi-copy data object to which the write operation is performed to a list to be restored; for the single-copy data object, after receiving a second read / write request, copy the single-copy data object to a hard disk outside the target hard disk to obtain a copied data object, and execute the second read / write request on the copied data object.
[0091] In an exemplary embodiment, the application module 46 is configured to filter at least one free hard disk that meets the free capacity threshold from the distributed storage system, determine a backup hard disk from the free hard disks based on the network topology location of the free hard disks and the target hard disk, transfer the single-copy data object from the target hard disk to the backup hard disk, and update the hard disk location information of the single-copy data object in the metadata information of the distributed storage system after the transfer is completed.
[0092] In an exemplary embodiment, the recovery module 48 is configured to transfer the single-copy data object on the backup hard disk from the backup hard disk to the target hard disk; after the transfer is completed, update the hard disk location information of the single-copy data object in the metadata information of the distributed storage system.
[0093] In an exemplary embodiment, the recovery module 48 is configured to read the list to be recovered and obtain the multi-copy data objects to be recovered recorded in the list; for the multi-copy data objects to be recovered, compare whether the multi-copy data objects on the target hard disk are consistent with the multi-copy data objects to be recovered; if it is determined that they are inconsistent, perform data synchronization on the multi-copy data objects on the target hard disk according to the multi-copy data objects to be recovered.
[0094] In one exemplary embodiment, the recovery module 48 is used to bring the target hard disk back online and mark it as available; and to synchronize the resource information of the target hard disk to the resource management pool of the distributed storage system.
[0095] In an exemplary embodiment, the apparatus is further configured to save the data object processing records and read / write request records of the target hard disk during the isolation process to a log database; and to provide feedback to the operation and maintenance end on the result information of the isolation maintenance completion, wherein the result information includes operation time and data processing volume.
[0096] For a description of the features in the embodiments corresponding to the above-mentioned hard disk isolation device, please refer to the relevant descriptions in the embodiments corresponding to the hard disk isolation method, which will not be repeated here.
[0097] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above embodiments of the hard disk isolation method.
[0098] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described embodiments of the hard disk isolation method when running.
[0099] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0100] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described embodiments of the hard disk isolation method.
[0101] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described hard disk isolation method embodiments.
[0102] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0103] The above provides a detailed description of a hard disk isolation method and electronic device provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to help understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A hard disk isolation method, characterized in that, Applied to a distributed storage system, the distributed storage system including multiple hard disks, including: In response to an isolation command for a target hard drive among the plurality of hard drives, a status check is performed on the target hard drive. After the status check is confirmed to be passed, an isolation task order is generated, wherein the isolation task order includes the hard drive identifier of the target hard drive and the isolation time period. Based on the hard disk identifier, traverse the multiple data objects stored on the target hard disk, query the replica distribution information of the multiple data objects in the distributed storage system, and determine the object type of the multiple data objects based on the replica distribution information. The object type includes multi-replica data objects and single-replica data objects. During the isolation period, different read / write strategies are applied to the multi-replica data object and the single-replica data object for read / write operations. After the isolation period ends, a data recovery operation is performed on the data objects stored on the target hard disk, and the isolation of the target hard disk is lifted after the recovery operation is completed.
2. The method according to claim 1, characterized in that, Perform a status check on the target hard drive. After confirming that the status check passes, generate an isolation task order, including: If the target hard drive is detected to be offline, the execution of the isolation command will be suspended. If the target hard drive is detected to be online and the business load exceeds a preset threshold, an alarm message is returned to the operation and maintenance terminal, and the isolation command is executed based on the response from the operation and maintenance terminal. If the target hard drive is detected to be online and the service load does not exceed the preset threshold, the status detection is determined to be successful, and the isolation task order is generated.
3. The method according to claim 1, characterized in that, Querying the replica distribution information of the multiple data objects in the distributed storage system, and determining the object type of the multiple data objects based on the replica distribution information, includes: Obtain the total number of replicas for each data object, the hard disk where each replica resides, and the availability status of each replica; If the total number of replicas of the target data object is greater than the preset number, and at least one replica in an available state is located outside the target hard disk, the object type of the target data object is determined to be the multi-replica data object; If it is determined that the target data object exists only in a usable copy on the target hard disk, the object type of the target data object is determined to be the single-copy data object.
4. The method according to claim 1, characterized in that, Different read / write strategies are applied to the multi-replica data object and the single-replica data object for read / write operations, including: For the multi-replica data object, the first read / write request is redirected to a first replica that is in an available state outside the target hard disk, and the first read / write request is executed on the first replica; If it is determined that the first read / write request includes a write request, the multi-copy data object to which the write operation is performed is recorded in the list to be restored. For the single-copy data object, after receiving the second read / write request, the single-copy data object is copied to a hard drive other than the target hard drive to obtain a copied data object, and the second read / write request is executed on the copied data object.
5. The method according to claim 4, characterized in that, Copying the single-copy data object to a hard drive other than the target hard drive includes: Select at least one free hard disk that meets the free capacity threshold from the distributed storage system, and determine the backup hard disk from the free hard disk based on the network topology location of the free hard disk and the target hard disk; Transfer the single-copy data object from the target hard disk to the backup hard disk; After the transmission is completed, update the hard disk location information of the single-copy data object in the metadata information of the distributed storage system.
6. The method according to claim 5, characterized in that, Performing data recovery operations on the data objects stored on the target hard disk includes: Transfer the single-copy data object on the backup hard disk from the backup hard disk to the target hard disk; After the transmission is completed, update the hard disk location information of the single-copy data object in the metadata information of the distributed storage system.
7. The method according to claim 4, characterized in that, Performing data recovery operations on the data objects stored on the target hard disk includes: Read the list to be restored and obtain the data objects of the multiple copies to be restored recorded in the list; For the multi-copy data object to be recovered, compare whether the multi-copy data object on the target hard disk is consistent with the multi-copy data object to be recovered; If an inconsistency is determined, the multi-copy data objects of the target hard disk are synchronized according to the multi-copy data objects to be recovered.
8. The method according to claim 1, characterized in that, After the recovery operation is completed, the isolation of the target hard drive is lifted, including: The target hard drive is brought back online and marked as available. The resource information of the target hard disk is synchronized to the resource management pool of the distributed storage system.
9. The method according to claim 1, characterized in that, The method further includes: The data object processing records and read / write request records of the target hard disk during the isolation process are saved to the log database; In addition, the system provides feedback to the operations and maintenance team on the completion of isolation maintenance, including operation time and data processing volume.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the hard disk isolation method as described in any one of claims 1 to 9 when executing the computer program.