CN115454339A - Data storage method, device and medium - Google Patents
Data storage method, device and medium Download PDFInfo
- Publication number
- CN115454339A CN115454339A CN202211071560.7A CN202211071560A CN115454339A CN 115454339 A CN115454339 A CN 115454339A CN 202211071560 A CN202211071560 A CN 202211071560A CN 115454339 A CN115454339 A CN 115454339A
- Authority
- CN
- China
- Prior art keywords
- data
- block device
- storage
- read
- original block
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000013500 data storage Methods 0.000 title claims abstract description 61
- 238000000034 method Methods 0.000 title claims abstract description 60
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 abstract description 9
- 238000007726 management method Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000011084 recovery Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000013459 approach Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000009877 rendering Methods 0.000 description 2
- 230000008439 repair process Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0635—Configuration or reconfiguration of storage systems by changing the path, e.g. traffic rerouting, path reconfiguration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0604—Improving or facilitating administration, e.g. storage management
- G06F3/0607—Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/064—Management of blocks
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application relates to the technical field of data processing, and discloses a data storage method, a data storage device and a medium. By adopting the technical scheme, the spare block equipment is reserved in advance, the spare block equipment is called to store when the original block equipment fails, data is directly written into the spare block equipment when data is written, the data is preferentially read from the original block equipment when the data is read, and the data is read from the spare block equipment if the data is not read. According to the technical scheme, the standby block equipment is used for storing when the original block equipment fails, operations such as restarting of a controller are not needed, continuous operation of services is achieved, and successful data dropping is guaranteed.
Description
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a data storage method, apparatus, and medium.
Background
With the rapid development of the cloud computing field, the cloud platform is mature, the system scale is huge, and the requirement on the reliability of the system is high. Especially, the stability of the storage device is crucial, and how to guarantee the availability and performance of the storage device when the storage device fails is an increasingly common problem.
In a production environment, the available capacity for data storage is commonly deployed using a multi-path, multi-site approach. When the storage device fails, the read-write mode of the multipath is also invalid, and data cannot be written into the multipath, so that the service is influenced. The solution strategy of common storage failure takes restarting nodes as a conventional means, when a similar hard disk failure occurs, the recovery and the availability of storage are guaranteed by restarting controllers one by one, but the method causes the multi-path switching of block equipment and requires the client equipment to perform frequent updating of paths. In addition to affecting traffic, there is a significant probability of confusion and unavailability of path management.
Therefore, how to guarantee the uninterrupted operation of the service when the block device fails to realize the successful disk-dropping of the data is a problem to be solved urgently by technical personnel in the field.
Disclosure of Invention
The application aims to provide a data storage method, a data storage device and a data storage medium, which are used for guaranteeing uninterrupted operation of services when a block device fails and realizing successful data downloading.
In order to solve the above technical problem, the present application provides a data storage method, including:
when the state of the original block device is detected to be changed into a read-only state, calling a reserved spare block device and establishing a storage path of the spare block device;
writing data into the spare block device through the storage path during a write operation;
and preferentially reading data in the original block device during reading operation, and if the data is not read, reading the data in the spare block device through the storage path.
Preferably, when the state of the original block device is restored to the normal read-write state, the method further includes:
and the storage path of the recovered data is the storage path of the original block device.
Preferably, when the state of the original block device is restored to the normal read-write state, the method further includes:
and moving the data in the spare block device to the original block device.
Preferably, after the step of moving the data in the spare block device to the original block device, the method further includes:
and deleting the storage path of the spare block device.
Preferably, the writing of data to the spare block device includes:
writing data into the spare block device and attaching a storage mark, wherein the storage mark is used for representing the storage position of the data in the original block device;
further, the moving the data in the spare block device to the original block device is: and moving the data in the spare block device to the original block device according to the storage mark.
Preferably, when it is detected that the state of the original block device is changed to the read-only state, the method further includes:
and setting the storage path of the original block device as a read-only attribute.
Preferably, when it is detected that the state of the original block device is changed to the read-only state, the method further includes: and sending a prompt signal.
In order to solve the above technical problem, the present application further provides a data storage device, including:
the calling module is used for calling the reserved spare block device and establishing a storage path of the spare block device when the state of the original block device is detected to be changed into a read-only state;
the data writing module is used for writing data into the spare block device through the storage path during writing operation;
and the data reading module is used for reading data in the original block device preferentially during reading operation, and reading the data in the standby block device through the storage path if the data is not read.
Preferably, the method further comprises the following steps: and the recovery module is used for recovering the storage path of the data as the storage path of the original block equipment.
Preferably, the method further comprises the following steps: and the moving module is used for moving the data in the standby block device to the original block device.
Preferably, the method further comprises the following steps: and the deleting module is used for deleting the storage path of the spare block device.
Preferably, the method further comprises the following steps: and the setting module is used for setting the storage path of the original block device as a read-only attribute.
Preferably, the method further comprises the following steps: and the prompt module is used for sending a prompt signal.
In order to solve the above technical problem, the present application further provides another data storage device, including a memory for storing a computer program;
a processor for implementing the steps of the data storage method as described above when executing the computer program.
In order to solve the above technical problem, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the data storage method as described above.
According to the data storage method provided by the application, when the state of an original block device is detected to be changed into a read-only state, a reserved spare block device is called and a storage path of the spare block device is established, data is written into the spare block device through the storage path during write operation, the data is preferentially read from the original block device during read operation, and if the data is not read, the data is read from the spare block device through the storage path. Compared with the prior art, data storage cannot be performed after the block device fails, the storage needs to be restored and available in a mode of repeatedly restarting the controller, and multipath switching of the block device easily causes path management confusion and unavailability, so that the service is affected. By adopting the technical scheme, the spare block equipment is reserved in advance, the spare block equipment is called to store when the original block equipment fails, data is directly written into the spare block equipment when data is written, the data is preferentially read from the original block equipment when the data is read, and the data is read from the spare block equipment if the data is not read. According to the technical scheme, the standby block equipment is used for storing when the original block equipment fails, operations such as restarting of a controller are not needed, continuous operation of services is achieved, and successful data dropping is guaranteed.
In addition, the data storage device and the medium provided by the application correspond to the data storage method, and the effects are the same as the effects.
Drawings
In order to more clearly illustrate the embodiments of the present application, the drawings needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a flowchart of a data storage method according to an embodiment of the present application;
FIG. 2 is a diagram of a prior art multi-path storage system;
fig. 3 is a structural diagram of a data storage device according to an embodiment of the present application;
fig. 4 is a structural diagram of another data storage device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any creative effort belong to the protection scope of the present application.
With the rapid development of the cloud computing field, the cloud platform is mature, the system scale is huge, and the requirement on the reliability of the system is high. Especially, the stability of the storage device is crucial, and how to guarantee the availability and performance of the storage device when the storage device fails is an increasingly common problem.
In a production environment, the available capacity for data storage is commonly deployed using a multi-path, multi-site approach. When the storage device fails, the read-write mode of the multipath is also invalid, and data cannot be written into the multipath, so that the service is influenced. The solution strategy of common storage failure takes restarting nodes as a conventional means, when a similar hard disk failure occurs, the recovery and the availability of storage are guaranteed by restarting controllers one by one, but the method causes the multi-path switching of block equipment and requires the client equipment to perform frequent updating of paths. In addition to affecting traffic, there is a significant probability of confusion and unavailability of path management.
Therefore, how to guarantee the uninterrupted operation of the service when the block device fails to realize the successful disk dropping of the data is a problem to be solved urgently by the technical personnel in the field.
The core of the application is to provide a data storage method, a data storage device and a data storage medium, which are used for guaranteeing the uninterrupted operation of the service when the block device fails, and realizing the successful disk-dropping of the data.
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings.
Fig. 1 is a flowchart of a data storage method according to an embodiment of the present application, and as shown in fig. 1, the method includes:
s10: when the state of the original block device is detected to be changed into a read-only state, calling the reserved standby block device and establishing a storage path of the standby block device;
s11: writing data into the spare block device through the storage path during a write operation;
s12: and reading the data in the original block device preferentially during the reading operation, and reading the data in the spare block device through the storage path if the data is not read.
Fig. 2 is a schematic diagram of a multipath storage system in the prior art, as shown in fig. 2, in which a Virtual Machine (VM) refers to a complete computer system having complete hardware system functions and operating in a completely isolated environment, which is simulated by software. The work that can be done in a physical computer can be implemented in a virtual machine. When creating a virtual machine in a computer, it is necessary to use a part of the hard disk and the memory capacity of the physical machine as the hard disk and the memory capacity of the virtual machine. Each virtual machine has an independent CMOS, hard disk and operating system, and can be operated like a physical machine. Block devices are one type of I/O devices that store information in fixed-size blocks, each block having its own address, and can also read data of a certain length at any location of the device, such as a hard disk, a U-disk, an SD card, and the like. vdb is the disk drive in a virtual machine, and similarly there are dda, bdc, etc. libvirt is an API for managing the open source of a virtualization platform, a background program and a management tool, and manages a virtual machine. dm-x is the multipath mapped device provided for libvrit use. A multipath daemon (multiprohed) is used to check for failed paths and reconfigure the multipath map. The daemon runs the multipath utility when an event occurs that requires reconfiguration of the device mapping. sdaa, sdab, sdac, etc. represent block device disks, mapped to servers by storage servers. Without multiprohd, all paths from a server node to a storage controller would be seen by the system as independent devices, even though I/O paths connecting the same server node to the same storage controller are no exception. Multipathd provides a method of logically managing I/O paths, i.e., creating a single multipath device on top of an underlying device. A Host Bus Adapter (HBA) is a circuit board or integrated circuit adapter that provides input/output processing and physical connections between a server and a storage device. Because the HBA relieves the host processor of the data storage and retrieval tasks, it can improve the performance of the server.
It can be seen that the volume in fig. 2 uses multiple paths, and if a storage link fails and other paths are in a normal state, the IO of the virtual machine can also be normally issued. However, when a storage device fails, all paths fail, thereby rendering the multi-path storage system unusable.
It should be noted that, in the specific implementation, the unavailability of the storage system is divided into a read-only state and an offline state of the storage device, where the unavailability in this application refers to the target file system changing into the read-only state, and the offline scenario of the storage device is not within the solution scope of the present invention.
Compared with the structure shown in fig. 2, the storage system in the present application reserves a spare block device in addition to an original block device that is normally used, and when it is detected that the original block device becomes a read-only state, the spare block device is called and a storage path of the spare block device is established, and data is written in through the spare block device, so that a data drop is realized without interrupting a service. When reading data, reading data from the original block device preferentially, and if not, reading data from the spare block device again. It can be understood that, in this embodiment, the spare block device guarantees that data storage is performed when the original block device is unavailable, so that the spare block device is usually not used for other purposes in specific implementation, and guarantees that data can be successfully landed only when the original block device is changed to a read-only state.
In specific implementation, when it is detected that the state of the original block device is changed to the read-only state, the controller may also send a prompt signal to prompt a technician to repair the original block device to ensure the service.
In specific implementation, when it is detected that the original block device is changed into a read-only state, the created storage path of the spare block device is in a normal read-write state, and the multiple paths of the original block device should be set to be read-only attributes, so as to avoid confusion of the read-write path after the state of the original block device is repaired.
By adopting the technical scheme, when the original block equipment fails and is changed into a read-only state, the data is written into the spare block equipment during the writing operation through the input of the spare block equipment, so that the virtual machine can not sense the abnormal bottom storage, can continuously provide the service, and the problem that the original block equipment cannot write the data and fall down is solved. When reading data, reading from the original block device preferentially, and if not, reading from the standby block device again, thereby ensuring normal operation of the service.
According to the data storage method provided by the embodiment of the application, when the state of an original block device is detected to be changed into a read-only state, a reserved spare block device is called and a storage path of the spare block device is established, data is written into the spare block device through the storage path during write operation, the data is preferentially read from the original block device during read operation, and if the data is not read, the data is read from the spare block device through the storage path. Compared with the prior art, data storage cannot be performed after the block device fails, the storage needs to be restored and available in a mode of repeatedly restarting the controller, and multipath switching of the block device easily causes path management confusion and unavailability, so that the service is affected. By adopting the technical scheme, the spare block equipment is reserved in advance, the spare block equipment is called to store when the original block equipment fails, data is directly written into the spare block equipment when data is written, the data is preferentially read from the original block equipment when the data is read, and the data is read from the spare block equipment if the data is not read. According to the technical scheme, the standby block equipment is used for storing when the original block equipment fails, operations such as restarting of a controller are not needed, continuous operation of services is achieved, and successful data dropping is guaranteed.
When the multipath of the original block device is set to be read-only attribute, the data needs to be written in through the storage path of the spare block device when the original block device is in normal read-write state, the storage path of the data needs to be recovered to be the storage path of the original block device, the path of the original block device is recovered to be normal read-write attribute, and normal operation of the storage system is recovered.
For subsequent reuse, the data falling is guaranteed, the spare block device is not needed to be put into use after the original block device is repaired, the spare block device is unloaded, the storage path is deleted, and the original block device is used for data reading and writing.
Before deleting the storage path of the spare block device, in order to ensure the normal operation of the service and avoid data loss, the data in the spare block device should be synchronously moved to the original block device.
Further, when data is written into the spare block device, a storage mark is added, and the storage mark is used for representing the storage position of the data in the original block device;
correspondingly, moving the data in the spare block device to the original block device is: and moving the data in the spare block device to the original block device according to the storage mark.
According to the data storage method provided by the embodiment of the application, after the state of the original block device is restored to the normal read-write state, the data in the standby block device is moved to the original block device according to the storage mark, the storage path of the standby block device is deleted, the storage path of the original block device is used for storing the data, and the normal operation of the storage system is restored.
In the above embodiments, detailed descriptions are given for the data storage method, and the present application also provides embodiments corresponding to the data storage device. It should be noted that the present application describes the embodiments of the apparatus portion from two perspectives, one from the perspective of the function module and the other from the perspective of the hardware.
Fig. 3 is a structural diagram of a data storage device according to an embodiment of the present application, and as shown in fig. 3, the data storage device includes:
a calling module 10, configured to call a reserved spare block device and establish a storage path of the spare block device when detecting that the state of the original block device changes to the read-only state;
a data writing module 11, configured to write data into the spare block device through the storage path during a write operation;
the read data module 12 is configured to preferentially read data in the original block device during a read operation, and if data is not read, read data in the spare block device through the storage path.
It should be noted that the structure shown in fig. 3 does not constitute a limitation of the data storage device, and may include more or less components than those shown. In other embodiments, as a preferred implementation, the data storage device may further include: and the recovery module is used for recovering the storage path of the data as the storage path of the original block device. When the multiple paths of the original block device are all set to be read-only attributes, the data needs to be written in through the storage path of the standby block device when the original block device is in a normal read-write state, the storage path of the data needs to be recovered to be the storage path of the original block device when the original block device is in a normal read-write state, the path of the original block device is recovered to be the normal read-write attributes, and normal operation of the storage system is recovered.
Preferably, the method further comprises the following steps: and the moving module is used for moving the data in the standby block device to the original block device. Before deleting the storage path of the spare block device, in order to ensure the normal operation of the service and avoid data loss, the data in the spare block device should be synchronously moved to the original block device.
Preferably, the method further comprises the following steps: and the deleting module is used for deleting the storage path of the standby block device. For subsequent reuse, the data falling is guaranteed, the spare block device is not needed to be put into use after the original block device is repaired, the spare block device is unloaded, the storage path is deleted, and the original block device is used for data reading and writing.
Preferably, the method further comprises the following steps: and the setting module is used for setting the storage path of the original block device as a read-only attribute. In specific implementation, when it is detected that the original block device is changed into a read-only state, the created storage path of the spare block device is in a normal read-write state, and the multiple paths of the original block device should be set to be read-only attributes, so as to avoid confusion of the read-write path after the state of the original block device is repaired.
Preferably, the method further comprises the following steps: and the prompt module is used for sending a prompt signal. In specific implementation, when it is detected that the state of the original block device is changed to the read-only state, the controller may also send a prompt signal to prompt a technician to repair the original block device to ensure the service.
Further, when data is written into the spare block device, a storage mark is added, and the storage mark is used for representing the storage position of the data in the original block device;
correspondingly, moving the data in the spare block device to the original block device is: and moving the data in the spare block device to the original block device according to the storage mark.
In the data storage apparatus provided in the embodiment of the present application, when it is detected that the state of the original block device is changed to the read-only state, the reserved spare block device is called and a storage path of the spare block device is established, data is written into the spare block device through the storage path during a write operation, data is preferentially read in the original block device during a read operation, and if data is not read, the data is read in the spare block device through the storage path. Compared with the prior art, data storage cannot be performed after the block device fails, the storage needs to be restored and available in a mode of repeatedly restarting the controller, and multipath switching of the block device easily causes path management confusion and unavailability, so that the service is affected. By adopting the technical scheme, the standby block equipment is reserved in advance, the standby block equipment is called to store when the original block equipment fails, data is directly written into the standby block equipment when data is written, the data is preferentially read from the original block equipment when the data is read, and the data is read from the standby block equipment if the data is not read. According to the technical scheme, the standby block equipment is used for storing when the original block equipment fails, operations such as restarting of a controller are not needed, continuous operation of services is achieved, and successful data dropping is guaranteed.
Fig. 4 is a structural diagram of another data storage device according to an embodiment of the present application, and as shown in fig. 4, the data storage device includes: a memory 20 for storing a computer program;
a processor 21, configured to implement the steps of the data storage method according to the above-mentioned embodiments when executing the computer program.
The data storage device provided by the embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, or a desktop computer.
The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The Processor 21 may be implemented in hardware using at least one of a Digital Signal Processor (DSP), a Field-Programmable Gate Array (FPGA), and a Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a Graphics Processing Unit (GPU) which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 21 may further include an Artificial Intelligence (AI) processor for processing computational operations related to machine learning.
Memory 20 may include one or more computer-readable storage media, which may be non-transitory. Memory 20 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used for storing the following computer program 201, wherein after being loaded and executed by the processor 21, the computer program can implement the relevant steps of the data storage method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202, data 203, and the like, and the storage manner may be a transient storage manner or a permanent storage manner. Operating system 202 may include, among others, windows, unix, linux, and the like. Data 203 may include, but is not limited to, storage tags, cues, and the like.
In some embodiments, the data storage device may further include a display 22, an input/output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
Those skilled in the art will appreciate that the architecture illustrated in fig. 4 does not constitute a limitation on data storage devices, and may include more or fewer components than those illustrated.
The data storage device provided by the embodiment of the application comprises a memory and a processor, and when the processor executes a program stored in the memory, the following method can be realized: when the state of the original block device is detected to be changed into a read-only state, calling the reserved standby block device and establishing a storage path of the standby block device; writing data into the spare block device through the storage path during a write operation; and reading the data in the original block device preferentially during the reading operation, and reading the data in the spare block device through the storage path if the data is not read.
In the data storage apparatus provided in the embodiment of the present application, when it is detected that the state of the original block device is changed to the read-only state, the reserved spare block device is called and a storage path of the spare block device is established, data is written into the spare block device through the storage path during a write operation, data is preferentially read in the original block device during a read operation, and if data is not read, the data is read in the spare block device through the storage path. Compared with the prior art, data storage cannot be performed after the block device fails, the storage needs to be restored and available in a mode of repeatedly restarting the controller, and multipath switching of the block device easily causes path management confusion and unavailability, so that the service is affected. By adopting the technical scheme, the spare block equipment is reserved in advance, the spare block equipment is called to store when the original block equipment fails, data is directly written into the spare block equipment when data is written, the data is preferentially read from the original block equipment when the data is read, and the data is read from the spare block equipment if the data is not read. According to the technical scheme, the standby block equipment is used for storing when the original block equipment fails, operations such as restarting of a controller are not needed, continuous operation of services is achieved, and successful data dropping is guaranteed.
Finally, the application also provides a corresponding embodiment of the computer readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps as set forth in the above-mentioned method embodiments.
It is understood that, if the method in the above embodiments is implemented in the form of software functional units and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods described in the embodiments of the present application, or all or part of the technical solutions. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The computer-readable storage medium provided in the embodiment of the present application, when detecting that the state of an original block device is changed to a read-only state, calls a reserved spare block device and establishes a storage path of the spare block device, writes data into the spare block device through the storage path during a write operation, preferentially reads the data from the original block device during a read operation, and reads the data from the spare block device through the storage path if the data is not read. Compared with the prior art, data storage cannot be performed after the block device fails, the storage needs to be restored and available in a mode of repeatedly restarting the controller, and multipath switching of the block device easily causes path management confusion and unavailability, so that the service is affected. By adopting the technical scheme, the spare block equipment is reserved in advance, the spare block equipment is called to store when the original block equipment fails, data is directly written into the spare block equipment when data is written, the data is preferentially read from the original block equipment when the data is read, and the data is read from the spare block equipment if the data is not read. According to the technical scheme, the standby block equipment is used for storing when the original block equipment fails, operations such as restarting of a controller are not needed, continuous operation of services is achieved, and successful data dropping is guaranteed.
The data storage method, apparatus and medium provided by the present application are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, without departing from the principle of the present application, the present application can also make several improvements and modifications, and those improvements and modifications also fall into the protection scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
Claims (10)
1. A method of storing data, comprising:
when the state of the original block device is detected to be changed into a read-only state, calling the reserved spare block device and establishing a storage path of the spare block device;
writing data into the spare block device through the storage path during a write operation;
and preferentially reading data in the original block device during reading operation, and reading the data in the spare block device through the storage path if the data is not read.
2. The data storage method according to claim 1, wherein when the state of the original block device is restored to the normal read-write state, the method further comprises:
and the storage path of the recovered data is the storage path of the original block device.
3. The data storage method according to claim 2, wherein when the state of the original block device is restored to the normal read-write state, the method further comprises:
and moving the data in the spare block device to the original block device.
4. The data storage method according to claim 3, further comprising, after the step of moving the data in the spare block device to the original block device:
and deleting the storage path of the spare block device.
5. The data storage method of claim 3, wherein writing data to the spare block device comprises:
writing data into the spare block device and attaching a storage mark, wherein the storage mark is used for representing the storage position of the data in the original block device;
further, the moving the data in the spare block device to the original block device is: and moving the data in the spare block device to the original block device according to the storage mark.
6. The data storage method according to claim 1, wherein when it is detected that the state of the original block device changes to the read-only state, further comprising:
and setting the storage path of the original block device as a read-only attribute.
7. The data storage method according to claim 1, wherein when it is detected that the state of the original block device changes to the read-only state, further comprising: and sending a prompt signal.
8. A data storage device, comprising:
the calling module is used for calling the reserved spare block device and establishing a storage path of the spare block device when the state of the original block device is detected to be changed into a read-only state;
the data writing module is used for writing data into the spare block device through the storage path during writing operation;
and the data reading module is used for reading data in the original block device preferentially during reading operation, and reading the data in the standby block device through the storage path if the data is not read.
9. A data storage device, comprising a memory for storing a computer program;
a processor for implementing the steps of the data storage method of any one of claims 1 to 7 when executing said computer program.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the data storage method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211071560.7A CN115454339A (en) | 2022-09-02 | 2022-09-02 | Data storage method, device and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211071560.7A CN115454339A (en) | 2022-09-02 | 2022-09-02 | Data storage method, device and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115454339A true CN115454339A (en) | 2022-12-09 |
Family
ID=84300373
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211071560.7A Pending CN115454339A (en) | 2022-09-02 | 2022-09-02 | Data storage method, device and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115454339A (en) |
-
2022
- 2022-09-02 CN CN202211071560.7A patent/CN115454339A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11397648B2 (en) | Virtual machine recovery method and virtual machine management device | |
US20060047926A1 (en) | Managing multiple snapshot copies of data | |
CN112199162B (en) | Disk snapshot method, device and medium based on virtualized disk double-active disaster tolerance | |
US10860447B2 (en) | Database cluster architecture based on dual port solid state disk | |
CN113626256B (en) | Virtual machine disk data backup method, device, terminal and storage medium | |
CN109445861A (en) | System start method, device, computer installation and storage medium | |
WO2021004256A1 (en) | Node switching method in node failure and related device | |
CN112328365A (en) | Virtual machine migration method, device, equipment and storage medium | |
CN115061634A (en) | System service load distribution method, device and medium | |
CN111090399A (en) | Online migration method, device, equipment and medium for disk data | |
CN115454339A (en) | Data storage method, device and medium | |
CN114884836A (en) | High-availability method, device and medium for virtual machine | |
CN111475334A (en) | TiDB database maintenance method and device, computer equipment and storage medium | |
CN109857519A (en) | The processing method and relevant apparatus of virtual disk | |
CN115562593A (en) | Abnormal RAID member disk processing method, device and medium | |
CN115114086A (en) | Array volume recovery method, system, equipment and storage medium based on disk array | |
CN114995958A (en) | Virtualization platform information consistency control method, device and medium | |
CN115543246A (en) | BMC and server | |
CN114840362A (en) | Cloud host recovery method, device and medium | |
CN118377657B (en) | Data recovery method and device, storage medium and electronic equipment | |
CN111176572B (en) | Method, device, equipment and medium for protecting stored data | |
CN114301927B (en) | Main node selection method, device and medium in distributed system | |
US11947827B2 (en) | Synchronizing a stale component of a distributed object using a delta component during maintenance | |
CN108509301A (en) | The update method and more new system of system slot information in a kind of SMBIOS | |
CN111030875A (en) | System deployment method and device of data center and computer storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |