[go: up one dir, main page]

WO2020244059A1 - Data backup method, apparatus and device based on network block device, and storage medium - Google Patents

Data backup method, apparatus and device based on network block device, and storage medium Download PDF

Info

Publication number
WO2020244059A1
WO2020244059A1 PCT/CN2019/101718 CN2019101718W WO2020244059A1 WO 2020244059 A1 WO2020244059 A1 WO 2020244059A1 CN 2019101718 W CN2019101718 W CN 2019101718W WO 2020244059 A1 WO2020244059 A1 WO 2020244059A1
Authority
WO
WIPO (PCT)
Prior art keywords
network block
mirroring
data backup
block device
client kernel
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.)
Ceased
Application number
PCT/CN2019/101718
Other languages
French (fr)
Chinese (zh)
Inventor
王新
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2020244059A1 publication Critical patent/WO2020244059A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1464Management of the backup or restore process for networked environments

Definitions

  • This application relates to the field of network block devices, and in particular to data backup methods, devices, devices and storage media based on network block devices.
  • Network block device (network block device referred to as nbd device) It is a block device widely used in linux system.
  • This application provides a data backup method, device, device and storage medium based on network block devices, aiming to improve the data security of network block devices.
  • the data backup method based on a network block device includes the following steps:
  • the client kernel When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and network block devices corresponding to the rbd-nbd process;
  • the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information;
  • the client kernel determines a second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device to perform data backup .
  • the client kernel when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and network block devices corresponding to the rbd-nbd process, including:
  • the client kernel When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network block device among the pre-stored network block devices;
  • the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process;
  • the client kernel When there is no network block device in the idle state, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the corresponding rbd-nbd process Network block device.
  • the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information
  • the steps include:
  • the client kernel reads the service level information in the first mirroring device, and determines whether the service level information includes a second mirroring device identifier;
  • the service level information includes the second mirroring device identifier, and it is determined that the data backup condition is met;
  • the service level information does not include the second mirroring device identifier, it is determined that the data backup condition is not met.
  • the client kernel determines a second mirroring device according to the service level information, and establishes a second connection between the network block device and the second mirroring device
  • the steps to perform data backup include:
  • the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and assigning the second mirroring device identifier to the second mirroring device;
  • the client kernel determines a second mirroring device according to the service level information, and establishes a second connection between the network block device and the second mirroring device
  • the steps to perform data backup include:
  • the client kernel When the client kernel receives an operation request based on the network block device, acquiring the first connection relationship and the second connection relationship corresponding to the network block device;
  • the client kernel sends the operation request to the first mirroring device corresponding to the first connection relationship, so that the first mirroring device feeds back first operation information;
  • the client kernel sends the operation request to the second mirroring device corresponding to the second connection relationship, so that the second mirroring device feeds back second operation information;
  • the client kernel When the client kernel does not receive the first operation information and the second operation information at the same time, it outputs a prompt message indicating that the network block device is abnormally connected to prompt the client corresponding to the user.
  • the client kernel determines a second mirroring device according to the service level information, and establishes a second connection between the network block device and the second mirroring device After the steps to perform data backup, it also includes:
  • the client kernel determines whether the network block device is simultaneously connected to the first mirroring device and the second mirroring device;
  • a prompt message indicating that the network block device is abnormally connected is output to prompt the client to correspond to the user.
  • the client kernel determines a second mirroring device according to the service level information, and establishes a second connection between the network block device and the second mirroring device After the steps to perform data backup, it also includes:
  • the client kernel When the client kernel receives the network block device deletion instruction, acquiring the device block identifier corresponding to the deletion instruction;
  • the client kernel obtains the connection relationship corresponding to the device block identifier, disconnects the connection relationship, and deletes the network block device corresponding to the device block identifier.
  • this application also provides a data backup device based on network block equipment, the data backup device based on network block equipment includes:
  • An information acquisition module which is used to acquire the process parameters and network block devices corresponding to the rbd-nbd process when the client kernel detects that the rbd-nbd process is started for the first time;
  • the first establishment module is used for the client kernel to determine a first mirroring device according to the process parameters, and to establish a first connection relationship between the network block device and the first mirroring device;
  • a backup judgment module configured to, when the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and judges whether the data backup condition is met according to the service level information;
  • the second establishment module is configured to, when the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second mirroring device between the network block device and the second mirroring device Connection relationship for data backup.
  • this application also provides a data backup device based on a network block device
  • the data backup device based on the network block device includes: a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor, wherein:
  • this application also provides a computer storage medium
  • the computer storage medium stores computer readable instructions, and when the computer readable instructions are executed by the processor, the steps of the data backup method based on the network block device as described above are realized.
  • the embodiment of the application proposes a data backup method, device, device and storage medium based on a network block device.
  • the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the rbd-nbd process Corresponding process parameters and network block devices; the client kernel determines the first mirroring device according to the process parameters, and establishes a first connection relationship between the network block device and the first mirroring device; in the When the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and judges whether the data backup condition is met according to the service level information; when the data backup condition is met, the The client kernel determines the second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device to perform data backup.
  • the network block device is established with multiple mirroring devices to prevent the problem of data loss caused by the failure of one mirroring device, and to improve the data security of the network block device.
  • FIG. 1 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application;
  • FIG. 2 is a schematic flowchart of a first embodiment of a data backup method based on network block devices according to this application;
  • FIG. 3 is a schematic diagram of functional modules of an embodiment of a data backup device based on a network block device according to the present application.
  • a network block device is usually connected to a mirroring device to facilitate data query of the network block device.
  • the mirroring device fails, it will cause the application readable instructions
  • the business process cannot be executed normally; this application proposes to set up multiple mapping relationships in response to the above problems, and open multiple mirroring devices (rbd-image) in the rbd-nbd process according to requirements. Then establish data redundancy on multiple mirroring devices. For example, there are mirroring device A and mirroring device B, Both mirroring devices are turned on at the same time, and the network block device sends data write requests to both mirroring device A and mirroring device B at the same time to realize data backup based on the network block device.
  • the network block device can read and write data from the mirroring device B to ensure service availability.
  • Figure 1 is a terminal (also called a client or a data backup device based on a network block device) of the hardware operating environment involved in the solution of the embodiment of the present application.
  • the data backup device based on the network block device can be a separate
  • the structure of the data backup device based on the network block device can also be formed by combining other devices and the data backup device based on the network block device).
  • the terminal of the embodiment of the present application may be a fixed terminal or a mobile terminal.
  • the terminal may include a processor 1001, for example, a central processing unit Central. Processing Unit, CPU), network interface 1004, user interface 1003, memory 1005, communication bus 1002.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as WIreless-FIdelity, WIFI interface).
  • the memory 1005 can be a high-speed RAM memory or a stable memory (non-volatile memory), for example, disk storage.
  • the memory 1005 may also be a storage device independent of the foregoing processor 1001.
  • terminal structure shown in FIG. 1 does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine some components, or arrange different components.
  • the computer software product is stored in a storage medium (storage medium: also called computer storage medium, computer medium, readable medium, readable storage medium, computer readable storage medium, or directly called medium, etc., storage medium
  • storage medium can be a non-volatile readable storage medium, such as RAM, magnetic disk, optical disk, and includes several instructions to make a terminal device (can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute this application
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and computer-readable instructions.
  • the network interface 1004 is mainly used to connect to a background server and perform data communication with the background server;
  • the user interface 1003 is mainly used to connect to a client (user side) and perform data communication with the client; and the processor 1001 may be used to call computer-readable instructions stored in the memory 1005 and execute the steps in the network block device-based data backup method provided in the following embodiments of the present application.
  • This embodiment provides a data backup method based on network block devices, which is applied to the client as shown in FIG. 1.
  • the data backup method based on the network block device includes:
  • Step S10 when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and the network block device corresponding to the rbd-nbd process.
  • the client kernel When the client kernel detects that the rbd-nbd process is started for the first time, for example, when the user operates the application readable instructions in the client, the client kernel creates the rbd-nbd process corresponding to the application readable instructions and starts the rbd-nbd process for the first time ,
  • the network block device driver loaded in the client kernel determines the network block device according to the rbd-nbd process, specifically, including:
  • Step S11 when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network block device in the pre-stored network block device.
  • the client kernel When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters corresponding to the rbd-nbd process, where the process parameters include access information or identification information (the identification information may include the identification of the mirroring device in the storage cluster) And so on, after obtaining the process parameters, the client kernel traverses each pre-stored network block device that has been created to determine whether the pre-stored network block device has an idle network block device.
  • the process parameters include access information or identification information (the identification information may include the identification of the mirroring device in the storage cluster)
  • Step S12 When there is an idle network block device, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process.
  • the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process.
  • Step S13 when there is no idle network block device, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the rbd- The network block device corresponding to the nbd process.
  • the client kernel When there is no idle network block device in the created pre-stored network block device of the client kernel, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as rbd -The network block device corresponding to the nbd process.
  • the status of the network block device is determined by traversing the network block device to improve the utilization of the network block device, and the network block device that meets the requirements is determined for the rbd-nbd process.
  • Step S20 The client kernel determines a first mirroring device according to the process parameters, and establishes a first connection relationship between the network block device and the first mirroring device.
  • the client kernel determines the first mirroring device according to the process parameters.
  • the process parameters include the first mirroring device identifier.
  • the client kernel determines the first mirroring device corresponding to the first mirroring device identifier, and establishes the network block device and the first mirroring device. For the first connection relationship between devices, it can be understood that the first mirroring device identifier corresponds to only one first mirroring device.
  • Step S30 When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information.
  • the client kernel reads the service level information in the first mirroring device to determine whether to perform data backup, which specifically includes:
  • Step a1 when the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and determines whether the service level information includes a second mirroring device identifier;
  • Step a2 including the second mirroring device identifier in the service level information, and determining that the data backup condition is met;
  • Step a3 The service level information does not include the second mirroring device identifier, and it is determined that the data backup condition is not met.
  • the client kernel reads the preset area in the first mirroring device (the preset area refers to the storage area preset in the mirroring device for storing service level information, for example, the first The area corresponding to the first 1M storage space in a mirroring device) service level information, the service level information includes the second mirroring device identifier, and the client kernel determines that it meets the data backup conditions; the service level information does not include the second mirroring device Identification, the client kernel determines that the data backup conditions are not met.
  • the preset area refers to the storage area preset in the mirroring device for storing service level information, for example, the first The area corresponding to the first 1M storage space in a mirroring device
  • the service level information includes the second mirroring device identifier
  • the client kernel determines that it meets the data backup conditions
  • the service level information does not include the second mirroring device Identification
  • the client kernel determines that the data backup conditions are not met.
  • Step S40 When the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device, so as to Make a data backup.
  • the client kernel determines that the data backup conditions are met, the client kernel needs to determine the second mirroring device corresponding to the network block device, which specifically includes:
  • Step b1 when the data backup condition is met, obtain the second mirror device identifier in the service level information, and obtain the free storage space information of each device in each preset storage cluster;
  • Step b2 according to the free storage space information, use the device with the largest free storage space as the second mirroring device corresponding to the network block device, and assign the second mirroring device identifier to the second mirroring device;
  • Step b3 Establish a second connection relationship between the network block device and the second mirroring device to perform data backup.
  • the client kernel obtains the second mirror device identifier in the service level information, and obtains the free storage space information of each device in each preset storage cluster, where the preset storage cluster refers to the preset storage cluster The storage cluster to which the mirroring device belongs; the client kernel uses the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and the client kernel registers the corresponding second mirroring device according to the second mirroring device identifier , In order to realize that the second mirroring device identifier is assigned to the second mirroring device. After the second mirroring device is determined, the client kernel establishes a second connection relationship between the network block device and the second mirroring device for data backup. In this embodiment, by establishing multiple mirroring devices for the network block device, the problem of data loss caused by a failure of one mirroring device is prevented and the data security of the network block device is improved.
  • the number of second mirroring devices in this embodiment can be one or more. That is, the client kernel in this embodiment can also obtain free storage space information in each preset storage cluster.
  • the largest target device for example, if there are 3 preset storage clusters, you can get 3 target devices, and then extract the preset number from the target device (the preset number refers to the number of network block devices set in advance.
  • the number can be set according to specific scenarios, for example, set to 2 devices as the second mirroring device.
  • the preset storage cluster has cluster a, cluster b, and cluster c; wherein cluster a includes equipment a1, equipment a2, equipment a3, and equipment a4; cluster b includes equipment b1, equipment b2, equipment b3, and equipment b4; Cluster c includes device c1, device c2, device c3, and device c4.
  • the client kernel obtains the preset number of devices with the largest free storage space information in different preset storage clusters as the second mirroring device, for example, the preset number is 2 , The client kernel obtains device a4, device b2, and device c3 with the largest free storage space information in each cluster, and then obtains the larger two of device a4, device b2, and device c3 as the second mirroring device.
  • multiple second mirroring devices are set in different preset storage clusters to ensure data security.
  • This embodiment is a step after step S40 in the first embodiment of this application.
  • it is determined whether there is a connection abnormality problem, that is, after the network block device determines multiple mirroring devices, the client The end kernel performs read and write operations on multiple mirroring devices at the same time, and determines whether the network block device connection is abnormal according to whether the mirroring device feeds back operation information.
  • the data backup method based on the network block device includes:
  • Step S50 when the client kernel receives an operation request based on the network block device, obtain the first connection relationship and the second connection relationship corresponding to the network block device.
  • the client core obtains the first connection relationship and the second connection relationship, so that the client core sends the operation request according to the obtained first connection relationship and the second connection relationship, specifically:
  • Step S60 the client kernel sends the operation request to the first mirror device corresponding to the first connection relationship; the client kernel sends the operation request to the second connection relationship The second mirroring device;
  • the client kernel sends the operation request to the first mirroring device according to the first connection relationship, so that the first mirroring device feeds back the first operation information, that is, when the first mirroring device receives the operation request sent by the client kernel, the first mirroring device
  • the mirroring device executes the operation request and obtains the first operation information corresponding to the operation request, and the first mirroring device feeds back the first operation information to the client kernel.
  • the client kernel sends the operation request to the second mirroring device according to the second connection relationship, so that the second mirroring device feeds back the second operation information, that is, when the second mirroring device receives the operation request sent by the client kernel, the second mirroring device
  • the mirroring device executes the operation request to obtain second operation information corresponding to the operation request, and the second mirroring device feeds back the second operation information to the client kernel.
  • the client kernel determines whether the connection of the network block device is normal according to whether the first operation information and the second operation information are received at the same time, that is,
  • Step S70 When the client kernel does not receive the first operation information and the second operation information at the same time, output a prompt message indicating that the network block device is abnormally connected to prompt the client corresponding to the user.
  • the client kernel When the client kernel does not receive the first operation information and the second operation information at the same time, it outputs a prompt message indicating that the network block device is abnormally connected to remind the client corresponding to the user; that is, the client core does not receive the first operation information , It is determined that the first connection relationship between the network block device and the first mirroring device is abnormal. Similarly, the client kernel does not receive the second operation information, and it is determined that the second connection relationship between the network block device and the second mirroring device is abnormal. .
  • the client kernel determines whether the connection of the network block device is abnormal according to whether the operation information is received at the same time, so as to prompt promptly when the connection of the network block device is abnormal. It should be supplemented that in this embodiment, when the network block device is abnormally connected, the client kernel determines the faulty mirror device, and the client kernel obtains the mirror device ID of the mirror device pair; the upper layer application that traces the mirror device ID The information acquires other mirroring devices other than the fault associated with the application information, and responds to the device to ensure data security.
  • This embodiment is a step after step S40 in the first embodiment of this application.
  • the difference between this embodiment and the second embodiment of this application is that in this embodiment, when the rbd-nbd process is restarted, it is detected whether the network block device is connected to multiple devices at the same time.
  • a mirroring device determines whether the network block device connection is abnormal.
  • the data backup method based on the network block device includes: To
  • Step S80 When the client kernel detects that the rbd-nbd process is started for the second time, the client kernel judges whether the network block device is connected to the first mirroring device and the second mirroring device at the same time.
  • the client kernel detects the second startup of the rbd-nbd process, and the client kernel obtains the network block device corresponding to the rbd-nbd process and the connection relationship with the network block device (the connection relationship of the network block device includes the first connection relationship and the second connection relationship). Connection relationship), the client kernel determines whether the network block device is abnormally connected according to whether the network block device is connected to the first mirroring device and the second mirroring device at the same time.
  • Step S90 When the network block device is not connected to the first mirroring device and the second mirroring device at the same time, output a prompt message indicating that the network block device is abnormally connected to prompt the client to correspond to the user.
  • a prompt message indicating that the network block device is abnormally connected is output to prompt the client to correspond to the user. That is, in this embodiment, the network block device is connected to all mirror devices at the same time, and it is determined that the network block device is abnormally connected, and real-time detection of the network block device is realized.
  • the client kernel deletes the network block device.
  • the data backup method based on the network block device includes:
  • Step S100 when the client kernel receives the network block device deletion instruction, obtain the device block identifier corresponding to the deletion instruction.
  • the client kernel When the client kernel receives the network block device deletion instruction, it obtains the device block identification corresponding to the deletion instruction, where the identification information of the network block device refers to identification information for identifying the network block device, for example, the network block device number.
  • Step S110 The client kernel obtains the connection relationship corresponding to the device block identifier, disconnects the connection relationship, and deletes the network block device corresponding to the device block identifier.
  • the client kernel obtains the connection relationship corresponding to the device block identifier, where the connection relationship includes a first connection relationship and a second connection relationship.
  • the client kernel first disconnects the connection relationship of the network block device, and deletes the network block device corresponding to the device block identifier ;
  • the client kernel can delete the network block in real time, reducing unnecessary resource occupation.
  • an embodiment of the present application also proposes a data backup device based on a network block device, and the data backup device based on a network block device includes:
  • the information acquisition module 10 is configured to obtain the process parameters and network block devices corresponding to the rbd-nbd process when the client kernel detects that the rbd-nbd process is started for the first time;
  • the first establishing module 20 is used for the client kernel to determine a first mirroring device according to the process parameters, and to establish a first connection relationship between the network block device and the first mirroring device;
  • the backup judgment module 30 is configured to, when the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and judges whether the data backup condition is met according to the service level information ;
  • the second establishment module 40 is configured to, when the data backup conditions are met, the client kernel determines a second mirroring device according to the service level information, and establishes a second mirroring device between the network block device and the second mirroring device Second, the connection relationship for data backup.
  • the information acquisition module 10 includes:
  • the device traversal unit is used for when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network in the pre-stored network block device Block device
  • An idle device determining unit configured to, when there is an idle network block device, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process;
  • the device creation unit is configured to, when there is no idle network block device, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the new network block device.
  • the network block device corresponding to the rbd-nbd process.
  • the backup judgment module 30 includes:
  • the information reading unit is configured to, when the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and judges whether the service level information includes a second mirroring Equipment Identity;
  • the first determining unit is configured to include a second mirroring device identifier in the service level information to determine that the data backup condition is met;
  • the second determining unit is configured to determine that the second mirroring device identifier is not included in the service level information, and the data backup condition is not met.
  • the second establishment module 40 includes:
  • the storage information obtaining unit is configured to obtain the second mirroring device identifier in the service level information, and obtain the free storage space information of each device in each preset storage cluster when the data backup condition is met;
  • the second mirroring device determining unit is configured to use the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and assigning the second mirroring device identifier to the first mirroring device Two mirror equipment;
  • the second establishing unit is configured to establish a second connection relationship between the network block device and the second mirroring device to perform data backup.
  • the data backup device based on network block equipment includes:
  • An operation request receiving module configured to obtain the first connection relationship and the second connection relationship corresponding to the network block device when the client kernel receives an operation request based on the network block device;
  • a first sending module configured for the client kernel to send the operation request to the first mirroring device corresponding to the first connection relationship, so that the first mirroring device feeds back first operation information
  • a second sending module configured for the client kernel to send the operation request to the second mirroring device corresponding to the second connection relationship, so that the second mirroring device feeds back second operation information
  • the first abnormal prompting module is configured to output prompt information of abnormal connection of the network block device when the client core does not simultaneously receive the first operation information and the second operation information, so as to prompt the client to correspond user.
  • the data backup device based on network block equipment includes:
  • connection judgment module is used to judge whether the network block device is connected to the first mirroring device and the second mirroring device when the client kernel detects that the rbd-nbd process is started for the second time ;
  • the second abnormality prompt module is configured to output prompt information of abnormal connection of the network block device when the network block device is not connected to the first mirroring device and the second mirroring device at the same time, so as to prompt the client to correspond to the user .
  • the data backup device based on network block equipment includes:
  • the delete receiving module is used to obtain the device block identifier corresponding to the delete instruction when the client kernel receives the network block device delete instruction;
  • the device deletion module is used for the client kernel to obtain the connection relationship corresponding to the device block identifier, disconnect the connection relationship and delete the network block device corresponding to the device block identifier.
  • each functional module of the data backup device based on the network block device can refer to the various embodiments of the data backup method based on the network block device of the present application, which will not be repeated here.
  • the embodiment of the present application also proposes a computer storage medium.
  • the computer storage medium stores computer readable instructions, and when the computer readable instructions are executed by the processor, the operations in the network block device-based data backup method provided in the foregoing embodiments are implemented.
  • the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.
  • the device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solution of the present application. Those of ordinary skill in the art can understand and implement it without creative work.
  • the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better. ⁇
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above. , Magnetic disk, optical disk), including several instructions to make a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method described in each embodiment of the present application.
  • a terminal device which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed is a data backup method based on a network block device, the method comprising: when a client kernel detects that an rbd-nbd process is initiated for the first time, the client kernel acquiring a process parameter and a network block device corresponding to the rbd-nbd process; determining a first mirror image device according to the process parameter, and the client kernel establishing a first connection relationship between the network block device and the first mirror image device; the client kernel reading service level information in the first mirror image device, and determining, according to the service level information, whether a data backup condition is met; and when the data backup condition is met, the client kernel determining a second mirror image device, and establishing a second connection relationship between the network block device and the second mirror image device, so as to perform a data backup. Further disclosed are a data backup apparatus and device based on a network block device, and a storage medium. In the present application, a network block device is connected to a plurality of mirror image devices to ensure data security.

Description

基于网络块设备的数据备份方法、装置、设备和存储介质 Data backup method, device, equipment and storage medium based on network block equipment To

本申请要求于2019年06月03日提交中国专利局、申请号为201910485602.3、发明名称为“基于网络块设备的数据备份方法、装置、设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。 This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on June 3, 2019, the application number is 201910485602.3, and the invention title is "Data backup methods, devices, equipment and storage media based on network block devices", all of which The content is incorporated in the application by reference.

技术领域Technical field

本申请涉及网络块设备领域,尤其涉及基于网络块设备的数据备份方法、装置、设备和存储介质。This application relates to the field of network block devices, and in particular to data backup methods, devices, devices and storage media based on network block devices.

背景技术Background technique

网络块设备(network block device简称nbd设备) 是linux系统广发使用的一种块设备。Network block device (network block device referred to as nbd device) It is a block device widely used in linux system.

Ceph分布式文件系统中,选取一个创建好的网络块设备,通过网络块设备协议连接使用的时候,需要指定这个网络块设备连接的哪一个镜像设备(又叫rbd image,镜像设备是指分布式存储集群中与网络块设备连接的设备), 然后把这个镜像设备和网络块设备连接起来,使得对这个网络块设备的读写转换为对镜像设备的读写。但是在镜像设备出现故障时,就不能进行数据读写操作,如何解决上述问题提高数据安全性成为了当前亟待解决的技术问题。In the Ceph distributed file system, select a created network block device and use it through the network block device protocol connection. You need to specify which mirror device (also called rbd) the network block device is connected to. image, mirroring device refers to the device connected to the network block device in the distributed storage cluster), Then connect the mirroring device and the network block device, so that the reading and writing of the network block device is converted to the reading and writing of the mirroring device. However, when the mirroring device fails, data reading and writing operations cannot be performed. How to solve the above problems and improve data security has become a technical problem that needs to be solved urgently.

发明内容Summary of the invention

本申请提供一种基于网络块设备的数据备份方法、装置、设备和存储介质,旨在提高网络块设备数据安全性。This application provides a data backup method, device, device and storage medium based on network block devices, aiming to improve the data security of network block devices.

为实现上述目的,本申请提供基于网络块设备的数据备份方法,所述基于网络块设备的数据备份方法包括以下步骤:In order to achieve the above objective, this application provides a data backup method based on a network block device. The data backup method based on a network block device includes the following steps:

在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备;When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and network block devices corresponding to the rbd-nbd process;

所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系;Determining, by the client kernel, a first mirroring device according to the process parameters, and establishing a first connection relationship between the network block device and the first mirroring device;

在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件;When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information;

在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。When the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device to perform data backup .

可选地,所述在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备的步骤,包括:Optionally, when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and network block devices corresponding to the rbd-nbd process, including:

在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取进程参数,并遍历各预存网络块设备,以判断预存网络块设备中是否存在空闲状态的网络块设备;When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network block device among the pre-stored network block devices;

在存在空闲状态的网络块设备时,所述客户端内核将空闲状态的网络块设备作为所述rbd-nbd进程对应的网络块设备;When there is an idle network block device, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process;

在不存在空闲状态的网络块设备时,所述客户端内核通过内核中已加载的网络块设备驱动创建新的网络块设备,并将新的所述网络块设备作为所述rbd-nbd进程对应的网络块设备。When there is no network block device in the idle state, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the corresponding rbd-nbd process Network block device.

可选地,所述在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件的步骤,包括:Optionally, when the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information The steps include:

在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并判断所述服务等级信息中是否包含第二镜像设备标识;When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the service level information includes a second mirroring device identifier;

在所述服务等级信息中包含第二镜像设备标识,判定符合数据备份条件;The service level information includes the second mirroring device identifier, and it is determined that the data backup condition is met;

在所述服务等级信息中不包含第二镜像设备标识,判定不符合数据备份条件。If the service level information does not include the second mirroring device identifier, it is determined that the data backup condition is not met.

可选地,所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤包括:Optionally, when the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection between the network block device and the second mirroring device The steps to perform data backup include:

在符合数据备份条件时,获取所述服务等级信息中的第二镜像设备标识,获取各预设存储机群中各设备的空闲存储空间信息;When the data backup condition is met, obtain the second mirroring device identifier in the service level information, and obtain the free storage space information of each device in each preset storage cluster;

根据所述空闲存储空间信息,将空闲存储空间最大的设备作为所述网络块设备对应的第二镜像设备,并将所述第二镜像设备标识赋予所述第二镜像设备;Using the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and assigning the second mirroring device identifier to the second mirroring device;

建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。Establish a second connection relationship between the network block device and the second mirror device to perform data backup.

可选地,所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤之后,包括:Optionally, when the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection between the network block device and the second mirroring device After the steps to perform data backup, include:

在所述客户端内核接收到基于所述网络块设备的操作请求时,获取所述网络块设备对应的所述第一连接关系和所述第二连接关系;When the client kernel receives an operation request based on the network block device, acquiring the first connection relationship and the second connection relationship corresponding to the network block device;

所述客户端内核将所述操作请求发送至所述第一连接关系对应的所述第一镜像设备,以使所述第一镜像设备反馈第一操作信息;The client kernel sends the operation request to the first mirroring device corresponding to the first connection relationship, so that the first mirroring device feeds back first operation information;

所述客户端内核将所述操作请求发送至所述第二连接关系对应的所述第二镜像设备,以使所述第二镜像设备反馈第二操作信息;The client kernel sends the operation request to the second mirroring device corresponding to the second connection relationship, so that the second mirroring device feeds back second operation information;

在所述客户端内核没有同时接收到所述第一操作信息和所述第二操作信息时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。When the client kernel does not receive the first operation information and the second operation information at the same time, it outputs a prompt message indicating that the network block device is abnormally connected to prompt the client corresponding to the user.

可选地,所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤之后,还包括:Optionally, when the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection between the network block device and the second mirroring device After the steps to perform data backup, it also includes:

在所述客户端内核检测到rbd-nbd进程二次启动时,所述客户端内核判断所述网络块设备是否同时连接所述第一镜像设备和所述第二镜像设备;When the client kernel detects that the rbd-nbd process is started for the second time, the client kernel determines whether the network block device is simultaneously connected to the first mirroring device and the second mirroring device;

在所述网络块设备没有同时连接所述第一镜像设备和所述第二镜像设备时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。When the network block device is not connected to the first mirroring device and the second mirroring device at the same time, a prompt message indicating that the network block device is abnormally connected is output to prompt the client to correspond to the user.

可选地,所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤之后,还包括:Optionally, when the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection between the network block device and the second mirroring device After the steps to perform data backup, it also includes:

在客户端内核接收到网络块设备删除指令时,获取所述删除指令对应的设备块标识;When the client kernel receives the network block device deletion instruction, acquiring the device block identifier corresponding to the deletion instruction;

所述客户端内核获取设备块标识对应的连接关系,断开所述连接关系并删除所述设备块标识对应的网络块设备。The client kernel obtains the connection relationship corresponding to the device block identifier, disconnects the connection relationship, and deletes the network block device corresponding to the device block identifier.

此外,为实现上述目的,本申请还提供一种基于网络块设备的数据备份装置,所述基于网络块设备的数据备份装置包括:In addition, in order to achieve the above objective, this application also provides a data backup device based on network block equipment, the data backup device based on network block equipment includes:

信息获取模块,用于在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备;An information acquisition module, which is used to acquire the process parameters and network block devices corresponding to the rbd-nbd process when the client kernel detects that the rbd-nbd process is started for the first time;

第一建立模块,用于所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系;The first establishment module is used for the client kernel to determine a first mirroring device according to the process parameters, and to establish a first connection relationship between the network block device and the first mirroring device;

备份判断模块,用于在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件;A backup judgment module, configured to, when the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and judges whether the data backup condition is met according to the service level information;

第二建立模块,用于在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。The second establishment module is configured to, when the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second mirroring device between the network block device and the second mirroring device Connection relationship for data backup.

此外,为实现上述目的,本申请还提供一种基于网络块设备的数据备份设备;In addition, in order to achieve the above purpose, this application also provides a data backup device based on a network block device;

所述基于网络块设备的数据备份设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,其中:The data backup device based on the network block device includes: a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor, wherein:

所述计算机可读指令被所述处理器执行时实现如上所述的基于网络块设备的数据备份方法的步骤。When the computer-readable instructions are executed by the processor, the steps of the data backup method based on the network block device as described above are implemented.

此外,为实现上述目的,本申请还提供计算机存储介质;In addition, in order to achieve the above purpose, this application also provides a computer storage medium;

所述计算机存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如上述的基于网络块设备的数据备份方法的步骤。The computer storage medium stores computer readable instructions, and when the computer readable instructions are executed by the processor, the steps of the data backup method based on the network block device as described above are realized.

本申请实施例提出的一种基于网络块设备的数据备份方法、装置、设备和存储介质,在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备;所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系;在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件;在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。本申请中通过将网络块设备建立多个镜像设备,防止一个镜像设备故障导致数据丢失的问题,提高网络块设备数据安全性。The embodiment of the application proposes a data backup method, device, device and storage medium based on a network block device. When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the rbd-nbd process Corresponding process parameters and network block devices; the client kernel determines the first mirroring device according to the process parameters, and establishes a first connection relationship between the network block device and the first mirroring device; in the When the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and judges whether the data backup condition is met according to the service level information; when the data backup condition is met, the The client kernel determines the second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device to perform data backup. In this application, the network block device is established with multiple mirroring devices to prevent the problem of data loss caused by the failure of one mirroring device, and to improve the data security of the network block device.

附图说明Description of the drawings

图1是本申请实施例方案涉及的硬件运行环境的装置结构示意图;FIG. 1 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application;

图2为本申请基于网络块设备的数据备份方法第一实施例的流程示意图;2 is a schematic flowchart of a first embodiment of a data backup method based on network block devices according to this application;

图3为本申请基于网络块设备的数据备份装置一实施例的功能模块示意图。FIG. 3 is a schematic diagram of functional modules of an embodiment of a data backup device based on a network block device according to the present application.

本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.

具体实施方式Detailed ways

应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the application, and are not used to limit the application.

现有技术中在启动rbd-nbd进程时,通常将一个网络块设备与一个镜像设备建立连接,方便网络块设备的数据查询,但是若镜像设备出现故障时,就会导致应用可读指令中的业务流程不可以正常执行;本申请中针对上述问题提出了设置了多映射关系,在rbd-nbd进程根据需求,打开多个镜像设备(rbd-image), 然后在多个镜像设备上面建立数据冗余。比如有镜像设备A和镜像设备B, 这两个镜像设备都同时打开,网络块设备将数据写请求同时都发送到镜像设备A和镜像设备B里面,实现基于网络块设备的数据备份。在出现磁盘故障导致镜像设备A无法读取,或者运维误操作镜像设备A被误删除,那么网络块设备可以从镜像设备B读写数据,保证业务的可用性。In the prior art, when the rbd-nbd process is started, a network block device is usually connected to a mirroring device to facilitate data query of the network block device. However, if the mirroring device fails, it will cause the application readable instructions The business process cannot be executed normally; this application proposes to set up multiple mapping relationships in response to the above problems, and open multiple mirroring devices (rbd-image) in the rbd-nbd process according to requirements. Then establish data redundancy on multiple mirroring devices. For example, there are mirroring device A and mirroring device B, Both mirroring devices are turned on at the same time, and the network block device sends data write requests to both mirroring device A and mirroring device B at the same time to realize data backup based on the network block device. In the event of a disk failure that causes the mirroring device A to be unreadable, or the operation and maintenance misoperation of the mirroring device A to be deleted by mistake, the network block device can read and write data from the mirroring device B to ensure service availability.

如图1所示,图1是本申请实施例方案涉及的硬件运行环境的终端(又叫客户端或者基于网络块设备的数据备份设备,其中,基于网络块设备的数据备份设备可以是由单独的基于网络块设备的数据备份装置构成,也可以是由其他装置与基于网络块设备的数据备份装置组合形成)结构示意图。As shown in Figure 1, Figure 1 is a terminal (also called a client or a data backup device based on a network block device) of the hardware operating environment involved in the solution of the embodiment of the present application. The data backup device based on the network block device can be a separate The structure of the data backup device based on the network block device can also be formed by combining other devices and the data backup device based on the network block device).

本申请实施例终端可以固定终端,也可以是移动终端,如图1所示,该终端可以包括:处理器1001,例如,中央处理器Central Processing Unit,CPU),网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如无线保真WIreless-FIdelity,WIFI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如,磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。The terminal of the embodiment of the present application may be a fixed terminal or a mobile terminal. As shown in FIG. 1, the terminal may include a processor 1001, for example, a central processing unit Central. Processing Unit, CPU), network interface 1004, user interface 1003, memory 1005, communication bus 1002. Among them, the communication bus 1002 is used to implement connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as WIreless-FIdelity, WIFI interface). The memory 1005 can be a high-speed RAM memory or a stable memory (non-volatile memory), for example, disk storage. Optionally, the memory 1005 may also be a storage device independent of the foregoing processor 1001.

本领域技术人员可以理解,图1中示出的终端结构并不构成对终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the terminal structure shown in FIG. 1 does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine some components, or arrange different components.

如图1所示,该计算机软件产品存储在一个存储介质(存储介质:又叫计算机存储介质、计算机介质、可读介质、可读存储介质、计算机可读存储介质或者直接叫介质等,存储介质可以是非易失性可读存储介质,如RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及计算机可读指令。As shown in Figure 1, the computer software product is stored in a storage medium (storage medium: also called computer storage medium, computer medium, readable medium, readable storage medium, computer readable storage medium, or directly called medium, etc., storage medium It can be a non-volatile readable storage medium, such as RAM, magnetic disk, optical disk, and includes several instructions to make a terminal device (can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute this application In the method described in each embodiment, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and computer-readable instructions.

在图1所示的终端中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的计算机可读指令,并执行本申请以下实施例提供的基于网络块设备的数据备份方法中的步骤。In the terminal shown in FIG. 1, the network interface 1004 is mainly used to connect to a background server and perform data communication with the background server; the user interface 1003 is mainly used to connect to a client (user side) and perform data communication with the client; and the processor 1001 may be used to call computer-readable instructions stored in the memory 1005 and execute the steps in the network block device-based data backup method provided in the following embodiments of the present application.

本实施例提供一种基于网络块设备的数据备份方法,应用于如图1所示的客户端。This embodiment provides a data backup method based on network block devices, which is applied to the client as shown in FIG. 1.

参照图2,在本申请基于网络块设备的数据备份方法的第一实施例中,所述基于网络块设备的数据备份方法包括: 2, in the first embodiment of the data backup method based on the network block device of the present application, the data backup method based on the network block device includes: To

步骤S10,在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备。Step S10, when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and the network block device corresponding to the rbd-nbd process.

客户端内核检测到rbd-nbd进程初次启动时,例如,用户对客户端中应用可读指令进行操作时,客户端内核创建应用可读指令对应的rbd-nbd进程,并初次启动rbd-nbd进程,客户端内核中已加载的网络块设备驱动根据rbd-nbd进程确定网络块设备,具体地,包括:When the client kernel detects that the rbd-nbd process is started for the first time, for example, when the user operates the application readable instructions in the client, the client kernel creates the rbd-nbd process corresponding to the application readable instructions and starts the rbd-nbd process for the first time , The network block device driver loaded in the client kernel determines the network block device according to the rbd-nbd process, specifically, including:

步骤S11,在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取进程参数,并遍历各预存网络块设备,以判断预存网络块设备中是否存在空闲状态的网络块设备。Step S11, when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network block device in the pre-stored network block device.

在客户端内核检测到rbd-nbd进程初次启动时,客户端内核获取rbd-nbd进程对应的进程参数,其中,进程参数包括访问信息或标识信息(标识信息可以包括存储集群中镜像设备的标识)等等,在获取到进程参数之后,客户端内核遍历已创建的各个预存网络块设备,判断预存网络块设备是否存在空闲状态的网络块设备。When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters corresponding to the rbd-nbd process, where the process parameters include access information or identification information (the identification information may include the identification of the mirroring device in the storage cluster) And so on, after obtaining the process parameters, the client kernel traverses each pre-stored network block device that has been created to determine whether the pre-stored network block device has an idle network block device.

步骤S12,在存在空闲状态的网络块设备时,所述客户端内核将空闲状态的网络块设备作为所述rbd-nbd进程对应的网络块设备。Step S12: When there is an idle network block device, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process.

在客户端内核的已创建预存网络块设备中存在空闲状态的网络块设备时,客户端内核将空闲状态的网络块设备作为rbd-nbd进程对应的网络块设备。When there is an idle network block device in the created pre-stored network block device of the client kernel, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process.

步骤S13,在不存在空闲状态的网络块设备时,所述客户端内核通过内核中已加载的网络块设备驱动创建新的网络块设备,并将新的所述网络块设备作为所述rbd-nbd进程对应的网络块设备。Step S13, when there is no idle network block device, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the rbd- The network block device corresponding to the nbd process.

客户端内核的已创建预存网络块设备中不存在空闲状态的网络块设备时,客户端内核通过内核中已加载的网络块设备驱动创建新的网络块设备,并将新的网络块设备作为rbd-nbd进程对应的网络块设备。本实施例中通过遍历网络块设备,确定网络块设备的状态,以提高网络块设备的利用率,为rbd-nbd进程确定符合需求的网络块设备。When there is no idle network block device in the created pre-stored network block device of the client kernel, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as rbd -The network block device corresponding to the nbd process. In this embodiment, the status of the network block device is determined by traversing the network block device to improve the utilization of the network block device, and the network block device that meets the requirements is determined for the rbd-nbd process.

步骤S20,所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系。Step S20: The client kernel determines a first mirroring device according to the process parameters, and establishes a first connection relationship between the network block device and the first mirroring device.

客户端内核根据进程参数确定第一镜像设备,例如,进程参数中包含有第一镜像设备标识,客户端内核确定第一镜像设备标识对应的第一镜像设备,并建立网络块设备与第一镜像设备之间的第一连接关系,可以理解的是第一镜像设备标识只对应的一个第一镜像设备。The client kernel determines the first mirroring device according to the process parameters. For example, the process parameters include the first mirroring device identifier. The client kernel determines the first mirroring device corresponding to the first mirroring device identifier, and establishes the network block device and the first mirroring device. For the first connection relationship between devices, it can be understood that the first mirroring device identifier corresponds to only one first mirroring device.

步骤S30,在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件。Step S30: When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information.

在网络块设备与第一镜像设备之间的第一连接关系建立完成时,客户端内核读取第一镜像设备中的服务等级信息,以判断是否进行数据备份,具体地,包括:When the establishment of the first connection relationship between the network block device and the first mirroring device is completed, the client kernel reads the service level information in the first mirroring device to determine whether to perform data backup, which specifically includes:

步骤a1,在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并判断所述服务等级信息中是否包含第二镜像设备标识;Step a1, when the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and determines whether the service level information includes a second mirroring device identifier;

步骤a2,在所述服务等级信息中包含第二镜像设备标识,判定符合数据备份条件;Step a2, including the second mirroring device identifier in the service level information, and determining that the data backup condition is met;

步骤a3,在所述服务等级信息中不包含第二镜像设备标识,判定不符合数据备份条件。Step a3: The service level information does not include the second mirroring device identifier, and it is determined that the data backup condition is not met.

即,在第一连接关系建立完成时,客户端内核读取第一镜像设备中预设区域(预设区域是指在镜像设备中预先设置的用于存储服务等级信息的存储区域,例如,第一镜像设备中的头1M存储空间对应的区域)的服务等级信息,在服务等级信息中包含第二镜像设备标识,客户端内核判定符合数据备份条件;在服务等级信息中不包含第二镜像设备标识,客户端内核判定不符合数据备份条件。That is, when the first connection relationship is established, the client kernel reads the preset area in the first mirroring device (the preset area refers to the storage area preset in the mirroring device for storing service level information, for example, the first The area corresponding to the first 1M storage space in a mirroring device) service level information, the service level information includes the second mirroring device identifier, and the client kernel determines that it meets the data backup conditions; the service level information does not include the second mirroring device Identification, the client kernel determines that the data backup conditions are not met.

步骤S40,在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。Step S40: When the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device, so as to Make a data backup.

在客户端内核确定符合数据备份条件时,客户端内核需要确定网络块设备对应的第二个镜像设备,具体地,包括:When the client kernel determines that the data backup conditions are met, the client kernel needs to determine the second mirroring device corresponding to the network block device, which specifically includes:

步骤b1,在符合数据备份条件时,获取所述服务等级信息中的第二镜像设备标识,获取各预设存储机群中各设备的空闲存储空间信息;Step b1, when the data backup condition is met, obtain the second mirror device identifier in the service level information, and obtain the free storage space information of each device in each preset storage cluster;

步骤b2,根据所述空闲存储空间信息,将空闲存储空间最大的设备作为所述网络块设备对应的第二镜像设备,并将所述第二镜像设备标识赋予所述第二镜像设备;Step b2, according to the free storage space information, use the device with the largest free storage space as the second mirroring device corresponding to the network block device, and assign the second mirroring device identifier to the second mirroring device;

步骤b3,建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。Step b3: Establish a second connection relationship between the network block device and the second mirroring device to perform data backup.

在符合数据备份条件时,客户端内核获取所述服务等级信息中的第二镜像设备标识,并获取各个预设存储机群中各设备的空闲存储空间信息,其中,预设存储机群是指预先设置镜像设备所属的存储集群;客户端内核根据空闲存储空间信息,将空闲存储空间最大的设备作为网络块设备对应的第二镜像设备,客户端内核按第二镜像设备标识注册对应的第二镜像设备,以实现将第二镜像设备标识赋予第二镜像设备,在确定第二镜像设备之后,客户端内核并建立网络块设备与第二镜像设备之间的第二连接关系,以进行数据备份。在本实施例中通过将网络块设备建立多个镜像设备,防止一个镜像设备故障导致数据丢失的问题,提高网络块设备数据安全性。When the data backup conditions are met, the client kernel obtains the second mirror device identifier in the service level information, and obtains the free storage space information of each device in each preset storage cluster, where the preset storage cluster refers to the preset storage cluster The storage cluster to which the mirroring device belongs; the client kernel uses the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and the client kernel registers the corresponding second mirroring device according to the second mirroring device identifier , In order to realize that the second mirroring device identifier is assigned to the second mirroring device. After the second mirroring device is determined, the client kernel establishes a second connection relationship between the network block device and the second mirroring device for data backup. In this embodiment, by establishing multiple mirroring devices for the network block device, the problem of data loss caused by a failure of one mirroring device is prevented and the data security of the network block device is improved.

需要补充说明的是,本实施例中的第二镜像设备的数量可以是一个也可以是多个,即,本实施实例中客户端内核还可以通过获取每个预设存储机群中空闲存储空间信息最大的目标设备,如,有3个预设存储机群,就可以得到3个目标设备,然后从目标设备中抽取预设数量(预设数量是指预先设置的网络块设备个数,其中,预设数量可以根据具体场景设置,例如,设置为2个)的设备作为第二镜像设备。It should be supplemented that the number of second mirroring devices in this embodiment can be one or more. That is, the client kernel in this embodiment can also obtain free storage space information in each preset storage cluster. The largest target device, for example, if there are 3 preset storage clusters, you can get 3 target devices, and then extract the preset number from the target device (the preset number refers to the number of network block devices set in advance. The number can be set according to specific scenarios, for example, set to 2 devices as the second mirroring device.

例如,预设存储机群有机群a、机群b和机群c;其中,机群a中包含设备a1、设备a2、设备a3和设备a4;机群b中包含设备b1、设备b2、设备b3和设备b4;机群c中包含设备c1、设备c2、设备c3和设备c4,客户端内核获取不同预设存储机群中空闲存储空间信息最大的预设数量的设备作为第二镜像设备,例如,预设数量为2,客户端内核获取各个机群中空闲存储空间信息最大的设备a4、设备b2和设备c3,然后,获取设备a4、设备b2和设备c3中较大的两个作为第二镜像设备。本实施例中在不同的预设存储机群中设置多个第二镜像设备,保证数据的安全性。For example, the preset storage cluster has cluster a, cluster b, and cluster c; wherein cluster a includes equipment a1, equipment a2, equipment a3, and equipment a4; cluster b includes equipment b1, equipment b2, equipment b3, and equipment b4; Cluster c includes device c1, device c2, device c3, and device c4. The client kernel obtains the preset number of devices with the largest free storage space information in different preset storage clusters as the second mirroring device, for example, the preset number is 2 , The client kernel obtains device a4, device b2, and device c3 with the largest free storage space information in each cluster, and then obtains the larger two of device a4, device b2, and device c3 as the second mirroring device. In this embodiment, multiple second mirroring devices are set in different preset storage clusters to ensure data security.

进一步地,在本申请第一实施例的基础上,提出了本申请基于网络块设备的数据备份方法的第二实施例。Further, on the basis of the first embodiment of the present application, a second embodiment of the data backup method based on the network block device of the present application is proposed.

本实施例是本申请第一实施例步骤S40之后的步骤,本实施例在网络块设备使用的过程中,判断是否出现连接异常的问题,即,在网络块设备确定多个镜像设备之后,客户端内核同时对多个镜像设备进行读写操作,根据镜像设备是否反馈操作信息,确定网络块设备连接是否异常,具体地,所述基于网络块设备的数据备份方法包括:This embodiment is a step after step S40 in the first embodiment of this application. In this embodiment, during the use of the network block device, it is determined whether there is a connection abnormality problem, that is, after the network block device determines multiple mirroring devices, the client The end kernel performs read and write operations on multiple mirroring devices at the same time, and determines whether the network block device connection is abnormal according to whether the mirroring device feeds back operation information. Specifically, the data backup method based on the network block device includes:

步骤S50,在所述客户端内核接收到基于所述网络块设备的操作请求时,获取所述网络块设备对应的所述第一连接关系和所述第二连接关系。Step S50, when the client kernel receives an operation request based on the network block device, obtain the first connection relationship and the second connection relationship corresponding to the network block device.

在客户端内核中网络块设备接收到操作请求时,客户端内核获取第一连接关系和第二连接关系,以使客户端内核根据获取的第一连接关系和第二连接关系进行操作请求发送,具体地:When the network block device in the client core receives the operation request, the client core obtains the first connection relationship and the second connection relationship, so that the client core sends the operation request according to the obtained first connection relationship and the second connection relationship, specifically:

步骤S60,所述客户端内核将所述操作请求发送至所述第一连接关系对应的所述第一镜像设备;所述客户端内核将所述操作请求发送至所述第二连接关系对应的所述第二镜像设备;Step S60, the client kernel sends the operation request to the first mirror device corresponding to the first connection relationship; the client kernel sends the operation request to the second connection relationship The second mirroring device;

客户端内核按第一连接关系将操作请求发送至第一镜像设备,以使第一镜像设备反馈第一操作信息,即,第一镜像设备在接收到客户端内核发送的操作请求时,第一镜像设备执行操作请求,得到操作请求对应的第一操作信息,第一镜像设备将第一操作信息反馈至客户端内核。The client kernel sends the operation request to the first mirroring device according to the first connection relationship, so that the first mirroring device feeds back the first operation information, that is, when the first mirroring device receives the operation request sent by the client kernel, the first mirroring device The mirroring device executes the operation request and obtains the first operation information corresponding to the operation request, and the first mirroring device feeds back the first operation information to the client kernel.

客户端内核按第二连接关系将操作请求发送至第二镜像设备,以使第二镜像设备反馈第二操作信息,即,第二镜像设备在接收到客户端内核发送的操作请求时,第二镜像设备执行操作请求,得到操作请求对应的第二操作信息,第二镜像设备将第二操作信息反馈至客户端内核。The client kernel sends the operation request to the second mirroring device according to the second connection relationship, so that the second mirroring device feeds back the second operation information, that is, when the second mirroring device receives the operation request sent by the client kernel, the second mirroring device The mirroring device executes the operation request to obtain second operation information corresponding to the operation request, and the second mirroring device feeds back the second operation information to the client kernel.

客户端内核根据是否同时接收到第一操作信息和第二操作信息,判断网络块设备的连接是否正常,即,The client kernel determines whether the connection of the network block device is normal according to whether the first operation information and the second operation information are received at the same time, that is,

步骤S70,在所述客户端内核没有同时接收到所述第一操作信息和所述第二操作信息时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。Step S70: When the client kernel does not receive the first operation information and the second operation information at the same time, output a prompt message indicating that the network block device is abnormally connected to prompt the client corresponding to the user.

在客户端内核没有同时接收到第一操作信息和第二操作信息时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户;即,客户端内核没有接收到第一操作信息,确定网络块设备与第一镜像设备之间的第一连接关系异常,同理,客户端内核没有接收到第二操作信息,确定网络块设备与第二镜像设备之间的第二连接关系异常。When the client kernel does not receive the first operation information and the second operation information at the same time, it outputs a prompt message indicating that the network block device is abnormally connected to remind the client corresponding to the user; that is, the client core does not receive the first operation information , It is determined that the first connection relationship between the network block device and the first mirroring device is abnormal. Similarly, the client kernel does not receive the second operation information, and it is determined that the second connection relationship between the network block device and the second mirroring device is abnormal. .

在本实施例中客户端内核根据是否同时接收到操作信息,判断网络块设备连接是否异常,以在网络块设备连接异常时进行及时提示。需要补充说明的是,本实施例中客户端内核在网络块设备连接异常时,客户端内核确定故障的镜像设备,客户端内核并获取镜像设备对的镜像设备标识;追溯镜像设备标识的上层应用信息获取该应用信息关联的除故障之外的其他镜像设备,并进行设备响应,以保证数据的安全性。In this embodiment, the client kernel determines whether the connection of the network block device is abnormal according to whether the operation information is received at the same time, so as to prompt promptly when the connection of the network block device is abnormal. It should be supplemented that in this embodiment, when the network block device is abnormally connected, the client kernel determines the faulty mirror device, and the client kernel obtains the mirror device ID of the mirror device pair; the upper layer application that traces the mirror device ID The information acquires other mirroring devices other than the fault associated with the application information, and responds to the device to ensure data security.

进一步地,在本申请第一实施例的基础上,提出了本申请基于网络块设备的数据备份方法的第三实施例。Further, on the basis of the first embodiment of the present application, a third embodiment of the data backup method based on the network block device of the present application is proposed.

本实施例是本申请第一实施例步骤S40之后的步骤,本实施与本申请第二实施例的区别在于,本实施例中在rbd-nbd进程重新启动时,检测网络块设备是否同时连接多个镜像设备,确定网络块设备连接是否异常,具体地,所述基于网络块设备的数据备份方法包括: This embodiment is a step after step S40 in the first embodiment of this application. The difference between this embodiment and the second embodiment of this application is that in this embodiment, when the rbd-nbd process is restarted, it is detected whether the network block device is connected to multiple devices at the same time. A mirroring device determines whether the network block device connection is abnormal. Specifically, the data backup method based on the network block device includes: To

步骤S80,在所述客户端内核检测到rbd-nbd进程二次启动时,所述客户端内核判断所述网络块设备是否同时连接所述第一镜像设备和所述第二镜像设备。Step S80: When the client kernel detects that the rbd-nbd process is started for the second time, the client kernel judges whether the network block device is connected to the first mirroring device and the second mirroring device at the same time.

在客户端内核检测到rbd-nbd进程二次启动,客户端内核获取rbd-nbd进程对应的网络块设备,和网络块设备的连接关系(网络块设备的连接关系包括第一连接关系和第二连接关系),客户端内核根据在网络块设备是否同时连接第一镜像设备和第二镜像设备判断网络块设备是否连接异常。The client kernel detects the second startup of the rbd-nbd process, and the client kernel obtains the network block device corresponding to the rbd-nbd process and the connection relationship with the network block device (the connection relationship of the network block device includes the first connection relationship and the second connection relationship). Connection relationship), the client kernel determines whether the network block device is abnormally connected according to whether the network block device is connected to the first mirroring device and the second mirroring device at the same time.

步骤S90,在所述网络块设备没有同时连接所述第一镜像设备和所述第二镜像设备时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。Step S90: When the network block device is not connected to the first mirroring device and the second mirroring device at the same time, output a prompt message indicating that the network block device is abnormally connected to prompt the client to correspond to the user.

在网络块设备没有同时连接所述第一镜像设备和所述第二镜像设备时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。即,本实施例中网络块设备同时连接全部的镜像设备,则确定网络块设备连接异常,实现了网络块设备的实时检测。When the network block device is not connected to the first mirroring device and the second mirroring device at the same time, a prompt message indicating that the network block device is abnormally connected is output to prompt the client to correspond to the user. That is, in this embodiment, the network block device is connected to all mirror devices at the same time, and it is determined that the network block device is abnormally connected, and real-time detection of the network block device is realized.

进一步地,在上述实施例的基础上,提出了本申请基于网络块设备的数据备份方法的第四实施例。Further, on the basis of the foregoing embodiments, a fourth embodiment of the data backup method based on network block devices of the present application is proposed.

本实施例可以与其他任意实施例进行结合,本实施例中客户端内核对网络块设备进行删除操作。所述基于网络块设备的数据备份方法包括:This embodiment can be combined with any other embodiments. In this embodiment, the client kernel deletes the network block device. The data backup method based on the network block device includes:

步骤S100,在客户端内核接收到网络块设备删除指令时,获取所述删除指令对应的设备块标识。Step S100, when the client kernel receives the network block device deletion instruction, obtain the device block identifier corresponding to the deletion instruction.

在客户端内核接收到网络块设备删除指令时,获取删除指令对应的设备块标识,其中,网络块设备的标识信息是指用于识别网络块设备的标识信息,例如,网络块设备编号。When the client kernel receives the network block device deletion instruction, it obtains the device block identification corresponding to the deletion instruction, where the identification information of the network block device refers to identification information for identifying the network block device, for example, the network block device number.

步骤S110,所述客户端内核获取设备块标识对应的连接关系,断开所述连接关系并删除所述设备块标识对应的网络块设备。Step S110: The client kernel obtains the connection relationship corresponding to the device block identifier, disconnects the connection relationship, and deletes the network block device corresponding to the device block identifier.

客户端内核获取设备块标识对应的连接关系,其中,连接关系包括第一连接关系和第二连接关系,客户端内核首先断开网络块设备的连接关系,并删除设备块标识对应的网络块设备;在本实施例中客户端内核可以对网络块进行实时地删除,减少不必要的资源占用。The client kernel obtains the connection relationship corresponding to the device block identifier, where the connection relationship includes a first connection relationship and a second connection relationship. The client kernel first disconnects the connection relationship of the network block device, and deletes the network block device corresponding to the device block identifier ; In this embodiment, the client kernel can delete the network block in real time, reducing unnecessary resource occupation.

此外,参照图3,本申请实施例还提出一种基于网络块设备的数据备份装置,所述基于网络块设备的数据备份装置包括: In addition, referring to FIG. 3, an embodiment of the present application also proposes a data backup device based on a network block device, and the data backup device based on a network block device includes: To

信息获取模块10,用于在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备;The information acquisition module 10 is configured to obtain the process parameters and network block devices corresponding to the rbd-nbd process when the client kernel detects that the rbd-nbd process is started for the first time;

第一建立模块20,用于所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系;The first establishing module 20 is used for the client kernel to determine a first mirroring device according to the process parameters, and to establish a first connection relationship between the network block device and the first mirroring device;

备份判断模块30,用于在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件;The backup judgment module 30 is configured to, when the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and judges whether the data backup condition is met according to the service level information ;

第二建立模块40,用于在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。The second establishment module 40 is configured to, when the data backup conditions are met, the client kernel determines a second mirroring device according to the service level information, and establishes a second mirroring device between the network block device and the second mirroring device Second, the connection relationship for data backup.

可选地,所述信息获取模块10,包括:Optionally, the information acquisition module 10 includes:

设备遍历单元,用于在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取进程参数,并遍历各预存网络块设备,以判断预存网络块设备中是否存在空闲状态的网络块设备;The device traversal unit is used for when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network in the pre-stored network block device Block device

空闲设备确定单元,用于在存在空闲状态的网络块设备时,所述客户端内核将空闲状态的网络块设备作为所述rbd-nbd进程对应的网络块设备;An idle device determining unit, configured to, when there is an idle network block device, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process;

设备创建单元,用于在不存在空闲状态的网络块设备时,所述客户端内核通过内核中已加载的网络块设备驱动创建新的网络块设备,并将新的所述网络块设备作为所述rbd-nbd进程对应的网络块设备。The device creation unit is configured to, when there is no idle network block device, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the new network block device. The network block device corresponding to the rbd-nbd process.

可选地,所述备份判断模块30,包括:Optionally, the backup judgment module 30 includes:

信息读取单元,用于在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并判断所述服务等级信息中是否包含第二镜像设备标识;The information reading unit is configured to, when the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and judges whether the service level information includes a second mirroring Equipment Identity;

第一判定单元,用于在所述服务等级信息中包含第二镜像设备标识,判定符合数据备份条件;The first determining unit is configured to include a second mirroring device identifier in the service level information to determine that the data backup condition is met;

第二判定单元,用于在所述服务等级信息中不包含第二镜像设备标识,判定不符合数据备份条件。The second determining unit is configured to determine that the second mirroring device identifier is not included in the service level information, and the data backup condition is not met.

可选地,所述第二建立模块40,包括:Optionally, the second establishment module 40 includes:

存储信息获取单元,用于在符合数据备份条件时,获取所述服务等级信息中的第二镜像设备标识,获取各预设存储机群中各设备的空闲存储空间信息;The storage information obtaining unit is configured to obtain the second mirroring device identifier in the service level information, and obtain the free storage space information of each device in each preset storage cluster when the data backup condition is met;

第二镜像设备确定单元,用于根据所述空闲存储空间信息,将空闲存储空间最大的设备作为所述网络块设备对应的第二镜像设备,并将所述第二镜像设备标识赋予所述第二镜像设备;The second mirroring device determining unit is configured to use the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and assigning the second mirroring device identifier to the first mirroring device Two mirror equipment;

第二建立单元,用于建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。The second establishing unit is configured to establish a second connection relationship between the network block device and the second mirroring device to perform data backup.

可选地,所述的基于网络块设备的数据备份装置,包括:Optionally, the data backup device based on network block equipment includes:

操作请求接收模块,用于在所述客户端内核接收到基于所述网络块设备的操作请求时,获取所述网络块设备对应的所述第一连接关系和所述第二连接关系;An operation request receiving module, configured to obtain the first connection relationship and the second connection relationship corresponding to the network block device when the client kernel receives an operation request based on the network block device;

第一发送模块,用于所述客户端内核将所述操作请求发送至所述第一连接关系对应的所述第一镜像设备,以使所述第一镜像设备反馈第一操作信息;A first sending module, configured for the client kernel to send the operation request to the first mirroring device corresponding to the first connection relationship, so that the first mirroring device feeds back first operation information;

第二发送模块,用于所述客户端内核将所述操作请求发送至所述第二连接关系对应的所述第二镜像设备,以使所述第二镜像设备反馈第二操作信息;A second sending module, configured for the client kernel to send the operation request to the second mirroring device corresponding to the second connection relationship, so that the second mirroring device feeds back second operation information;

第一异常提示模块,用于在所述客户端内核没有同时接收到所述第一操作信息和所述第二操作信息时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。The first abnormal prompting module is configured to output prompt information of abnormal connection of the network block device when the client core does not simultaneously receive the first operation information and the second operation information, so as to prompt the client to correspond user.

可选地,所述的基于网络块设备的数据备份装置,包括:Optionally, the data backup device based on network block equipment includes:

连接判断模块,用于在所述客户端内核检测到rbd-nbd进程二次启动时,所述客户端内核判断所述网络块设备是否同时连接所述第一镜像设备和所述第二镜像设备;The connection judgment module is used to judge whether the network block device is connected to the first mirroring device and the second mirroring device when the client kernel detects that the rbd-nbd process is started for the second time ;

第二异常提示模块,用于在所述网络块设备没有同时连接所述第一镜像设备和所述第二镜像设备时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。The second abnormality prompt module is configured to output prompt information of abnormal connection of the network block device when the network block device is not connected to the first mirroring device and the second mirroring device at the same time, so as to prompt the client to correspond to the user .

可选地,所述的基于网络块设备的数据备份装置,包括:Optionally, the data backup device based on network block equipment includes:

删除接收模块,用于在客户端内核接收到网络块设备删除指令时,获取所述删除指令对应的设备块标识;The delete receiving module is used to obtain the device block identifier corresponding to the delete instruction when the client kernel receives the network block device delete instruction;

设备删除模块,用于所述客户端内核获取设备块标识对应的连接关系,断开所述连接关系并删除所述设备块标识对应的网络块设备。The device deletion module is used for the client kernel to obtain the connection relationship corresponding to the device block identifier, disconnect the connection relationship and delete the network block device corresponding to the device block identifier.

其中,基于网络块设备的数据备份装置的各个功能模块实现的步骤可参照本申请基于网络块设备的数据备份方法的各个实施例,此处不再赘述。Among them, the steps implemented by each functional module of the data backup device based on the network block device can refer to the various embodiments of the data backup method based on the network block device of the present application, which will not be repeated here.

此外,本申请实施例还提出一种计算机存储介质。In addition, the embodiment of the present application also proposes a computer storage medium.

所述计算机存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述实施例提供的基于网络块设备的数据备份方法中的操作。The computer storage medium stores computer readable instructions, and when the computer readable instructions are executed by the processor, the operations in the network block device-based data backup method provided in the foregoing embodiments are implemented.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体/操作/对象与另一个实体/操作/对象区分开来,而不一定要求或者暗示这些实体/操作/对象之间存在任何这种实际的关系或者顺序;术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity/operation/object from another entity/operation/object, and do not necessarily require or imply these There is any such actual relationship or sequence between entities/operations/objects; the terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, An article or system includes not only those elements, but also other elements that are not explicitly listed, or include elements inherent to the process, method, article, or system. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article or system that includes the element.

对于装置实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的。可以根据实际的需要选择中的部分或者全部模块来实现本申请方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solution of the present application. Those of ordinary skill in the art can understand and implement it without creative work.

上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the foregoing embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above. , Magnetic disk, optical disk), including several instructions to make a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method described in each embodiment of the present application.

以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

一种基于网络块设备的数据备份方法,其特征在于,所述基于网络块设备的数据备份方法包括以下步骤: A data backup method based on a network block device is characterized in that the data backup method based on a network block device includes the following steps: 在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备;When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and network block devices corresponding to the rbd-nbd process; 所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系;Determining, by the client kernel, a first mirroring device according to the process parameters, and establishing a first connection relationship between the network block device and the first mirroring device; 在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件;When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information; 在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。When the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device to perform data backup . 如权利要求1所述的基于网络块设备的数据备份方法,其特征在于,所述在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备的步骤,包括:The data backup method based on the network block device according to claim 1, wherein when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the data corresponding to the rbd-nbd process Process parameters and steps for network block devices include: 在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取进程参数,并遍历各预存网络块设备,以判断预存网络块设备中是否存在空闲状态的网络块设备;When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network block device among the pre-stored network block devices; 在存在空闲状态的网络块设备时,所述客户端内核将空闲状态的网络块设备作为所述rbd-nbd进程对应的网络块设备;When there is an idle network block device, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process; 在不存在空闲状态的网络块设备时,所述客户端内核通过内核中已加载的网络块设备驱动创建新的网络块设备,并将新的所述网络块设备作为所述rbd-nbd进程对应的网络块设备。When there is no network block device in the idle state, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the corresponding rbd-nbd process Network block device. 如权利要求1所述的基于网络块设备的数据备份方法,其特征在于,所述在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件的步骤,包括:The data backup method based on a network block device according to claim 1, wherein when the establishment of the first connection relationship is completed, the client kernel reads the service level in the first mirroring device The step of judging whether it meets the data backup conditions according to the service level information includes: 在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并判断所述服务等级信息中是否包含第二镜像设备标识;When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the service level information includes a second mirroring device identifier; 在所述服务等级信息中包含第二镜像设备标识,判定符合数据备份条件;The service level information includes the second mirroring device identifier, and it is determined that the data backup condition is met; 在所述服务等级信息中不包含第二镜像设备标识,判定不符合数据备份条件。If the service level information does not include the second mirroring device identifier, it is determined that the data backup condition is not met. 如权利要求1所述的基于网络块设备的数据备份方法,其特征在于,所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤,包括:The data backup method based on a network block device according to claim 1, wherein when the data backup condition is met, the client kernel determines the second mirroring device according to the service level information, and establishes the The second connection relationship between the network block device and the second mirroring device for data backup includes: 在符合数据备份条件时,获取所述服务等级信息中的第二镜像设备标识,获取各预设存储机群中各设备的空闲存储空间信息;When the data backup condition is met, obtain the second mirroring device identifier in the service level information, and obtain the free storage space information of each device in each preset storage cluster; 根据所述空闲存储空间信息,将空闲存储空间最大的设备作为所述网络块设备对应的第二镜像设备,并将所述第二镜像设备标识赋予所述第二镜像设备;Using the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and assigning the second mirroring device identifier to the second mirroring device; 建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。Establish a second connection relationship between the network block device and the second mirror device to perform data backup. 如权利要求1所述的基于网络块设备的数据备份方法,其特征在于,所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤之后,包括:The data backup method based on a network block device according to claim 1, wherein when the data backup condition is met, the client kernel determines the second mirroring device according to the service level information, and establishes the The second connection relationship between the network block device and the second mirroring device after the step of performing data backup includes: 在所述客户端内核接收到基于所述网络块设备的操作请求时,获取所述网络块设备对应的所述第一连接关系和所述第二连接关系;When the client kernel receives an operation request based on the network block device, acquiring the first connection relationship and the second connection relationship corresponding to the network block device; 所述客户端内核将所述操作请求发送至所述第一连接关系对应的所述第一镜像设备,以使所述第一镜像设备反馈第一操作信息;The client kernel sends the operation request to the first mirroring device corresponding to the first connection relationship, so that the first mirroring device feeds back first operation information; 所述客户端内核将所述操作请求发送至所述第二连接关系对应的所述第二镜像设备,以使所述第二镜像设备反馈第二操作信息;The client kernel sends the operation request to the second mirroring device corresponding to the second connection relationship, so that the second mirroring device feeds back second operation information; 在所述客户端内核没有同时接收到所述第一操作信息和所述第二操作信息时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。When the client kernel does not receive the first operation information and the second operation information at the same time, it outputs a prompt message indicating that the network block device is abnormally connected to prompt the client corresponding to the user. 如权利要求1所述的基于网络块设备的数据备份方法,其特征在于,所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤之后,还包括:The data backup method based on a network block device according to claim 1, wherein when the data backup condition is met, the client kernel determines the second mirroring device according to the service level information, and establishes the After the second connection relationship between the network block device and the second mirroring device to perform data backup, it further includes: 在所述客户端内核检测到rbd-nbd进程二次启动时,所述客户端内核判断所述网络块设备是否同时连接所述第一镜像设备和所述第二镜像设备;When the client kernel detects that the rbd-nbd process is started for the second time, the client kernel determines whether the network block device is simultaneously connected to the first mirroring device and the second mirroring device; 在所述网络块设备没有同时连接所述第一镜像设备和所述第二镜像设备时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。When the network block device is not connected to the first mirroring device and the second mirroring device at the same time, a prompt message indicating that the network block device is abnormally connected is output to prompt the client to correspond to the user. 如权利要求1所述的基于网络块设备的数据备份方法,其特征在于,所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤之后,还包括:The data backup method based on a network block device according to claim 1, wherein when the data backup condition is met, the client kernel determines the second mirroring device according to the service level information, and establishes the After the second connection relationship between the network block device and the second mirroring device to perform data backup, it further includes: 在客户端内核接收到网络块设备删除指令时,获取所述删除指令对应的设备块标识;When the client kernel receives the network block device deletion instruction, acquiring the device block identifier corresponding to the deletion instruction; 所述客户端内核获取设备块标识对应的连接关系,断开所述连接关系并删除所述设备块标识对应的网络块设备。The client kernel obtains the connection relationship corresponding to the device block identifier, disconnects the connection relationship, and deletes the network block device corresponding to the device block identifier. 一种基于网络块设备的数据备份装置,其特征在于,所述基于网络块设备的数据备份装置包括:A data backup device based on network block equipment, wherein the data backup device based on network block equipment includes: 信息获取模块,用于在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备;An information acquisition module, which is used to acquire the process parameters and network block devices corresponding to the rbd-nbd process when the client kernel detects that the rbd-nbd process is started for the first time; 第一建立模块,用于所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系;The first establishment module is used for the client kernel to determine a first mirroring device according to the process parameters, and to establish a first connection relationship between the network block device and the first mirroring device; 备份判断模块,用于在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件;A backup judgment module, configured to, when the first connection relationship is established, the client kernel reads the service level information in the first mirroring device, and judges whether the data backup condition is met according to the service level information; 第二建立模块,用于在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。The second establishment module is configured to, when the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second mirroring device between the network block device and the second mirroring device Connection relationship for data backup. 如权利要求8所述的基于网络块设备的数据备份装置,其特征在于,所述信息获取模块,包括:8. The device for data backup based on network block devices according to claim 8, wherein the information acquisition module comprises: 设备遍历单元,用于在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取进程参数,并遍历各预存网络块设备,以判断预存网络块设备中是否存在空闲状态的网络块设备;The device traversal unit is used for when the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network in the pre-stored network block device Block device 空闲设备确定单元,用于在存在空闲状态的网络块设备时,所述客户端内核将空闲状态的网络块设备作为所述rbd-nbd进程对应的网络块设备;An idle device determining unit, configured to, when there is an idle network block device, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process; 设备创建单元,用于在不存在空闲状态的网络块设备时,所述客户端内核通过内核中已加载的网络块设备驱动创建新的网络块设备,并将新的所述网络块设备作为所述rbd-nbd进程对应的网络块设备。The device creation unit is configured to, when there is no idle network block device, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the new network block device. The network block device corresponding to the rbd-nbd process. 如权利要求8所述的基于网络块设备的数据备份装置,其特征在于,所述备份判断模块,包括:8. The data backup device based on network block equipment according to claim 8, wherein the backup judgment module comprises: 信息读取单元,用于在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并判断所述服务等级信息中是否包含第二镜像设备标识;The information reading unit is configured to, when the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and judges whether the service level information includes a second mirroring Equipment Identity; 第一判定单元,用于在所述服务等级信息中包含第二镜像设备标识,判定符合数据备份条件;The first determining unit is configured to include a second mirroring device identifier in the service level information to determine that the data backup condition is met; 第二判定单元,用于在所述服务等级信息中不包含第二镜像设备标识,判定不符合数据备份条件。The second determining unit is configured to determine that the second mirroring device identifier is not included in the service level information, and the data backup condition is not met. 如权利要求8所述的基于网络块设备的数据备份装置,其特征在于,所述第二建立模块,包括:8. The data backup device based on network block equipment according to claim 8, wherein the second establishment module comprises: 存储信息获取单元,用于在符合数据备份条件时,获取所述服务等级信息中的第二镜像设备标识,获取各预设存储机群中各设备的空闲存储空间信息;The storage information obtaining unit is configured to obtain the second mirroring device identifier in the service level information, and obtain the free storage space information of each device in each preset storage cluster when the data backup condition is met; 第二镜像设备确定单元,用于根据所述空闲存储空间信息,将空闲存储空间最大的设备作为所述网络块设备对应的第二镜像设备,并将所述第二镜像设备标识赋予所述第二镜像设备;The second mirroring device determining unit is configured to use the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and assigning the second mirroring device identifier to the first mirroring device Two mirror equipment; 第二建立单元,用于建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。The second establishing unit is configured to establish a second connection relationship between the network block device and the second mirroring device to perform data backup. 如权利要求8所述的基于网络块设备的数据备份装置,其特征在于,所述的基于网络块设备的数据备份装置,包括:8. The device for data backup based on network block devices according to claim 8, wherein the device for data backup based on network block devices comprises: 操作请求接收模块,用于在所述客户端内核接收到基于所述网络块设备的操作请求时,获取所述网络块设备对应的所述第一连接关系和所述第二连接关系;The operation request receiving module is configured to obtain the first connection relationship and the second connection relationship corresponding to the network block device when the client kernel receives an operation request based on the network block device; 第一发送模块,用于所述客户端内核将所述操作请求发送至所述第一连接关系对应的所述第一镜像设备,以使所述第一镜像设备反馈第一操作信息;A first sending module, configured for the client kernel to send the operation request to the first mirroring device corresponding to the first connection relationship, so that the first mirroring device feeds back first operation information; 第二发送模块,用于所述客户端内核将所述操作请求发送至所述第二连接关系对应的所述第二镜像设备,以使所述第二镜像设备反馈第二操作信息;A second sending module, configured for the client kernel to send the operation request to the second mirroring device corresponding to the second connection relationship, so that the second mirroring device feeds back second operation information; 第一异常提示模块,用于在所述客户端内核没有同时接收到所述第一操作信息和所述第二操作信息时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。The first abnormal prompting module is configured to output prompt information of abnormal connection of the network block device when the client core does not simultaneously receive the first operation information and the second operation information, so as to prompt the client to correspond user. 如权利要求8所述的基于网络块设备的数据备份装置,其特征在于,所述的基于网络块设备的数据备份装置,包括:8. The device for data backup based on network block devices according to claim 8, wherein the device for data backup based on network block devices comprises: 连接判断模块,用于在所述客户端内核检测到rbd-nbd进程二次启动时,所述客户端内核判断所述网络块设备是否同时连接所述第一镜像设备和所述第二镜像设备;The connection judgment module is used to judge whether the network block device is connected to the first mirroring device and the second mirroring device when the client kernel detects that the rbd-nbd process is started for the second time ; 第二异常提示模块,用于在所述网络块设备没有同时连接所述第一镜像设备和所述第二镜像设备时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。The second abnormality prompt module is configured to output prompt information of abnormal connection of the network block device when the network block device is not connected to the first mirroring device and the second mirroring device at the same time, so as to prompt the client to correspond to the user . 如权利要求8所述的基于网络块设备的数据备份装置,其特征在于,所述的基于网络块设备的数据备份装置,还包括:8. The device for data backup based on network block devices according to claim 8, wherein the device for data backup based on network block devices further comprises: 删除接收模块,用于在客户端内核接收到网络块设备删除指令时,获取所述删除指令对应的设备块标识;The delete receiving module is used to obtain the device block identifier corresponding to the delete instruction when the client kernel receives the network block device delete instruction; 设备删除模块,用于所述客户端内核获取设备块标识对应的连接关系,断开所述连接关系并删除所述设备块标识对应的网络块设备。The device deletion module is used for the client kernel to obtain the connection relationship corresponding to the device block identifier, disconnect the connection relationship and delete the network block device corresponding to the device block identifier. 一种基于网络块设备的数据备份设备,其特征在于,所述基于网络块设备的数据备份设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,其中:A data backup device based on a network block device, characterized in that the data backup device based on a network block device includes: a memory, a processor, and a computer that is stored in the memory and can run on the processor. Read instructions, where: 所述计算机可读指令被所述处理器执行时实现如下的步骤:When the computer-readable instructions are executed by the processor, the following steps are implemented: 在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备;When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and network block devices corresponding to the rbd-nbd process; 所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系;Determining, by the client kernel, a first mirroring device according to the process parameters, and establishing a first connection relationship between the network block device and the first mirroring device; 在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件;When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information; 在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。When the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device to perform data backup . 如权利要求15所述的基于网络块设备的数据备份设备,其特征在于,所述计算机可读指令被所述处理器执行所述在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备的步骤,包括:The network block device-based data backup device of claim 15, wherein the computer-readable instructions are executed by the processor when the client kernel detects that the rbd-nbd process is first started, The steps for the client kernel to obtain the process parameters and network block devices corresponding to the rbd-nbd process include: 在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取进程参数,并遍历各预存网络块设备,以判断预存网络块设备中是否存在空闲状态的网络块设备;When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains process parameters and traverses each pre-stored network block device to determine whether there is an idle network block device among the pre-stored network block devices; 在存在空闲状态的网络块设备时,所述客户端内核将空闲状态的网络块设备作为所述rbd-nbd进程对应的网络块设备;When there is an idle network block device, the client kernel uses the idle network block device as the network block device corresponding to the rbd-nbd process; 在不存在空闲状态的网络块设备时,所述客户端内核通过内核中已加载的网络块设备驱动创建新的网络块设备,并将新的所述网络块设备作为所述rbd-nbd进程对应的网络块设备。When there is no network block device in the idle state, the client kernel creates a new network block device through the loaded network block device driver in the kernel, and uses the new network block device as the corresponding rbd-nbd process Network block device. 如权利要求15所述的基于网络块设备的数据备份设备,其特征在于,所述计算机可读指令被所述处理器执行所述在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件的步骤,包括:The network block device-based data backup device of claim 15, wherein the computer-readable instructions are executed by the processor, and when the establishment of the first connection relationship is completed, the client kernel The step of reading the service level information in the first mirroring device and judging whether it meets the data backup condition according to the service level information includes: 在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并判断所述服务等级信息中是否包含第二镜像设备标识;When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the service level information includes a second mirroring device identifier; 在所述服务等级信息中包含第二镜像设备标识,判定符合数据备份条件;The service level information includes the second mirroring device identifier, and it is determined that the data backup condition is met; 在所述服务等级信息中不包含第二镜像设备标识,判定不符合数据备份条件。If the service level information does not include the second mirroring device identifier, it is determined that the data backup condition is not met. 如权利要求15所述的基于网络块设备的数据备份设备,其特征在于,所述计算机可读指令被所述处理器执行所述在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份的步骤,包括:The network block device-based data backup device according to claim 15, wherein the computer-readable instructions are executed by the processor when the data backup condition is met, the client kernel is based on the service The step of determining the second mirroring device by the level information and establishing a second connection relationship between the network block device and the second mirroring device to perform data backup includes: 在符合数据备份条件时,获取所述服务等级信息中的第二镜像设备标识,获取各预设存储机群中各设备的空闲存储空间信息;When the data backup condition is met, obtain the second mirroring device identifier in the service level information, and obtain the free storage space information of each device in each preset storage cluster; 根据所述空闲存储空间信息,将空闲存储空间最大的设备作为所述网络块设备对应的第二镜像设备,并将所述第二镜像设备标识赋予所述第二镜像设备;Using the device with the largest free storage space as the second mirroring device corresponding to the network block device according to the free storage space information, and assigning the second mirroring device identifier to the second mirroring device; 建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。Establish a second connection relationship between the network block device and the second mirror device to perform data backup. 如权利要求15所述的基于网络块设备的数据备份设备,其特征在于,所述计算机可读指令被所述处理器执行时,还实现以下步骤:The data backup device based on the network block device according to claim 15, wherein when the computer-readable instruction is executed by the processor, the following steps are further implemented: 在所述客户端内核接收到基于所述网络块设备的操作请求时,获取所述网络块设备对应的所述第一连接关系和所述第二连接关系;When the client kernel receives an operation request based on the network block device, acquiring the first connection relationship and the second connection relationship corresponding to the network block device; 所述客户端内核将所述操作请求发送至所述第一连接关系对应的所述第一镜像设备,以使所述第一镜像设备反馈第一操作信息;The client kernel sends the operation request to the first mirroring device corresponding to the first connection relationship, so that the first mirroring device feeds back first operation information; 所述客户端内核将所述操作请求发送至所述第二连接关系对应的所述第二镜像设备,以使所述第二镜像设备反馈第二操作信息;The client kernel sends the operation request to the second mirroring device corresponding to the second connection relationship, so that the second mirroring device feeds back second operation information; 在所述客户端内核没有同时接收到所述第一操作信息和所述第二操作信息时,输出网络块设备连接异常的提示信息,以提示所述客户端对应用户。When the client kernel does not receive the first operation information and the second operation information at the same time, it outputs a prompt message indicating that the network block device is abnormally connected to prompt the client corresponding to the user. 一种计算机存储介质,其特征在于,所述计算机存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现以下步骤:A computer storage medium, characterized in that computer readable instructions are stored on the computer storage medium, and when the computer readable instructions are executed by a processor, the following steps are implemented: 在客户端内核检测到rbd-nbd进程初次启动时,所述客户端内核获取所述rbd-nbd进程对应的进程参数和网络块设备;When the client kernel detects that the rbd-nbd process is started for the first time, the client kernel obtains the process parameters and network block devices corresponding to the rbd-nbd process; 所述客户端内核根据所述进程参数确定第一镜像设备,并建立所述网络块设备与所述第一镜像设备之间的第一连接关系;Determining, by the client kernel, a first mirroring device according to the process parameters, and establishing a first connection relationship between the network block device and the first mirroring device; 在所述第一连接关系建立完成时,所述客户端内核读取所述第一镜像设备中的服务等级信息,并根据所述服务等级信息判断是否符合数据备份条件;When the establishment of the first connection relationship is completed, the client kernel reads the service level information in the first mirroring device, and determines whether the data backup condition is met according to the service level information; 在符合数据备份条件时,所述客户端内核根据所述服务等级信息确定第二镜像设备,并建立所述网络块设备与所述第二镜像设备之间的第二连接关系,以进行数据备份。 When the data backup condition is met, the client kernel determines a second mirroring device according to the service level information, and establishes a second connection relationship between the network block device and the second mirroring device to perform data backup . To
PCT/CN2019/101718 2019-06-03 2019-08-21 Data backup method, apparatus and device based on network block device, and storage medium Ceased WO2020244059A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910485602.3A CN110321251B (en) 2019-06-03 2019-06-03 Data backup method, device, equipment and storage medium based on network block equipment
CN201910485602.3 2019-06-03

Publications (1)

Publication Number Publication Date
WO2020244059A1 true WO2020244059A1 (en) 2020-12-10

Family

ID=68120284

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/101718 Ceased WO2020244059A1 (en) 2019-06-03 2019-08-21 Data backup method, apparatus and device based on network block device, and storage medium

Country Status (2)

Country Link
CN (1) CN110321251B (en)
WO (1) WO2020244059A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024016595A1 (en) * 2022-07-20 2024-01-25 天翼云科技有限公司 Rbd-nbd mapping method and apparatus
CN119760707A (en) * 2024-12-11 2025-04-04 中电云计算技术有限公司 Malicious code detection method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414915A (en) * 2007-10-19 2009-04-22 英业达股份有限公司 Remote copy send request processing system and method thereof
CN105843704A (en) * 2016-03-15 2016-08-10 上海爱数信息技术股份有限公司 Data protection method and system capable of combining with snapshot function based on distributed block storage
CN109033328A (en) * 2018-07-19 2018-12-18 郑州云海信息技术有限公司 A kind of access request processing method, device, equipment and readable storage medium storing program for executing
CN109814946A (en) * 2018-12-29 2019-05-28 创新科存储技术(深圳)有限公司 A method and device for realizing distributed storage in XenServer
US20190166163A1 (en) * 2016-09-27 2019-05-30 Red Hat, Inc. Method of managing system utilities access control

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106227621B (en) * 2016-07-25 2019-03-01 北京飞杰信息技术有限公司 The data back up method and system of logic-based volume management simplification volume
CN206546569U (en) * 2017-02-24 2017-10-10 深圳市中博睿存信息技术有限公司 A kind of block device mirror back-up device
CN108446164B (en) * 2018-03-01 2022-02-22 深信服科技股份有限公司 Data migration method, system and related device of V2P

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414915A (en) * 2007-10-19 2009-04-22 英业达股份有限公司 Remote copy send request processing system and method thereof
CN105843704A (en) * 2016-03-15 2016-08-10 上海爱数信息技术股份有限公司 Data protection method and system capable of combining with snapshot function based on distributed block storage
US20190166163A1 (en) * 2016-09-27 2019-05-30 Red Hat, Inc. Method of managing system utilities access control
CN109033328A (en) * 2018-07-19 2018-12-18 郑州云海信息技术有限公司 A kind of access request processing method, device, equipment and readable storage medium storing program for executing
CN109814946A (en) * 2018-12-29 2019-05-28 创新科存储技术(深圳)有限公司 A method and device for realizing distributed storage in XenServer

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024016595A1 (en) * 2022-07-20 2024-01-25 天翼云科技有限公司 Rbd-nbd mapping method and apparatus
CN119760707A (en) * 2024-12-11 2025-04-04 中电云计算技术有限公司 Malicious code detection method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110321251A (en) 2019-10-11
CN110321251B (en) 2023-06-20

Similar Documents

Publication Publication Date Title
WO2018214320A1 (en) Database service logic monitoring method and system, and storage medium
WO2020224246A1 (en) Block chain-based data management method and apparatus, device and storage medium
WO2018120681A1 (en) Data synchronization method, device and system, data processing server, and storage medium
WO2018233352A1 (en) Data transmission method, device, terminal and computer readable storage medium
WO2020019405A1 (en) Database monitoring method, device and apparatus, and computer storage medium
WO2020253125A1 (en) Log management method, apparatus, and device, and storage medium
WO2020233073A1 (en) Blockchain environment test method, device and apparatus, and storage medium
WO2021012481A1 (en) System performance monitoring method and apparatus, device, and storage medium
WO2018076841A1 (en) Data sharing method, apparatus, storage medium and server
WO2020042464A1 (en) Data interaction method, apparatus and device, and readable storage medium
WO2020119369A1 (en) Intelligent it operation and maintenance fault positioning method, apparatus and device, and readable storage medium
WO2021012490A1 (en) Service relay switching method and apparatus, terminal device, and storage medium
WO2020237849A1 (en) Snapshot read-write method for network block device, apparatus, device, and storage medium
WO2020015060A1 (en) Power consumption anomaly estimation method and apparatus, device, and computer storage medium
WO2020237859A1 (en) Data migration method employing nbd device, apparatus, device, and storage medium
WO2018120680A1 (en) Virtual disk backup system, method, apparatus, service host and storage medium
WO2017126740A1 (en) Terminal device, remote control system and control method
WO2020077832A1 (en) Cloud desktop access method, apparatus and device, and storage medium
WO2016101441A1 (en) File synchronization method and system
WO2021051492A1 (en) Database service node switching method, apparatus and device, and computer storage medium
WO2017140080A1 (en) Addressing communication method and apparatus based on media access control address
WO2020042471A1 (en) Firewall policy verification method, system and device, and readable storage medium
WO2018184302A1 (en) Data transmission method, system, virtual load balancer and readable storage medium
WO2020062615A1 (en) Gamma value adjustment method and apparatus for display panel, and display device
WO2020244059A1 (en) Data backup method, apparatus and device based on network block device, and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19931996

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19931996

Country of ref document: EP

Kind code of ref document: A1