A method and device for repairing disk failure in a distributed storage system
Through automated disk failure replacement methods and devices, the problem of frequent disk failures in Hadoop system is solved, automated disposal is realized, operation and maintenance pressure and cost are reduced, and fault detection and processing efficiency is improved.
Patent Information
- Application Number
- CN202011165795.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-27
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2040-10-27
AI Technical Summary
In Hadoop distributed file storage and computing systems, the high disk I/O load leads to frequent storage failures. The existing technology needs to be manually dealt with, resulting in complex operation and maintenance and high pressure, and lacks automated handling methods.
Provide a method and device for replacing disk failures in a distributed storage system. By obtaining hard disk information, matching data directories, determining idle disks, partitioning, formatting and mounting, it realizes automated handling of storage failures in Hadoop system, including judging disks. Whether it is on the blacklist, capacity threshold judgment and alarm mechanism.
It realizes automatic discovery and handling of disk failures in Hadoop system, reduces operation and maintenance complexity and cost, avoids fault missed and misdetection, and improves fault detection rate and operation and maintenance efficiency.
Smart Images

Figure CN112328173B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a method and device for repairing a disk failure in a distributed storage system. Background Art
[0002] Hadoop distributed file storage and computing system is one of the mainstream technologies in big data application scenarios. It relies on a large number of disks as storage media. Usually, in the use scenario of HDFS (Hadoop Distributed File System), due to the long-term high disk I / O load, system storage failures occur frequently, so storage failure handling operations need to be performed frequently.
[0003] The steps for handling storage failures in the Hadoop system involve server hardware, operating system, and Hadoop system operations, requiring operation and maintenance personnel in various fields to cooperate with each other to perform manual handling, which makes operation and maintenance complex and stressful.
[0004] Therefore, in order to reduce the intensity of operation and maintenance and alleviate the pressure of operation and maintenance, it is urgent to provide a technical solution of a distributed storage system disk failure repair method and device, which can realize the automatic handling of Hadoop system storage failures and reduce its operation and maintenance pressure. Summary of the invention
[0005] In view of the above problems in the prior art, the purpose of the present invention is to provide a method and device for replacing a disk failure in a distributed storage system, which can realize automatic handling of storage failures in the Hadoop system and reduce its operation and maintenance pressure.
[0006] In a first aspect, the present invention provides a method for replacing a disk failure in a distributed storage system, wherein the distributed storage system is configured with at least one server, each of the servers is configured with at least one idle disk, and the method comprises:
[0007] Obtaining a hard disk information set of the current operating system through a first tool instruction, wherein the hard disk information includes: a disk device name;
[0008] Query the directory configuration file to obtain the data directory list of the current operating system;
[0009] Matching the data in the data directory list with the disk device name one by one to determine whether there is an unmounted data directory;
[0010] If there is an unmounted data directory, determining a free disk according to the obtained list of all disk device information and the list of disks in a non-free state in the current operating system;
[0011] The idle disk is partitioned, formatted and data directory mounted in sequence.
[0012] Further, the step of determining the idle disk according to the obtained list of all disk device information and the list of disks in a non-idle state in the current operating system includes:
[0013] Obtaining a list of all disk device information in the current operating system;
[0014] Obtain a list of disks in a non-idle state from at least one of the following system files, wherein the system files include: a mounted device list file, a static information file of a mounted device, a swap space file in the current operating system, a device list file with partitions, and a disk list file being formatted;
[0015] Matching the disk devices in the disk device information list with the disk devices in the non-idle disk list one by one;
[0016] Disk devices that fail to match the device are considered free disks.
[0017] Furthermore, before sequentially partitioning, formatting and mounting the data directory on the idle disk, the process further includes:
[0018] Determine whether the disk name corresponding to the idle disk is in the blacklist;
[0019] Correspondingly, partitioning, formatting and mounting the data directory of the idle disk in sequence are performed when the disk name corresponding to the idle disk is not in the blacklist.
[0020] Furthermore, it also includes:
[0021] If the disk name corresponding to the free disk is not in the blacklist, determining whether the capacity of the free disk is greater than a preset capacity threshold;
[0022] Correspondingly, the disk partitioning, formatting and data directory mounting of the idle disk are performed in sequence when the disk name corresponding to the idle disk is not in the blacklist and the capacity is greater than the preset capacity threshold.
[0023] Furthermore, it also includes:
[0024] If the capacity of the free disk is not greater than the preset capacity threshold, the disk name corresponding to the free disk is added to the blacklist.
[0025] Furthermore, the hard disk information also includes: system interface device code;
[0026] The method further comprises:
[0027] If there is no unmounted data directory, determining whether the system interface device code in the disk information corresponds to the disk device name one by one;
[0028] If there is no one-to-one correspondence between the system interface device code and the disk device name, the following is repeated after a preset time: obtaining a hard disk information set of the current operating system through a first tool instruction, the hard disk information including: a disk device name; querying a directory configuration file to obtain a data directory list of the current operating system; matching the data in the data directory list with the disk device name one by one to determine whether there is an unmounted data directory; if there is no unmounted data directory, determining whether the system interface device code in the disk information corresponds to the disk device name; if there is still no one-to-one correspondence between the system interface device code and the disk device name, unmounting the data directory and deleting the corresponding mount information in the static information file of the mounted device.
[0029] Furthermore, it also includes:
[0030] If the system interface device code corresponds to the disk device name one by one, then check whether the directory file corresponding to the system interface device code has a read-only problem;
[0031] If there is a read-only problem, uninstall the directory file and use the second tool instruction to repair the disk device corresponding to the directory file;
[0032] If the repair is successful, the directory file is mounted to the corresponding disk device;
[0033] If the repair fails, the corresponding mount information is deleted from the static information file of the mount device.
[0034] Furthermore, if the repair fails, after deleting the corresponding mounting information in the static information file of the mounting device, the method further includes:
[0035] Obtaining the disk primary name corresponding to the directory file through a third tool instruction;
[0036] The disk master name is compared with the hard disk information, and an alarm message is issued based on the system interface device code in the hard disk information that passes the comparison, so that the person who subscribes to the alarm information can know the content of the abnormal information corresponding to the disk.
[0037] In a second aspect, the present invention provides a device for replacing a disk failure in a distributed storage system, wherein the distributed storage system is configured with at least one server, each of the servers is configured with at least one idle disk, and the device comprises:
[0038] The hard disk information acquisition module is configured to execute a first tool instruction to acquire a hard disk information set of the current operating system, wherein the hard disk information includes: a disk device name;
[0039] A query module is configured to execute a query directory configuration file to obtain a data directory list of the current operating system;
[0040] A first determination module is configured to match the data in the data directory list with the disk device name one by one to determine whether there is an unmounted data directory;
[0041] The idle disk determination module is configured to determine the idle disk according to the obtained list of all disk device information and the list of disks in non-idle state in the current operating system if there is an unmounted data directory;
[0042] The mounting module is configured to sequentially perform disk partitioning, formatting, and data directory mounting on the idle disk.
[0043] In a third aspect, the present invention provides a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement a distributed storage system disk failure replacement method as described above.
[0044] The present invention provides a method and device for replacing a disk failure in a distributed storage system, which has the following beneficial effects:
[0045] The implementation of the embodiments of this specification transforms the process of discovering faults and anomalies of disk-intensive servers of some manufacturers and models through manual inspection by operation and maintenance engineers into a method of regular automatic inspection and discovery and alarm, effectively avoiding the risk of missed fault detection, false detection or untimely discovery, thereby greatly saving the human operation and maintenance costs of the enterprise and improving the efficiency of operation and maintenance work. In addition, the implementation of the embodiments of this specification ensures that the alarms issued are all new faults that appear during automatic inspection, so that the fault information will not be submerged in a large number of repeated alarms, solves the problem of operation and maintenance personnel repeatedly receiving the same fault information, and enables new faults to be discovered and handled in a timely manner, thereby improving the fault discovery rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1A schematic diagram of the process of replacing a disk failure in a first distributed storage system provided by an embodiment of the present invention;
[0048] Figure 2 A schematic diagram of the process of a second method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention;
[0049] Figure 3 A schematic diagram of a process flow of a third method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention;
[0050] Figure 4 A schematic diagram of a flow chart of a fourth method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention;
[0051] Figure 5 A schematic diagram of the process flow of a fifth method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention;
[0052] Figure 6 A schematic diagram of a flow chart of a sixth method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention;
[0053] Figure 7 A schematic diagram of a seventh method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention;
[0054] Figure 8 A schematic diagram of the structure of a device for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention;
[0055] Fig. 9 A schematic diagram of the structure of a disk failure replacement device for a distributed storage system provided by an embodiment of the present invention.
[0056] Among them, 910 - information acquisition module, 920 - first writing module, 930 - comparison module, 940 - second writing module, 950 - alarm module. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0058] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. In order to facilitate the understanding of the technical solutions described in the embodiments of this specification and the technical effects produced therefrom, the embodiments of this specification first explain the relevant professional terms:
[0059] Hadoop: A distributed system infrastructure that enables distributed file storage and distributed computing processing of data.
[0060] Data: The servers in the Hadoop cluster store the actual data.
[0061] File system: A software organization on an operating system that is responsible for managing and storing file information.
[0062] Disk mount: The process by which an operating system makes computer files and directories on a storage device (such as a disk) accessible to users using the computer's file system.
[0063] File system read-only: The file system can only perform read operations and cannot write data.
[0064] like Figure 1 and Figure 2 As shown, Figure 1 A schematic diagram of a process flow of a first method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention. Figure 2 The present invention provides a flow chart of a second method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention. The present invention provides a method for replacing a disk failure in a distributed storage system. The distributed storage system is configured with at least one server, and each of the servers is configured with at least one idle disk. The method includes:
[0065] S102: Obtain a hard disk information set of the current operating system through a first tool instruction, where the hard disk information includes: a disk device name.
[0066] In a specific implementation process, the first tool instruction may be lsscsi, and the current operating system may obtain a disk information set through the lsscsi command. The disk information set may include multiple disk information, and each disk information may include: system interface device code (i.e., SCSI device ID), device type, device manufacturer, model, version information, and disk device name. Each disk device name corresponds to a disk, and each disk corresponds to a server. At least two servers are provided in the distributed storage system for controlling and / or storing information respectively. The current operating system may be a distributed storage system.
[0067] S104: Query the directory configuration file to obtain a data directory list of the current operating system.
[0068] In a specific implementation process, the current operating system can view a Hadoop directory configuration file, which includes a Hadoop data directory list of the current operating system. The data directory list includes multiple data representing disk information.
[0069] S106: Match the data in the data directory list with the disk device name one by one to determine whether there is an unmounted data directory.
[0070] In a specific implementation process, the data in the data directory list is matched with the disk device name to determine whether there is an unmounted data directory.
[0071] For example, the data directory list has three data A, B and C. There are two disk information in the hard disk information set, and the corresponding two disk device names are A' and B'. A is matched with A' and B' in turn. Since A and A' have the same representation, it can be determined that A corresponds to a mounted disk. Similarly, it can be determined that B corresponds to a mounted disk. Since C is matched with A' and B' but does not match the corresponding C', it is determined that C' is the mounted data.
[0072] S108: If there is an unmounted data directory, determine a free disk according to the obtained list of all disk device information and the list of non-free disks in the current operating system.
[0073] In a specific implementation process, if there is an unmounted data directory, the idle disk can be determined based on the obtained disk device information list and non-idle disk list in the current operating system. An idle disk can be characterized as a disk to which the distributed storage system has not allocated data. The disk device information list is characterized as all disk devices connected to the distributed storage system, and the non-idle disk list is characterized as a disk device connected to the distributed storage system that is storing and / or controlling.
[0074] In some possible embodiments, determining the free disk according to the acquired list of all disk device information and the list of disks in a non-free state in the current operating system includes:
[0075] S1082, obtaining a list of all disk device information in the current operating system;
[0076] S1084, obtaining a list of disks in a non-idle state from at least one of the following system files, wherein the system files include: a mounted device list file, a static information file of a mounted device, a swap space file in the current operating system, a device list file with partitions, and a disk list file being formatted;
[0077] In the specific implementation process, the mounted device list file can be obtained from the / proc / mounts file, the static information file of the mounted device can be obtained from the device list configured in fstab, the swap space file in the current operating system (that is, the device list of swap being mounted) can be obtained through the swapon command, the device list file of the existing partitions can be obtained from the partitions configuration file, and the disk list file being formatted can be viewed through the process search mkfs.
[0078] S1086, matching the disk devices in the disk device information list with the disk devices in the non-idle disk list one by one;
[0079] In a specific implementation process, the disk devices in the disk device information list may be matched one by one with the disk devices in the non-idle disk list.
[0080] S1088. The disk devices that fail to match are treated as idle disks.
[0081] In a specific implementation process, if a disk device in the disk device information list does not appear in the list of disks in a non-idle state, it can be determined that the corresponding disk device is an idle disk.
[0082] S110, sequentially partitioning, formatting, and mounting data directories on the idle disk.
[0083] In the specific implementation process, after the free disk is determined, it is partitioned, formatted and the data directory is mounted.
[0084] The implementation of the embodiments of this specification can reduce the complexity and labor cost of Hadoop system operation and maintenance, and realize the automatic discovery and handling of Hadoop disk failures. When a disk fails or the file system becomes read-only, it can automatically detect and try to recover. If it cannot be recovered, the system will automatically replace the disk. The whole process does not require manual intervention, freeing up operation and maintenance personnel.
[0085] Based on the above embodiments, in one embodiment of this specification, Figure 3 A schematic diagram of a flow chart of a third method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, before partitioning, formatting and mounting the data directory of the idle disk in sequence, the following steps are also included:
[0086] S302: Determine whether the disk name corresponding to the idle disk is in the blacklist.
[0087] In the specific implementation process, the blacklist can be characterized as disks that clearly do not meet the requirements, which can be disk devices with too low transmission rates, disk devices in read-only state and failed repair, and disk devices whose disk capacity does not meet the requirements.
[0088] Correspondingly, partitioning, formatting and mounting the data directory of the idle disk in sequence are performed when the disk name corresponding to the idle disk is not in the blacklist.
[0089] The implementation of the embodiments of this specification can avoid disk partitioning, formatting and data directory mounting of idle disks that do not meet the requirements, thereby improving the accuracy of the implementation of the embodiments of this specification.
[0090] Based on the above embodiments, in one embodiment of this specification, Figure 4 A schematic diagram of a fourth method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown, it also includes:
[0091] S402: If the disk name corresponding to the free disk is not in the blacklist, determine whether the capacity of the free disk is greater than a preset capacity threshold.
[0092] In a specific implementation process, if the free disk is not in the blacklist, the capacity of the free disk can be determined to determine whether its capacity is greater than a preset capacity threshold. The preset capacity threshold can be understood as the minimum disk capacity requirement allowed by the current operating system to be mounted. The preset capacity threshold is not specifically limited in the embodiments of this specification and can be set according to actual needs.
[0093] Correspondingly, the disk partitioning, formatting and data directory mounting of the idle disk are performed in sequence when the disk name corresponding to the idle disk is not in the blacklist and the capacity is greater than the preset capacity threshold.
[0094] Based on the above embodiment, in one embodiment of this specification, it further includes:
[0095] If the capacity of the free disk is not greater than the preset capacity threshold, the disk name corresponding to the free disk is added to the blacklist.
[0096] In the specific implementation process, if the capacity of the idle disk is not greater than the preset capacity threshold, the disk name corresponding to the idle disk can be added to the blacklist, so as to avoid the idle disk being tested again during the next disk inspection, thereby speeding up the resolution of the directory mounting problem.
[0097] Based on the above embodiments, in one embodiment of this specification, Figure 5 A schematic diagram of a fifth method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the hard disk information also includes: a system interface device code; the system interface device code may be a disk serial number.
[0098] The method further comprises:
[0099] S602: If there is no unmounted data directory, determine whether the system interface device code in the disk information corresponds to the disk device name.
[0100] S604. If there is no one-to-one correspondence between the system interface device code and the disk device name, repeat the execution after a preset time: obtain the hard disk information set of the current operating system through the first tool instruction, and the hard disk information includes: the disk device name; query the directory configuration file to obtain the data directory list of the current operating system; match the data in the data directory list with the disk device name one by one to determine whether there is an unmounted data directory; if there is no unmounted data directory, determine whether the system interface device code in the disk information corresponds to the disk device name; if there is still no one-to-one correspondence between the system interface device code and the disk device name, unmount the data directory and delete the corresponding mount information in the static information file of the mounted device.
[0101] In the specific implementation process, if the system interface device code and the disk device name do not correspond one to one, it is characterized by the non-existence of the disk device. The reason for the non-existence of the disk device may be that the device does not exist due to reasons such as unplugging the disk or being offline. Therefore, a test is performed again after a preset time (to prevent the misjudgment of the non-existence of the device due to a flash disconnection). When it is detected again that the disk device does not exist, it is determined that the disk does not exist, the directory is unmounted, and the corresponding mount information is deleted from the fstab configuration file (the fstab file records the disk mount information, which must be consistent with the actual disk mount status of the operating system, otherwise it will cause the host to restart failed). The preset time is not specifically limited in the embodiment of this specification, and can be 5s.
[0102] Based on the above embodiments, in one embodiment of this specification, Figure 6 A flowchart of a sixth method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, it also includes:
[0103] S702: If the system interface device code corresponds to the disk device name one by one, then check whether the directory file corresponding to the system interface device code has a read-only problem;
[0104] S704: If there is a read-only problem, uninstall the directory file and use the second tool instruction to repair the disk device corresponding to the directory file;
[0105] S706: If the repair is successful, the directory file is mounted to the corresponding disk device;
[0106] S708: If the repair fails, the corresponding mounting information is deleted from the static information file of the mounting device.
[0107] In the specific implementation process, if the disk device is detected, the file system is checked for read-only problems. If not, the directory is mounted normally and the next Hadoop data directory is scanned. If there is a read-only problem, the disk is repaired: unmount the directory and use fsck to repair the disk. If the repair is successful, the directory is remounted on the disk. If the disk repair fails, the directory remains unmounted and the corresponding mount information is deleted from the fstab configuration file.
[0108] Based on the above embodiments, in one embodiment of this specification, Figure 7 A flow chart of a seventh method for replacing a disk failure in a distributed storage system provided by an embodiment of the present invention is shown in FIG. Figure 7 As shown, if the repair fails, the corresponding mounting information is deleted from the static information file of the mounting device, and the following further comprises:
[0109] S802, obtaining the disk primary name corresponding to the directory file through a third tool instruction;
[0110] S804: Compare the disk master name with the hard disk information, and issue an alarm message based on the system interface device code in the hard disk information that passes the comparison, so that the person who subscribes to the alarm message can know the content of the abnormal information corresponding to the disk.
[0111] In the specific implementation process, if the disk device does not exist or the file system read-only problem fails to be repaired, the findfs command is used to obtain the primary name of the disk that is missing in the directory, and the hard disk information obtained in the first step is compared to notify the operation and maintenance personnel of the faulty disk SCSI device ID. The corresponding alarm information can also be generated based on the system interface device code in the hard disk information that has passed the comparison and pushed to the terminal device that subscribes to the alarm information, so that the person who subscribes to the alarm information can know the content of the abnormal information corresponding to the disk.
[0112] The implementation of the embodiments of this specification can realize automatic scanning and processing of disks. The embodiments of this specification can automatically scan the disk device status mounted by the Hadoop data directory, and automatically process disk failures or file system read-only problems:
[0113] ① If the directory is not mounted, it will search for free disk devices. If there is a free disk that meets the requirements, the Hadoop data directory will be mounted.
[0114] ②If the detection directory has been mounted, the file system will be detected to see if there is a read-only problem. If a read-only problem is found, the fsck command will be used to repair it.
[0115] The implementation of the embodiment of this specification searches for free disks by the elimination method, by obtaining a list of all disk devices in the operating system and excluding non-free disk devices such as mounts, fstab, swap, partitions, and those being formatted, to search for free disk devices.
[0116] The embodiments of this specification propose a disk blacklist mechanism. If it is detected that a certain idle disk device does not meet the Hadoop data directory capacity requirements, or a directory mount fails, the disk information is added to the blacklist, and the idle disk is directly skipped during the next detection.
[0117] The embodiments of this specification can realize automatic mounting of disks. When a free disk is detected, the disk can be automatically partitioned, formatted and directory mounted without manually logging into the operating system for adaptation.
[0118] On the other hand, the embodiment of this specification provides a distributed storage system disk failure repair device, Figure 8 A schematic diagram of a structure of a disk failure replacement device for a distributed storage system provided by an embodiment of the present invention is shown in FIG. Figure 8 As shown, the distributed storage system is configured with at least one server, each of the servers is configured with at least one idle disk, and the device includes:
[0119] The hard disk information acquisition module 910 is configured to execute a first tool instruction to acquire a hard disk information set of the current operating system, wherein the hard disk information includes: a disk device name;
[0120] The query module 920 is configured to execute the query directory configuration file to obtain a data directory list of the current operating system;
[0121] The first determination module 930 is configured to match the data in the data directory list with the disk device name one by one to determine whether there is an unmounted data directory;
[0122] The idle disk determination module 940 is configured to determine the idle disk according to the obtained list of all disk device information and the list of disks in non-idle state in the current operating system if there is an unmounted data directory;
[0123] The mounting module 950 is configured to sequentially perform disk partitioning, formatting, and data directory mounting on the idle disk.
[0124] On the other hand, an embodiment of the present specification provides a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement a distributed storage system disk failure replacement method as described above.
[0125] On the other hand, the embodiment of this specification provides a disk alarm device, Fig. 9 A schematic diagram of a structure of a disk failure replacement device for a distributed storage system provided by an embodiment of the present invention is shown in FIG. Fig. 9 As shown, it includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements a distributed storage system disk failure replacement method as described above by executing the instructions stored in the memory.
[0126] Since the technical effects of the distributed storage system disk failure replacement device, computer-readable storage medium, and distributed storage system disk failure replacement equipment are the same as those of the distributed storage system disk failure replacement method, they will not be repeated here.
[0127] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. The test method provided in the embodiment of the present invention has the same implementation principle and technical effects as the aforementioned system embodiment. For the sake of brief description, for the parts not mentioned in the method embodiment, reference can be made to the corresponding contents in the aforementioned system embodiment.
[0128] In several embodiments provided in the present application, it should be understood that the disclosed system and method can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order 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, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0129] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.
[0130] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the above-mentioned claims.
Claims
1. A method for repairing a disk failure in a distributed storage system, wherein the distributed storage system is configured with at least one server, each of which is configured with at least one idle disk, the method comprising: Obtaining a hard disk information set of the current operating system through a first tool instruction, wherein the hard disk information includes: a disk device name and a system interface device code; Query the directory configuration file to obtain the data directory list of the current operating system; Matching the data in the data directory list with the disk device name one by one to determine whether there is an unmounted data directory; If there is an unmounted data directory, determining a free disk according to the obtained list of all disk device information and the list of disks in a non-free state in the current operating system; Partitioning, formatting and mounting data directories on the idle disk in sequence; If there is no unmounted data directory, determining whether the system interface device code in the hard disk information corresponds to the disk device name; If the system interface device code corresponds to the disk device name one by one, then it is determined whether the directory file corresponding to the system interface device code has a read-only problem; if there is a read-only problem, then the directory file is uninstalled and the disk device corresponding to the directory file is repaired using the second tool instruction; if the repair is successful, then the directory file is mounted on the corresponding disk device; if the repair fails, then the corresponding mounting information is deleted from the static information file of the mounted device; If there is no one-to-one correspondence between the system interface device code and the disk device name, the following is repeated after a preset time: obtaining a hard disk information set of the current operating system through a first tool instruction, the hard disk information including: a disk device name; querying a directory configuration file to obtain a data directory list of the current operating system; matching the data in the data directory list with the disk device name one by one to determine whether there is an unmounted data directory; if there is no unmounted data directory, determining whether the system interface device code in the hard disk information corresponds to the disk device name; if there is still no one-to-one correspondence between the system interface device code and the disk device name, unmounting the data directory and deleting the corresponding mount information in the static information file of the mounted device.
2. The method according to claim 1, wherein determining the idle disk according to the obtained list of all disk device information and the list of disks in a non-idle state in the current operating system comprises: Obtaining a list of all disk device information in the current operating system; Obtain a list of disks in a non-idle state from at least one of the following system files, wherein the system files include: a mounted device list file, a static information file of a mounted device, a swap space file in the current operating system, a device list file with partitions, and a disk list file being formatted; Matching the disk devices in the disk device information list with the disk devices in the non-idle disk list one by one; Disk devices that fail to match the device are considered free disks.
3. The method according to claim 1, before sequentially partitioning, formatting and mounting the data directory on the idle disk, further comprises: Determine whether the disk name corresponding to the idle disk is in the blacklist; Correspondingly, partitioning, formatting and mounting the data directory of the idle disk in sequence are performed when the disk name corresponding to the idle disk is not in the blacklist.
4. The method of claim 3, further comprising: If the disk name corresponding to the free disk is not in the blacklist, determining whether the capacity of the free disk is greater than a preset capacity threshold; Correspondingly, the disk partitioning, formatting and data directory mounting of the idle disk are performed in sequence when the disk name corresponding to the idle disk is not in the blacklist and the capacity is greater than the preset capacity threshold.
5. The method of claim 4, further comprising: If the capacity of the free disk is not greater than the preset capacity threshold, the disk name corresponding to the free disk is added to the blacklist.
6. The method according to claim 1, wherein if the repair fails, after deleting the corresponding mounting information in the static information file of the mounting device, the method further comprises: Obtaining the disk primary name corresponding to the directory file through a third tool instruction; The disk master name is compared with the hard disk information, and corresponding alarm information is generated based on the system interface device code in the hard disk information that passes the comparison, so that people who subscribe to the alarm information can know the content of the abnormal information corresponding to the disk.
7. A distributed storage system disk failure repair device, the distributed storage system is configured with at least one server, each of the servers is configured with at least one idle disk, and the device is used to execute a distributed storage system disk failure repair method as described in any one of claims 1-6.
8. A computer-readable storage medium, wherein at least one instruction or at least one program is stored in the computer-readable storage medium, and the at least one instruction or at least one program is loaded and executed by a processor to implement a distributed storage system disk failure repair method as described in any one of claims 1-6.
Citation Information
Patent Citations
Method for solving disorder of magnetic disks set up by hadoop cluster
CN102929561A
Method and device for testing hard disk
CN106875980A
Hard disk drive mounting method and module and operating system
CN107423157A
Method and system for repairing distributed file systems, and server
CN108121620A
Cluster deployment method and device
CN108234164A
