Data backup method and device, storage medium and electronic equipment
By periodically freezing the write operations of the file system and backing up incremental data on the clock control device, the problem of low data backup efficiency in the existing technology is solved, and a faster and more reliable data backup process is achieved.
Patent Information
- Application Number
- CN202410865879.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-15
AI Technical Summary
In the existing technology, when the primary storage system and the backup storage system perform data backup through a remote replication relationship, the network link bandwidth is limited, resulting in a long data copy time and reducing the reliability and efficiency of data transmission.
In the first clock cycle of the clock control device, the freeze command is called to freeze the write operation function of the file system, and the incremental data is backed up to the primary snapshot device and the backup snapshot device, and the task queue is polled through a timer to synchronize periodically. Incremental data in the file system to avoid full data copying.
It improves the speed and efficiency of data backup, ensures that incremental data of the file system is backed up each time, reduces backup time, and improves the reliability of data transmission.
Smart Images

Figure CN118779153A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and specifically, to a data backup method and device, a storage medium, and an electronic device. Background Art
[0002] In the related technology, in the associated primary storage system and backup storage system, the corresponding primary storage device and backup storage device are determined, a remote replication relationship is established between the primary storage device and the backup storage device, and the data resources in the primary storage device are synchronized to the backup storage device through the remote replication relationship, thereby completing the data backup of the primary storage device in the backup storage device; when the primary storage system fails, the backup storage system works, stops the remote replication relationship between the primary storage device and the backup storage device, and starts the data recovery function of the file system of the backup storage device in the backup storage system.
[0003] However, the primary storage system and the backup storage system perform data backup by establishing a remote replication relationship. Each time, the data in the storage device needs to be fully copied. When the amount of data is large, the data copy time may be increased due to the limitation of the network link bandwidth. Excessive data transmission time will reduce the reliability of data transmission. Summary of the invention
[0004] The embodiments of the present application provide a data backup method and device, a storage medium, and an electronic device to at least solve the problem of low data backup efficiency in the related art.
[0005] According to an embodiment of the present application, a data backup method is provided, which is applied to a primary storage system, wherein the primary storage system includes a clock control device, a file system and a primary storage device connected in sequence, and includes: when a first clock cycle of the clock control device is reached, calling a first freeze instruction; in response to the first freeze instruction, freezing the write operation function of the file system; controlling the primary storage device to back up first incremental data to a primary snapshot device, wherein the first incremental data is data that the file system responds to a first write operation instruction sent by a client within the first clock cycle, and writes the first data sent by the client to the primary storage device using the write operation function, and the primary snapshot device is a pre-created device connected to the primary storage device; sending a backup instruction to a backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, wherein the first backup incremental data is data that the primary storage system controls the primary snapshot device to back up the first incremental data to the backup storage device, and the backup snapshot device is a pre-created device connected to the backup storage device.
[0006] In an exemplary embodiment, the clock control device includes a listener, a task processor and a timer connected in sequence, wherein when a first clock cycle of the clock control device is reached, a first freeze instruction is called, including: monitoring a port of a command line tool connected to the main storage system through the listener, wherein the command line tool is used to generate a freeze command, and one freeze command corresponds to one clock cycle; when the listener monitors the freeze command from the port, obtaining the freeze command from the port through the task processor; inserting the freeze command into a task queue according to the corresponding clock cycle through the task processor, wherein one or more freeze commands in the task queue are set according to the corresponding clock cycle; polling the task queue through the timer, and calling the first freeze command from the task queue when the first clock cycle is reached, wherein the first freeze command is a command among multiple freeze commands.
[0007] In an exemplary embodiment, after freezing the write operation function of the file system in response to the first freeze instruction, the method further includes: generating a create instruction; sending the create instruction to the primary storage device and the backup storage device, wherein the primary storage device is used to create the primary snapshot device based on the create instruction, and the backup storage device is used to create the backup snapshot device based on the create instruction; generating a first thawing instruction when it is determined that a connection is established between the primary snapshot device and the primary storage device, and a connection is established between the backup snapshot device and the backup storage device; detecting the operating status of the primary storage system to obtain status information; and determining from the status information whether the primary storage system is in a state of Under normal operating conditions, the first thawing instruction is sent to the file system to unfreeze the write operation function of the file system; wherein the file system is also used to continue to respond to the second write operation instruction sent by the client within a second clock cycle when unfreezing the write operation function, use the write operation function to write the second data sent by the client to the primary storage device, and write the second data to the primary snapshot device to replace the first incremental data, back up the second data to the backup storage device through the primary snapshot device, and the backup storage device stores the second data in the backup snapshot device to replace the first backup incremental data.
[0008] In an exemplary embodiment, controlling the primary storage device to back up the first incremental data to the primary snapshot device includes: detecting the operating status of the primary storage system to obtain status information; and when it is determined from the status information that the primary storage system is in a normal operating state, controlling the primary storage device to back up the first incremental data to the primary snapshot device.
[0009] In an exemplary embodiment, after sending a backup instruction to a backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, the method further includes: detecting the operating status of the primary storage system to obtain status information; in the case where it is determined from the status information that the primary storage system is in an abnormal operating state, generating a data recovery instruction, wherein the abnormal operating state includes at least one of the following: an abnormality in the writing of data by the file system, an abnormality in the storage of data by the primary storage device, and an abnormality in the primary snapshot device; and restoring the first incremental data to the primary storage device based on the data recovery instruction.
[0010] In an exemplary embodiment, the first incremental data stored in the primary snapshot device is restored to the primary storage device based on the data recovery instruction, including: sending the data recovery instruction to the backup storage device; restoring the first backup incremental data stored in the backup snapshot device to the backup storage device through the backup storage device; when the primary storage system resumes normal operation, restoring the first backup incremental data restored to the backup storage device to the primary snapshot device; restoring the first backup incremental data in the primary snapshot device to the primary storage device, so as to restore the first incremental data to the primary storage device.
[0011] In an exemplary embodiment, after the first incremental data is restored to the primary storage device based on the data recovery instruction, the method further includes: generating a second thawing instruction; sending the second thawing instruction to the file system to unfreeze the write operation function of the file system; wherein the file system is also used to continue to respond to a third write operation instruction sent by the client within a third clock cycle when unfreezing the write operation function, use the write operation function to write the third data sent by the client to the primary storage device, and write the third data to the primary snapshot device to replace the first incremental data, back up the third data to the backup storage device through the primary snapshot device, and the backup storage device stores the third data in the backup snapshot device to replace the first backup incremental data.
[0012] According to another embodiment of the present application, a data backup device is provided, which is applied to a primary storage system, wherein the primary storage system includes a clock control device, a file system and a primary storage device connected in sequence, and the device includes: a first calling module, which is used to call a first freezing instruction when a first clock cycle of the clock control device is reached; a first responding module, which is used to respond to the first freezing instruction and freeze the write operation function of the file system; a first control module, which is used to control the primary storage device to back up first incremental data to a primary snapshot device, wherein the first incremental data is data that the file system responds to a first write operation instruction sent by a client within the first clock cycle, and writes the first data sent by the client to the primary storage device using the write operation function, and the primary snapshot device is a pre-created device connected to the primary storage device; a first sending module, which is used to send a backup instruction to a backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, wherein the first backup incremental data is data that the primary storage system controls the primary snapshot device to back up the first incremental data to the backup storage device, and the backup snapshot device is a pre-created device connected to the backup storage device.
[0013] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0014] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0015] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0016] Through this application, when the primary storage system reaches the first clock cycle of the clock control device, it calls the first freeze instruction to freeze the write operation function of the file system; and controls the primary storage device to back up the first incremental data to the primary snapshot device, and sends a backup instruction to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device. It can be ensured that the data synchronized and backed up each time is the incremental data of the file system, and there is no need to synchronize the full amount of data, which speeds up the data backup. Therefore, the problem of low data backup efficiency in the related technology can be solved, and the effect of improving data backup efficiency can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a hardware structure block diagram of a mobile terminal of a data backup method according to an embodiment of the present application;
[0018] Figure 2 is a flow chart of a data backup method according to an embodiment of the present application;
[0019] Figure 3 is a schematic diagram of the hardware structure connection of the main storage system in this embodiment;
[0020] Figure 4 is a schematic diagram of interaction between a clock control device and a CMD according to an embodiment of the present application;
[0021] Figure 5 is a timing diagram between the CLI and various components in the clock control device according to an embodiment of the present application;
[0022] Figure 6 is a flowchart of a timer executing a task according to an embodiment of the present application;
[0023] Figure 7 is a timing diagram of NAS disaster recovery data according to an embodiment of the present application;
[0024] Figure 8 It is a structural block diagram of a data backup device according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0027] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 1 is a hardware structure block diagram of a mobile terminal of a data backup method according to an embodiment of the present application. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 The mobile terminal includes a processor 102 (only one is shown) (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0028] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data backup method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0029] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0030] In this embodiment, a data backup method is provided, which is applied to a primary storage system, wherein the primary storage system includes a clock control device, a file system, and a primary storage device connected in sequence. Figure 2 is a flow chart of a data backup method according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0031] Step S202, when the first clock cycle of the clock control device is reached, calling a first freeze instruction;
[0032] Step S204, responding to the first freeze instruction, freezing the write operation function of the file system;
[0033] Step S206, controlling the primary storage device to back up the first incremental data to the primary snapshot device, wherein the first incremental data is data that the file system responds to the first write operation instruction sent by the client in the first clock cycle, and writes the first data sent by the client to the primary storage device by using the write operation function, and the primary snapshot device is a pre-created device connected to the primary storage device;
[0034] Step S208, sending a backup instruction to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, wherein the first backup incremental data is the data that the primary storage system controls the primary snapshot device to back up the first incremental data to the backup storage device, and the backup snapshot device is a pre-created device connected to the backup storage device.
[0035] Optionally, this embodiment includes but is not limited to being applied to the field of storage systems. The primary storage system includes but is not limited to a network file system (NFS). NFS is a network storage device, usually as an independent hardware device, or it can be software running on dedicated hardware or a virtualized environment. The NAS device is connected to the network and provides file-level data access to users through network protocols (e.g., NFS, SMB / CIFS, etc.). Among them, NFS (Network File System): a protocol for sharing files and file systems on a network. It allows users to access files on remote computers as if they were local files. SMB / CIFS (Server Message Block / Common Internet File System): a protocol for sharing files, printers, and other resources between computers. It is commonly used for file sharing in Windows operating systems. HTTP (Hypertext Transfer Protocol): a protocol for transferring data between a Web server and a client. It is one of the most commonly used protocols on the World Wide Web. FTP (File Transfer Protocol): a protocol for transferring files between computers. It allows users to upload and download files to a remote server. TCP / IP (Transmission Control Protocol / Internet Protocol): a protocol suite for communicating on the Internet. It includes multiple protocols, such as TCP, IP, UDP, etc., for data transmission, routing and communication. Users can access shared files on NAS devices through LAN or WAN, just like accessing files on a local hard disk. Among them, local area network (LAN) access: For devices within the same LAN, you can directly use the LAN IP address or host name to access shared files on the NAS device. Normally, shared files on NAS devices can be accessed through the network sharing function or network mapping. Wide area network (WAN) access: If access is required between different networks, shared files on NAS devices can be accessed through the remote access function or VPN connection. Port mapping or VPN connection needs to be set up to ensure secure access to shared files on NAS devices.
[0036] Optionally, Figure 3 FIG. 1 is a schematic diagram of the hardware structure connection of the main storage system in this embodiment. Figure 3As shown, the main storage system is connected to the client through a network, and the main storage system includes a clock control device (e.g., agent), a file system (e.g., XFS) and a main storage device (e.g., main volume) connected in sequence, and the main snapshot device (e.g., main volume) created by the main storage device is connected to the main storage device. Among them, the agent and XFS are set in the virtual machine kvm of the main storage system. The main storage system is also connected to the backup storage system through a network, and the backup storage system includes a virtual machine kvm, and XFS is set in the kvm. The backup storage system also includes a backup storage device (e.g., slave volume), and the backup storage device is connected to the created backup snapshot device (e.g., slave snapshot volume). For example, the specific process includes: adding a timer in the NAS, creating a volume layer snapshot after periodically freezing the file system and synchronizing it to the central disaster recovery site, and thawing the file system and restoring IO after the data synchronization is successful. It can be ensured that the data synchronized each time is a consistent snapshot of the file system.
[0037] Optionally, the first clock cycle may be a preset timer duration of a timer in a clock control device. The primary storage device and the backup storage device include but are not limited to a hard disk, a solid state drive, etc. The primary snapshot device and the backup snapshot device include but are not limited to a cache device with a certain storage space.
[0038] Through the above steps, when the primary storage system reaches the first clock cycle of the clock control device, the first freeze instruction is called to freeze the write operation function of the file system; and the primary storage device is controlled to back up the first incremental data to the primary snapshot device, and a backup instruction is sent to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device. It can be ensured that the data synchronized and backed up each time is the incremental data of the file system, and there is no need to synchronize the full amount of data, which speeds up the data backup. Therefore, the problem of low data backup efficiency in the related technology can be solved, and the effect of improving data backup efficiency can be achieved.
[0039] In an exemplary embodiment, a clock control device includes a listener, a task processor and a timer connected in sequence, wherein when a first clock cycle of the clock control device is reached, a first freeze instruction is called, including: monitoring a port of a command line tool connected to a main storage system through a listener, wherein the command line tool is used to generate a freeze command, and one freeze command corresponds to one clock cycle; when the listener monitors a freeze command from the port, obtaining the freeze command from the port through a task processor; inserting the freeze command into a task queue according to a corresponding clock cycle through the task processor, wherein one or more freeze commands in the task queue are set according to the corresponding clock cycle; polling the task queue through a timer, and when the first clock cycle is reached, calling the first freeze command from the task queue, wherein the first freeze command is a command among multiple freeze commands.
[0040] Optionally, the clock control device can be implemented by the background process nassrv of the main storage system. A command line tool is a tool that allows a user to interact with a computer or application program through text commands. A user can execute a specific task or start a program by entering a text command. For example, when the command line tool is CLI, the task processor is Dispatch, the timer is timer, and the task queue is Task queue, the interaction process between the clock control device and CMD is as follows: Figure 4 As shown in the figure, CMD refers to the Command Prompt, which is a text mode interface for executing command line operations. The freeze command in the CLI is sent through CMD.
[0041] Optionally, the timing diagram between CLI and each device in the clock control device is as follows Figure 5 As shown in the figure, the specific process includes: the listener listens to the port, receives the freeze command sent by the CMD, assigns the task corresponding to the freeze command through Dispatch, inserts the task into the Task queue, and sends other tasks to the CMD handler for execution. The timer is configured autonomously according to the actual business scenario, cyclically reads tasks from the Task queue, calls the execution thread to execute the handler, the timer polls the task queue, and executes the start-cycle asynchronous replication relationship process according to the expiration time; the handler executes the specific timed task according to the set timing strategy; the timed task returns the execution result to the timer.
[0042] Optionally, during the data backup process, the timer executes the task as follows: Figure 6 As shown, the following steps are included:
[0043] S601, lock the task queue;
[0044] S602, take the queue tasks and take out the tasks whose backup relationship status is start;
[0045] S603, judging the current time curtime and the recorded next cycle time nexttime, when curtime>nexttime, executing the task of starting periodic data backup;
[0046] S604, unlock the task queue and wait for the next task to enter the queue.
[0047] Optionally, the task queue can be polled by the callback function in the timer. Each time the timer is triggered, it is checked whether there is a task in the queue that needs to be executed. If there is a task in the task queue and the execution condition of the task is met (for example, the first set clock cycle has been reached), the task is taken out of the queue and executed. After the task is executed, the status of the task is updated, for example, it is removed from the queue or marked as executed. The timer continues to trigger and the above process is repeated. Thereby, the purpose of periodically storing the incremental data of the file system can be achieved.
[0048] This embodiment polls the task queue through a timer and retrieves tasks from the task queue for execution, which is beneficial for periodically backing up incremental data in the file system.
[0049] In an exemplary embodiment, after responding to the first freeze instruction and freezing the write operation function of the file system, the method further includes: generating a create instruction; sending the create instruction to the primary storage device and the backup storage device, wherein the primary storage device is used to create a primary snapshot device based on the create instruction, and the backup storage device is used to create a backup snapshot device based on the create instruction; generating a first thawing instruction when it is determined that a connection is established between the primary snapshot device and the primary storage device, and a connection is established between the backup snapshot device and the backup storage device; detecting the operating state of the primary storage system to obtain state information; when it is determined from the state information that the primary storage system is in a normal operating state, sending the first thawing instruction to the file system to unfreeze the write operation function of the file system; wherein the file system is further used to continue to respond to the second write operation instruction sent by the client within a second clock cycle when unfreezing the write operation function, write the second data sent by the client into the primary storage device by using the write operation function, and write the second data into the primary snapshot device to replace the first incremental data, back up the second data to the backup storage device through the primary snapshot device, and the backup storage device stores the second data in the backup snapshot device to replace the first backup incremental data.
[0050] Optionally, when the primary storage device creates a primary snapshot device, the data on the primary storage device is copied or snapshotted to create a data copy that is identical to the current state. The primary snapshot device can be used for backup, data recovery, or testing new software updates without affecting the data and operation on the primary storage device. When the backup storage device creates a backup snapshot device, the data on the backup storage device is copied or snapshotted to ensure that the backup storage device can quickly take over data storage and processing tasks when the primary storage device fails. The backup snapshot device can be used for disaster recovery, data synchronization, or data migration without affecting the operation of the primary storage device.
[0051] The creation of snapshots needs to be implemented through storage management software or hardware. In this embodiment, it is an incremental snapshot (containing only the data that has changed since the last snapshot). After the snapshot is created, the incremental data is copied to another storage device, thereby creating a primary snapshot device or a backup snapshot device. When restoring data, the integrity and consistency of the data can be guaranteed. This embodiment also needs to manage the storage space occupied by the snapshot to ensure that the resources of the primary storage device and the backup storage device are reasonably allocated. The status of the snapshot device needs to be monitored regularly to ensure the effectiveness of the data backup and recovery strategy. In this way, the primary storage device and the backup storage device can work together to ensure the security, availability and reliability of the data.
[0052] Optionally, in this embodiment, a command line tool may be used to detect the status of the primary storage system, including checking system logs, hardware status indicators, performance indicators, etc. The collected logs and performance indicators are checked to determine whether the primary storage system is in a normal operating state.
[0053] When the primary storage system is confirmed to be operating normally, consider whether the conditions for unfreezing the write operation function of the file system are met. This includes confirming that there is no ongoing maintenance operation and that the storage performance is normal. Once it is confirmed that the primary storage system is in normal operation, a thawing command can be sent. Unfreeze the write operation function of the file system. After sending the thawing command, it is necessary to check the system status again to confirm that the write operation function has been successfully restored. This can be verified by attempting a write operation or checking the system log. It should be noted that if the primary storage system is not in normal operation, the write operation function of the file system needs to continue to be frozen. Switch to the backup storage system to perform the data write operation function. To ensure the real-time performance of data processing.
[0054] This embodiment can effectively store incremental data within a cycle by creating a primary snapshot device and a backup snapshot device. Thus, during data recovery, the amount of data to be recovered is reduced and the speed of data recovery is accelerated. After the primary snapshot device and the backup snapshot device are created, the write operation function of the file system is restored in a timely manner, ensuring the performance of data storage.
[0055] In an exemplary embodiment, controlling the main storage device to back up the first incremental data to the main snapshot device includes: detecting the operating status of the main storage system to obtain status information; and when it is determined from the status information that the main storage system is in a normal operating state, controlling the main storage device to back up the first incremental data to the main snapshot device.
[0056] Optionally, the primary storage device may back up the first incremental data to the primary snapshot device by directly copying, using a copy service, or transmitting through a network.
[0057] In this embodiment, the incremental data of the primary storage device is copied to the primary snapshot device. If a system failure or data loss occurs, these snapshots can be used to restore the system to the state at the time of backup.
[0058] In an exemplary embodiment, after sending a backup instruction to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, the method also includes: detecting the operating status of the primary storage system to obtain status information; when it is determined from the status information that the primary storage system is in an abnormal operating state, generating a data recovery instruction, wherein the abnormal operating state includes at least one of the following: an abnormality in the file system writing data, an abnormality in the primary storage device storing data, and an abnormality in the primary snapshot device; and restoring the first incremental data to the primary storage device based on the data recovery instruction.
[0059] Optionally, the first incremental data stored in the primary snapshot device is restored to the primary storage device based on the data recovery instruction, including: sending the data recovery instruction to the backup storage device; restoring the first backup incremental data stored in the backup snapshot device to the backup storage device through the backup storage device; when the primary storage system resumes normal operation, restoring the first backup incremental data restored to the backup storage device to the primary snapshot device; restoring the first backup incremental data in the primary snapshot device to the primary storage device, so as to restore the first incremental data to the primary storage device.
[0060] Optionally, this embodiment needs to select a data recovery method based on the specific cause of the failure of the primary storage system. For example, after the primary storage device is restored after a failure, the first incremental data in the primary snapshot device can be directly copied to the primary storage device. After the primary storage device and the primary snapshot device are both restored after a failure, it is necessary to copy the first backup incremental data from the backup snapshot device to the backup storage device, the backup storage device to copy the first backup incremental data to the primary snapshot device, and the primary snapshot device to copy the first backup incremental data to the primary storage device.
[0061] This embodiment performs data recovery through the primary snapshot device and the backup snapshot device, thereby avoiding the time cost caused by full data copying and increasing the speed of data recovery.
[0062] In an exemplary embodiment, after the first incremental data is restored to the primary storage device based on the data recovery instruction, the method further includes: generating a second thawing instruction; sending the second thawing instruction to the file system to unfreeze the write operation function of the file system; wherein the file system is also used to continue to respond to the third write operation instruction sent by the client within a third clock cycle when unfreezing the write operation function, using the write operation function to write the third data sent by the client to the primary storage device, and write the third data to the primary snapshot device to replace the first incremental data, back up the third data to the backup storage device through the primary snapshot device, and the backup storage device stores the third data in the backup snapshot device to replace the first backup incremental data.
[0063] Optionally, when data recovery is completed and the primary storage system is in normal operation, a thawing command can be sent to unfreeze the write operation function of the file system. After sending the thawing command, the system status needs to be checked again to confirm that the write operation function has been successfully restored. This can be verified by attempting a write operation or viewing the system log. It should be noted that when the primary storage system is not in normal operation, the write operation function of the file system needs to continue to be frozen. Switch to the backup storage system to perform the data write operation function. To ensure the real-time nature of data processing.
[0064] This embodiment ensures the performance of data storage by timely restoring the write operation function of the file system.
[0065] The present application is described below in conjunction with specific embodiments:
[0066] This specific embodiment takes NAS as an example to illustrate the main storage system, and provides a NAS disaster recovery solution based on periodic asynchronous operation. Figure 7 As shown, it is a timing diagram of NAS disaster recovery data in this specific embodiment, which specifically includes the following steps:
[0067] S70 1, data writing process, the writing operation is written to NAS storage through the NFS / CIFS client, and written to XFS through the server process; XFS writes to the backend volume / disk and returns to the client,
[0068] S702, periodic asynchronous snapshot device creation process, the timer agent periodically runs in the NAS kvm virtual machine and is started regularly according to the user-set policy. At the beginning of a cycle, the timer calls the freeze instruction to freeze the write operation function of the file system. After freezing, the primary storage system creates a snapshot command to notify the primary storage device (primary volume) and the backup storage device (slave volume) to create a snapshot, and obtain the primary snapshot device (primary snapshot volume) and the backup snapshot device (slave snapshot volume). After the primary and slave volume snapshots are successfully processed, the timer unfreezes the file system and resumes writing data.
[0069] S703, the underlying volume replication process, in a remote replication cycle, after the master volume snapshot is created, the slave volume snapshot created by the slave volume in the backup storage system is notified to recover data after replication failure, and after the master and slave volumes are successfully created, the periodic asynchronous snapshot data is synchronized.
[0070] This specific embodiment can avoid the time cost caused by full data copying, and the timer strategy can be flexibly adjusted, and the RPO can be flexibly customized according to the actual business scenario.
[0071] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0072] In the present embodiment, a data backup device is also provided, which is applied to a primary storage system, wherein the primary storage system includes a clock control device, a file system and a primary storage device connected in sequence. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions thereof will not be repeated. As used below, the term "module" may implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0073] Figure 8 is a structural block diagram of a data backup device according to an embodiment of the present application, such as Figure 8 As shown, the device comprises:
[0074] A first calling module 82, configured to call a first freeze instruction when a first clock cycle of a clock control device is reached;
[0075] A first response module 84, configured to respond to a first freezing instruction and freeze the write operation function of the file system;
[0076] A first control module 86 is used to control the primary storage device to back up first incremental data to the primary snapshot device, wherein the first incremental data is data sent by the client to the primary storage device by the file system in response to the first write operation instruction sent by the client in the first clock cycle, using the write operation function, and the primary snapshot device is a pre-created device connected to the primary storage device;
[0077] The first sending module 88 is used to send a backup instruction to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, wherein the first backup incremental data is the data that the primary storage system controls the primary snapshot device to back up the first incremental data to the backup storage device, and the backup snapshot device is a pre-created device connected to the backup storage device.
[0078] In an exemplary embodiment, the clock control device includes a listener, a task processor and a timer connected in sequence, wherein the above-mentioned first calling module 82 includes: a first listening unit, which is used to listen to the port of the command line tool connected to the main storage system through the listener, wherein the command line tool is used to generate a freeze command, and one freeze command corresponds to one clock cycle; a first acquisition unit, which is used to acquire the freeze command from the port through the task processor when the listener listens to the freeze command from the port; a first insertion unit, which is used to insert the freeze command into the task queue according to the corresponding clock cycle through the task processor, wherein one or more freeze commands in the task queue are set according to the corresponding clock cycle; a first polling unit, which is used to poll the task queue through the timer, and when the first clock cycle is reached, call the first freeze command from the task queue, wherein the first freeze command is a command among multiple freeze commands.
[0079] In an exemplary embodiment, the above-mentioned device also includes: a first generating module, which is used to generate a creation instruction after responding to the first freezing instruction and freezing the write operation function of the file system; a first sending module, which is used to send the creation instruction to the primary storage device and the backup storage device, wherein the primary storage device is used to create a primary snapshot device based on the creation instruction, and the backup storage device is used to create a backup snapshot device based on the creation instruction; a second generating module, which is used to generate a first thawing instruction when it is determined that a connection is established between the primary snapshot device and the primary storage device, and a connection is established between the backup snapshot device and the backup storage device; a first detecting module, which is used to detect the operating status of the primary storage system and obtain status information; The second sending module is used to send a first thawing instruction to the file system to unfreeze the write operation function of the file system when it is determined from the status information that the main storage system is in a normal operating state; wherein the file system is also used to continue to respond to the second write operation instruction sent by the client within a second clock cycle when unfreezing the write operation function, use the write operation function to write the second data sent by the client to the main storage device, and write the second data to the main snapshot device to replace the first incremental data, back up the second data to the backup storage device through the main snapshot device, and the backup storage device stores the second data in the backup snapshot device to replace the first backup incremental data.
[0080] In an exemplary embodiment, the above-mentioned first control module includes: a first detection unit, used to detect the operating status of the main storage system and obtain status information; a first control unit, used to control the main storage device to back up the first incremental data to the main snapshot device when it is determined from the status information that the main storage system is in a normal operating state.
[0081] In an exemplary embodiment, the above-mentioned device also includes: a second detection module, which is used to send a backup instruction to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, and then detect the operating status of the main storage system to obtain status information; a third generation module, which is used to generate a data recovery instruction when it is determined from the status information that the main storage system is in an abnormal operating state, wherein the abnormal operating state includes at least one of the following: an abnormality in the file system writing data, an abnormality in the storage of data by the main storage device, and an abnormality in the main snapshot device; a first recovery module, which is used to restore the first incremental data to the main storage device based on the data recovery instruction.
[0082] In an exemplary embodiment, the above-mentioned first recovery module includes: a first sending unit, used to send a data recovery instruction to a backup storage device; a first recovery unit, used to recover the first backup incremental data stored in the backup snapshot device to the backup storage device through the backup storage device; a second recovery unit, used to recover the first backup incremental data recovered to the backup storage device to the main snapshot device when the main storage system recovers to normal operating state; a third recovery unit, used to recover the first backup incremental data in the main snapshot device to the main storage device, so as to recover the first incremental data to the main storage device.
[0083] In an exemplary embodiment, the above-mentioned device also includes: a third sending module, which is used to send a second thawing instruction to the file system after restoring the first incremental data to the main storage device based on the data recovery instruction to unfreeze the write operation function of the file system; wherein the file system is also used to continue to respond to the third write operation instruction sent by the client within a third clock cycle when unfreezing the write operation function, use the write operation function to write the third data sent by the client to the main storage device, and write the third data to the main snapshot device to replace the first incremental data, back up the third data to the backup storage device through the main snapshot device, and the backup storage device stores the third data in the backup snapshot device to replace the first backup incremental data.
[0084] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0085] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0086] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0087] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.
[0088] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0089] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0090] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0091] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0092] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0093] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0094] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data backup method, characterized in that: Applied to a main storage system, the main storage system includes a clock control device, a file system and a main storage device connected in sequence, the method includes: In case of reaching a first clock cycle of the clock control device, calling a first freeze instruction; In response to the first freezing instruction, freezing the write operation function of the file system; Control the primary storage device to back up first incremental data to a primary snapshot device, wherein the first incremental data is data sent by the client to the primary storage device in response to the first write operation instruction sent by the client by the file system within the first clock cycle, and the primary snapshot device is a pre-created device connected to the primary storage device. A backup instruction is sent to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, wherein the first backup incremental data is the data that the primary storage system controls the primary snapshot device to back up the first incremental data to the backup storage device, and the backup snapshot device is a pre-created device connected to the backup storage device.
2. The method according to claim 1, characterized in that The clock control device includes a listener, a task processor and a timer connected in sequence, wherein: When a first clock cycle of the clock control device is reached, calling a first freeze instruction comprises: Monitoring a port of a command line tool connected to the primary storage system through the monitor, wherein the command line tool is used to generate a freeze command, and one freeze command corresponds to one clock cycle; When the listener listens to the freeze command from the port, the task processor obtains the freeze command from the port; Inserting the freeze command into the task queue according to the corresponding clock cycle by the task processor, wherein one or more freeze commands in the task queue are set according to the corresponding clock cycle; The task queue is polled by the timer, and when the first clock cycle is reached, the first freeze command is called from the task queue, wherein the first freeze command is a command among the plurality of freeze commands.
3. The method according to claim 1, characterized in that: After responding to the first freezing instruction and freezing the write operation function of the file system, the method further includes: Generate creation instructions; Sending the creation instruction to the primary storage device and the backup storage device, wherein the primary storage device is used to create the primary snapshot device based on the creation instruction, and the backup storage device is used to create the backup snapshot device based on the creation instruction; In the case where it is determined that a connection is established between the primary snapshot device and the primary storage device, and a connection is established between the backup snapshot device and the backup storage device, generating a first thawing instruction; Detecting the operating status of the primary storage system to obtain status information; In a case where it is determined from the status information that the primary storage system is in a normal operating state, sending the first unfreeze instruction to the file system to unfreeze the write operation function of the file system; Among them, the file system is also used to continue to respond to the second write operation instruction sent by the client within a second clock cycle when the write operation function is unfrozen, use the write operation function to write the second data sent by the client to the primary storage device, and write the second data to the primary snapshot device to replace the first incremental data, back up the second data to the backup storage device through the primary snapshot device, and the backup storage device stores the second data in the backup snapshot device to replace the first backup incremental data.
4. The method according to claim 1, characterized in that: Controlling the primary storage device to back up the first incremental data to the primary snapshot device includes: Detecting the operating status of the primary storage system to obtain status information; When it is determined from the status information that the primary storage system is in a normal operating state, the primary storage device is controlled to back up the first incremental data to the primary snapshot device.
5. The method according to claim 1, characterized in that After sending a backup instruction to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, the method further includes: Detecting the operating status of the primary storage system to obtain status information; In the case where it is determined from the status information that the primary storage system is in an abnormal operation state, a data recovery instruction is generated, wherein the abnormal operation state includes at least one of the following: an abnormality occurs in the writing of data by the file system, an abnormality occurs in the storage of data by the primary storage device, and an abnormality occurs in the primary snapshot device; The first incremental data is restored to the primary storage device based on the data recovery instruction.
6. The method according to claim 5, characterized in that Restoring the first incremental data stored in the primary snapshot device to the primary storage device based on the data recovery instruction includes: Sending the data recovery instruction to the backup storage device; Restoring the first backup incremental data stored in the backup snapshot device to the backup storage device through the backup storage device; When the primary storage system is restored to a normal operating state, restoring the first backup incremental data restored to the backup storage device to the primary snapshot device; The first backup incremental data in the primary snapshot device is restored to the primary storage device, so as to restore the first incremental data to the primary storage device.
7. The method according to claim 5, characterized in that After restoring the first incremental data to the primary storage device based on the data recovery instruction, the method further includes: generating a second thawing instruction; sending the second unfreezing instruction to the file system to unfreeze the write operation function of the file system; In which, the file system is also used to continue to respond to the third write operation instruction sent by the client within a third clock cycle when the write operation function is unfrozen, use the write operation function to write the third data sent by the client to the primary storage device, and write the third data to the primary snapshot device to replace the first incremental data, back up the third data to the backup storage device through the primary snapshot device, and the backup storage device stores the third data in the backup snapshot device to replace the first backup incremental data.
8. A data backup device, characterized in that: Applied to a main storage system, the main storage system includes a clock control device, a file system and a main storage device connected in sequence, the device includes: A first calling module, configured to call a first freezing instruction when a first clock cycle of the clock control device is reached; A first response module, configured to respond to the first freeze instruction and freeze the write operation function of the file system; A first control module is configured to control the primary storage device to back up first incremental data to a primary snapshot device, wherein the first incremental data is data that the file system responds to a first write operation instruction sent by a client within the first clock cycle, and uses the write operation function to write the first data sent by the client to the primary storage device, and the primary snapshot device is a pre-created device connected to the primary storage device; The first sending module is used to send a backup instruction to the backup storage system to instruct the backup storage system to control the backup storage device to back up the first backup incremental data to the backup snapshot device, wherein the first backup incremental data is the data that the primary storage system controls the primary snapshot device to back up the first incremental data to the backup storage device, and the backup snapshot device is a pre-created device connected to the backup storage device.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Application data migration method and device, storage medium, electronic equipment and program product
CN121858253A
Migration method and device of application data, storage medium, electronic device and program product
CN121858253B
Data backup method and apparatus, and device, storage medium and program product
WO2026144244A1
