WO2019219059A1 - Method, apparatus and system for storing data, and method for reading data, apparatus, and system - Google Patents

Method, apparatus and system for storing data, and method for reading data, apparatus, and system Download PDF

Info

Publication number
WO2019219059A1
WO2019219059A1 PCT/CN2019/087232 CN2019087232W WO2019219059A1 WO 2019219059 A1 WO2019219059 A1 WO 2019219059A1 CN 2019087232 W CN2019087232 W CN 2019087232W WO 2019219059 A1 WO2019219059 A1 WO 2019219059A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage
volume
data
block
identifier
Prior art date
Application number
PCT/CN2019/087232
Other languages
French (fr)
Chinese (zh)
Inventor
林鹏
林起芊
汪渭春
Original Assignee
杭州海康威视系统技术有限公司
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 杭州海康威视系统技术有限公司 filed Critical 杭州海康威视系统技术有限公司
Publication of WO2019219059A1 publication Critical patent/WO2019219059A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device

Definitions

  • the present application relates to the field of communications, and in particular, to a method for storing data, a method, device, and system for reading data.
  • the camera device In the field of monitoring, the camera device is used to capture video data, and the video data captured by the camera device needs to be saved, so that the video data captured by the camera device can be queried in a later period. At present, the camera device transmits the captured video data to the network side after capturing the video data.
  • a management server and multiple storage servers can be deployed in advance, and a large-capacity disk is deployed in each storage server.
  • the management server selects a storage server from the plurality of storage servers, and stores the video data in the selected disk of the storage server.
  • the video data Since the reliability of the storage server is not high, the video data is stored on the storage server, resulting in low reliability of data storage.
  • the embodiment of the present application provides a method for storing data, a method, device, and system for reading data.
  • the technical solution is as follows:
  • an embodiment of the present application provides a method for storing data, where the method includes:
  • the first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume;
  • the first storage device applies at least one data object included in the target storage block in an object storage platform
  • the first storage device correspondingly saves a correspondence between the device identifier and the first index information in the management device, where the first index information includes at least a volume identifier of the target virtual storage volume, and the target storage block. a block identifier, a data identifier of the data to be stored, a first data start location of the data to be stored, and a first data length of the data to be stored;
  • the first storage device stores second index information in an index block object corresponding to the target storage block in the object storage platform, where the second index information includes at least the first data start position.
  • the determining a target virtual storage volume for storing data to be stored, and determining a target storage block from the target virtual storage volume includes:
  • a free memory block is selected from the target virtual storage volume as a target storage block according to the block bitmap object.
  • the method further includes:
  • an identification bit of the target storage block is set to identify that the target storage block has been used.
  • the method further includes:
  • the creating, by the object storage platform, the first virtual storage volume for the first storage device includes:
  • the boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the first storage device;
  • An object is configured to store an identifier bit of each of the first virtual storage volumes, where an identifier of the storage block is used to identify whether the storage block is idle;
  • an index object of the storage block is used to store third index information.
  • the third index information includes at least the number of data objects in the storage block.
  • the method further includes:
  • the storage volume list object is used to store a volume identifier of at least one virtual storage volume corresponding to the first storage device.
  • the at least one virtual storage volume corresponding to the first storage device is loaded into the first storage device according to the storage volume list object corresponding to the first storage device in the object storage platform.
  • a volume identifier of the second virtual storage volume Downloading, according to a volume identifier of the second virtual storage volume, a boot block object of the second virtual storage volume from the object storage platform, where a volume identifier of the second virtual storage volume is any one of the storage volume list objects
  • the method further includes:
  • the first storage device takes over the third virtual storage volume according to the volume identifier of the third virtual storage volume, where the third virtual storage volume is a virtual storage volume corresponding to the second storage device, and the second storage device is Other storage devices than the first storage device.
  • the taking over the third virtual storage volume according to the volume identifier of the third virtual storage volume includes:
  • the device identifier of the second storage device Updating, according to the volume identifier of the third virtual storage volume, the device identifier of the second storage device saved in the startup block object of the third virtual storage volume to the device identifier of the first storage device;
  • the present application provides a method of reading data, the method comprising:
  • a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, a volume identifier of the target storage volume where the data to be read is located, and a target The block identifier of the storage block;
  • the reading the data to be read from the target storage block in the object storage platform according to the location information including:
  • an index object of the target storage block from an object storage platform according to a volume identifier of the target storage volume and a block identifier of the target storage block, where the index object includes a data stored in the target storage block a data starting position;
  • the present application provides an apparatus for storing data, the apparatus comprising:
  • a determining module configured to determine a target virtual storage volume for storing data to be stored, and determining a target storage block from the target virtual storage volume
  • An application module configured to apply, in an object storage platform, at least one data object included in the target storage block;
  • a storage module configured to store the to-be-stored data in the at least one data object, and correspondingly store a correspondence between the device identifier of the device and the first index information, where the first index information is And including at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, a first data start location of the data to be stored, and a first to be stored data a data length; storing, in the index block object corresponding to the target storage block in the object storage platform, second index information, where the second index information includes at least the first data start position.
  • the determining module includes:
  • a first selection unit configured to select one virtual storage volume from the at least one virtual storage volume corresponding to the device as the target virtual storage volume
  • An obtaining unit configured to acquire, from the object storage platform, a block bitmap object of the target virtual storage volume, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and a storage block The flag bit is used to record whether the memory block is idle;
  • a second selecting unit configured to select, from the target virtual storage volume, a free storage block as the target storage block according to the block bitmap object.
  • the device further includes:
  • a setting unit configured to set, in a block bitmap object of the target virtual storage volume, an identification bit of the target storage block to identify that the target storage block has been used.
  • the device further includes:
  • a module is created for creating a first virtual storage volume for the device in the object storage platform.
  • the creating module includes:
  • a generating unit configured to generate a volume identifier of the first virtual storage volume
  • a first adding unit configured to add a volume identifier of the first virtual storage volume to a storage volume list object corresponding to the device located in the object storage platform;
  • An application unit configured to apply, in the object storage platform, a boot block object of the first virtual storage volume, a block bitmap object, and an index object of each of the first virtual storage volumes;
  • the boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the device; the block bitmap object is used for And storing an identifier bit of each of the first virtual storage volumes, where an identifier of the storage block is used to identify whether the storage block is idle; an index object of the storage block is configured to store third index information, The third index information includes at least the number of data objects in the storage block.
  • the device further includes:
  • a loading module configured to load at least one virtual storage volume corresponding to the device into the device according to a storage volume list object corresponding to the device in the object storage platform when the device is started,
  • the storage volume list object is used to store a volume identifier of at least one virtual storage volume corresponding to the device.
  • the loading module includes:
  • a downloading unit configured to download, from the object storage platform, a storage volume list object corresponding to the device, and downloading, according to a volume identifier of the second virtual storage volume, the startup of the second virtual storage volume from the object storage platform a volume identifier, where a volume identifier of the second virtual storage volume is a volume identifier of any one of the storage volume list objects;
  • a second adding unit configured to add a volume identifier of the second virtual storage volume to the device when the boot block object stores the device identifier of the device.
  • the device further includes:
  • a takeover module configured to take over the third virtual storage volume according to the volume identifier of the third virtual storage volume, where the third virtual storage volume is a virtual storage volume corresponding to the second storage device, and the second storage device is Other storage devices than the device.
  • the takeover module includes:
  • a receiving unit configured to receive a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume
  • An update unit configured to update, according to the volume identifier of the third virtual storage volume, a device identifier of the second storage device saved in the startup block object of the third virtual storage volume to a device identifier of the device;
  • a third adding unit configured to separately add volume identifiers of the third virtual storage volume to the storage volume list object corresponding to the device and the device.
  • the present application provides an apparatus for reading data, the apparatus comprising:
  • a receiving module configured to receive a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, and a volume of the target storage volume where the data to be read is located The identifier of the block and the block of the target storage block;
  • a reading module configured to read the data to be read from the target storage block in the object storage platform according to the location information.
  • the reading module includes:
  • An obtaining unit configured to acquire an index object of the target storage block from an object storage platform according to a volume identifier of the target storage volume and a block identifier of the target storage block, where the index object includes the target storage block The first data start position of the stored data;
  • a determining unit configured to determine, according to the first data start location and the second data start location, a target data object for storing the data to be read and the data to be read in the target data The offset in the object;
  • a reading unit configured to read the data to be read from the target data object according to the offset and the second data length.
  • the embodiment of the present application provides a system for storing data, where the system includes: a storage device, an object storage platform, and a management device;
  • the storage device is configured to determine a target virtual storage volume for storing data to be stored, and determine a target storage block from the target virtual storage volume; and apply at least the target storage block included in the object storage platform a data object; storing the data to be stored in the at least one data object; correspondingly storing a correspondence between the device identifier of the storage device and the first index information in the management device, the first
  • the index information includes at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, a first data start location of the data to be stored, and the to-be-stored data
  • the first data length is stored in the index block object corresponding to the target storage block in the object storage platform, and the second index information includes at least the first data start position.
  • the embodiment of the present application provides a system for reading data, where the system includes: a storage device, a management device, and an object storage platform;
  • the storage device is configured to receive a read request message that includes the location information that is sent by the management device, where the location information includes a second data start location of the data to be read, a second data length, and the to-be-read
  • the first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume; applies at least one data object included in the target storage block in the object storage platform; and the data to be stored Stored in at least one data object. Moreover, since the reliability of the storage data of the object storage platform is high, the reliability of the data storage is improved.
  • 1-1 is a schematic diagram of a network architecture provided by an embodiment of the present application.
  • 1-2 is a schematic diagram of a storage structure provided by an embodiment of the present application.
  • FIG. 2 is a flowchart of a method for creating a virtual storage volume according to an embodiment of the present application
  • FIG. 3 is a flowchart of a method for loading a virtual storage volume according to an embodiment of the present application
  • FIG. 4 is a flowchart of a method for taking over a virtual storage volume according to an embodiment of the present application
  • FIG. 5 is a flowchart of a method for storing data according to an embodiment of the present application.
  • FIG. 6 is a flowchart of a method for reading data according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an apparatus for storing data according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of an apparatus for reading data according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of a system for storing data according to an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a system for reading data according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of a device according to an embodiment of the present application.
  • an embodiment of the present application provides a network architecture, including:
  • Management device 1, at least one storage device 2 and object storage platform 3;
  • a network connection is established between the management device 1 and each of the at least one storage device 2, and a network connection is established between each storage device 2 and the object storage platform 3.
  • the network connection can be a wired connection or a wireless connection.
  • the object storage platform 3 stores data in a file storage manner.
  • the storage unit in the object storage platform 3 is a data object, and one data object can be a file.
  • the storage device 2 can call an object storage interface of the object storage platform 3, by which data can be read from the object storage platform 3, stored in or deleted from the object storage platform 3, and the like.
  • the management device 1 may be a management server or a management terminal
  • the storage device 2 may be a storage server or a storage terminal or the like.
  • the storage device 2 corresponds to one storage volume list object and at least one virtual storage volume, and each virtual storage volume includes at least one storage block.
  • the storage volume list object is a data object in the object storage platform 3 for storing the volume identifier of each virtual storage volume corresponding to the storage device 2.
  • the virtual storage volume corresponds to a boot block object and a block bitmap object;
  • the boot block object is a data object in the object storage platform 3, and is used to store volume basic information of the virtual storage volume.
  • the volume basic information includes at least the capacity of the virtual storage volume, the number of storage blocks, and the device identification of the storage device 2.
  • the block bitmap object is also a data object in the object storage platform 3, and is used for storing an identifier bit of each storage block included in the virtual storage volume, and the identifier bit of the storage block is used to identify whether the storage block is free.
  • the storage block corresponds to an index object, and the storage block includes at least one data object.
  • the index object corresponding to the storage block is a data object in the object storage platform 3, and is used for storing index information of the storage block; when the storage block does not store data, that is, when the storage block is idle, the index information is
  • the third index information includes at least the number of data objects in the storage block.
  • the index information includes second index information, and may further include third index information, where the second index information is at least Includes the starting position of the data.
  • the embodiment of the present application provides a method for creating a virtual storage volume, which may be applied to the network architecture shown in FIG. 1-1, and the execution entity may be a storage device in the network architecture.
  • the storage device is referred to as a first storage device, and the first storage device creates a first virtual storage volume for the storage device in the object storage platform.
  • the creation process can be:
  • Step 201 The first storage device generates a volume identifier of the first virtual storage volume.
  • the first storage device may allocate a character string, and the device identifier of the first storage device and the string form a volume identifier of the first virtual storage volume.
  • the first storage device may randomly assign a character string or sequentially assign a character string based on the last last allocated string. For the manner of sequential allocation, assuming that the last last allocated character string is OS 251, the character string sequentially allocated on the basis of the character string OS 251 is OS 252.
  • the string may be suffixed and the device identifier of the first storage device is formed into a volume identifier of the first virtual storage volume; for example, if the device identifier of the first storage device is fall 613158, The assigned character string OS252 is suffixed, and the volume identifier of the first virtual storage volume constituting the device identifier of the first storage device is fall613158/OS252. or,
  • the string may be prefixed with the device identifier of the first storage device to form a volume identifier of the first virtual storage volume; for example, the assigned string OS252 is prefixed, and The device identifier of a storage device constitutes the volume identifier of the first virtual storage volume as OS252/fall613158.
  • the first storage device When the first storage device generates the volume identifier of the first virtual storage volume, it may ensure that the volume identifier of the first virtual storage volume is not the same as the volume identifier of the generated virtual storage volume. Therefore, in general, the first storage device may generate a volume identifier of the first virtual storage volume in a sequential allocation manner.
  • the volume identifier of the first virtual storage volume may be added to the storage volume list object corresponding to the first storage device in the object storage platform, and the implementation process may be as follows. The operations of steps 202 to 204.
  • Step 202 The first storage device determines whether there is a storage volume list object corresponding to the first storage device in the object storage platform. If not, step 203 is performed, and if yes, step 204 is performed.
  • the storage volume list object corresponding to the first storage device is a data object in the object storage platform, and is used to store a volume identifier of at least one virtual storage volume belonging to the first storage device.
  • the storage volume list object may include a storage volume list, and the volume identifier of the at least one virtual storage volume belonging to the first storage device may be stored in the storage volume list.
  • the first storage device may acquire the object identifier of the storage volume list object according to the device identifier of the first storage device and the preset and the first preset character string, invoke the object storage interface, and invoke the object storage interface from the object.
  • the storage platform queries the storage volume list object corresponding to the object identifier.
  • the object storage platform Before the step of executing, if the first storage device has applied for the storage volume list object in the object storage platform, the object storage platform has an object identifier that is the same as the acquired object identifier, and the data object is the first storage.
  • the first storage device may query, from the object storage platform, the obtained storage volume list object corresponding to the acquired object identifier.
  • the object storage platform does not have the same data object as the obtained object identifier.
  • the first storage device may not query the obtained storage volume list object corresponding to the object identifier from the object storage platform.
  • the first storage device acquires an object identifier of the storage volume list object, and may be:
  • the first storage device may form the first preset character string and the device identifier of the first storage device to form an object identifier of the storage volume list object.
  • the first storage device may use the first preset character string as the prefix of the device identifier of the first storage device, and the device identifier of the first storage device to form the object identifier of the storage volume list object.
  • the first preset character string is LIST
  • the first preset character string LIST is used as a prefix
  • the object identifier of the storage volume list object is formed by the device identifier fall 613158 of the first storage device as LIST_fall 613158. or,
  • the first storage device may use the first preset character string as the suffix of the device identifier of the first storage device and the device identifier of the first storage device to form the object identifier of the storage volume list object.
  • the first preset character string is LIST
  • the first preset character string LIST is used as a suffix
  • the object identifier of the storage volume list object is formed with the device identifier fall 613158 of the first storage device as fall613158/LIST.
  • Step 203 The first storage device applies, in the object storage platform, a storage volume list object, where the storage volume list object is used to store the volume identifier of the first virtual storage volume, and step 205 is performed.
  • the first storage device may invoke an object storage interface of the object storage platform, apply for a data object in the object storage platform, and set the object identifier of the data object to obtain the object identifier, and obtain the corresponding storage device.
  • a volume list object is stored, and the volume identifier of the first virtual storage volume is stored in the storage volume list object.
  • Step 204 The first storage device adds the volume identifier of the first virtual virtual volume to the storage volume list object in the object storage platform.
  • the volume identifier of the first virtual storage volume may be added to the storage volume list object.
  • the storage volume list object may include a storage volume list, and the volume identifier of the first virtual storage volume may be added to the storage volume list.
  • the volume ID of the first virtual storage volume can be appended to the end of the list of storage volumes.
  • the storage volume list object corresponding to the first storage device is substantially a file stored in the object storage platform.
  • the storage volume list object is read from the object storage platform, and the volume identifier of the first virtual storage volume is added to the In the storage volume list object, the added storage volume list object is uploaded to the object storage platform, so that the object storage platform updates the storage volume list object corresponding to the first storage device saved by the object storage platform to the added storage volume list object.
  • Step 205 The first storage device applies, in the object storage platform, a boot block object and a block bitmap object of the first virtual storage volume, and an index object of each storage block in the first virtual storage volume.
  • the boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the first storage device.
  • the block bitmap object is used to store an identification bit of each storage block in the first virtual storage volume, and the identification bit of the storage block is used to identify whether the storage block is free.
  • the index object of the storage block is used to store third index information, and the third index information includes at least the number of data objects in the storage block.
  • the first storage device may set the capacity of the first virtual storage volume, the number of storage blocks M, and set the number N of data objects included in each storage block, and generate an object of the startup block object of the first virtual storage volume.
  • the object identifier of the identifier and the block bitmap object, and the object identifier of the index object of each storage block applying the data object in the object storage platform, setting the object identifier of the data object to the object identifier of the startup block object, and obtaining the a boot block object of a virtual storage volume, storing basic information of the volume in the boot block object; applying a data object in the object storage platform, setting an object identifier of the data object to an object identifier of the block bitmap object, obtaining the first a block bitmap object of a virtual storage volume, where the M bitmap bits are stored in the block bitmap object, each identifier bit corresponding to a storage block in the first virtual storage volume, used to identify whether the storage block is idle; For each storage block, apply for a data object
  • each storage block in the first virtual storage volume is idle, and the identification bits of the M storage blocks included in the block bitmap object of the first virtual storage volume, The identification bit of the memory block is used to identify that the memory block is free.
  • the operation of generating the object identifier of the boot block object of the first virtual storage volume and the object identifier of the block bitmap object, and the object identifier of the index object of each storage block may be:
  • the volume identifier of the first virtual storage volume and the second preset string are grouped into an object identifier of a boot block object of the first virtual storage volume.
  • the object identifier of the startup block object of the first virtual storage volume composed may be fall613158/OS252/boot.
  • the volume identifier of the first virtual storage volume and the third preset string are grouped into object identifiers of the block bitmap object of the first virtual storage volume.
  • the object identifier of the block bitmap object of the first virtual storage volume composed may be fall613158/OS252/map.
  • the volume identifier of the first virtual storage volume, the fourth preset character string, and the block number of the storage block in the first virtual storage volume constitute an object identifier of the index object of the storage block.
  • the fourth preset character string is info and the block number of the storage block in the first virtual storage volume is 1, the object identifier of the index object of the storage block that is formed is fall613158/OS252/info/1.
  • the volume identifier of the first virtual storage volume may also be added to the memory of the first storage device.
  • the memory of the first storage device may include a storage volume linked list, where the storage volume linked list is used to store a volume identifier of each virtual storage volume corresponding to the first storage device.
  • each node in the storage volume linked list is used to store a volume identifier of a virtual storage volume. Therefore, adding a node that stores the volume identifier of the first virtual storage volume to the storage volume linked list is implemented to add the volume identifier of the first virtual storage volume to the memory of the first storage device.
  • the embodiment of the present application provides a method for loading a virtual storage volume.
  • the method may be applied to a network architecture as shown in FIG. 1-1, and the execution entity may be a storage device in the network architecture.
  • the storage device is referred to as a first storage device for convenience of description.
  • the volume identifier of the virtual storage volume corresponding to the first storage device is loaded into the first storage device according to the storage volume list object of the first storage device in the object storage platform.
  • the data saved in the memory of the first storage device may be lost when the first storage device is turned off, that is, the volume identifier of the virtual storage volume corresponding to the first storage device included in the memory of the first storage device may be lost.
  • the volume identifier of the virtual storage volume corresponding to the first storage device needs to be saved to the memory of the first storage device.
  • Loading the volume identifier of the virtual storage volume corresponding to the first storage device into the first storage device is: saving the volume identifier of the virtual storage volume corresponding to the first storage device to the memory of the first storage device. Referring to Figure 3, the loading process can be:
  • Step 301 The first storage device downloads its corresponding storage volume list object from the object storage platform.
  • the first storage device may obtain the object identifier of the storage volume list object, invoke the object storage interface, and download the storage volume list object corresponding to the object identifier from the object storage platform by using the invoked object storage interface.
  • the first storage device may form the first preset character string and the device identifier of the first storage device to form an object identifier of the storage volume list object.
  • the first storage device may use the first preset character string as a prefix of the device identifier of the first storage device and the device identifier of the first storage device to form an object identifier of the storage volume list object.
  • the first preset character string is LIST
  • the device identifier of the first storage device is fall 613158
  • the first preset character string LIST is used as a prefix
  • the device identifier fall 613158 of the first storage device constitutes an object identifier of the storage volume list object.
  • LIST_fall613158 LIST_fall613158.
  • the first storage device may use the first preset character string as a suffix of the device identifier of the first storage device and the device identifier of the first storage device to form an object identifier of the storage volume list object.
  • the first preset character string is LIST
  • the first preset character string LIST is used as a suffix
  • the object identifier of the storage volume list object is formed with the device identifier fall 613158 of the first storage device as fall613158/LIST.
  • Step 302 Download a boot block object of the second virtual storage volume from the object storage platform according to the volume identifier of the second virtual storage volume, where the volume identifier of the second virtual storage volume is any virtual storage volume in the storage volume list object. Volume identification.
  • the object identifier of the startup block object of the second virtual storage volume is generated, and the object storage interface is invoked, and the startup block object corresponding to the object identifier is downloaded from the object storage platform through the object storage interface.
  • the volume identifier of the second virtual storage volume and the second preset string may be formed into an object identifier of the startup block object of the second virtual storage volume. For example, suppose the second string boot is preset, the volume identifier of the second virtual storage volume is fall613158/OS252, and the object identifier of the startup block object of the composed second virtual storage volume may be fall613158/OS252/boot.
  • Step 303 Add a volume identifier of the second virtual storage volume to the first storage device when the boot block object of the second virtual storage volume stores the device identifier of the first storage device.
  • the volume basic information of the second virtual storage volume is stored in the startup block object of the second virtual storage volume, and the volume basic information includes at least the capacity of the second virtual storage volume, the number of storage blocks, and the device identifier of the storage device to which the storage device belongs.
  • the memory of the first storage device may include a storage volume linked list, where the storage volume linked list is used to store a volume identifier of each virtual storage volume corresponding to the first storage device.
  • a node storing the volume identifier of the second virtual storage volume is added to the storage volume linked list to implement the first
  • the volume identifier of the second virtual storage volume is added to the memory of the first storage device.
  • steps 302 and 303 above are performed on the volume identifier of each virtual storage volume in the storage volume list object, thereby loading the virtual storage volume of the first storage device into the first storage device.
  • the embodiment of the present application provides a method for taking over a virtual storage volume.
  • the method can be applied to the network architecture shown in FIG. 1-1, and the execution entity can be a storage device in the network architecture.
  • the storage device is referred to as a first storage device, and the first storage device takes over the third virtual storage volume according to the volume identifier of the third virtual storage volume, and the third virtual storage volume is The virtual storage volume corresponding to the second storage device, and the second storage device is a storage device other than the first storage device.
  • the takeover process can be:
  • Step 401 The first storage device receives a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume.
  • the management device can send a takeover request message to the first storage device.
  • the management device may schedule a storage device other than the second storage device to take over the virtual storage volume of the second storage device.
  • the implementation process can be:
  • the management device downloads the storage volume list object corresponding to the second storage device from the object storage platform, and determines the storage device to be taken over, which is referred to as the first storage device for convenience of description. Selecting, from the storage volume list object, a volume identifier of the virtual storage volume for the first storage device. To facilitate description of the volume identifier of the third virtual storage volume, a takeover request message is sent to the first storage device, where the takeover request message carries the Volume ID of the three virtual storage volumes.
  • the management device further stores a correspondence between the device identifier and the first index information of the storage block, where the first index information of each storage block in the correspondence relationship is
  • An index information includes at least a volume identifier of a storage volume in which the storage block is located, a block number of the storage block, a data identifier of data stored in the storage block, a start position and a data length of the data, and the like.
  • each first index information including the volume identifier of the third virtual storage volume may also be obtained from the corresponding relationship, where the corresponding information is obtained.
  • the device identifier of the storage device corresponding to each first index information is updated to the device identifier of the first storage device.
  • the operation of the management device to download the storage volume list object corresponding to the second storage device may be: acquiring the device identifier of the second storage device, and setting the device identifier of the second storage device and the first preset character
  • the string constitutes an object identifier of the storage volume list object of the second storage device; and the storage volume list object corresponding to the second storage device is downloaded from the object storage platform according to the object identifier.
  • Step 402 The first storage device updates the device identifier of the second storage device saved in the startup block object of the third virtual storage volume to the device identifier of the first storage device according to the volume identifier of the third virtual storage volume.
  • the first storage device may form a volume identifier of the third virtual storage volume and a second preset character string to form an object identifier of the startup block object, and download a startup block object of the third virtual storage volume from the object storage platform according to the object identifier; Modifying the device identifier of the second storage device saved in the boot block object to the device identifier of the first storage device; uploading the modified boot block object to the object storage platform, so that the third virtual storage volume to be saved by the object storage platform The startup block object is updated to the modified startup block object.
  • Step 403 The first storage device adds the volume identifier of the third virtual storage volume to the storage volume list object corresponding to the first storage device in the memory of the first storage device.
  • the first storage device may compose the device identifier and the first preset character string into an object identifier of the storage volume list object, and download the corresponding corresponding storage device from the object storage platform according to the object identifier. Storing a volume list object, adding a volume identifier of the third virtual storage volume to the storage volume list object; uploading the added storage volume list object to the object storage platform, so that the object storage platform stores the storage volume corresponding to the first storage device The list object is updated to the added storage volume list object.
  • the first storage device may add a node that stores the volume identifier of the third virtual storage volume in the storage storage volume linked list thereof, and add the volume identifier of the third virtual storage volume to the first A memory device in memory.
  • the first storage device when the second storage device is faulty or exits, the first storage device may be used to take over the third virtual storage volume corresponding to the second storage device, so that when the second storage device is faulty, A storage device reads the data in the third virtual storage volume, and the data cannot be read when the second storage device fails or exits, thereby improving the reliability of the data storage.
  • an embodiment of the present application provides a method for storing data, where the method includes:
  • Step 501 The first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume.
  • the data to be stored may be data buffered by the first storage device, and the cached data may be sent by the management device.
  • the management device can receive data sent by the terminal device, and the terminal device can be an imaging device or the like, and the data can be image data captured by the imaging device.
  • the management device determines a storage device for storing the data.
  • the storage device is referred to as a first storage device, and the data is sent to the first storage device.
  • the first storage device receives the data and caches the data in its buffer.
  • the first storage device may reach a preset data volume threshold in the amount of data in the buffer, or the buffer occupancy rate reaches a preset occupancy threshold, or in its buffer cache.
  • the method of the embodiment is started to store the data to be stored in the buffer into the object storage platform.
  • the method in this embodiment is also started to store the data to be stored in the buffer into the object storage platform. That is, even if the amount of data in the buffer does not reach the preset data amount threshold, or if the buffer occupancy rate does not reach the preset occupancy threshold, or if its buffer is not buffered, etc., when in the buffer
  • the method of the embodiment is started to store the data to be stored in the buffer into the object storage platform.
  • the first storage device stores the data to be stored in the cache cache of the cache to the object storage platform, which can improve the reliability of the data storage.
  • the target virtual storage volume may be determined through the following processes of 5011 to 5013, and the target storage block is determined, respectively:
  • the volume identifier of the corresponding at least one virtual storage volume is stored in the memory of the first storage device.
  • the first storage device determines each virtual storage volume corresponding to each virtual storage volume that is stored according to the volume identifier of each virtual storage volume that it stores, and selects one virtual storage volume from each corresponding virtual storage volume as the target virtual storage. volume.
  • Block 5012 Download a block bitmap object of the target virtual storage volume from the object storage platform, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and the storage block identifier bit is used for record storage. Whether the block is free.
  • the volume identifier of the target virtual storage volume and the third preset string may be formed into an object identifier of the block bitmap object of the target virtual storage volume, and the object storage interface is invoked, and the object storage identifier is downloaded according to the object identifier.
  • a block bitmap object for the target virtual storage volume may be formed into an object identifier of the block bitmap object of the target virtual storage volume, and the object storage interface is invoked, and the object storage identifier is downloaded according to the object identifier.
  • the volume identifier of the target virtual storage volume is fall613158/OS252
  • the third preset string is map
  • the volume identifier fall613158/OS252 of the target virtual storage volume and the third preset string map are composed of the target virtual storage volume.
  • the object identifier of the block bitmap object is fall613158/OS252/map.
  • the object storage interface is called, and the block bitmap object of the target virtual storage volume is downloaded through the object storage interface according to the object identifier fall613158/OS252/map.
  • the block bitmap object is used to store the identification bits corresponding to each of the storage blocks in the target virtual storage volume.
  • the storage bits of each storage block in the block bitmap object are stored in the same order as each storage block in the target virtual storage volume.
  • the identification bit of the storage block is used to identify whether the storage block is free. In a possible implementation manner, when the identifier bit is a value of 1, it may indicate that the storage block is idle; when the identifier bit is a value of 0, it may indicate that the storage block has been used.
  • the block bitmap object stores 0001111, it means that the first storage block, the second storage block, and the third storage block in the target virtual storage volume are used, and the fourth storage block and the fifth storage block are used.
  • the memory block, the sixth memory block, and the seventh memory block are all free.
  • the free storage block in the target virtual storage volume can be determined, and the storage block is selected from the free storage block as the target storage block.
  • the storage block and the seventh storage block can select the fourth storage block as the target storage block.
  • the identification bit of the target storage block is set to be used to identify that the target storage block has been used.
  • Step 502 The first storage device applies at least one data object included in the target storage block in the object storage platform.
  • the first storage device acquires an index object of the target storage block from the object storage platform, and applies N data objects from the object storage platform according to the number N of data objects included in the target storage block stored by the index object, and sets the N The object ID of each data object in the data object.
  • the setting process of the object identifier of the data object can be:
  • the volume identifier of the target virtual storage volume, the block number, and the sequence number may be formed into an object identifier of the data object. For example, suppose the volume identifier of the target virtual storage volume is fall613158/OS252, the block number is 1, and the sequence number is 1, the object identifier of the data object composed is fall613158/OS252/1/1. or,
  • the volume identifier of the target virtual storage volume, the block number, the sequence number, and the fifth preset string may be formed into an object identifier of the data object. For example, suppose the volume identifier of the target virtual storage volume is fall613158/OS252, the block number is 1, the sequence number is 1, and the fifth preset string is DATA/BLOCK, and the object identifier of the data object composed is fall613158/OS252. /DATA/BLOCK/1/1.
  • Step 503 The first storage device stores the to-be-stored data in the at least one data object.
  • the first storage device selects one or more data objects from the data objects included in the target storage block according to the data amount of the data to be stored, and sends a storage request to the object storage platform through the object storage interface.
  • the storage request carries the object identifier of the data to be stored and the selected data object.
  • the object storage platform stores the data to be stored in the data object corresponding to the object identifier.
  • the capacity of each data object in the object storage platform may be equal, and the capacity of the data object is included in the first storage device, so the first storage device determines the data object according to the data amount of the data to be stored and the capacity of the data object.
  • the number according to the number, selects a data object from the data objects included in the target storage block.
  • Step 504 The first storage device saves the correspondence between the device identifier and the first index information in the management device, and stores the second index information in the index block object corresponding to the target storage block in the object storage platform.
  • the first index information includes at least a volume identifier of the target virtual storage volume, a block number of the target storage block, and a data identifier of the data to be stored, a first data start location, and a first data length.
  • the second index information includes at least a first data start position.
  • the first data starting position is a starting storage location of the data to be stored in the target storage block, and the first data length is the length of the data to be stored.
  • the first storage device may update the third index information saved by the index object of the target storage block to the second index information, or add the second index information to the index object of the target storage block; and then upload the update to the object storage platform. Or the added index object, so that the object storage platform replaces the index object of its saved target storage block with the updated or added index object.
  • the first storage device may send the first index information to the management device, so that the management device saves the device identifier of the first storage device and the first index information in a corresponding relationship between the device identifier and the first index information.
  • the data identifier of the data to be stored may be a device identifier of a device that collects data to be stored.
  • the data identifier of the data to be stored may be the device identifier of the camera device
  • the first data start position of the data to be stored may be the start of the segment of video data. time.
  • the first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume; and at least one of the target storage blocks is requested in the object storage platform.
  • a data object storing the data to be stored in at least one data object.
  • the data to be stored is stored in the data object of the object storage platform, which can improve the reliability of the data storage.
  • an embodiment of the present application provides a method for reading data, where the method includes:
  • Step 601 Receive a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, a volume identifier of the target storage volume where the data to be read is located, and a target The block number of the storage block.
  • the read request message may be sent by the management device.
  • the corresponding relationship between the device identifier and the first index information is stored in the management device.
  • the first index information of the storage block is stored in the correspondence, and the first index information of the storage block includes at least a volume identifier of the virtual storage volume where the storage block is located, a block number of the storage block, and is stored in the storage block.
  • the management device may receive the query data request from the terminal device, where the query data request may carry the data identifier of the data to be read, the second data start location, and the second data length; and the slave device identifier according to the data identifier of the data to be read.
  • first index information of the at least one storage block Obtaining, by the correspondence relationship with the first index information, first index information of the at least one storage block, where the first index information of each of the at least one storage block includes a data identifier of the data to be read, according to each storage block Determining a first data start position and a first data length included in the first index information, determining a location range of data stored in each of the storage blocks, determining a location range including the second data start position, and determining the determined location range Corresponding storage block is used as the target storage block; the device identifier of the storage device corresponding to the first index information of the target storage block is obtained from the correspondence, and the target virtual storage of the target storage block is obtained from the first index information of the target storage block.
  • the volume ID of the volume and the block number of the target storage block; the storage device is identified according to the device identifier of the storage device Transmitting a read request message including location information, where the second data start position of the data to be read, the second data length, the volume identifier of the target storage volume where the data to be read is located, and the target storage block where the target is located Block number.
  • the data to be read can be read from the target storage block in the object storage platform according to the location information.
  • the detailed reading process can be implemented by the following steps 602 to 604.
  • Step 602 Acquire an index object of the target storage block from the object storage platform according to the volume identifier of the target storage volume and the block number of the target storage block, where the index object includes a first data start position of the data stored in the target storage block.
  • the object identifier of the index object of the target storage block is obtained according to the volume identifier of the target storage volume and the block number of the target storage block, and the index object of the target storage block is downloaded from the object storage platform according to the object identifier.
  • the volume identifier of the target virtual storage volume, the fourth preset character string, and the block number of the target storage block may be the object identifier of the index object of the target storage block.
  • Step 603 Determine, according to the first data start position and the second data start position, an offset of the target data object for storing the data to be read and the data to be read in the target data object.
  • Each data object in the object storage platform has the same capacity. Therefore, in this step, a difference between the first data start position and the second data start position may be calculated, and according to the difference and the data object capacity, the target data object for storing the data to be read may be calculated. The sequence number and the offset of the data to be read in the target data object.
  • Step 604 Read data to be read from the target data object according to the offset and the second data length.
  • An object identifier of the target data object may be obtained, and according to the offset, the data to be read of the second data length is read in the data object corresponding to the object identifier in the object storage platform.
  • the read data is sent to the management device, and the data to be read is sent by the management device to the terminal device.
  • the object identifier of the target data object may be generated according to the volume identifier of the target virtual storage volume, the block number of the target storage block, and the sequence number of the target data object.
  • the volume identifier of the target virtual storage volume, the block number of the target storage block, and the sequence number of the target data object may be composed of the object identifier of the data object.
  • the volume identifier of the target virtual storage volume, the block number of the target storage block, the sequence number of the target data object, and the fifth preset string may be composed of the object identifier of the data object.
  • a read request message including location information is included, where the location information includes a second data start location of the data to be read, a second data length, and a volume identifier of the target storage volume where the data to be read is located And a block identifier of the target storage block; and reading the data to be read from the target storage block in the object storage platform according to the location information. Therefore, the data is stored in the object storage platform. Since the object storage platform stores data with high reliability, the data is stored in the object storage platform, thereby improving the reliability of the data storage. Using data objects in the object storage platform to simulate blocks, it is easy to manage unstructured data such as video data. In addition, one of the multiple storage devices fails, and other normal devices can quickly take over the storage volumes in the failed device. , which further improves reliability.
  • an embodiment of the present application provides an apparatus 700 for storing data, where the apparatus 700 includes:
  • a determining module 701 configured to determine a target virtual storage volume for storing data to be stored, and determine a target storage block from the target virtual storage volume;
  • the application module 702 is configured to apply, in the object storage platform, at least one data object included in the target storage block;
  • a storage module 703 configured to store the to-be-stored data in the at least one data object, and correspondingly save a correspondence between the device identifier of the device 700 and the first index information, where the first The index information includes at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, a first data start location of the data to be stored, and the to-be-stored data
  • the first data length is stored in the index block object corresponding to the target storage block in the object storage platform, and the second index information includes at least the first data start position.
  • the determining module 701 includes:
  • a first selection unit configured to select one virtual storage volume from the at least one virtual storage volume corresponding to the device 700 as the target virtual storage volume
  • An obtaining unit configured to acquire, from the object storage platform, a block bitmap object of the target virtual storage volume, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and a storage block The flag bit is used to record whether the memory block is idle;
  • a second selecting unit configured to select, from the target virtual storage volume, a free storage block as the target storage block according to the block bitmap object.
  • the apparatus 700 further includes:
  • a setting unit configured to set, in a block bitmap object of the target virtual storage volume, an identification bit of the target storage block to identify that the target storage block has been used.
  • the apparatus 700 further includes:
  • a module is created for creating a first virtual storage volume for the apparatus 700 in the object storage platform.
  • the creating module includes:
  • a generating unit configured to generate a volume identifier of the first virtual storage volume
  • a first adding unit configured to add a volume identifier of the first virtual storage volume to a storage volume list object corresponding to the device 700 located in the object storage platform;
  • An application unit configured to apply, in the object storage platform, a boot block object of the first virtual storage volume, a block bitmap object, and an index object of each of the first virtual storage volumes;
  • the boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the device 700; And storing an identifier bit of each storage block in the first virtual storage volume, where an identifier bit of the storage block is used to identify whether the storage block is idle; an index object of the storage block is used to store third index information, where The third index information includes at least the number of data objects in the storage block.
  • the apparatus 700 further includes:
  • a loading module configured to load at least one virtual storage volume corresponding to the device 700 to the device 700 according to a storage volume list object corresponding to the device 700 in the object storage platform when the device 700 is started.
  • the storage volume list object is configured to store a volume identifier of the at least one virtual storage volume corresponding to the device 700.
  • the loading module includes:
  • a downloading unit configured to download a storage volume list object corresponding to the device 700 from the object storage platform, and download the second virtual storage volume from the object storage platform according to a volume identifier of the second virtual storage volume Activating a block object, the volume identifier of the second virtual storage volume being a volume identifier of any one of the storage volume list objects;
  • a second adding unit configured to add a volume identifier of the second virtual storage volume to the device 700 when the boot block object stores the device identifier of the device 700.
  • the apparatus 700 further includes:
  • a takeover module configured to take over the third virtual storage volume according to the volume identifier of the third virtual storage volume, where the third virtual storage volume is a virtual storage volume corresponding to the second storage device, and the second storage device is Other storage devices than the device 700.
  • the takeover module includes:
  • a receiving unit configured to receive a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume
  • An update unit configured to update, according to the volume identifier of the third virtual storage volume, a device identifier of the second storage device saved in the startup block object of the third virtual storage volume to a device identifier of the device 700;
  • a third adding unit configured to add a volume identifier of the third virtual storage volume to the storage volume list object corresponding to the device 700 in the device 700.
  • an embodiment of the present application provides an apparatus 800 for reading data, where the apparatus 800 includes:
  • the receiving module 801 is configured to receive a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, and a target storage volume where the data to be read is located The volume identifier and the block identifier of the target storage block in which it resides;
  • the reading module 802 is configured to read the data to be read from the target storage block in the object storage platform according to the location information.
  • the reading module 802 includes:
  • An obtaining unit configured to acquire an index object of the target storage block from an object storage platform according to a volume identifier of the target storage volume and a block identifier of the target storage block, where the index object includes the target storage block The first data start position of the stored data;
  • a determining unit configured to determine, according to the first data start location and the second data start location, a target data object for storing the data to be read and the data to be read in the target data The offset in the object;
  • a reading unit configured to read the data to be read from the target data object according to the offset and the second data length.
  • the embodiment of the present application provides a system 900 for storing data, where the system 900 includes: a storage device 901, an object storage platform 902, and a management device 903;
  • the first storage device 901 is configured to determine a target virtual storage volume for storing data to be stored, and determine a target storage block from the target virtual storage volume; apply the target storage in the object storage platform 902 At least one data object included in the block; storing the data to be stored in the at least one data object; correspondingly storing a correspondence between the device identifier of the storage device 901 and the first index information in the management device 903
  • the first index information includes at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, and a first data start location of the data to be stored. a first data length of the data to be stored; storing, in the index block object corresponding to the target storage block in the object storage platform, second index information, where the second index information includes at least the first data starting point.
  • an embodiment of the present application provides a system 1000 for reading data, where the system 1000 includes: a storage device 1001, a management device 1002, and an object storage platform 1003;
  • the storage device 1001 is configured to receive a read request message that includes the location information that is sent by the management device 1002, where the location information includes a second data start location, a second data length, and the to-be-read data. And reading a volume identifier of the target storage volume where the data is located and a block identifier of the target storage block where the data is stored; and reading the data to be read from the target storage block in the object storage platform 1003 according to the location information.
  • FIG. 11 is a block diagram showing the structure of a device 1100 according to an exemplary embodiment of the present invention.
  • the device 1100 includes a processor 1101 and a memory 1102.
  • the processor 1101 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like.
  • the processor 1101 may be configured by at least one of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). achieve.
  • the processor 1101 may also include a main processor and a coprocessor.
  • the main processor is a processor for processing data in an awake state, which is also called a CPU (Central Processing Unit); the coprocessor is A low-power processor for processing data in standby.
  • the processor 1101 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and rendering of content that needs to be displayed on the display screen.
  • the processor 1101 may further include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
  • AI Artificial Intelligence
  • Memory 1102 can include one or more computer readable storage media, which can be non-transitory. Memory 1102 can also include high speed random access memory, as well as non-volatile memory, such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer readable storage medium in memory 1102 is for storing at least one instruction for execution by processor 1101 to implement the present application as shown in FIGS. 2-6. The method provided by any of the method embodiments.
  • the device 1100 can also optionally include: a peripheral device interface 1103 and at least one peripheral device.
  • the processor 1101, the memory 1102, and the peripheral device interface 1103 may be connected by a bus or a signal line.
  • Each peripheral device can be connected to the peripheral device interface 1103 via a bus, signal line or circuit board.
  • the peripheral device includes at least one of a radio frequency circuit 1104, an audio circuit 1107, and a power source 1109.
  • the peripheral device interface 1103 can be used to connect at least one peripheral device associated with an I/O (Input/Output) to the processor 1101 and the memory 1102.
  • processor 1101, memory 1102, and peripheral interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any of processor 1101, memory 1102, and peripheral interface 1103 or The two can be implemented on a separate chip or circuit board, which is not limited in this embodiment.
  • the RF circuit 1104 is configured to receive and transmit an RF (Radio Frequency) signal, also called an electromagnetic signal.
  • the RF circuit 1104 communicates with the communication network and other communication devices via electromagnetic signals.
  • the radio frequency circuit 1104 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal.
  • the radio frequency circuit 1104 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like.
  • the radio frequency circuit 1104 can communicate with other devices via at least one wireless communication protocol.
  • the wireless communication protocols include, but are not limited to, the World Wide Web, a metropolitan area network, an intranet, generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity) networks.
  • the display 1105 is used to display a UI (User Interface).
  • the UI can include graphics, text, icons, video, and any combination thereof.
  • the display 1105 also has the ability to capture touch signals over the surface or surface of the display 1105.
  • the touch signal can be input to the processor 1101 as a control signal for processing.
  • the display 1105 can also be used to provide virtual buttons and/or virtual keyboards, also referred to as soft buttons and/or soft keyboards.
  • the display 1105 can be made of a material such as an LCD (Liquid Crystal Display) or an OLED (Organic Light-Emitting Diode).
  • the audio circuit 1107 can include a microphone and a speaker.
  • the microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals for input to the processor 1101 for processing, or to the RF circuit 1104 for voice communication.
  • the microphones may be multiple, and are respectively disposed at different parts of the device 1100.
  • the microphone can also be an array microphone or an omnidirectional acquisition microphone.
  • the speaker is then used to convert electrical signals from the processor 1101 or the RF circuit 1104 into sound waves.
  • the speaker can be a conventional film speaker or a piezoelectric ceramic speaker.
  • the audio circuit 1107 can also include a headphone jack.
  • Power source 1109 is used to power various components in device 1100.
  • the power source 1109 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery.
  • the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery.
  • a wired rechargeable battery is a battery that is charged by a wired line
  • a wireless rechargeable battery is a battery that is charged by a wireless coil.
  • the rechargeable battery can also be used to support fast charging technology.
  • FIG. 11 does not constitute a limitation to device 1100, may include more or fewer components than illustrated, or may combine certain components, or employ different component arrangements.

Landscapes

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

Abstract

The present application belongs to the field of communications and relates to a method, apparatus and system for storing data, and a method, apparatus and system for reading the data. The method comprises: a first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume; apply for at least one data object comprised in the target storage block in an object storage platform; store the data to be stored into the at least one data object; correspondingly save a correspondence relationship between a device identifier of a management device and first index information in the management device; and store second index information in an index block object corresponding to the target storage block in the object storage platform. The present application can improve the reliability of data storage.

Description

一种存储数据的方法、读取数据的方法、装置及系统Method for storing data, method, device and system for reading data
本申请要求于2018年5月17日提交的申请号为201810474325.1、发明名称为“一种存储数据的方法、读取数据的方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The application claims the priority of the Chinese patent application filed on May 17, 2018, the application number of which is the number of the above-mentioned patent application No. 201101474,324.31, the title of the invention is "a method of storing data, a method, a device and a system for reading data", the entire contents of which are The citations are incorporated herein by reference.
技术领域Technical field
本申请涉及通信领域,特别涉及一种存储数据的方法、读取数据的方法、装置及系统。The present application relates to the field of communications, and in particular, to a method for storing data, a method, device, and system for reading data.
背景技术Background technique
在监控领域,摄像设备用于拍摄视频数据,摄像设备拍摄的视频数据需要被保存,以便后期可以查询某段时间摄像设备拍摄的视频数据。目前摄像设备在拍摄到视频数据后,将拍摄的视频数据发送到网络侧。In the field of monitoring, the camera device is used to capture video data, and the video data captured by the camera device needs to be saved, so that the video data captured by the camera device can be queried in a later period. At present, the camera device transmits the captured video data to the network side after capturing the video data.
在网络侧可以事先部署管理服务器和多个存储服务器,每个存储服务器中部署了容量较大的磁盘。管理服务器在接收摄像设备发送的视频数据时,从该多个存储服务器选择一个存储服务器,将该视频数据存储在选择的该存储服务器的磁盘中。On the network side, a management server and multiple storage servers can be deployed in advance, and a large-capacity disk is deployed in each storage server. When receiving the video data sent by the camera device, the management server selects a storage server from the plurality of storage servers, and stores the video data in the selected disk of the storage server.
发明人在实现本申请的过程中,发现上述方式至少存在如下缺陷:In the process of implementing the present application, the inventors found that the above method has at least the following defects:
由于存储服务器的可靠性不高,所以将视频数据存储存储服务器上,导致数据的存储可靠性也较低。Since the reliability of the storage server is not high, the video data is stored on the storage server, resulting in low reliability of data storage.
发明内容Summary of the invention
为了提高数据存储的可靠性,本申请实施例提供了一种存储数据的方法、读取数据的方法、装置及系统。所述技术方案如下:In order to improve the reliability of the data storage, the embodiment of the present application provides a method for storing data, a method, device, and system for reading data. The technical solution is as follows:
第一方面,本申请实施例提供了一种存储数据的方法,所述方法包括:In a first aspect, an embodiment of the present application provides a method for storing data, where the method includes:
第一存储设备确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块;The first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume;
所述第一存储设备在对象存储平台中申请所述目标存储块包括的至少一个数据对象;The first storage device applies at least one data object included in the target storage block in an object storage platform;
所述第一存储设备在管理设备中对应保存其设备标识与第一索引信息之间的对应关系,所述第一索引信息至少包括所述目标虚拟存储卷的卷标识、所述目标存储块的块标识、所述待存储数据的数据标识、所述待存储数据的第一数据起始位置和所述待存储数据的第一数据长度;The first storage device correspondingly saves a correspondence between the device identifier and the first index information in the management device, where the first index information includes at least a volume identifier of the target virtual storage volume, and the target storage block. a block identifier, a data identifier of the data to be stored, a first data start location of the data to be stored, and a first data length of the data to be stored;
所述第一存储设备在所述对象存储平台中的所述目标存储块对应的索引块对象中存储第二索引信息,所述第二索引信息至少包括所述第一数据起始位置。The first storage device stores second index information in an index block object corresponding to the target storage block in the object storage platform, where the second index information includes at least the first data start position.
可选的,所述确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块,包括:Optionally, the determining a target virtual storage volume for storing data to be stored, and determining a target storage block from the target virtual storage volume, includes:
从所述第一存储设备对应的至少一个虚拟存储卷中选择一个虚拟存储卷作为目标虚拟存储卷;Selecting one virtual storage volume from the at least one virtual storage volume corresponding to the first storage device as the target virtual storage volume;
从对象存储平台中获取所述目标虚拟存储卷的块位图对象,所述块位图对象用于存储所述目标虚拟存储卷中的每个存储块的标识位,存储块的标识位用于记录所述存储块是否空闲;Obtaining, from the object storage platform, a block bitmap object of the target virtual storage volume, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and an identifier bit of the storage block is used for Recording whether the storage block is idle;
根据所述块位图对象从所述目标虚拟存储卷中选择空闲的存储块作为目标存储块。A free memory block is selected from the target virtual storage volume as a target storage block according to the block bitmap object.
可选的,所述根据所述块位图对象从所述目标虚拟存储卷中选择空闲的存储块作为目标存储块之后,还包括:Optionally, after the selecting, according to the block bitmap object, the free storage block from the target virtual storage volume as the target storage block, the method further includes:
在所述目标虚拟存储卷的块位图对象中,将所述目标存储块的标识位设置成用于标识所述目标存储块已被使用。In a block bitmap object of the target virtual storage volume, an identification bit of the target storage block is set to identify that the target storage block has been used.
可选的,所述方法还包括:Optionally, the method further includes:
在所述对象存储平台中为所述第一存储设备创建第一虚拟存储卷。Creating a first virtual storage volume for the first storage device in the object storage platform.
可选的,所述在所述对象存储平台中为所述第一存储设备创建第一虚拟存储卷,包括:Optionally, the creating, by the object storage platform, the first virtual storage volume for the first storage device includes:
生成第一虚拟存储卷的卷标识;Generating a volume identifier of the first virtual storage volume;
将所述第一虚拟存储卷的卷标识添加到位于所述对象存储平台中的所述第一存储设备对应的存储卷列表对象中;Adding a volume identifier of the first virtual storage volume to a storage volume list object corresponding to the first storage device in the object storage platform;
在所述对象存储平台中申请所述第一虚拟存储卷的启动块对象、块位图对象和所述第一虚拟存储卷中的每个存储块的索引对象;Applying, in the object storage platform, a boot block object of the first virtual storage volume, a block bitmap object, and an index object of each of the first virtual storage volumes;
其中,所述启动块对象用于存储卷基本信息,所述卷基本信息至少包括所述第一虚拟存储卷的容量、存储块数目和所述第一存储设备的设备标识;所述块位图对象用于存储所述第一虚拟存储卷中的每个存储块的标识位,存储块的 标识位用于标识所述存储块是否空闲;所述存储块的索引对象用于存储第三索引信息,所述第三索引信息至少包括所述存储块中的数据对象数目。The boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the first storage device; An object is configured to store an identifier bit of each of the first virtual storage volumes, where an identifier of the storage block is used to identify whether the storage block is idle; an index object of the storage block is used to store third index information. The third index information includes at least the number of data objects in the storage block.
可选的,所述方法还包括:Optionally, the method further includes:
在所述第一存储设备启动时,根据所述对象存储平台中的所述第一存储设备对应的存储卷列表对象,将所述第一存储设备对应的至少一个虚拟存储卷加载到所述第一存储设备中,所述存储卷列表对象用于存储所述第一存储设备对应的至少一个虚拟存储卷的卷标识。Loading at least one virtual storage volume corresponding to the first storage device to the first storage device according to the storage volume list object corresponding to the first storage device in the object storage platform when the first storage device is started In a storage device, the storage volume list object is used to store a volume identifier of at least one virtual storage volume corresponding to the first storage device.
可选的,所述根据所述对象存储平台中的所述第一存储设备对应的存储卷列表对象,将所述第一存储设备对应的至少一个虚拟存储卷加载到所述第一存储设备中,包括:Optionally, the at least one virtual storage volume corresponding to the first storage device is loaded into the first storage device according to the storage volume list object corresponding to the first storage device in the object storage platform. ,include:
从所述对象存储平台中下载所述第一存储设备对应的存储卷列表对象;Downloading, from the object storage platform, a storage volume list object corresponding to the first storage device;
根据第二虚拟存储卷的卷标识,从所述对象存储平台中下载所述第二虚拟存储卷的启动块对象,所述第二虚拟存储卷的卷标识为所述存储卷列表对象中的任一个虚拟存储卷的卷标识;Downloading, according to a volume identifier of the second virtual storage volume, a boot block object of the second virtual storage volume from the object storage platform, where a volume identifier of the second virtual storage volume is any one of the storage volume list objects The volume ID of a virtual storage volume;
在所述启动块对象存储有所述第一存储设备的设备标识时,将所述第二虚拟存储卷的卷标识添加到所述第一存储设备中。And adding, when the boot block object stores the device identifier of the first storage device, the volume identifier of the second virtual storage volume to the first storage device.
可选的,所述方法还包括:Optionally, the method further includes:
所述第一存储设备根据第三虚拟存储卷的卷标识,接管所述第三虚拟存储卷,所述第三虚拟存储卷是第二存储设备对应的虚拟存储卷,所述第二存储设备是除所述第一存储设备以外的其他存储设备。The first storage device takes over the third virtual storage volume according to the volume identifier of the third virtual storage volume, where the third virtual storage volume is a virtual storage volume corresponding to the second storage device, and the second storage device is Other storage devices than the first storage device.
可选的,所述根据第三虚拟存储卷的卷标识,接管所述第三虚拟存储卷,包括:Optionally, the taking over the third virtual storage volume according to the volume identifier of the third virtual storage volume includes:
接收接管请求消息,所述接管请求消息携带所述第三虚拟存储卷的卷标识;Receiving a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume;
根据所述第三虚拟存储卷的卷标识,将所述第三虚拟存储卷的启动块对象中保存的第二存储设备的设备标识更新为所述第一存储设备的设备标识;Updating, according to the volume identifier of the third virtual storage volume, the device identifier of the second storage device saved in the startup block object of the third virtual storage volume to the device identifier of the first storage device;
将所述第三虚拟存储卷的卷标识分别添加到所述第一虚拟存储设备和所述第一存储设备对应的存储卷列表对象中。And adding a volume identifier of the third virtual storage volume to the first virtual storage device and the storage volume list object corresponding to the first storage device.
第二方面,本申请提供了一种读取数据的方法,所述方法包括:In a second aspect, the present application provides a method of reading data, the method comprising:
接收包括位置信息的读取请求消息,所述位置信息包括待读取数据的第二数据起始位置、第二数据长度、所述待读取数据所在的目标存储卷的卷标识和 所在的目标存储块的块标识;Receiving a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, a volume identifier of the target storage volume where the data to be read is located, and a target The block identifier of the storage block;
根据所述位置信息从对象存储平台中的所述目标存储块中读取所述待读取数据。Reading the data to be read from the target storage block in the object storage platform according to the location information.
可选的,所述根据所述位置信息从对象存储平台中的所述目标存储块中读取所述待读取数据,包括:Optionally, the reading the data to be read from the target storage block in the object storage platform according to the location information, including:
根据所述目标存储卷的卷标识和所述目标存储块的块标识,从对象存储平台中获取所述目标存储块的索引对象,所述索引对象包括所述目标存储块中存储的数据的第一数据起始位置;Obtaining an index object of the target storage block from an object storage platform according to a volume identifier of the target storage volume and a block identifier of the target storage block, where the index object includes a data stored in the target storage block a data starting position;
根据所述第一数据起始位置和所述第二数据起始位置,确定用于存储所述待读取数据的目标数据对象和所述待读取数据在所述目标数据对象中的偏移;Determining, according to the first data start position and the second data start position, a target data object for storing the data to be read and an offset of the data to be read in the target data object ;
根据所述偏移和所述第二数据长度,从所述目标数据对象中读取所述待读取数据。Reading the data to be read from the target data object according to the offset and the second data length.
第三方面,本申请提供了一种存储数据的装置,所述装置包括:In a third aspect, the present application provides an apparatus for storing data, the apparatus comprising:
确定模块,用于确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块;a determining module, configured to determine a target virtual storage volume for storing data to be stored, and determining a target storage block from the target virtual storage volume;
申请模块,用于在对象存储平台中申请所述目标存储块包括的至少一个数据对象;An application module, configured to apply, in an object storage platform, at least one data object included in the target storage block;
存储模块,用于将所述待存储数据存储在所述至少一个数据对象中;在管理设备中对应保存所述装置的设备标识与第一索引信息之间的对应关系,所述第一索引信息至少包括所述目标虚拟存储卷的卷标识、所述目标存储块的块标识、所述待存储数据的数据标识、所述待存储数据的第一数据起始位置和所述待存储数据的第一数据长度;在所述对象存储平台中的所述目标存储块对应的索引块对象中存储第二索引信息,所述第二索引信息至少包括所述第一数据起始位置。a storage module, configured to store the to-be-stored data in the at least one data object, and correspondingly store a correspondence between the device identifier of the device and the first index information, where the first index information is And including at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, a first data start location of the data to be stored, and a first to be stored data a data length; storing, in the index block object corresponding to the target storage block in the object storage platform, second index information, where the second index information includes at least the first data start position.
可选的,所述确定模块包括:Optionally, the determining module includes:
第一选择单元,用于从所述装置对应的至少一个虚拟存储卷中选择一个虚拟存储卷作为目标虚拟存储卷;a first selection unit, configured to select one virtual storage volume from the at least one virtual storage volume corresponding to the device as the target virtual storage volume;
获取单元,用于从对象存储平台中获取所述目标虚拟存储卷的块位图对象,所述块位图对象用于存储所述目标虚拟存储卷中的每个存储块的标识位,存储块的标识位用于记录所述存储块是否空闲;An obtaining unit, configured to acquire, from the object storage platform, a block bitmap object of the target virtual storage volume, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and a storage block The flag bit is used to record whether the memory block is idle;
第二选择单元,用于根据所述块位图对象从所述目标虚拟存储卷中选择空闲的存储块作为目标存储块。And a second selecting unit, configured to select, from the target virtual storage volume, a free storage block as the target storage block according to the block bitmap object.
可选的,所述装置还包括:Optionally, the device further includes:
设置单元,用于在所述目标虚拟存储卷的块位图对象中,将所述目标存储块的标识位设置成用于标识所述目标存储块已被使用。a setting unit, configured to set, in a block bitmap object of the target virtual storage volume, an identification bit of the target storage block to identify that the target storage block has been used.
可选的,所述装置还包括:Optionally, the device further includes:
创建模块,用于在所述对象存储平台中为所述装置创建第一虚拟存储卷。A module is created for creating a first virtual storage volume for the device in the object storage platform.
可选的,所述创建模块包括:Optionally, the creating module includes:
生成单元,用于生成第一虚拟存储卷的卷标识;a generating unit, configured to generate a volume identifier of the first virtual storage volume;
第一添加单元,用于将所述第一虚拟存储卷的卷标识添加到位于所述对象存储平台中的所述装置对应的存储卷列表对象中;a first adding unit, configured to add a volume identifier of the first virtual storage volume to a storage volume list object corresponding to the device located in the object storage platform;
申请单元,用于在所述对象存储平台中申请所述第一虚拟存储卷的启动块对象、块位图对象和所述第一虚拟存储卷中的每个存储块的索引对象;An application unit, configured to apply, in the object storage platform, a boot block object of the first virtual storage volume, a block bitmap object, and an index object of each of the first virtual storage volumes;
其中,所述启动块对象用于存储卷基本信息,所述卷基本信息至少包括所述第一虚拟存储卷的容量、存储块数目和所述装置的设备标识;所述块位图对象用于存储所述第一虚拟存储卷中的每个存储块的标识位,存储块的标识位用于标识所述存储块是否空闲;所述存储块的索引对象用于存储第三索引信息,所述第三索引信息至少包括所述存储块中的数据对象数目。The boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the device; the block bitmap object is used for And storing an identifier bit of each of the first virtual storage volumes, where an identifier of the storage block is used to identify whether the storage block is idle; an index object of the storage block is configured to store third index information, The third index information includes at least the number of data objects in the storage block.
可选的,所述装置还包括:Optionally, the device further includes:
加载模块,用于在所述装置启动时,根据所述对象存储平台中的所述装置对应的存储卷列表对象,将所述装置对应的至少一个虚拟存储卷加载到所述装置中,所述存储卷列表对象用于存储所述装置对应的至少一个虚拟存储卷的卷标识。a loading module, configured to load at least one virtual storage volume corresponding to the device into the device according to a storage volume list object corresponding to the device in the object storage platform when the device is started, The storage volume list object is used to store a volume identifier of at least one virtual storage volume corresponding to the device.
可选的,所述加载模块包括:Optionally, the loading module includes:
下载单元,用于从所述对象存储平台中下载所述装置对应的存储卷列表对象;根据第二虚拟存储卷的卷标识,从所述对象存储平台中下载所述第二虚拟存储卷的启动块对象,所述第二虚拟存储卷的卷标识为所述存储卷列表对象中的任一个虚拟存储卷的卷标识;a downloading unit, configured to download, from the object storage platform, a storage volume list object corresponding to the device, and downloading, according to a volume identifier of the second virtual storage volume, the startup of the second virtual storage volume from the object storage platform a volume identifier, where a volume identifier of the second virtual storage volume is a volume identifier of any one of the storage volume list objects;
第二添加单元,用于在所述启动块对象存储有所述装置的设备标识时,将所述第二虚拟存储卷的卷标识添加到所述装置中。a second adding unit, configured to add a volume identifier of the second virtual storage volume to the device when the boot block object stores the device identifier of the device.
可选的,所述装置还包括:Optionally, the device further includes:
接管模块,用于根据第三虚拟存储卷的卷标识,接管所述第三虚拟存储卷,所述第三虚拟存储卷是第二存储设备对应的虚拟存储卷,所述第二存储设备是除所述装置以外的其他存储设备。a takeover module, configured to take over the third virtual storage volume according to the volume identifier of the third virtual storage volume, where the third virtual storage volume is a virtual storage volume corresponding to the second storage device, and the second storage device is Other storage devices than the device.
可选的,所述接管模块包括:Optionally, the takeover module includes:
接收单元,用于接收接管请求消息,所述接管请求消息携带所述第三虚拟存储卷的卷标识;a receiving unit, configured to receive a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume;
更新单元,用于根据所述第三虚拟存储卷的卷标识,将所述第三虚拟存储卷的启动块对象中保存的第二存储设备的设备标识更新为所述装置的设备标识;An update unit, configured to update, according to the volume identifier of the third virtual storage volume, a device identifier of the second storage device saved in the startup block object of the third virtual storage volume to a device identifier of the device;
第三添加单元,用于将所述第三虚拟存储卷的卷标识分别添加到所述装置中和所述装置对应的存储卷列表对象中。And a third adding unit, configured to separately add volume identifiers of the third virtual storage volume to the storage volume list object corresponding to the device and the device.
第四方面,本申请提供了一种读取数据的装置,所述装置包括:In a fourth aspect, the present application provides an apparatus for reading data, the apparatus comprising:
接收模块,用于接收包括位置信息的读取请求消息,所述位置信息包括待读取数据的第二数据起始位置、第二数据长度、所述待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块标识;a receiving module, configured to receive a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, and a volume of the target storage volume where the data to be read is located The identifier of the block and the block of the target storage block;
读取模块,用于根据所述位置信息从对象存储平台中的所述目标存储块中读取所述待读取数据。And a reading module, configured to read the data to be read from the target storage block in the object storage platform according to the location information.
可选的,所述读取模块包括:Optionally, the reading module includes:
获取单元,用于根据所述目标存储卷的卷标识和所述目标存储块的块标识,从对象存储平台中获取所述目标存储块的索引对象,所述索引对象包括所述目标存储块中存储的数据的第一数据起始位置;An obtaining unit, configured to acquire an index object of the target storage block from an object storage platform according to a volume identifier of the target storage volume and a block identifier of the target storage block, where the index object includes the target storage block The first data start position of the stored data;
确定单元,用于根据所述第一数据起始位置和所述第二数据起始位置,确定用于存储所述待读取数据的目标数据对象和所述待读取数据在所述目标数据对象中的偏移;a determining unit, configured to determine, according to the first data start location and the second data start location, a target data object for storing the data to be read and the data to be read in the target data The offset in the object;
读取单元,用于根据所述偏移和所述第二数据长度,从所述目标数据对象中读取所述待读取数据。And a reading unit, configured to read the data to be read from the target data object according to the offset and the second data length.
第五方面,本申请实施例提供了一种存储数据的系统,所述系统包括:存储设备、对象存储平台和管理设备;In a fifth aspect, the embodiment of the present application provides a system for storing data, where the system includes: a storage device, an object storage platform, and a management device;
所述存储设备,用于确定用于存储待存储数据的目标虚拟存储卷,以及从 所述目标虚拟存储卷中确定目标存储块;在所述对象存储平台中申请所述目标存储块包括的至少一个数据对象;将所述待存储数据存储在所述至少一个数据对象中;在所述管理设备中对应保存所述存储设备的设备标识与第一索引信息之间的对应关系,所述第一索引信息至少包括所述目标虚拟存储卷的卷标识、所述目标存储块的块标识、所述待存储数据的数据标识、所述待存储数据的第一数据起始位置和所述待存储数据的第一数据长度;在所述对象存储平台中的所述目标存储块对应的索引块对象中存储第二索引信息,所述第二索引信息至少包括所述第一数据起始位置。The storage device is configured to determine a target virtual storage volume for storing data to be stored, and determine a target storage block from the target virtual storage volume; and apply at least the target storage block included in the object storage platform a data object; storing the data to be stored in the at least one data object; correspondingly storing a correspondence between the device identifier of the storage device and the first index information in the management device, the first The index information includes at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, a first data start location of the data to be stored, and the to-be-stored data The first data length is stored in the index block object corresponding to the target storage block in the object storage platform, and the second index information includes at least the first data start position.
第六方面,本申请实施例提供了一种读取数据的系统,所述系统包括:存储设备、管理设备和对象存储平台;In a sixth aspect, the embodiment of the present application provides a system for reading data, where the system includes: a storage device, a management device, and an object storage platform;
所述存储设备,用于接收所述管理设备发送的包括位置信息的读取请求消息,所述位置信息包括待读取数据的第二数据起始位置、第二数据长度、所述待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块标识;根据所述位置信息从所述对象存储平台中的所述目标存储块中读取所述待读取数据。The storage device is configured to receive a read request message that includes the location information that is sent by the management device, where the location information includes a second data start location of the data to be read, a second data length, and the to-be-read The volume identifier of the target storage volume where the data is located and the block identifier of the target storage block in which the data is stored; the data to be read is read from the target storage block in the object storage platform according to the location information.
本申请实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present application may include the following beneficial effects:
由于第一存储设备确定用于存储待存储数据的目标虚拟存储卷,以及从目标虚拟存储卷中确定目标存储块;在对象存储平台中申请目标存储块包括的至少一个数据对象;将待存储数据存储在至少一个数据对象中。又由于对象存储平台的存储数据的可靠性较高,从而提高了数据存储的可靠性。The first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume; applies at least one data object included in the target storage block in the object storage platform; and the data to be stored Stored in at least one data object. Moreover, since the reliability of the storage data of the object storage platform is high, the reliability of the data storage is improved.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。The above general description and the following detailed description are intended to be illustrative and not restrictive.
附图说明DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The drawings herein are incorporated in and constitute a part of the specification,
图1-1是本申请实施例提供的网络架构示意图;1-1 is a schematic diagram of a network architecture provided by an embodiment of the present application;
图1-2是本申请实施例提供的存储结构示意图;1-2 is a schematic diagram of a storage structure provided by an embodiment of the present application;
图2是本申请实施例提供的一种创建虚拟存储卷的方法流程图;2 is a flowchart of a method for creating a virtual storage volume according to an embodiment of the present application;
图3是本申请实施例提供的一种加载虚拟存储卷的方法流程图;3 is a flowchart of a method for loading a virtual storage volume according to an embodiment of the present application;
图4是本申请实施例提供的一种接管虚拟存储卷的方法流程图;4 is a flowchart of a method for taking over a virtual storage volume according to an embodiment of the present application;
图5是本申请实施例提供的一种存储数据的方法流程图;FIG. 5 is a flowchart of a method for storing data according to an embodiment of the present application;
图6是本申请实施例提供的一种读取数据的方法流程图;FIG. 6 is a flowchart of a method for reading data according to an embodiment of the present application;
图7是本申请实施例提供的一种存储数据的装置结构示意图;FIG. 7 is a schematic structural diagram of an apparatus for storing data according to an embodiment of the present disclosure;
图8是本申请实施例提供的一种读取数据的装置结构示意图;FIG. 8 is a schematic structural diagram of an apparatus for reading data according to an embodiment of the present disclosure;
图9是本申请实施例提供的一种存储数据的系统结构示意图;9 is a schematic structural diagram of a system for storing data according to an embodiment of the present application;
图10是本申请实施例提供的一种读取数据的系统结构示意图;FIG. 10 is a schematic structural diagram of a system for reading data according to an embodiment of the present disclosure;
图11是本申请实施例提供的一种设备结构示意图。FIG. 11 is a schematic structural diagram of a device according to an embodiment of the present application.
通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。The embodiments of the present application have been illustrated by the above-described figures, which will be described in more detail hereinafter. The drawings and the written description are not intended to limit the scope of the present invention in any way, and the concept of the present application will be described by those skilled in the art by referring to the specific embodiments.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. The following description refers to the same or similar elements in the different figures unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with aspects of the present application as detailed in the appended claims.
参见图1-1,参见图1-1,本申请实施例提供了一种网络架构,包括:Referring to FIG. 1-1, referring to FIG. 1-1, an embodiment of the present application provides a network architecture, including:
管理设备1、至少一个存储设备2和对象存储平台3;Management device 1, at least one storage device 2 and object storage platform 3;
管理设备1与该至少一个存储设备2中的每个存储设备2之间建立有网络连接,每个存储设备2与对象存储平台3之间建立有网络连接。该网络连接可以为有线连接或无线连接。A network connection is established between the management device 1 and each of the at least one storage device 2, and a network connection is established between each storage device 2 and the object storage platform 3. The network connection can be a wired connection or a wireless connection.
对象存储平台3采用文件存储方式存储数据,对象存储平台3中的存储单元为数据对象,一个数据对象可以为一个文件。The object storage platform 3 stores data in a file storage manner. The storage unit in the object storage platform 3 is a data object, and one data object can be a file.
存储设备2可以调用对象存储平台3的对象存储接口,通过该对象存储接口可以从对象存储平台3中读取数据、向对象存储平台3中存储数据或从对象存储平台3中删除数据等。The storage device 2 can call an object storage interface of the object storage platform 3, by which data can be read from the object storage platform 3, stored in or deleted from the object storage platform 3, and the like.
在一种可能的实施方式中,管理设备1可以为管理服务器或管理终端等,存储设备2可以为存储服务器或存储终端等。In a possible implementation manner, the management device 1 may be a management server or a management terminal, and the storage device 2 may be a storage server or a storage terminal or the like.
参见图1-2,存储设备2对应一个存储卷列表对象和至少一个虚拟存储卷,每个虚拟存储卷包括至少一个存储块。存储卷列表对象是对象存储平台3中的一个数据对象,用于存储存储设备2对应的每个虚拟存储卷的卷标识。Referring to FIG. 1-2, the storage device 2 corresponds to one storage volume list object and at least one virtual storage volume, and each virtual storage volume includes at least one storage block. The storage volume list object is a data object in the object storage platform 3 for storing the volume identifier of each virtual storage volume corresponding to the storage device 2.
对于每个虚拟存储卷,该虚拟存储卷对应一个启动块对象和一个块位图对象;该启动块对象是对象存储平台3中的一个数据对象,用于存储该虚拟存储卷的卷基本信息,该卷基本信息至少包括该虚拟存储卷的容量、存储块数目和该存储设备2的设备标识。该块位图对象也是对象存储平台3中的一个数据对象,用于存储该虚拟存储卷包括的每个存储块的标识位,存储块的标识位用于标识该存储块是否空闲。For each virtual storage volume, the virtual storage volume corresponds to a boot block object and a block bitmap object; the boot block object is a data object in the object storage platform 3, and is used to store volume basic information of the virtual storage volume. The volume basic information includes at least the capacity of the virtual storage volume, the number of storage blocks, and the device identification of the storage device 2. The block bitmap object is also a data object in the object storage platform 3, and is used for storing an identifier bit of each storage block included in the virtual storage volume, and the identifier bit of the storage block is used to identify whether the storage block is free.
对于该虚拟存储卷中的每个存储块,该存储块对应一个索引对象,且该存储块包括至少一个数据对象。该存储块对应的索引对象为对象存储平台3中的一个数据对象,用于存储该存储块的索引信息;在该存储块未存储数据时,即在该存储块空闲时,该索引信息为第三索引信息,第三索引信息至少包括该存储块中的数据对象数目;在该存储块存储有数据时,该索引信息包括第二索引信息,还可以包括第三索引信息,第二索引信息至少包括该数据的起始位置。For each memory block in the virtual storage volume, the storage block corresponds to an index object, and the storage block includes at least one data object. The index object corresponding to the storage block is a data object in the object storage platform 3, and is used for storing index information of the storage block; when the storage block does not store data, that is, when the storage block is idle, the index information is The third index information includes at least the number of data objects in the storage block. When the storage block stores data, the index information includes second index information, and may further include third index information, where the second index information is at least Includes the starting position of the data.
参见图2,本申请实施例提供了一种创建虚拟存储卷的方法,该方法可以应用于如图1-1所示的网络架构中,且执行主体可以为该网络架构中的存储设备。Referring to FIG. 2, the embodiment of the present application provides a method for creating a virtual storage volume, which may be applied to the network architecture shown in FIG. 1-1, and the execution entity may be a storage device in the network architecture.
对于该网络架构的任一个存储设备,为了便于说明称该存储设备为第一存储设备,第一存储设备在对象存储平台中为其创建第一虚拟存储卷。参见图2,该创建过程可以为:For any storage device of the network architecture, for convenience of description, the storage device is referred to as a first storage device, and the first storage device creates a first virtual storage volume for the storage device in the object storage platform. Referring to Figure 2, the creation process can be:
步骤201:第一存储设备生成第一虚拟存储卷的卷标识。Step 201: The first storage device generates a volume identifier of the first virtual storage volume.
在一种可能的实施方式中,第一存储设备可以分配一个字符串,将第一存储设备的设备标识和该字符串组成第一虚拟存储卷的卷标识。In a possible implementation manner, the first storage device may allocate a character string, and the device identifier of the first storage device and the string form a volume identifier of the first virtual storage volume.
第一存储设备可以随机分配一个字符串,或者在最近上一次分配的字符串基础上进行顺序分配一个字符串。对于顺序分配的方式,假设最近上一次分配的字符串为OS251,则在字符串OS251的基础上顺序分配的字符串为OS252。The first storage device may randomly assign a character string or sequentially assign a character string based on the last last allocated string. For the manner of sequential allocation, assuming that the last last allocated character string is OS 251, the character string sequentially allocated on the basis of the character string OS 251 is OS 252.
在一种可能的实施方式中,可以将该字符串作为后缀,并与第一存储设备的设备标识组成第一虚拟存储卷的卷标识;例如,假设,第一存储设备的设备标识为fall613158,将分配的字符串OS252作为后缀,并与第一存储设备的设备标识组成第一虚拟存储卷的卷标识为fall613158/OS252。或者,In a possible implementation, the string may be suffixed and the device identifier of the first storage device is formed into a volume identifier of the first virtual storage volume; for example, if the device identifier of the first storage device is fall 613158, The assigned character string OS252 is suffixed, and the volume identifier of the first virtual storage volume constituting the device identifier of the first storage device is fall613158/OS252. or,
在一种可能的实施方式中,可以将该字符串作为前缀,并与第一存储设备的设备标识组成第一虚拟存储卷的卷标识;例如,将分配的字符串OS252作为前缀,并与第一存储设备的设备标识组成第一虚拟存储卷的卷标识为OS252/fall613158。In a possible implementation, the string may be prefixed with the device identifier of the first storage device to form a volume identifier of the first virtual storage volume; for example, the assigned string OS252 is prefixed, and The device identifier of a storage device constitutes the volume identifier of the first virtual storage volume as OS252/fall613158.
第一存储设备在生成第一虚拟存储卷的卷标识时,可以保证第一虚拟存储卷的卷标识不与已生成的虚拟存储卷的卷标识相同。所以通常情况下,第一存储设备可以采用顺序分配的方式生成第一虚拟存储卷的卷标识。When the first storage device generates the volume identifier of the first virtual storage volume, it may ensure that the volume identifier of the first virtual storage volume is not the same as the volume identifier of the generated virtual storage volume. Therefore, in general, the first storage device may generate a volume identifier of the first virtual storage volume in a sequential allocation manner.
在一种可能的实施方式中,执行完本步骤后,可以将第一虚拟存储卷的卷标识添加到位于对象存储平台中的第一存储设备对应的存储卷列表对象中,实现过程可以为如下步骤202至204的操作。In a possible implementation, after the step is performed, the volume identifier of the first virtual storage volume may be added to the storage volume list object corresponding to the first storage device in the object storage platform, and the implementation process may be as follows. The operations of steps 202 to 204.
步骤202:第一存储设备确定对象存储平台中是否存在第一存储设备对应的存储卷列表对象,如果不存在,则执行步骤203,如果存在,则执行步骤204。Step 202: The first storage device determines whether there is a storage volume list object corresponding to the first storage device in the object storage platform. If not, step 203 is performed, and if yes, step 204 is performed.
第一存储设备对应的存储卷列表对象是对象存储平台中的数据对象,用于存储属于第一存储设备的至少一个虚拟存储卷的卷标识。The storage volume list object corresponding to the first storage device is a data object in the object storage platform, and is used to store a volume identifier of at least one virtual storage volume belonging to the first storage device.
在一种可能的实施方式中,存储卷列表对象可以包括存储卷列表,属于第一存储设备的至少一个虚拟存储卷的卷标识可以存储在该存储卷列表中。In a possible implementation manner, the storage volume list object may include a storage volume list, and the volume identifier of the at least one virtual storage volume belonging to the first storage device may be stored in the storage volume list.
在本步骤中,第一存储设备可以根据第一存储设备的设备标识和预设和第一预设字符串获取存储卷列表对象的对象标识,调用对象存储接口,通过调用的对象存储接口从对象存储平台查询该对象标识对应的存储卷列表对象。In this step, the first storage device may acquire the object identifier of the storage volume list object according to the device identifier of the first storage device and the preset and the first preset character string, invoke the object storage interface, and invoke the object storage interface from the object. The storage platform queries the storage volume list object corresponding to the object identifier.
在执行本步骤之前如果第一存储设备已在对象存储平台中申请了存储卷列表对象,则对象存储平台中存在一个对象标识与该获取的对象标识相同的数据对象,该数据对象为第一存储设备已在对象存储平台中申请的存储卷列表对象。相应的,第一存储设备可以从对象存储平台查询到获取的该对象标识对应的存储卷列表对象。Before the step of executing, if the first storage device has applied for the storage volume list object in the object storage platform, the object storage platform has an object identifier that is the same as the acquired object identifier, and the data object is the first storage. The storage volume list object that the device has applied for in the object storage platform. Correspondingly, the first storage device may query, from the object storage platform, the obtained storage volume list object corresponding to the acquired object identifier.
在执行本步骤之前如果第一存储设备没有在对象存储平台中申请存储卷列表对象,则对象存储平台中不存在对象标识与获取的该对象标识相同的数据对象。相应的,第一存储设备不可以从对象存储平台查询到获取的该对象标识对应的存储卷列表对象。If the first storage device does not apply for the storage volume list object in the object storage platform before performing this step, the object storage platform does not have the same data object as the obtained object identifier. Correspondingly, the first storage device may not query the obtained storage volume list object corresponding to the object identifier from the object storage platform.
在一种可能的实施方式中,第一存储设备获取存储卷列表对象的对象标识的操作,可以为:In a possible implementation manner, the first storage device acquires an object identifier of the storage volume list object, and may be:
第一存储设备可以将第一预设字符串与第一存储设备的设备标识组成存储 卷列表对象的对象标识。The first storage device may form the first preset character string and the device identifier of the first storage device to form an object identifier of the storage volume list object.
例如,列举了如上两种组成对象标识的例子,对于其他组成对象标识的例子就不再一一列举。在第一个例子中,第一存储设备可以将第一预设字符串作为第一存储设备的设备标识的前缀,与第一存储设备的设备标识组成存储卷列表对象的对象标识。例如,第一预设字符串为LIST,将第一预设字符串LIST作为前缀,与第一存储设备的设备标识fall613158组成存储卷列表对象的对象标识为LIST_fall613158。或者,For example, the above two examples of constituent object identifiers are listed, and examples of other constituent object identifiers are not listed one by one. In the first example, the first storage device may use the first preset character string as the prefix of the device identifier of the first storage device, and the device identifier of the first storage device to form the object identifier of the storage volume list object. For example, the first preset character string is LIST, the first preset character string LIST is used as a prefix, and the object identifier of the storage volume list object is formed by the device identifier fall 613158 of the first storage device as LIST_fall 613158. or,
在第二个例子中,第一存储设备可以将第一预设字符串作为第一存储设备的设备标识的后缀,与第一存储设备的设备标识组成存储卷列表对象的对象标识。例如,假设第一预设字符串为LIST,将第一预设字符串LIST作为后缀,与第一存储设备的设备标识fall613158组成存储卷列表对象的对象标识为fall613158/LIST。In the second example, the first storage device may use the first preset character string as the suffix of the device identifier of the first storage device and the device identifier of the first storage device to form the object identifier of the storage volume list object. For example, suppose the first preset character string is LIST, the first preset character string LIST is used as a suffix, and the object identifier of the storage volume list object is formed with the device identifier fall 613158 of the first storage device as fall613158/LIST.
步骤203:第一存储设备在对象存储平台中申请存储卷列表对象,该存储卷列表对象用于存储第一虚拟存储卷的卷标识,执行步骤205。Step 203: The first storage device applies, in the object storage platform, a storage volume list object, where the storage volume list object is used to store the volume identifier of the first virtual storage volume, and step 205 is performed.
第一存储设备可以调用对象存储平台的对象存储接口,通过该对象存储接口在对象存储平台中申请数据对象,并设置该数据对象的对象标识为获取的该对象标识,得到第一存储设备对应的存储卷列表对象,将第一虚拟存储卷的卷标识存储在该存储卷列表对象中。The first storage device may invoke an object storage interface of the object storage platform, apply for a data object in the object storage platform, and set the object identifier of the data object to obtain the object identifier, and obtain the corresponding storage device. A volume list object is stored, and the volume identifier of the first virtual storage volume is stored in the storage volume list object.
步骤204:第一存储设备将第一虚拟虚拟卷的卷标识添加到对象存储平台中的该存储卷列表对象中。Step 204: The first storage device adds the volume identifier of the first virtual virtual volume to the storage volume list object in the object storage platform.
第一存储设备在从对象存储平台中查询到其对应的存储卷列表对象后,可以将第一虚拟存储卷的卷标识添加到该存储卷列表对象中。After the first storage device queries the corresponding storage volume list object from the object storage platform, the volume identifier of the first virtual storage volume may be added to the storage volume list object.
在一种可能的实施方式中,该存储卷列表对象中可以包括存储卷列表,可以将第一虚拟存储卷的卷标识添加到该存储卷列表中。例如,可以将第一虚拟存储卷的卷标识追加到该存储卷列表的末尾。In a possible implementation manner, the storage volume list object may include a storage volume list, and the volume identifier of the first virtual storage volume may be added to the storage volume list. For example, the volume ID of the first virtual storage volume can be appended to the end of the list of storage volumes.
第一存储设备对应的存储卷列表对象实质是存储在对象存储平台中的一个文件。在本步骤中,第一存储设备在从对象存储平台中查询到其对应的存储卷列表对象后,从对象存储平台中读取存储卷列表对象,将第一虚拟存储卷的卷标识添加到该存储卷列表对象中,向对象存储平台上传添加后的存储卷列表对象,以使对象存储平台将其保存的第一存储设备对应的存储卷列表对象更新为添加后的存储卷列表对象。The storage volume list object corresponding to the first storage device is substantially a file stored in the object storage platform. In this step, after the first storage device queries the corresponding storage volume list object from the object storage platform, the storage volume list object is read from the object storage platform, and the volume identifier of the first virtual storage volume is added to the In the storage volume list object, the added storage volume list object is uploaded to the object storage platform, so that the object storage platform updates the storage volume list object corresponding to the first storage device saved by the object storage platform to the added storage volume list object.
步骤205:第一存储设备在对象存储平台中申请第一虚拟存储卷的启动块对象和块位图对象,以及第一虚拟存储卷中的每个存储块的索引对象。Step 205: The first storage device applies, in the object storage platform, a boot block object and a block bitmap object of the first virtual storage volume, and an index object of each storage block in the first virtual storage volume.
该启动块对象用于存储卷基本信息,该卷基本信息至少包括第一虚拟存储卷的容量、存储块数目和第一存储设备的设备标识。块位图对象用于存储第一虚拟存储卷中的每个存储块的标识位,存储块的标识位用于标识该存储块是否空闲。存储块的索引对象用于存储第三索引信息,第三索引信息至少包括该存储块中的数据对象数目。The boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the first storage device. The block bitmap object is used to store an identification bit of each storage block in the first virtual storage volume, and the identification bit of the storage block is used to identify whether the storage block is free. The index object of the storage block is used to store third index information, and the third index information includes at least the number of data objects in the storage block.
在本步骤中,第一存储设备可以设置第一虚拟存储卷的容量、存储块数目M,以及设置每个存储块中包括的数据对象数目N,生成第一虚拟存储卷的启动块对象的对象标识和块位图对象的对象标识,以及每个存储块的索引对象的对象标识;在对象存储平台中申请数据对象,将该数据对象的对象标识设置为该启动块对象的对象标识,得到第一虚拟存储卷的启动块对象,在该启动块对象中存储该卷基本信息;在对象存储平台中申请数据对象,将该数据对象的对象标识设置为该块位图对象的对象标识,得到第一虚拟存储卷的块位图对象,在该块位图对象中存储M个标识位,每个标识位对应第一虚拟存储卷中的一个存储块,用于标识该存储块是否空闲;以及对于每个存储块,在对象存储平台中申请数据对象,将该数据对象的对象标识设置成该存储块的索引对象的对象标识,得到该存储块对应的索引对象,将该存储块包括的数据对象数目存储在该索引对象中。In this step, the first storage device may set the capacity of the first virtual storage volume, the number of storage blocks M, and set the number N of data objects included in each storage block, and generate an object of the startup block object of the first virtual storage volume. The object identifier of the identifier and the block bitmap object, and the object identifier of the index object of each storage block; applying the data object in the object storage platform, setting the object identifier of the data object to the object identifier of the startup block object, and obtaining the a boot block object of a virtual storage volume, storing basic information of the volume in the boot block object; applying a data object in the object storage platform, setting an object identifier of the data object to an object identifier of the block bitmap object, obtaining the first a block bitmap object of a virtual storage volume, where the M bitmap bits are stored in the block bitmap object, each identifier bit corresponding to a storage block in the first virtual storage volume, used to identify whether the storage block is idle; For each storage block, apply for a data object in the object storage platform, and set the object identifier of the data object to an index object of the storage block. Object identifier, to obtain the index object corresponding to the storage block, the storage block includes a number of data objects stored in the index object.
由于第一虚拟存储卷是新创建的存储卷,所以第一虚拟存储卷中的每个存储块均为空闲,对于第一虚拟存储卷的块位图对象包括的M个存储块的标识位,该存储块的标识位用于标识该存储块空闲。Since the first virtual storage volume is a newly created storage volume, each storage block in the first virtual storage volume is idle, and the identification bits of the M storage blocks included in the block bitmap object of the first virtual storage volume, The identification bit of the memory block is used to identify that the memory block is free.
在一种可能的实施方式中,生成第一虚拟存储卷的启动块对象的对象标识和块位图对象的对象标识,以及生成每个存储块的索引对象的对象标识的操作,可以为:In a possible implementation, the operation of generating the object identifier of the boot block object of the first virtual storage volume and the object identifier of the block bitmap object, and the object identifier of the index object of each storage block may be:
将第一虚拟存储卷的卷标识和第二预设字符串组成第一虚拟存储卷的启动块对象的对象标识。例如,假设预设第二字符串boot,组成的第一虚拟存储卷的启动块对象的对象标识可以为fall613158/OS252/boot。The volume identifier of the first virtual storage volume and the second preset string are grouped into an object identifier of a boot block object of the first virtual storage volume. For example, assuming that the second string boot is preset, the object identifier of the startup block object of the first virtual storage volume composed may be fall613158/OS252/boot.
将第一虚拟存储卷的卷标识和第三预设字符串组成第一虚拟存储卷的块位图对象的对象标识。例如,假设第三预设字符串为map,组成的第一虚拟存储卷的块位图对象的对象标识可以为fall613158/OS252/map。The volume identifier of the first virtual storage volume and the third preset string are grouped into object identifiers of the block bitmap object of the first virtual storage volume. For example, assuming that the third preset character string is map, the object identifier of the block bitmap object of the first virtual storage volume composed may be fall613158/OS252/map.
对于每个存储块,将第一虚拟存储卷的卷标识、第四预设字符串和该存储块在第一虚拟存储卷中的块号组成该存储块的索引对象的对象标识。例如,假设第四预设字符串为info,存储块在第一虚拟存储卷中的块号为1,则组成的该存储块的索引对象的对象标识为fall613158/OS252/info/1。For each memory block, the volume identifier of the first virtual storage volume, the fourth preset character string, and the block number of the storage block in the first virtual storage volume constitute an object identifier of the index object of the storage block. For example, if the fourth preset character string is info and the block number of the storage block in the first virtual storage volume is 1, the object identifier of the index object of the storage block that is formed is fall613158/OS252/info/1.
在一种可能的实施方式中,还可以将第一虚拟存储卷的卷标识添加到第一存储设备的内存中。In a possible implementation manner, the volume identifier of the first virtual storage volume may also be added to the memory of the first storage device.
在一种可能的实施方式中,第一存储设备的内存中可以包括存储卷链表,该存储卷链表用于存储第一存储设备对应的每个虚拟存储卷的卷标识。In a possible implementation, the memory of the first storage device may include a storage volume linked list, where the storage volume linked list is used to store a volume identifier of each virtual storage volume corresponding to the first storage device.
在一种可能的实施方式中,该存储卷链表中的每个节点用于存储一个虚拟存储卷的卷标识。所以在该存储卷链表中添加一个存储有第一虚拟存储卷的卷标识的节点,实现将第一虚拟存储卷的卷标识添加到第一存储设备的内存中。In a possible implementation, each node in the storage volume linked list is used to store a volume identifier of a virtual storage volume. Therefore, adding a node that stores the volume identifier of the first virtual storage volume to the storage volume linked list is implemented to add the volume identifier of the first virtual storage volume to the memory of the first storage device.
参见图3,本申请实施例提供了加载虚拟存储卷的方法,该方法可以应用于如图1-1所示的网络架构中,且执行主体可以为该网络架构中的存储设备。Referring to FIG. 3, the embodiment of the present application provides a method for loading a virtual storage volume. The method may be applied to a network architecture as shown in FIG. 1-1, and the execution entity may be a storage device in the network architecture.
对于该网络架构的任一个存储设备,为了便于说明称该存储设备为第一存储设备。在第一存储设备启动时,根据对象存储平台中的第一存储设备的存储卷列表对象,将第一存储设备对应的虚拟存储卷的卷标识加载到第一存储设备中。For any storage device of the network architecture, the storage device is referred to as a first storage device for convenience of description. When the first storage device is started, the volume identifier of the virtual storage volume corresponding to the first storage device is loaded into the first storage device according to the storage volume list object of the first storage device in the object storage platform.
在第一存储设备在关闭时第一存储设备的内存中保存的数据会丢失,也就是说第一存储设备的内存中包括的第一存储设备对应的虚拟存储卷的卷标识会丢失。在第一存储设备启动时,需要将第一存储设备对应的虚拟存储卷的卷标识重新保存到第一存储设备的内存中。所谓将第一存储设备对应的虚拟存储卷的卷标识加载到第一存储设备中实质是:将第一存储设备对应的虚拟存储卷的卷标识保存到第一存储设备的内存中。参见图3,该加载过程可以为:The data saved in the memory of the first storage device may be lost when the first storage device is turned off, that is, the volume identifier of the virtual storage volume corresponding to the first storage device included in the memory of the first storage device may be lost. When the first storage device is started, the volume identifier of the virtual storage volume corresponding to the first storage device needs to be saved to the memory of the first storage device. Loading the volume identifier of the virtual storage volume corresponding to the first storage device into the first storage device is: saving the volume identifier of the virtual storage volume corresponding to the first storage device to the memory of the first storage device. Referring to Figure 3, the loading process can be:
步骤301:第一存储设备从对象存储平台中下载其对应的存储卷列表对象。Step 301: The first storage device downloads its corresponding storage volume list object from the object storage platform.
第一存储设备可以获取存储卷列表对象的对象标识,调用对象存储接口,通过调用的对象存储接口从对象存储平台下载该对象标识对应的存储卷列表对象。The first storage device may obtain the object identifier of the storage volume list object, invoke the object storage interface, and download the storage volume list object corresponding to the object identifier from the object storage platform by using the invoked object storage interface.
在一种可能的实施方式中,第一存储设备可以将第一预设字符串与第一存储设备的设备标识组成存储卷列表对象的对象标识。In a possible implementation manner, the first storage device may form the first preset character string and the device identifier of the first storage device to form an object identifier of the storage volume list object.
在一种可能的实施方式中,第一存储设备可以将第一预设字符串作为第一 存储设备的设备标识的前缀,与第一存储设备的设备标识组成存储卷列表对象的对象标识。例如,假设第一预设字符串为LIST,第一存储设备的设备标识为fall613158;将第一预设字符串LIST作为前缀,与第一存储设备的设备标识fall613158组成存储卷列表对象的对象标识为LIST_fall613158。或者,In a possible implementation manner, the first storage device may use the first preset character string as a prefix of the device identifier of the first storage device and the device identifier of the first storage device to form an object identifier of the storage volume list object. For example, suppose the first preset character string is LIST, the device identifier of the first storage device is fall 613158; the first preset character string LIST is used as a prefix, and the device identifier fall 613158 of the first storage device constitutes an object identifier of the storage volume list object. For LIST_fall613158. or,
第一存储设备可以将第一预设字符串作为第一存储设备的设备标识的后缀,与第一存储设备的设备标识组成存储卷列表对象的对象标识。例如,假设第一预设字符串为LIST,将第一预设字符串LIST作为后缀,与第一存储设备的设备标识fall613158组成存储卷列表对象的对象标识为fall613158/LIST。The first storage device may use the first preset character string as a suffix of the device identifier of the first storage device and the device identifier of the first storage device to form an object identifier of the storage volume list object. For example, suppose the first preset character string is LIST, the first preset character string LIST is used as a suffix, and the object identifier of the storage volume list object is formed with the device identifier fall 613158 of the first storage device as fall613158/LIST.
步骤302:根据第二虚拟存储卷的卷标识,从对象存储平台中下载第二虚拟存储卷的启动块对象,第二虚拟存储卷的卷标识为该存储卷列表对象中的任一个虚拟存储卷的卷标识。Step 302: Download a boot block object of the second virtual storage volume from the object storage platform according to the volume identifier of the second virtual storage volume, where the volume identifier of the second virtual storage volume is any virtual storage volume in the storage volume list object. Volume identification.
在一种可能的实施方式中,生成第二虚拟存储卷的启动块对象的对象标识,调用对象存储接口,通过对象存储接口从对象存储平台中下载该对象标识对应的启动块对象。In a possible implementation, the object identifier of the startup block object of the second virtual storage volume is generated, and the object storage interface is invoked, and the startup block object corresponding to the object identifier is downloaded from the object storage platform through the object storage interface.
在一种可能的实施方式中,可以将第二虚拟存储卷的卷标识和第二预设字符串组成第二虚拟存储卷的启动块对象的对象标识。例如,假设预设第二字符串boot,第二虚拟存储卷的卷标识为fall613158/OS252,组成的第二虚拟存储卷的启动块对象的对象标识可以为fall613158/OS252/boot。In a possible implementation manner, the volume identifier of the second virtual storage volume and the second preset string may be formed into an object identifier of the startup block object of the second virtual storage volume. For example, suppose the second string boot is preset, the volume identifier of the second virtual storage volume is fall613158/OS252, and the object identifier of the startup block object of the composed second virtual storage volume may be fall613158/OS252/boot.
步骤303:在第二虚拟存储卷的启动块对象存储有第一存储设备的设备标识时,将第二虚拟存储卷的卷标识添加到第一存储设备中。Step 303: Add a volume identifier of the second virtual storage volume to the first storage device when the boot block object of the second virtual storage volume stores the device identifier of the first storage device.
第二虚拟存储卷的启动块对象中存储有第二虚拟存储卷的卷基本信息,该卷基本信息至少包括第二虚拟存储卷的容量、存储块数目和所属存储设备的设备标识。The volume basic information of the second virtual storage volume is stored in the startup block object of the second virtual storage volume, and the volume basic information includes at least the capacity of the second virtual storage volume, the number of storage blocks, and the device identifier of the storage device to which the storage device belongs.
在一种可能的实施方式中,第一存储设备的内存中可以包括存储卷链表,该存储卷链表用于存储第一存储设备对应的每个虚拟存储卷的卷标识。In a possible implementation, the memory of the first storage device may include a storage volume linked list, where the storage volume linked list is used to store a volume identifier of each virtual storage volume corresponding to the first storage device.
在本步骤中,在第二虚拟存储卷的启动块对象存储有第一存储设备的设备标识时,在该存储卷链表中添加一个存储有第二虚拟存储卷的卷标识的节点,实现将第二虚拟存储卷的卷标识添加到第一存储设备的内存中。In this step, when the boot block object of the second virtual storage volume stores the device identifier of the first storage device, a node storing the volume identifier of the second virtual storage volume is added to the storage volume linked list to implement the first The volume identifier of the second virtual storage volume is added to the memory of the first storage device.
对该存储卷列表对象中的每个虚拟存储卷的卷标识,执行上述步骤302和303的操作,从而将第一存储设备的虚拟存储卷加载到第一存储设备中。The operations of steps 302 and 303 above are performed on the volume identifier of each virtual storage volume in the storage volume list object, thereby loading the virtual storage volume of the first storage device into the first storage device.
参见图4,本申请实施例提供了接管虚拟存储卷的方法,该方法可以应用于如图1-1所示的网络架构中,且执行主体可以为该网络架构中的存储设备。Referring to FIG. 4, the embodiment of the present application provides a method for taking over a virtual storage volume. The method can be applied to the network architecture shown in FIG. 1-1, and the execution entity can be a storage device in the network architecture.
对于该网络架构的任一个存储设备,为了便于说明称该存储设备为第一存储设备,第一存储设备根据第三虚拟存储卷的卷标识,接管第三虚拟存储卷,第三虚拟存储卷是第二存储设备对应的虚拟存储卷,第二存储设备是除第一存储设备以外的其他存储设备。参见图4,该接管过程可以为:For any storage device of the network architecture, for convenience of description, the storage device is referred to as a first storage device, and the first storage device takes over the third virtual storage volume according to the volume identifier of the third virtual storage volume, and the third virtual storage volume is The virtual storage volume corresponding to the second storage device, and the second storage device is a storage device other than the first storage device. Referring to Figure 4, the takeover process can be:
步骤401:第一存储设备接收接管请求消息,该接管请求消息携带第三虚拟存储卷的卷标识。Step 401: The first storage device receives a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume.
管理设备可以向第一存储设备发送接管请求消息。The management device can send a takeover request message to the first storage device.
在一种可能的实施方式中,在第二存储设备出现故障或退出等情况时,管理设备可以安排除第二存储设备以外的其他存储设备接管第二存储设备的虚拟存储卷。实现过程可以为:In a possible implementation manner, when the second storage device fails or exits, the management device may schedule a storage device other than the second storage device to take over the virtual storage volume of the second storage device. The implementation process can be:
管理设备从对象存储平台中下载第二存储设备对应的存储卷列表对象,确定待接管的存储设备,为了便于说明称为第一存储设备。从该存储卷列表对象中为第一存储设备选择虚拟存储卷的卷标识,为了便于说明称为第三虚拟存储卷的卷标识,向第一存储设备发送接管请求消息,该接管请求消息携带第三虚拟存储卷的卷标识。The management device downloads the storage volume list object corresponding to the second storage device from the object storage platform, and determines the storage device to be taken over, which is referred to as the first storage device for convenience of description. Selecting, from the storage volume list object, a volume identifier of the virtual storage volume for the first storage device. To facilitate description of the volume identifier of the third virtual storage volume, a takeover request message is sent to the first storage device, where the takeover request message carries the Volume ID of the three virtual storage volumes.
在一种可能的实施方式中,管理设备中还保存有设备标识与存储块的第一索引信息的对应关系,对于该对应关系中的每个存储块的第一索引信息,该存储块的第一索引信息至少包括该存储块所在的存储卷的卷标识、该存储块的块号、该存储块中存储的数据的数据标识、该数据的起始位置和数据长度等。In a possible implementation, the management device further stores a correspondence between the device identifier and the first index information of the storage block, where the first index information of each storage block in the correspondence relationship is An index information includes at least a volume identifier of a storage volume in which the storage block is located, a block number of the storage block, a data identifier of data stored in the storage block, a start position and a data length of the data, and the like.
在一种可能的实施方式中,管理设备向第一存储设备发送接管请求消息后,还可以从该对应关系中获取包括第三虚拟存储卷的卷标识的每个第一索引信息,在该对应关系中将该每个第一索引信息对应的存储设备的设备标识更新为第一存储设备的设备标识。In a possible implementation, after the management device sends the takeover request message to the first storage device, each first index information including the volume identifier of the third virtual storage volume may also be obtained from the corresponding relationship, where the corresponding information is obtained. In the relationship, the device identifier of the storage device corresponding to each first index information is updated to the device identifier of the first storage device.
在一种可能的实施方式中,管理设备下载第二存储设备对应的存储卷列表对象的操作可以为:获取第二存储设备的设备标识,将第二存储设备的设备标识和第一预设字符串组成第二存储设备的存储卷列表对象的对象标识;根据该对象标识从对象存储平台中下载第二存储设备对应的存储卷列表对象。In a possible implementation, the operation of the management device to download the storage volume list object corresponding to the second storage device may be: acquiring the device identifier of the second storage device, and setting the device identifier of the second storage device and the first preset character The string constitutes an object identifier of the storage volume list object of the second storage device; and the storage volume list object corresponding to the second storage device is downloaded from the object storage platform according to the object identifier.
步骤402:第一存储设备根据第三虚拟存储卷的卷标识,将第三虚拟存储卷的启动块对象中保存的第二存储设备的设备标识更新为第一存储设备的设备标 识。Step 402: The first storage device updates the device identifier of the second storage device saved in the startup block object of the third virtual storage volume to the device identifier of the first storage device according to the volume identifier of the third virtual storage volume.
第一存储设备可以将第三虚拟存储卷的卷标识和第二预设字符串组成启动块对象的对象标识,根据该对象标识,从对象存储平台中下载第三虚拟存储卷的启动块对象;将该启动块对象中保存的第二存储设备的设备标识修改为第一存储设备的设备标识;向对象存储平台上传修改后的启动块对象,以使对象存储平台将保存的第三虚拟存储卷的启动块对象更新为修改后的该启动块对象。The first storage device may form a volume identifier of the third virtual storage volume and a second preset character string to form an object identifier of the startup block object, and download a startup block object of the third virtual storage volume from the object storage platform according to the object identifier; Modifying the device identifier of the second storage device saved in the boot block object to the device identifier of the first storage device; uploading the modified boot block object to the object storage platform, so that the third virtual storage volume to be saved by the object storage platform The startup block object is updated to the modified startup block object.
步骤403:第一存储设备将第三虚拟存储卷的卷标识分别添加到第一存储设备的内存中和第一存储设备对应的存储卷列表对象中。Step 403: The first storage device adds the volume identifier of the third virtual storage volume to the storage volume list object corresponding to the first storage device in the memory of the first storage device.
在一种可能的实施方式中,第一存储设备可以将其设备标识和第一预设字符串组成存储卷列表对象的对象标识,根据该对象标识从对象存储平台中下载第一存储设备对应的存储卷列表对象,将第三虚拟存储卷的卷标识添加到该存储卷列表对象;向对象存储平台上传添加后的该存储卷列表对象,以使对象存储平台将第一存储设备对应的存储卷列表对象更新为添加后的该存储卷列表对象。In a possible implementation manner, the first storage device may compose the device identifier and the first preset character string into an object identifier of the storage volume list object, and download the corresponding corresponding storage device from the object storage platform according to the object identifier. Storing a volume list object, adding a volume identifier of the third virtual storage volume to the storage volume list object; uploading the added storage volume list object to the object storage platform, so that the object storage platform stores the storage volume corresponding to the first storage device The list object is updated to the added storage volume list object.
在一种可能的实施方式中,第一存储设备可以在其保存的存储卷链表中添加一个存储有第三虚拟存储卷的卷标识的节点,实现将第三虚拟存储卷的卷标识添加到第一存储设备的内存中。In a possible implementation manner, the first storage device may add a node that stores the volume identifier of the third virtual storage volume in the storage storage volume linked list thereof, and add the volume identifier of the third virtual storage volume to the first A memory device in memory.
在本申请实施例中,当第二存储设备故障或退出时,可以使用第一存储设备来接管第二存储设备对应的第三虚拟存储卷,这样在第二存储设备故障时,还可以通过第一存储设备读取第三虚拟存储卷中的数据,不会出现数据随着第二存储设备故障或退出时,无法读取的情况,提高了数据存储的可靠性。In the embodiment of the present application, when the second storage device is faulty or exits, the first storage device may be used to take over the third virtual storage volume corresponding to the second storage device, so that when the second storage device is faulty, A storage device reads the data in the third virtual storage volume, and the data cannot be read when the second storage device fails or exits, thereby improving the reliability of the data storage.
参见图5,本申请实施例提供了一种存储数据的方法,所述方法包括:Referring to FIG. 5, an embodiment of the present application provides a method for storing data, where the method includes:
步骤501:第一存储设备确定用于存储待存储数据的目标虚拟存储卷,以及从目标虚拟存储卷中确定目标存储块。Step 501: The first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume.
待存储数据可以是第一存储设备缓存的数据,该缓存的数据可以是管理设备发送的。The data to be stored may be data buffered by the first storage device, and the cached data may be sent by the management device.
管理设备可以接收终端设备发送的数据,该终端设备可以为摄像设备等,该数据可以为摄像设备拍摄的图像数据等。管理设备确定一个用于存储该数据的存储设备,为了便于说明,称该存储设备为第一存储设备,向第一存储设备发送该数据。The management device can receive data sent by the terminal device, and the terminal device can be an imaging device or the like, and the data can be image data captured by the imaging device. The management device determines a storage device for storing the data. For convenience of explanation, the storage device is referred to as a first storage device, and the data is sent to the first storage device.
第一存储设备接收该数据,将该数据缓存在其缓存器中。在一种可能的实施方式中,第一存储设备可以在其缓存器中的数据量达到预设数据量阈值,或者在其缓存器的占用率达到预设占用率阈值,或者在其缓存器缓存满等情况下,开始执行本实施例的方法将其缓存器中的待存储数据存储到对象存储平台中。The first storage device receives the data and caches the data in its buffer. In a possible implementation manner, the first storage device may reach a preset data volume threshold in the amount of data in the buffer, or the buffer occupancy rate reaches a preset occupancy threshold, or in its buffer cache. In the case of full, etc., the method of the embodiment is started to store the data to be stored in the buffer into the object storage platform.
在一种可能的实施方式中,缓存器中的数据的缓存时间达到预设时间阈时,也开始执行本实施例的方法将其缓存器中的待存储数据存储到对象存储平台中。就是说,即使缓存器中的数据量未达到预设数据量阈值,或者在其缓存器的占用率未达到预设占用率阈值,或者在其缓存器未缓存满等情况下,当缓存器中的数据的缓存时间达到预设时间阈值时,开始执行本实施例的方法将其缓存器中的待存储数据存储到对象存储平台中。In a possible implementation manner, when the buffering time of the data in the buffer reaches a preset time threshold, the method in this embodiment is also started to store the data to be stored in the buffer into the object storage platform. That is, even if the amount of data in the buffer does not reach the preset data amount threshold, or if the buffer occupancy rate does not reach the preset occupancy threshold, or if its buffer is not buffered, etc., when in the buffer When the buffering time of the data reaches the preset time threshold, the method of the embodiment is started to store the data to be stored in the buffer into the object storage platform.
由于对象存储平台的可靠性较高,所以第一存储设备将其缓存器缓存的待存储数据存储到对象存储平台中,可以提高数据存储的可靠性。Because the reliability of the object storage platform is high, the first storage device stores the data to be stored in the cache cache of the cache to the object storage platform, which can improve the reliability of the data storage.
在一种可能的实施方式中,在本步骤中,可以通过如下5011至5013的过程,确定目标虚拟存储卷,以及确定目标存储块,分别为:In a possible implementation manner, in this step, the target virtual storage volume may be determined through the following processes of 5011 to 5013, and the target storage block is determined, respectively:
5011:从第一存储设备对应的至少一个虚拟存储卷中选择一个虚拟存储卷作为目标虚拟存储卷。5011: Select one virtual storage volume from the at least one virtual storage volume corresponding to the first storage device as the target virtual storage volume.
第一存储设备的内存中存储有其对应的至少一个虚拟存储卷的卷标识。在本步骤中,第一存储设备根据其存储的每个虚拟存储卷的卷标识确定其对应的每个虚拟存储卷,从其对应的每个虚拟存储卷中选择一个虚拟存储卷作为目标虚拟存储卷。The volume identifier of the corresponding at least one virtual storage volume is stored in the memory of the first storage device. In this step, the first storage device determines each virtual storage volume corresponding to each virtual storage volume that is stored according to the volume identifier of each virtual storage volume that it stores, and selects one virtual storage volume from each corresponding virtual storage volume as the target virtual storage. volume.
5012:从对象存储平台中下载该目标虚拟存储卷的块位图对象,该块位图对象用于存储目标虚拟存储卷中的每个存储块的标识位,存储块的标识位用于记录存储块是否空闲。5012: Download a block bitmap object of the target virtual storage volume from the object storage platform, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and the storage block identifier bit is used for record storage. Whether the block is free.
在本步骤中,可以将目标虚拟存储卷的卷标识和第三预设字符串组成目标虚拟存储卷的块位图对象的对象标识,调用对象存储接口,根据该对象标识通过该对象存储接口下载目标虚拟存储卷的块位图对象。In this step, the volume identifier of the target virtual storage volume and the third preset string may be formed into an object identifier of the block bitmap object of the target virtual storage volume, and the object storage interface is invoked, and the object storage identifier is downloaded according to the object identifier. A block bitmap object for the target virtual storage volume.
例如,假设目标虚拟存储卷的卷标识为fall613158/OS252,第三预设字符串为map,所以将目标虚拟存储卷的卷标识fall613158/OS252和第三预设字符串map组成目标虚拟存储卷的块位图对象的对象标识为fall613158/OS252/map。调用对象存储接口,根据该对象标识fall613158/OS252/map通过该对象存储接口下载目标虚拟存储卷的块位图对象。For example, suppose the volume identifier of the target virtual storage volume is fall613158/OS252, and the third preset string is map, so the volume identifier fall613158/OS252 of the target virtual storage volume and the third preset string map are composed of the target virtual storage volume. The object identifier of the block bitmap object is fall613158/OS252/map. The object storage interface is called, and the block bitmap object of the target virtual storage volume is downloaded through the object storage interface according to the object identifier fall613158/OS252/map.
该块位图对象用于存储目标虚拟存储卷中的每个存储块对应的标识位。在该块位图对象中每个存储块的标识位的存储顺序与在目标虚拟存储卷中每个存储块的顺序相同。The block bitmap object is used to store the identification bits corresponding to each of the storage blocks in the target virtual storage volume. The storage bits of each storage block in the block bitmap object are stored in the same order as each storage block in the target virtual storage volume.
存储块的标识位用于标识该存储块是否空闲。在一种可能的实施方式中,当该标识位为数值1时,可以表示该存储块空闲;当该标识位为数值0时,可以表示该存储块已被使用。The identification bit of the storage block is used to identify whether the storage block is free. In a possible implementation manner, when the identifier bit is a value of 1, it may indicate that the storage block is idle; when the identifier bit is a value of 0, it may indicate that the storage block has been used.
例如,假设该块位图对象存储了0001111,则表示目标虚拟存储卷中的第一个存储块、第二个存储块和第三个存储块均被使用,第四个存储块、第五个存储块、第六个存储块和第七个存储块均空闲。For example, if the block bitmap object stores 0001111, it means that the first storage block, the second storage block, and the third storage block in the target virtual storage volume are used, and the fourth storage block and the fifth storage block are used. The memory block, the sixth memory block, and the seventh memory block are all free.
5013:根据该块位图对象从目标虚拟存储卷中选择空闲的存储块作为目标存储块。5013: Select a free storage block from the target virtual storage volume as the target storage block according to the block bitmap object.
根据该块位图对象中存储的目标虚拟存储卷中的每个存储块的标识位,可以确定出目标虚拟存储卷中空闲的存储块,从空闲的存储块中选择存储块作为目标存储块。According to the identification bit of each storage block in the target virtual storage volume stored in the block bitmap object, the free storage block in the target virtual storage volume can be determined, and the storage block is selected from the free storage block as the target storage block.
例如,根据该块位图对象存储的每个存储块的标识位0001111,确定目标虚拟存储卷中空闲的存储块为目标虚拟存储卷中的第四个存储块、第五个存储块、第六个存储块和第七个存储块,可以选择第四个存储块作为目标存储块。For example, determining, according to the identifier bit 0001111 of each storage block stored by the block bitmap object, that the free storage block in the target virtual storage volume is the fourth storage block, the fifth storage block, and the sixth in the target virtual storage volume. The storage block and the seventh storage block can select the fourth storage block as the target storage block.
在一种可能的实施方式中,在目标虚拟存储卷的块位图对象中,将目标存储块的标识位设置成用于标识目标存储块已被使用。In a possible implementation, in the block bitmap object of the target virtual storage volume, the identification bit of the target storage block is set to be used to identify that the target storage block has been used.
步骤502:第一存储设备在对象存储平台中申请目标存储块包括的至少一个数据对象。Step 502: The first storage device applies at least one data object included in the target storage block in the object storage platform.
具体地,第一存储设备从对象存储平台获取目标存储块的索引对象,根据该索引对象存储的目标存储块包括的数据对象数目N,从对象存储平台中申请N个数据对象,并设置该N个数据对象中的每个数据对象的对象标识。Specifically, the first storage device acquires an index object of the target storage block from the object storage platform, and applies N data objects from the object storage platform according to the number N of data objects included in the target storage block stored by the index object, and sets the N The object ID of each data object in the data object.
对于每个数据对象,该数据对象的对象标识的设置过程可以为:For each data object, the setting process of the object identifier of the data object can be:
获取目标存储块在目标虚拟存储卷中的块号,以及获取该数据对象在目标存储块中的序号,根据目标虚拟存储卷的卷标识、该块号和该序号生成该数据对象的对象标识,将该数据对象的对象标识设置为生成的对象标识。Obtaining a block number of the target storage block in the target virtual storage volume, and obtaining a sequence number of the data object in the target storage block, and generating an object identifier of the data object according to the volume identifier of the target virtual storage volume, the block number, and the sequence number, Set the object ID of the data object to the generated object ID.
在一种可能的实施方式中,可以将目标虚拟存储卷的卷标识、该块号和该序号组成该数据对象的对象标识。例如,假设目标虚拟存储卷的卷标识为fall613158/OS252,该块号为1,该序号为1,则组成的该数据对象的对象标识为 fall613158/OS252/1/1。或者,In a possible implementation manner, the volume identifier of the target virtual storage volume, the block number, and the sequence number may be formed into an object identifier of the data object. For example, suppose the volume identifier of the target virtual storage volume is fall613158/OS252, the block number is 1, and the sequence number is 1, the object identifier of the data object composed is fall613158/OS252/1/1. or,
在一种可能的实施方式中,可以将目标虚拟存储卷的卷标识、该块号、该序号和第五预设字符串组成该数据对象的对象标识。例如,假设目标虚拟存储卷的卷标识为fall613158/OS252,该块号为1,该序号为1,第五预设字符串为DATA/BLOCK,则组成的该数据对象的对象标识为fall613158/OS252/DATA/BLOCK/1/1。In a possible implementation, the volume identifier of the target virtual storage volume, the block number, the sequence number, and the fifth preset string may be formed into an object identifier of the data object. For example, suppose the volume identifier of the target virtual storage volume is fall613158/OS252, the block number is 1, the sequence number is 1, and the fifth preset string is DATA/BLOCK, and the object identifier of the data object composed is fall613158/OS252. /DATA/BLOCK/1/1.
步骤503:第一存储设备将待存储数据存储在该至少一个数据对象中。Step 503: The first storage device stores the to-be-stored data in the at least one data object.
在一种可能的实施方式中,第一存储设备根据待存储数据的数据量,从目标存储块包括的数据对象中选择一个或多个数据对象,通过对象存储接口,向对象存储平台发送存储请求,该存储请求携带待存储数据和选择的数据对象的对象标识。对象存储平台将待存储数据存储到该对象标识对应的数据对象中。In a possible implementation, the first storage device selects one or more data objects from the data objects included in the target storage block according to the data amount of the data to be stored, and sends a storage request to the object storage platform through the object storage interface. The storage request carries the object identifier of the data to be stored and the selected data object. The object storage platform stores the data to be stored in the data object corresponding to the object identifier.
其中,对象存储平台中的每个数据对象的容量可以相等,且第一存储设备中包括数据对象的容量,所以第一存储设备根据待存储数据的数据量和数据对象的容量,确定数据对象的个数,根据该个数,从目标存储块包括的数据对象中选择数据对象。The capacity of each data object in the object storage platform may be equal, and the capacity of the data object is included in the first storage device, so the first storage device determines the data object according to the data amount of the data to be stored and the capacity of the data object. The number, according to the number, selects a data object from the data objects included in the target storage block.
步骤504:第一存储设备在管理设备中对应保存其设备标识和第一索引信息之间的对应关系,在对象存储平台中的目标存储块对应的索引块对象中存储第二索引信息。Step 504: The first storage device saves the correspondence between the device identifier and the first index information in the management device, and stores the second index information in the index block object corresponding to the target storage block in the object storage platform.
在一种可能的实施方式中,第一索引信息至少包括目标虚拟存储卷的卷标识、目标存储块的块号、以及待存储数据的数据标识、第一数据起始位置和第一数据长度。In a possible implementation manner, the first index information includes at least a volume identifier of the target virtual storage volume, a block number of the target storage block, and a data identifier of the data to be stored, a first data start location, and a first data length.
第二索引信息至少包括第一数据起始位置。第一数据起始位置是待存储数据在目标存储块的起始存储位置,第一数据长度是待存储数据的长度。The second index information includes at least a first data start position. The first data starting position is a starting storage location of the data to be stored in the target storage block, and the first data length is the length of the data to be stored.
第一存储设备可以将目标存储块的索引对象保存的第三索引信息更新为第二索引信息,或者,将第二索引信息添加到目标存储块的索引对象中;然后向对象存储平台上传更新后或添加后的索引对象,以使对象存储平台使用更新后或添加后的该索引对象替换其保存的目标存储块的索引对象。The first storage device may update the third index information saved by the index object of the target storage block to the second index information, or add the second index information to the index object of the target storage block; and then upload the update to the object storage platform. Or the added index object, so that the object storage platform replaces the index object of its saved target storage block with the updated or added index object.
第一存储设备可以将第一索引信息发送到管理设备,以使管理设备将第一存储设备的设备标识和第一索引信息对应保存在设备标识与第一索引信息的对应关系中。The first storage device may send the first index information to the management device, so that the management device saves the device identifier of the first storage device and the first index information in a corresponding relationship between the device identifier and the first index information.
在一种可能的实施方式中,待存储数据的数据标识可以为采集待存储数据 的设备的设备标识。例如,假设待存储数据是摄像设备拍摄的一段视频数据,则待存储数据的数据标识可以是该摄像设备的设备标识,待存储数据的第一数据起始位置可以为该段视频数据的起始时间。In a possible implementation manner, the data identifier of the data to be stored may be a device identifier of a device that collects data to be stored. For example, if the data to be stored is a piece of video data captured by the camera device, the data identifier of the data to be stored may be the device identifier of the camera device, and the first data start position of the data to be stored may be the start of the segment of video data. time.
在本申请实施例中,由于第一存储设备确定用于存储待存储数据的目标虚拟存储卷,以及从目标虚拟存储卷中确定目标存储块;在对象存储平台中申请目标存储块包括的至少一个数据对象;将待存储数据存储在至少一个数据对象中。又由于对象存储平台的存储数据的可靠性较高,将待存储数据存储在对象存储平台的数据对象中,可以提高数据存储的可靠性。In the embodiment of the present application, the first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume; and at least one of the target storage blocks is requested in the object storage platform. a data object; storing the data to be stored in at least one data object. Moreover, since the reliability of the storage data of the object storage platform is high, the data to be stored is stored in the data object of the object storage platform, which can improve the reliability of the data storage.
参见图6,本申请实施例提供了一种读取数据的方法,所述方法包括:Referring to FIG. 6, an embodiment of the present application provides a method for reading data, where the method includes:
步骤601:接收包括位置信息的读取请求消息,该位置信息包括待读取数据的第二数据起始位置、第二数据长度、待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块号。Step 601: Receive a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, a volume identifier of the target storage volume where the data to be read is located, and a target The block number of the storage block.
该读取请求消息可以是管理设备发送的。管理设备中存储有设备标识与第一索引信息的对应关系。该对应关系中存储了存储块的第一索引信息,该存储块的第一索引信息至少包括该存储块所在的虚拟存储卷的卷标识、该存储块的块号、以及存储在该存储块中的数据的数据标识、该数据的第一数据起始位置和该数据的第一数据长度。The read request message may be sent by the management device. The corresponding relationship between the device identifier and the first index information is stored in the management device. The first index information of the storage block is stored in the correspondence, and the first index information of the storage block includes at least a volume identifier of the virtual storage volume where the storage block is located, a block number of the storage block, and is stored in the storage block. The data identification of the data, the first data start location of the data, and the first data length of the data.
管理设备可以接收来自终端设备的查询数据请求,该查询数据请求可以携带待读取数据的数据标识、第二数据起始位置和第二数据长度;根据待读取数据的数据标识,从设备标识与第一索引信息的对应关系中获取至少一个存储块的第一索引信息,该至少一个存储块中的每个存储块的第一索引信息包括待读取数据的数据标识,根据每个存储块的第一索引信息中包括的第一数据起始位置和第一数据长度,确定每个存储块中存储的数据的位置范围,确定包括第二数据起始位置的位置范围,将确定的位置范围对应的存储块作为目标存储块;从该对应关系中获取目标存储块的第一索引信息对应的存储设备的设备标识,以及从目标存储块的第一索引信息中获取目标存储块所在目标虚拟存储卷的卷标识和目标存储块的块号;根据该存储设备的设备标识向该存储设备发送包括位置信息的读取请求消息,该位置信息包括待读取数据的第二数据起始位置、第二数据长度、待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块号。The management device may receive the query data request from the terminal device, where the query data request may carry the data identifier of the data to be read, the second data start location, and the second data length; and the slave device identifier according to the data identifier of the data to be read. Obtaining, by the correspondence relationship with the first index information, first index information of the at least one storage block, where the first index information of each of the at least one storage block includes a data identifier of the data to be read, according to each storage block Determining a first data start position and a first data length included in the first index information, determining a location range of data stored in each of the storage blocks, determining a location range including the second data start position, and determining the determined location range Corresponding storage block is used as the target storage block; the device identifier of the storage device corresponding to the first index information of the target storage block is obtained from the correspondence, and the target virtual storage of the target storage block is obtained from the first index information of the target storage block. The volume ID of the volume and the block number of the target storage block; the storage device is identified according to the device identifier of the storage device Transmitting a read request message including location information, where the second data start position of the data to be read, the second data length, the volume identifier of the target storage volume where the data to be read is located, and the target storage block where the target is located Block number.
接下来可以根据该位置信息从对象存储平台中的目标存储块中读取待读取数据。详细的读取过程,可以通过如下602至604的步骤来实现。Next, the data to be read can be read from the target storage block in the object storage platform according to the location information. The detailed reading process can be implemented by the following steps 602 to 604.
步骤602:根据目标存储卷的卷标识和目标存储块的块号,从对象存储平台中获取目标存储块的索引对象,该索引对象包括目标存储块中存储的数据的第一数据起始位置。Step 602: Acquire an index object of the target storage block from the object storage platform according to the volume identifier of the target storage volume and the block number of the target storage block, where the index object includes a first data start position of the data stored in the target storage block.
具体的,根据目标存储卷的卷标识和目标存储块的块号获取目标存储块的索引对象的对象标识,根据该对象标识从对象存储平台中下载该目标存储块的索引对象。Specifically, the object identifier of the index object of the target storage block is obtained according to the volume identifier of the target storage volume and the block number of the target storage block, and the index object of the target storage block is downloaded from the object storage platform according to the object identifier.
对于索引对象的对象标识,可以将目标虚拟存储卷的卷标识、第四预设字符串和目标存储块的块号组成目标存储块的索引对象的对象标识。For the object identifier of the index object, the volume identifier of the target virtual storage volume, the fourth preset character string, and the block number of the target storage block may be the object identifier of the index object of the target storage block.
步骤603:根据第一数据起始位置和第二数据起始位置,确定用于存储待读取数据的目标数据对象和待读取数据在目标数据对象中的偏移。Step 603: Determine, according to the first data start position and the second data start position, an offset of the target data object for storing the data to be read and the data to be read in the target data object.
对象存储平台中的每个数据对象的容量相等。所以本步骤中,可以计算第一数据起始位置和第二数据起始位置之间的差值,根据该差值和数据对象的容量,可以计算出用于存储待读取数据的目标数据对象的序号和待读取数据在目标数据对象中的偏移。Each data object in the object storage platform has the same capacity. Therefore, in this step, a difference between the first data start position and the second data start position may be calculated, and according to the difference and the data object capacity, the target data object for storing the data to be read may be calculated. The sequence number and the offset of the data to be read in the target data object.
步骤604:根据该偏移和该第二数据长度,从目标数据对象中读取待读取数据。Step 604: Read data to be read from the target data object according to the offset and the second data length.
可以获取目标数据对象的对象标识,根据该偏移,在对象存储平台中的该对象标识对应的数据对象中读取第二数据长度的待读取数据。将该读取数据发送给管理设备,由管理设备将待读取数据发送给终端设备。An object identifier of the target data object may be obtained, and according to the offset, the data to be read of the second data length is read in the data object corresponding to the object identifier in the object storage platform. The read data is sent to the management device, and the data to be read is sent by the management device to the terminal device.
对于目标数据对象的对象标识,可以根据目标虚拟存储卷的卷标识、目标存储块的块号和目标数据对象的序号生成目标数据对象的对象标识。For the object identifier of the target data object, the object identifier of the target data object may be generated according to the volume identifier of the target virtual storage volume, the block number of the target storage block, and the sequence number of the target data object.
例如,可以将目标虚拟存储卷的卷标识、目标存储块的块号和目标数据对象的序号组成该数据对象的对象标识。或者,可以将目标虚拟存储卷的卷标识、目标存储块的块号、目标数据对象的序号和第五预设字符串组成该数据对象的对象标识。For example, the volume identifier of the target virtual storage volume, the block number of the target storage block, and the sequence number of the target data object may be composed of the object identifier of the data object. Alternatively, the volume identifier of the target virtual storage volume, the block number of the target storage block, the sequence number of the target data object, and the fifth preset string may be composed of the object identifier of the data object.
在本申请实施例中,接收包括位置信息的读取请求消息,该位置信息包括待读取数据的第二数据起始位置、第二数据长度、待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块标识;根据该位置信息从对象存储平台中的目标存储块中读取待读取数据。从而支持了将数据存储在对象存储平台中, 由于对象存储平台存储数据的可靠性较高,将数据存储在对象存储平台中,提高了数据存储的可靠性。使用对象存储平台中的数据对象来模拟块,很容易管理视频数据这种非结构化数据,另外在多个存储设备中其中一台故障,其它正常的设备可以快速接管该故障设备中的存储卷,从而进一步提高了可靠性。In the embodiment of the present application, a read request message including location information is included, where the location information includes a second data start location of the data to be read, a second data length, and a volume identifier of the target storage volume where the data to be read is located And a block identifier of the target storage block; and reading the data to be read from the target storage block in the object storage platform according to the location information. Therefore, the data is stored in the object storage platform. Since the object storage platform stores data with high reliability, the data is stored in the object storage platform, thereby improving the reliability of the data storage. Using data objects in the object storage platform to simulate blocks, it is easy to manage unstructured data such as video data. In addition, one of the multiple storage devices fails, and other normal devices can quickly take over the storage volumes in the failed device. , which further improves reliability.
参见图7,本申请实施例提供了一种存储数据的装置700,所述装置700包括:Referring to FIG. 7, an embodiment of the present application provides an apparatus 700 for storing data, where the apparatus 700 includes:
确定模块701,用于确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块;a determining module 701, configured to determine a target virtual storage volume for storing data to be stored, and determine a target storage block from the target virtual storage volume;
申请模块702,用于在对象存储平台中申请所述目标存储块包括的至少一个数据对象;The application module 702 is configured to apply, in the object storage platform, at least one data object included in the target storage block;
存储模块703,用于将所述待存储数据存储在所述至少一个数据对象中;在管理设备中对应保存所述装置700的设备标识与第一索引信息之间的对应关系,所述第一索引信息至少包括所述目标虚拟存储卷的卷标识、所述目标存储块的块标识、所述待存储数据的数据标识、所述待存储数据的第一数据起始位置和所述待存储数据的第一数据长度;在所述对象存储平台中的所述目标存储块对应的索引块对象中存储第二索引信息,所述第二索引信息至少包括所述第一数据起始位置。a storage module 703, configured to store the to-be-stored data in the at least one data object, and correspondingly save a correspondence between the device identifier of the device 700 and the first index information, where the first The index information includes at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, a first data start location of the data to be stored, and the to-be-stored data The first data length is stored in the index block object corresponding to the target storage block in the object storage platform, and the second index information includes at least the first data start position.
在一种可能的实施方式中,所述确定模块701包括:In a possible implementation manner, the determining module 701 includes:
第一选择单元,用于从所述装置700对应的至少一个虚拟存储卷中选择一个虚拟存储卷作为目标虚拟存储卷;a first selection unit, configured to select one virtual storage volume from the at least one virtual storage volume corresponding to the device 700 as the target virtual storage volume;
获取单元,用于从对象存储平台中获取所述目标虚拟存储卷的块位图对象,所述块位图对象用于存储所述目标虚拟存储卷中的每个存储块的标识位,存储块的标识位用于记录所述存储块是否空闲;An obtaining unit, configured to acquire, from the object storage platform, a block bitmap object of the target virtual storage volume, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and a storage block The flag bit is used to record whether the memory block is idle;
第二选择单元,用于根据所述块位图对象从所述目标虚拟存储卷中选择空闲的存储块作为目标存储块。And a second selecting unit, configured to select, from the target virtual storage volume, a free storage block as the target storage block according to the block bitmap object.
在一种可能的实施方式中,所述装置700还包括:In a possible implementation, the apparatus 700 further includes:
设置单元,用于在所述目标虚拟存储卷的块位图对象中,将所述目标存储块的标识位设置成用于标识所述目标存储块已被使用。a setting unit, configured to set, in a block bitmap object of the target virtual storage volume, an identification bit of the target storage block to identify that the target storage block has been used.
在一种可能的实施方式中,所述装置700还包括:In a possible implementation, the apparatus 700 further includes:
创建模块,用于在所述对象存储平台中为所述装置700创建第一虚拟存储 卷。A module is created for creating a first virtual storage volume for the apparatus 700 in the object storage platform.
在一种可能的实施方式中,所述创建模块包括:In a possible implementation manner, the creating module includes:
生成单元,用于生成第一虚拟存储卷的卷标识;a generating unit, configured to generate a volume identifier of the first virtual storage volume;
第一添加单元,用于将所述第一虚拟存储卷的卷标识添加到位于所述对象存储平台中的所述装置700对应的存储卷列表对象中;a first adding unit, configured to add a volume identifier of the first virtual storage volume to a storage volume list object corresponding to the device 700 located in the object storage platform;
申请单元,用于在所述对象存储平台中申请所述第一虚拟存储卷的启动块对象、块位图对象和所述第一虚拟存储卷中的每个存储块的索引对象;An application unit, configured to apply, in the object storage platform, a boot block object of the first virtual storage volume, a block bitmap object, and an index object of each of the first virtual storage volumes;
其中,所述启动块对象用于存储卷基本信息,所述卷基本信息至少包括所述第一虚拟存储卷的容量、存储块数目和所述装置700的设备标识;所述块位图对象用于存储所述第一虚拟存储卷中的每个存储块的标识位,存储块的标识位用于标识所述存储块是否空闲;所述存储块的索引对象用于存储第三索引信息,所述第三索引信息至少包括所述存储块中的数据对象数目。The boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the device 700; And storing an identifier bit of each storage block in the first virtual storage volume, where an identifier bit of the storage block is used to identify whether the storage block is idle; an index object of the storage block is used to store third index information, where The third index information includes at least the number of data objects in the storage block.
在一种可能的实施方式中,所述装置700还包括:In a possible implementation, the apparatus 700 further includes:
加载模块,用于在所述装置700启动时,根据所述对象存储平台中的所述装置700对应的存储卷列表对象,将所述装置700对应的至少一个虚拟存储卷加载到所述装置700中,所述存储卷列表对象用于存储所述装置700对应的至少一个虚拟存储卷的卷标识。a loading module, configured to load at least one virtual storage volume corresponding to the device 700 to the device 700 according to a storage volume list object corresponding to the device 700 in the object storage platform when the device 700 is started. The storage volume list object is configured to store a volume identifier of the at least one virtual storage volume corresponding to the device 700.
在一种可能的实施方式中,所述加载模块包括:In a possible implementation manner, the loading module includes:
下载单元,用于从所述对象存储平台中下载所述装置700对应的存储卷列表对象;根据第二虚拟存储卷的卷标识,从所述对象存储平台中下载所述第二虚拟存储卷的启动块对象,所述第二虚拟存储卷的卷标识为所述存储卷列表对象中的任一个虚拟存储卷的卷标识;a downloading unit, configured to download a storage volume list object corresponding to the device 700 from the object storage platform, and download the second virtual storage volume from the object storage platform according to a volume identifier of the second virtual storage volume Activating a block object, the volume identifier of the second virtual storage volume being a volume identifier of any one of the storage volume list objects;
第二添加单元,用于在所述启动块对象存储有所述装置700的设备标识时,将所述第二虚拟存储卷的卷标识添加到所述装置700中。And a second adding unit, configured to add a volume identifier of the second virtual storage volume to the device 700 when the boot block object stores the device identifier of the device 700.
在一种可能的实施方式中,所述装置700还包括:In a possible implementation, the apparatus 700 further includes:
接管模块,用于根据第三虚拟存储卷的卷标识,接管所述第三虚拟存储卷,所述第三虚拟存储卷是第二存储设备对应的虚拟存储卷,所述第二存储设备是除所述装置700以外的其他存储设备。a takeover module, configured to take over the third virtual storage volume according to the volume identifier of the third virtual storage volume, where the third virtual storage volume is a virtual storage volume corresponding to the second storage device, and the second storage device is Other storage devices than the device 700.
在一种可能的实施方式中,所述接管模块包括:In a possible implementation manner, the takeover module includes:
接收单元,用于接收接管请求消息,所述接管请求消息携带所述第三虚拟存储卷的卷标识;a receiving unit, configured to receive a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume;
更新单元,用于根据所述第三虚拟存储卷的卷标识,将所述第三虚拟存储卷的启动块对象中保存的第二存储设备的设备标识更新为所述装置700的设备标识;An update unit, configured to update, according to the volume identifier of the third virtual storage volume, a device identifier of the second storage device saved in the startup block object of the third virtual storage volume to a device identifier of the device 700;
第三添加单元,用于将所述第三虚拟存储卷的卷标识分别添加到所述装置700中和所述装置700对应的存储卷列表对象中。And a third adding unit, configured to add a volume identifier of the third virtual storage volume to the storage volume list object corresponding to the device 700 in the device 700.
参见图8,本申请实施例提供了一种读取数据的装置800,所述装置800包括:Referring to FIG. 8, an embodiment of the present application provides an apparatus 800 for reading data, where the apparatus 800 includes:
接收模块801,用于接收包括位置信息的读取请求消息,所述位置信息包括待读取数据的第二数据起始位置、第二数据长度、所述待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块标识;The receiving module 801 is configured to receive a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, and a target storage volume where the data to be read is located The volume identifier and the block identifier of the target storage block in which it resides;
读取模块802,用于根据所述位置信息从对象存储平台中的所述目标存储块中读取所述待读取数据。The reading module 802 is configured to read the data to be read from the target storage block in the object storage platform according to the location information.
在一种可能的实施方式中,所述读取模块802包括:In a possible implementation, the reading module 802 includes:
获取单元,用于根据所述目标存储卷的卷标识和所述目标存储块的块标识,从对象存储平台中获取所述目标存储块的索引对象,所述索引对象包括所述目标存储块中存储的数据的第一数据起始位置;An obtaining unit, configured to acquire an index object of the target storage block from an object storage platform according to a volume identifier of the target storage volume and a block identifier of the target storage block, where the index object includes the target storage block The first data start position of the stored data;
确定单元,用于根据所述第一数据起始位置和所述第二数据起始位置,确定用于存储所述待读取数据的目标数据对象和所述待读取数据在所述目标数据对象中的偏移;a determining unit, configured to determine, according to the first data start location and the second data start location, a target data object for storing the data to be read and the data to be read in the target data The offset in the object;
读取单元,用于根据所述偏移和所述第二数据长度,从所述目标数据对象中读取所述待读取数据。And a reading unit, configured to read the data to be read from the target data object according to the offset and the second data length.
参见图9,本申请实施例提供了一种存储数据的系统900,所述系统900包括:存储设备901、对象存储平台902和管理设备903;Referring to FIG. 9, the embodiment of the present application provides a system 900 for storing data, where the system 900 includes: a storage device 901, an object storage platform 902, and a management device 903;
所述第一存储设备901,用于确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块;在所述对象存储平台902中申请所述目标存储块包括的至少一个数据对象;将所述待存储数据存储在所述至少一个数据对象中;在所述管理设备903中对应保存所述存储设备901的设备标识与第一索引信息之间的对应关系,所述第一索引信息至少包括所述目标虚拟存储卷的卷标识、所述目标存储块的块标识、所述待存储数据的数据标识、 所述待存储数据的第一数据起始位置和所述待存储数据的第一数据长度;在所述对象存储平台中的所述目标存储块对应的索引块对象中存储第二索引信息,所述第二索引信息至少包括所述第一数据起始位置。The first storage device 901 is configured to determine a target virtual storage volume for storing data to be stored, and determine a target storage block from the target virtual storage volume; apply the target storage in the object storage platform 902 At least one data object included in the block; storing the data to be stored in the at least one data object; correspondingly storing a correspondence between the device identifier of the storage device 901 and the first index information in the management device 903 The first index information includes at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, and a first data start location of the data to be stored. a first data length of the data to be stored; storing, in the index block object corresponding to the target storage block in the object storage platform, second index information, where the second index information includes at least the first data starting point.
参见图10,本申请实施例提供了一种读取数据的系统1000,所述系统1000包括:存储设备1001、管理设备1002和对象存储平台1003;Referring to FIG. 10, an embodiment of the present application provides a system 1000 for reading data, where the system 1000 includes: a storage device 1001, a management device 1002, and an object storage platform 1003;
所述存储设备1001,用于接收所述管理设备1002发送的包括位置信息的读取请求消息,所述位置信息包括待读取数据的第二数据起始位置、第二数据长度、所述待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块标识;根据所述位置信息从所述对象存储平台1003中的所述目标存储块中读取所述待读取数据。The storage device 1001 is configured to receive a read request message that includes the location information that is sent by the management device 1002, where the location information includes a second data start location, a second data length, and the to-be-read data. And reading a volume identifier of the target storage volume where the data is located and a block identifier of the target storage block where the data is stored; and reading the data to be read from the target storage block in the object storage platform 1003 according to the location information.
图11示出了本发明一个示例性实施例提供的设备1100的结构框图。通常,设备1100包括有:处理器1101和存储器1102。FIG. 11 is a block diagram showing the structure of a device 1100 according to an exemplary embodiment of the present invention. Generally, the device 1100 includes a processor 1101 and a memory 1102.
处理器1101可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器1101可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器1101也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central Processing Unit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器1101可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器1101还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The processor 1101 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 1101 may be configured by at least one of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). achieve. The processor 1101 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, which is also called a CPU (Central Processing Unit); the coprocessor is A low-power processor for processing data in standby. In some embodiments, the processor 1101 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and rendering of content that needs to be displayed on the display screen. In some embodiments, the processor 1101 may further include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
存储器1102可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器1102还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器1102中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器1101所执行以实现本申请中如图2至6所示的任一方法实施例提供的方法。 Memory 1102 can include one or more computer readable storage media, which can be non-transitory. Memory 1102 can also include high speed random access memory, as well as non-volatile memory, such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer readable storage medium in memory 1102 is for storing at least one instruction for execution by processor 1101 to implement the present application as shown in FIGS. 2-6. The method provided by any of the method embodiments.
在一些实施例中,设备1100还可选包括有:外围设备接口1103和至少一个外围设备。处理器1101、存储器1102和外围设备接口1103之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口1103相连。具体地,外围设备包括:射频电路1104、音频电路1107和电源1109中的至少一种。In some embodiments, the device 1100 can also optionally include: a peripheral device interface 1103 and at least one peripheral device. The processor 1101, the memory 1102, and the peripheral device interface 1103 may be connected by a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 1103 via a bus, signal line or circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 1104, an audio circuit 1107, and a power source 1109.
外围设备接口1103可被用于将I/O(Input/Output,输入/输出)相关的至少一个外围设备连接到处理器1101和存储器1102。在一些实施例中,处理器1101、存储器1102和外围设备接口1103被集成在同一芯片或电路板上;在一些其他实施例中,处理器1101、存储器1102和外围设备接口1103中的任意一个或两个可以在单独的芯片或电路板上实现,本实施例对此不加以限定。The peripheral device interface 1103 can be used to connect at least one peripheral device associated with an I/O (Input/Output) to the processor 1101 and the memory 1102. In some embodiments, processor 1101, memory 1102, and peripheral interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any of processor 1101, memory 1102, and peripheral interface 1103 or The two can be implemented on a separate chip or circuit board, which is not limited in this embodiment.
射频电路1104用于接收和发射RF(Radio Frequency,射频)信号,也称电磁信号。射频电路1104通过电磁信号与通信网络以及其他通信设备进行通信。射频电路1104将电信号转换为电磁信号进行发送,或者,将接收到的电磁信号转换为电信号。可选地,射频电路1104包括:天线系统、RF收发器、一个或多个放大器、调谐器、振荡器、数字信号处理器、编解码芯片组、用户身份模块卡等等。射频电路1104可以通过至少一种无线通信协议来与其它设备进行通信。该无线通信协议包括但不限于:万维网、城域网、内联网、各代移动通信网络(2G、3G、4G及5G)、无线局域网和/或WiFi(Wireless Fidelity,无线保真)网络。The RF circuit 1104 is configured to receive and transmit an RF (Radio Frequency) signal, also called an electromagnetic signal. The RF circuit 1104 communicates with the communication network and other communication devices via electromagnetic signals. The radio frequency circuit 1104 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1104 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 1104 can communicate with other devices via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to, the World Wide Web, a metropolitan area network, an intranet, generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity) networks.
显示屏1105用于显示UI(User Interface,用户界面)。该UI可以包括图形、文本、图标、视频及其它们的任意组合。当显示屏1105是触摸显示屏时,显示屏1105还具有采集在显示屏1105的表面或表面上方的触摸信号的能力。该触摸信号可以作为控制信号输入至处理器1101进行处理。此时,显示屏1105还可以用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。显示屏1105可以采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-Emitting Diode,有机发光二极管)等材质制备。The display 1105 is used to display a UI (User Interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display 1105 is a touch display, the display 1105 also has the ability to capture touch signals over the surface or surface of the display 1105. The touch signal can be input to the processor 1101 as a control signal for processing. At this time, the display 1105 can also be used to provide virtual buttons and/or virtual keyboards, also referred to as soft buttons and/or soft keyboards. The display 1105 can be made of a material such as an LCD (Liquid Crystal Display) or an OLED (Organic Light-Emitting Diode).
音频电路1107可以包括麦克风和扬声器。麦克风用于采集用户及环境的声波,并将声波转换为电信号输入至处理器1101进行处理,或者输入至射频电路1104以实现语音通信。出于立体声采集或降噪的目的,麦克风可以为多个,分别设置在设备1100的不同部位。麦克风还可以是阵列麦克风或全向采集型麦克风。扬声器则用于将来自处理器1101或射频电路1104的电信号转换为声波。 扬声器可以是传统的薄膜扬声器,也可以是压电陶瓷扬声器。当扬声器是压电陶瓷扬声器时,不仅可以将电信号转换为人类可听见的声波,也可以将电信号转换为人类听不见的声波以进行测距等用途。在一些实施例中,音频电路1107还可以包括耳机插孔。The audio circuit 1107 can include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals for input to the processor 1101 for processing, or to the RF circuit 1104 for voice communication. For the purpose of stereo acquisition or noise reduction, the microphones may be multiple, and are respectively disposed at different parts of the device 1100. The microphone can also be an array microphone or an omnidirectional acquisition microphone. The speaker is then used to convert electrical signals from the processor 1101 or the RF circuit 1104 into sound waves. The speaker can be a conventional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only can the electrical signal be converted into human audible sound waves, but also the electrical signal can be converted into sound waves that are inaudible to humans for ranging and the like. In some embodiments, the audio circuit 1107 can also include a headphone jack.
电源1109用于为设备1100中的各个组件进行供电。电源1109可以是交流电、直流电、一次性电池或可充电电池。当电源1109包括可充电电池时,该可充电电池可以是有线充电电池或无线充电电池。有线充电电池是通过有线线路充电的电池,无线充电电池是通过无线线圈充电的电池。该可充电电池还可以用于支持快充技术。 Power source 1109 is used to power various components in device 1100. The power source 1109 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power source 1109 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged by a wired line, and a wireless rechargeable battery is a battery that is charged by a wireless coil. The rechargeable battery can also be used to support fast charging technology.
本领域技术人员可以理解,图11中示出的结构并不构成对设备1100的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。Those skilled in the art will appreciate that the structure illustrated in FIG. 11 does not constitute a limitation to device 1100, may include more or fewer components than illustrated, or may combine certain components, or employ different component arrangements.
本领域技术人员在考虑说明书及实践这里公开的申请后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。Other embodiments of the present application will be readily apparent to those skilled in the <RTIgt; The application is intended to cover any variations, uses, or adaptations of the application, which are in accordance with the general principles of the application and include common general knowledge or common technical means in the art that are not disclosed herein. . The specification and examples are to be regarded as illustrative only,
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It is to be understood that the invention is not limited to the details of the details and The scope of the present application is limited only by the accompanying claims.

Claims (24)

  1. 一种存储数据的方法,其特征在于,所述方法包括:A method of storing data, the method comprising:
    第一存储设备确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块;The first storage device determines a target virtual storage volume for storing data to be stored, and determines a target storage block from the target virtual storage volume;
    所述第一存储设备在对象存储平台中申请所述目标存储块包括的至少一个数据对象;The first storage device applies at least one data object included in the target storage block in an object storage platform;
    所述第一存储设备将所述待存储数据存储在所述至少一个数据对象中;The first storage device stores the to-be-stored data in the at least one data object;
    所述第一存储设备在管理设备中对应保存其设备标识与第一索引信息之间的对应关系,所述第一索引信息至少包括所述目标虚拟存储卷的卷标识、所述目标存储块的块标识、所述待存储数据的数据标识、所述待存储数据的第一数据起始位置和所述待存储数据的第一数据长度;The first storage device correspondingly saves a correspondence between the device identifier and the first index information in the management device, where the first index information includes at least a volume identifier of the target virtual storage volume, and the target storage block. a block identifier, a data identifier of the data to be stored, a first data start location of the data to be stored, and a first data length of the data to be stored;
    所述第一存储设备在所述对象存储平台中的所述目标存储块对应的索引块对象中存储第二索引信息,所述第二索引信息至少包括所述第一数据起始位置。The first storage device stores second index information in an index block object corresponding to the target storage block in the object storage platform, where the second index information includes at least the first data start position.
  2. 如权利要求1所述的方法,其特征在于,所述确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块,包括:The method of claim 1, wherein the determining a target virtual storage volume for storing data to be stored, and determining a target storage block from the target virtual storage volume comprises:
    从所述第一存储设备对应的至少一个虚拟存储卷中选择一个虚拟存储卷作为目标虚拟存储卷;Selecting one virtual storage volume from the at least one virtual storage volume corresponding to the first storage device as the target virtual storage volume;
    从对象存储平台中获取所述目标虚拟存储卷的块位图对象,所述块位图对象用于存储所述目标虚拟存储卷中的每个存储块的标识位,存储块的标识位用于记录所述存储块是否空闲;Obtaining, from the object storage platform, a block bitmap object of the target virtual storage volume, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and an identifier bit of the storage block is used for Recording whether the storage block is idle;
    根据所述块位图对象从所述目标虚拟存储卷中选择空闲的存储块作为目标存储块。A free memory block is selected from the target virtual storage volume as a target storage block according to the block bitmap object.
  3. 如权利要求1所述的方法,其特征在于,所述根据所述块位图对象从所述目标虚拟存储卷中选择空闲的存储块作为目标存储块之后,还包括:The method of claim 1, wherein after the selecting, according to the block bitmap object, the free storage block from the target virtual storage volume as the target storage block, the method further comprises:
    在所述目标虚拟存储卷的块位图对象中,将所述目标存储块的标识位设置成用于标识所述目标存储块已被使用。In a block bitmap object of the target virtual storage volume, an identification bit of the target storage block is set to identify that the target storage block has been used.
  4. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 wherein the method further comprises:
    在所述对象存储平台中为所述第一存储设备创建第一虚拟存储卷。Creating a first virtual storage volume for the first storage device in the object storage platform.
  5. 如权利要求4所述的方法,其特征在于,所述在所述对象存储平台中为所述第一存储设备创建第一虚拟存储卷,包括:The method of claim 4, wherein the creating a first virtual storage volume for the first storage device in the object storage platform comprises:
    生成第一虚拟存储卷的卷标识;Generating a volume identifier of the first virtual storage volume;
    将所述第一虚拟存储卷的卷标识添加到位于所述对象存储平台中的所述第一存储设备对应的存储卷列表对象中;Adding a volume identifier of the first virtual storage volume to a storage volume list object corresponding to the first storage device in the object storage platform;
    在所述对象存储平台中申请所述第一虚拟存储卷的启动块对象、块位图对象和所述第一虚拟存储卷中的每个存储块的索引对象;Applying, in the object storage platform, a boot block object of the first virtual storage volume, a block bitmap object, and an index object of each of the first virtual storage volumes;
    其中,所述启动块对象用于存储卷基本信息,所述卷基本信息至少包括所述第一虚拟存储卷的容量、存储块数目和所述第一存储设备的设备标识;所述块位图对象用于存储所述第一虚拟存储卷中的每个存储块的标识位,存储块的标识位用于标识所述存储块是否空闲;所述存储块的索引对象用于存储第三索引信息,所述第三索引信息至少包括所述存储块中的数据对象数目。The boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the first storage device; An object is configured to store an identifier bit of each of the first virtual storage volumes, where an identifier of the storage block is used to identify whether the storage block is idle; an index object of the storage block is used to store third index information. The third index information includes at least the number of data objects in the storage block.
  6. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 wherein the method further comprises:
    在所述第一存储设备启动时,根据所述对象存储平台中的所述第一存储设备对应的存储卷列表对象,将所述第一存储设备对应的至少一个虚拟存储卷加载到所述第一存储设备中,所述存储卷列表对象用于存储所述第一存储设备对应的至少一个虚拟存储卷的卷标识。Loading at least one virtual storage volume corresponding to the first storage device to the first storage device according to the storage volume list object corresponding to the first storage device in the object storage platform when the first storage device is started In a storage device, the storage volume list object is used to store a volume identifier of at least one virtual storage volume corresponding to the first storage device.
  7. 如权利要求6所述的方法,其特征在于,所述根据所述对象存储平台中的所述第一存储设备对应的存储卷列表对象,将所述第一存储设备对应的至少一个虚拟存储卷加载到所述第一存储设备中,包括:The method according to claim 6, wherein the at least one virtual storage volume corresponding to the first storage device is according to a storage volume list object corresponding to the first storage device in the object storage platform Loading into the first storage device, including:
    从所述对象存储平台中下载所述第一存储设备对应的存储卷列表对象;Downloading, from the object storage platform, a storage volume list object corresponding to the first storage device;
    根据第二虚拟存储卷的卷标识,从所述对象存储平台中下载所述第二虚拟存储卷的启动块对象,所述第二虚拟存储卷的卷标识为所述存储卷列表对象中的任一个虚拟存储卷的卷标识;Downloading, according to a volume identifier of the second virtual storage volume, a boot block object of the second virtual storage volume from the object storage platform, where a volume identifier of the second virtual storage volume is any one of the storage volume list objects The volume ID of a virtual storage volume;
    在所述启动块对象存储有所述第一存储设备的设备标识时,将所述第二虚 拟存储卷的卷标识添加到所述第一存储设备中。And adding, when the boot block object stores the device identifier of the first storage device, a volume identifier of the second virtual storage volume to the first storage device.
  8. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 wherein the method further comprises:
    所述第一存储设备根据第三虚拟存储卷的卷标识,接管所述第三虚拟存储卷,所述第三虚拟存储卷是第二存储设备对应的虚拟存储卷,所述第二存储设备是除所述第一存储设备以外的其他存储设备。The first storage device takes over the third virtual storage volume according to the volume identifier of the third virtual storage volume, where the third virtual storage volume is a virtual storage volume corresponding to the second storage device, and the second storage device is Other storage devices than the first storage device.
  9. 如权利要求8所述的方法,其特征在于,所述根据第三虚拟存储卷的卷标识,接管所述第三虚拟存储卷,包括:The method of claim 8, wherein the taking over the third virtual storage volume according to the volume identifier of the third virtual storage volume comprises:
    接收接管请求消息,所述接管请求消息携带所述第三虚拟存储卷的卷标识;Receiving a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume;
    根据所述第三虚拟存储卷的卷标识,将所述第三虚拟存储卷的启动块对象中保存的第二存储设备的设备标识更新为所述第一存储设备的设备标识;Updating, according to the volume identifier of the third virtual storage volume, the device identifier of the second storage device saved in the startup block object of the third virtual storage volume to the device identifier of the first storage device;
    将所述第三虚拟存储卷的卷标识分别添加到所述第一虚拟存储设备中和所述第一存储设备对应的存储卷列表对象中。And adding a volume identifier of the third virtual storage volume to the storage volume list object corresponding to the first storage device and the first storage device.
  10. 一种读取数据的方法,其特征在于,所述方法包括:A method of reading data, the method comprising:
    接收包括位置信息的读取请求消息,所述位置信息包括待读取数据的第二数据起始位置、第二数据长度、所述待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块标识;Receiving a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, a volume identifier of the target storage volume where the data to be read is located, and a target The block identifier of the storage block;
    根据所述位置信息从对象存储平台中的所述目标存储块中读取所述待读取数据。Reading the data to be read from the target storage block in the object storage platform according to the location information.
  11. 如权利要求10所述的方法,其特征在于,所述根据所述位置信息从对象存储平台中的所述目标存储块中读取所述待读取数据,包括:The method of claim 10, wherein the reading the data to be read from the target storage block in the object storage platform according to the location information comprises:
    根据所述目标存储卷的卷标识和所述目标存储块的块标识,从对象存储平台中获取所述目标存储块的索引对象,所述索引对象包括所述目标存储块中存储的数据的第一数据起始位置;Obtaining an index object of the target storage block from an object storage platform according to a volume identifier of the target storage volume and a block identifier of the target storage block, where the index object includes a data stored in the target storage block a data starting position;
    根据所述第一数据起始位置和所述第二数据起始位置,确定用于存储所述待读取数据的目标数据对象和所述待读取数据在所述目标数据对象中的偏移;Determining, according to the first data start position and the second data start position, a target data object for storing the data to be read and an offset of the data to be read in the target data object ;
    根据所述偏移和所述第二数据长度,从所述目标数据对象中读取所述待读 取数据。The to-be-read data is read from the target data object based on the offset and the second data length.
  12. 一种存储数据的装置,其特征在于,所述装置包括:An apparatus for storing data, the apparatus comprising:
    确定模块,用于确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块;a determining module, configured to determine a target virtual storage volume for storing data to be stored, and determining a target storage block from the target virtual storage volume;
    申请模块,用于在对象存储平台中申请所述目标存储块包括的至少一个数据对象;An application module, configured to apply, in an object storage platform, at least one data object included in the target storage block;
    存储模块,用于将所述待存储数据存储在所述至少一个数据对象中;在管理设备中对应保存所述装置的设备标识与第一索引信息之间的对应关系,所述第一索引信息至少包括所述目标虚拟存储卷的卷标识、所述目标存储块的块标识、所述待存储数据的数据标识、所述待存储数据的第一数据起始位置和所述待存储数据的第一数据长度;在所述对象存储平台中的所述目标存储块对应的索引块对象中存储第二索引信息,所述第二索引信息至少包括所述第一数据起始位置。a storage module, configured to store the to-be-stored data in the at least one data object, and correspondingly store a correspondence between the device identifier of the device and the first index information, where the first index information is And including at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, a first data start location of the data to be stored, and a first to be stored data a data length; storing, in the index block object corresponding to the target storage block in the object storage platform, second index information, where the second index information includes at least the first data start position.
  13. 如权利要求12所述的装置,其特征在于,所述确定模块包括:The device of claim 12, wherein the determining module comprises:
    第一选择单元,用于从所述装置对应的至少一个虚拟存储卷中选择一个虚拟存储卷作为目标虚拟存储卷;a first selection unit, configured to select one virtual storage volume from the at least one virtual storage volume corresponding to the device as the target virtual storage volume;
    获取单元,用于从对象存储平台中获取所述目标虚拟存储卷的块位图对象,所述块位图对象用于存储所述目标虚拟存储卷中的每个存储块的标识位,存储块的标识位用于记录所述存储块是否空闲;An obtaining unit, configured to acquire, from the object storage platform, a block bitmap object of the target virtual storage volume, where the block bitmap object is used to store an identifier bit of each storage block in the target virtual storage volume, and a storage block The flag bit is used to record whether the memory block is idle;
    第二选择单元,用于根据所述块位图对象从所述目标虚拟存储卷中选择空闲的存储块作为目标存储块。And a second selecting unit, configured to select, from the target virtual storage volume, a free storage block as the target storage block according to the block bitmap object.
  14. 如权利要求12所述的装置,其特征在于,所述装置还包括:The device of claim 12, wherein the device further comprises:
    设置单元,用于在所述目标虚拟存储卷的块位图对象中,将所述目标存储块的标识位设置成用于标识所述目标存储块已被使用。a setting unit, configured to set, in a block bitmap object of the target virtual storage volume, an identification bit of the target storage block to identify that the target storage block has been used.
  15. 如权利要求12所述的装置,其特征在于,所述装置还包括:The device of claim 12, wherein the device further comprises:
    创建模块,用于在所述对象存储平台中为所述装置创建第一虚拟存储卷。A module is created for creating a first virtual storage volume for the device in the object storage platform.
  16. 如权利要求15所述的装置,其特征在于,所述创建模块包括:The device of claim 15, wherein the creating module comprises:
    生成单元,用于生成第一虚拟存储卷的卷标识;a generating unit, configured to generate a volume identifier of the first virtual storage volume;
    第一添加单元,用于将所述第一虚拟存储卷的卷标识添加到位于所述对象存储平台中的所述装置对应的存储卷列表对象中;a first adding unit, configured to add a volume identifier of the first virtual storage volume to a storage volume list object corresponding to the device located in the object storage platform;
    申请单元,用于在所述对象存储平台中申请所述第一虚拟存储卷的启动块对象、块位图对象和所述第一虚拟存储卷中的每个存储块的索引对象;An application unit, configured to apply, in the object storage platform, a boot block object of the first virtual storage volume, a block bitmap object, and an index object of each of the first virtual storage volumes;
    其中,所述启动块对象用于存储卷基本信息,所述卷基本信息至少包括所述第一虚拟存储卷的容量、存储块数目和所述装置的设备标识;所述块位图对象用于存储所述第一虚拟存储卷中的每个存储块的标识位,存储块的标识位用于标识所述存储块是否空闲;所述存储块的索引对象用于存储第三索引信息,所述第三索引信息至少包括所述存储块中的数据对象数目。The boot block object is configured to store volume basic information, where the volume basic information includes at least a capacity of the first virtual storage volume, a number of storage blocks, and a device identifier of the device; the block bitmap object is used for And storing an identifier bit of each of the first virtual storage volumes, where an identifier of the storage block is used to identify whether the storage block is idle; an index object of the storage block is configured to store third index information, The third index information includes at least the number of data objects in the storage block.
  17. 如权利要求12所述的装置,其特征在于,所述装置还包括:The device of claim 12, wherein the device further comprises:
    加载模块,用于在所述装置启动时,根据所述对象存储平台中的所述装置对应的存储卷列表对象,将所述装置对应的至少一个虚拟存储卷加载到所述装置中,所述存储卷列表对象用于存储所述装置对应的至少一个虚拟存储卷的卷标识。a loading module, configured to load at least one virtual storage volume corresponding to the device into the device according to a storage volume list object corresponding to the device in the object storage platform when the device is started, The storage volume list object is used to store a volume identifier of at least one virtual storage volume corresponding to the device.
  18. 如权利要求17所述的装置,其特征在于,所述加载模块包括:The device of claim 17, wherein the loading module comprises:
    下载单元,用于从所述对象存储平台中下载所述装置对应的存储卷列表对象;根据第二虚拟存储卷的卷标识,从所述对象存储平台中下载所述第二虚拟存储卷的启动块对象,所述第二虚拟存储卷的卷标识为所述存储卷列表对象中的任一个虚拟存储卷的卷标识;a downloading unit, configured to download, from the object storage platform, a storage volume list object corresponding to the device, and downloading, according to a volume identifier of the second virtual storage volume, the startup of the second virtual storage volume from the object storage platform a volume identifier, where a volume identifier of the second virtual storage volume is a volume identifier of any one of the storage volume list objects;
    第二添加单元,用于在所述启动块对象存储有所述装置的设备标识时,将所述第二虚拟存储卷的卷标识添加到所述装置中。a second adding unit, configured to add a volume identifier of the second virtual storage volume to the device when the boot block object stores the device identifier of the device.
  19. 如权利要求12所述的装置,其特征在于,所述装置还包括:The device of claim 12, wherein the device further comprises:
    接管模块,用于根据第三虚拟存储卷的卷标识,接管所述第三虚拟存储卷,所述第三虚拟存储卷是第二存储设备对应的虚拟存储卷,所述第二存储设备是 除所述装置以外的其他存储设备。a takeover module, configured to take over the third virtual storage volume according to the volume identifier of the third virtual storage volume, where the third virtual storage volume is a virtual storage volume corresponding to the second storage device, and the second storage device is Other storage devices than the device.
  20. 如权利要求19所述的装置,其特征在于,所述接管模块包括:The device of claim 19, wherein the takeover module comprises:
    接收单元,用于接收接管请求消息,所述接管请求消息携带所述第三虚拟存储卷的卷标识;a receiving unit, configured to receive a takeover request message, where the takeover request message carries a volume identifier of the third virtual storage volume;
    更新单元,用于根据所述第三虚拟存储卷的卷标识,将所述第三虚拟存储卷的启动块对象中保存的第二存储设备的设备标识更新为所述装置的设备标识;An update unit, configured to update, according to the volume identifier of the third virtual storage volume, a device identifier of the second storage device saved in the startup block object of the third virtual storage volume to a device identifier of the device;
    第三添加单元,用于将所述第三虚拟存储卷的卷标识分别添加到所述装置中和所述装置对应的存储卷列表对象中。And a third adding unit, configured to separately add volume identifiers of the third virtual storage volume to the storage volume list object corresponding to the device and the device.
  21. 一种读取数据的装置,其特征在于,所述装置包括:A device for reading data, characterized in that the device comprises:
    接收模块,用于接收包括位置信息的读取请求消息,所述位置信息包括待读取数据的第二数据起始位置、第二数据长度、所述待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块标识;a receiving module, configured to receive a read request message including location information, where the location information includes a second data start location of the data to be read, a second data length, and a volume of the target storage volume where the data to be read is located The identifier of the block and the block of the target storage block;
    读取模块,用于根据所述位置信息从对象存储平台中的所述目标存储块中读取所述待读取数据。And a reading module, configured to read the data to be read from the target storage block in the object storage platform according to the location information.
  22. 如权利要求21所述的装置,其特征在于,所述读取模块包括:The device of claim 21, wherein the reading module comprises:
    获取单元,用于根据所述目标存储卷的卷标识和所述目标存储块的块标识,从对象存储平台中获取所述目标存储块的索引对象,所述索引对象包括所述目标存储块中存储的数据的第一数据起始位置;An obtaining unit, configured to acquire an index object of the target storage block from an object storage platform according to a volume identifier of the target storage volume and a block identifier of the target storage block, where the index object includes the target storage block The first data start position of the stored data;
    确定单元,用于根据所述第一数据起始位置和所述第二数据起始位置,确定用于存储所述待读取数据的目标数据对象和所述待读取数据在所述目标数据对象中的偏移;a determining unit, configured to determine, according to the first data start location and the second data start location, a target data object for storing the data to be read and the data to be read in the target data The offset in the object;
    读取单元,用于根据所述偏移和所述第二数据长度,从所述目标数据对象中读取所述待读取数据。And a reading unit, configured to read the data to be read from the target data object according to the offset and the second data length.
  23. 一种存储数据的系统,其特征在于,所述系统包括:存储设备、对象存储平台和管理设备;A system for storing data, the system comprising: a storage device, an object storage platform, and a management device;
    所述存储设备,用于确定用于存储待存储数据的目标虚拟存储卷,以及从所述目标虚拟存储卷中确定目标存储块;在所述对象存储平台中申请所述目标存储块包括的至少一个数据对象;将所述待存储数据存储在所述至少一个数据对象中;在所述管理设备中对应保存所述存储设备的设备标识与第一索引信息之间的对应关系,所述第一索引信息至少包括所述目标虚拟存储卷的卷标识、所述目标存储块的块标识、所述待存储数据的数据标识、所述待存储数据的第一数据起始位置和所述待存储数据的第一数据长度;在所述对象存储平台中的所述目标存储块对应的索引块对象中存储第二索引信息,所述第二索引信息至少包括所述第一数据起始位置。The storage device is configured to determine a target virtual storage volume for storing data to be stored, and determine a target storage block from the target virtual storage volume; and apply at least the target storage block included in the object storage platform a data object; storing the data to be stored in the at least one data object; correspondingly storing a correspondence between the device identifier of the storage device and the first index information in the management device, the first The index information includes at least a volume identifier of the target virtual storage volume, a block identifier of the target storage block, a data identifier of the data to be stored, a first data start location of the data to be stored, and the to-be-stored data The first data length is stored in the index block object corresponding to the target storage block in the object storage platform, and the second index information includes at least the first data start position.
  24. 一种读取数据的系统,其特征在于,所述系统包括:存储设备、管理设备和对象存储平台;A system for reading data, characterized in that the system comprises: a storage device, a management device and an object storage platform;
    所述存储设备,用于接收所述管理设备发送的包括位置信息的读取请求消息,所述位置信息包括待读取数据的第二数据起始位置、第二数据长度、所述待读取数据所在的目标存储卷的卷标识和所在的目标存储块的块标识;根据所述位置信息从所述对象存储平台中的所述目标存储块中读取所述待读取数据。The storage device is configured to receive a read request message that includes the location information that is sent by the management device, where the location information includes a second data start location of the data to be read, a second data length, and the to-be-read The volume identifier of the target storage volume where the data is located and the block identifier of the target storage block in which the data is stored; the data to be read is read from the target storage block in the object storage platform according to the location information.
PCT/CN2019/087232 2018-05-17 2019-05-16 Method, apparatus and system for storing data, and method for reading data, apparatus, and system WO2019219059A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810474325.1 2018-05-17
CN201810474325.1A CN110502184B (en) 2018-05-17 2018-05-17 Data storage method, data reading method, device and system

Publications (1)

Publication Number Publication Date
WO2019219059A1 true WO2019219059A1 (en) 2019-11-21

Family

ID=68539488

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/087232 WO2019219059A1 (en) 2018-05-17 2019-05-16 Method, apparatus and system for storing data, and method for reading data, apparatus, and system

Country Status (2)

Country Link
CN (1) CN110502184B (en)
WO (1) WO2019219059A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102304929B1 (en) 2020-02-07 2021-09-24 삼성전자 주식회사 Storage system storing model information, Storage system including storage system and Operating method of storage system
CN111262952B (en) * 2020-03-27 2023-11-21 北京环鼎科技有限责任公司 Breakpoint continuous loading method for downloading acoustic data file for storage logging
CN112100184A (en) * 2020-10-26 2020-12-18 上海擎感智能科技有限公司 Vehicle total mileage data storage method and computer storage medium
CN113449155B (en) * 2021-07-16 2024-02-27 百度在线网络技术(北京)有限公司 Method, apparatus, device and medium for feature representation processing

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1602480A (en) * 2001-12-10 2005-03-30 单球体有限公司 Managing storage resources attached to a data network
US20130282674A1 (en) * 2012-04-23 2013-10-24 International Business Machines Corporation Preserving redundancy in data deduplication systems by designation of virtual address
CN103748548A (en) * 2011-06-30 2014-04-23 亚马逊科技公司 Storage gateway activation process
CN107315533A (en) * 2016-04-26 2017-11-03 杭州海康威视数字技术股份有限公司 A kind of date storage method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7548975B2 (en) * 2002-01-09 2009-06-16 Cisco Technology, Inc. Methods and apparatus for implementing virtualization of storage within a storage area network through a virtual enclosure
US9289681B2 (en) * 2007-10-09 2016-03-22 International Business Machines Corporation Suggested actions within a virtual environment
CN103064765B (en) * 2012-12-28 2015-12-02 华为技术有限公司 Data reconstruction method, device and cluster storage system
CN108021513B (en) * 2016-11-02 2021-09-10 杭州海康威视数字技术股份有限公司 Data storage method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1602480A (en) * 2001-12-10 2005-03-30 单球体有限公司 Managing storage resources attached to a data network
CN103748548A (en) * 2011-06-30 2014-04-23 亚马逊科技公司 Storage gateway activation process
US20130282674A1 (en) * 2012-04-23 2013-10-24 International Business Machines Corporation Preserving redundancy in data deduplication systems by designation of virtual address
CN107315533A (en) * 2016-04-26 2017-11-03 杭州海康威视数字技术股份有限公司 A kind of date storage method and device

Also Published As

Publication number Publication date
CN110502184B (en) 2021-01-05
CN110502184A (en) 2019-11-26

Similar Documents

Publication Publication Date Title
WO2019219059A1 (en) Method, apparatus and system for storing data, and method for reading data, apparatus, and system
CN112783564B (en) Method for accelerating starting of application program and electronic equipment
CN110232048A (en) Acquisition methods, device and the storage medium of journal file
WO2020211712A1 (en) Patching method and related device, and system
CN111628916B (en) Method for cooperation of intelligent sound box and electronic equipment
CN113254409B (en) File sharing method, system and related equipment
CN113722087B (en) Virtual memory management method and electronic equipment
CN113704205B (en) Log storage method, chip, electronic device and readable storage medium
WO2021185352A1 (en) Version upgrade method and related apparatus
CN114579954A (en) Method for safely starting verification and electronic equipment
CN114416723B (en) Data processing method, device, equipment and storage medium
KR102240526B1 (en) Contents download method of electronic apparatus and electronic appparatus thereof
CN111399874A (en) System upgrading method and device, storage medium and intelligent wearable device
WO2021104117A1 (en) Method for constructing application program resource packet, construction apparatus, and terminal device
CN113641634A (en) Method for controlling log flow and electronic equipment
CN114253737B (en) Electronic device, memory recovery method thereof and medium
CN113485969B (en) Storage fragmentation method and device, terminal and computer storage medium
CN113590346B (en) Method and electronic equipment for processing service request
CN112783418B (en) Method for storing application program data and mobile terminal
CN111131019B (en) Multiplexing method and terminal for multiple HTTP channels
CN113721836A (en) Data deduplication method and device
CN114268931A (en) IoT (Internet of things) equipment management method and terminal
CN112988552A (en) Application program testing method, device, equipment and storage medium
KR100678081B1 (en) Mass storage data file management method of mobile communication terminal
CN117009023B (en) Method for displaying notification information and related device

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: 19804069

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: 19804069

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19804069

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.06.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19804069

Country of ref document: EP

Kind code of ref document: A1