CN111522883B - Backup method, device, equipment and storage medium of object data - Google Patents

Backup method, device, equipment and storage medium of object data Download PDF

Info

Publication number
CN111522883B
CN111522883B CN202010349216.4A CN202010349216A CN111522883B CN 111522883 B CN111522883 B CN 111522883B CN 202010349216 A CN202010349216 A CN 202010349216A CN 111522883 B CN111522883 B CN 111522883B
Authority
CN
China
Prior art keywords
storage node
hash
object data
storage
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010349216.4A
Other languages
Chinese (zh)
Other versions
CN111522883A (en
Inventor
丁光凯
夏伟强
王定琋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision System Technology Co Ltd
Original Assignee
Hangzhou Hikvision System Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision System Technology Co Ltd filed Critical Hangzhou Hikvision System Technology Co Ltd
Priority to CN202010349216.4A priority Critical patent/CN111522883B/en
Publication of CN111522883A publication Critical patent/CN111522883A/en
Application granted granted Critical
Publication of CN111522883B publication Critical patent/CN111522883B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/273Asynchronous replication or reconciliation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a backup method, device and equipment of object data and a storage medium, and belongs to the technical field of data storage. The method comprises the following steps: and reading an asynchronous backup task in an asynchronous backup task table, wherein the asynchronous backup task comprises a first hash parameter and first hash ring information, the asynchronous backup task refers to a task for backing up first object data in the first storage node, and the first hash ring indicated by the first hash ring information comprises a plurality of storage nodes in the cloud storage system. And determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data, and backing up the first object data into the second storage node. In the application, the second storage node for backup can be dynamically determined, and the situation that certain object data can only be stored for one time can be avoided, so that the storage stability is ensured.

Description

Backup method, device, equipment and storage medium of object data
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a method, an apparatus, a device, and a storage medium for backing up object data.
Background
In a cloud storage system, in order to improve the reliability of storage, when object data is written, backup is generally performed in different storage nodes, so that when one or more storage nodes in the cloud storage system fail, the read-write service of the object data is not affected.
In the related art, a backup manner is generally adopted, wherein storage nodes in a cloud storage system are grouped according to a fixed manner, and multi-copy storage is performed in the group. For example, if the cloud storage system includes storage node a, storage node B, storage node C, and storage node D, storage node a and storage node B may be grouped together and storage node C and storage node D may be grouped together.
However, in the above manner, since the grouping backup is performed in a fixed manner, if the number of storage nodes in the cloud storage system is an odd number, some object data can be stored only in one copy, so that the storage stability is poor.
Disclosure of Invention
The application provides a backup method, device and equipment for object data and a storage medium, which can solve the problem that some object data in the related technology can only be stored for one time, so that the storage stability is poor. The technical scheme is as follows:
In one aspect, a backup method of object data is provided, which is applied to a first storage node, where the first storage node is any storage node in a cloud storage system, and the method includes:
reading an asynchronous backup task in an asynchronous backup task table, wherein the asynchronous backup task comprises a first hash parameter and first hash ring information, the asynchronous backup task is a task for backing up first object data in a first storage node, and the first hash ring indicated by the first hash ring information comprises a plurality of storage nodes in the cloud storage system;
determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data;
and backing up the first object data to the second storage node.
In one possible implementation manner of the present application, the determining, according to the first hash parameter and the first hash ring information, a second storage node includes:
determining whether other storage nodes exist in the first hash ring on the basis of the first hash ring information, wherein the other storage nodes refer to storage nodes except the first storage node;
If other storage nodes exist in the first hash ring on line, determining the number of the storage nodes in the first hash ring according to the first hash ring information;
performing hash operation according to the first hash parameter and the number of the storage nodes to obtain a hash value;
determining a storage node corresponding to the hash value from the first hash ring;
and if the storage node corresponding to the hash value is the first storage node and the next storage node of the first storage node in the first hash ring is online, determining the next storage node of the first storage node as the second storage node.
In one possible implementation manner of the present application, after determining the storage node corresponding to the hash value from the first hash ring, the method further includes:
if the storage node corresponding to the hash value is the last storage node of the first storage node, and the last storage node of the first storage node is online, determining the last storage node of the first storage node as the second storage node; or,
and if the storage node corresponding to the hash value is the last storage node of the first storage node and the last storage node of the first storage node is not online, determining the next storage node of the first storage node as the second storage node if the next storage node of the first storage node is online.
In one possible implementation manner of the present application, after determining the storage node corresponding to the hash value from the first hash ring, the method further includes:
if the storage node corresponding to the hash value is not the first storage node and is not the last storage node of the first storage node, determining the storage node corresponding to the hash value as the second storage node if the storage node corresponding to the hash value is online.
In one possible implementation manner of the present application, after determining, based on the first hash ring information, whether there are other storage nodes in the first hash ring online, the method further includes:
if no other storage nodes exist in the first hash ring, acquiring the latest hash ring information;
and determining the second storage node from the hash ring corresponding to the latest hash ring information based on the latest hash ring information and the first hash parameter.
In one possible implementation manner of the present application, the method further includes:
receiving a write request of the first object data, wherein the write request carries the first hash parameter and the first hash ring information;
Determining a primary storage node based on the first hash parameter and the first hash ring information;
storing the first object data to the primary storage node;
determining a next storage node of the main storage node from the first hash ring under the condition that the first object data is successfully stored in the main storage node;
and if the next storage node of the main storage node is not online, recording the asynchronous backup task in the asynchronous backup task table.
In one possible implementation manner of the present application, after determining a next storage node of the primary storage node from the first hash ring, the method further includes:
if the next storage node of the main storage node is online, writing the first object data into the next storage node of the main storage node;
and recording the asynchronous backup task in the asynchronous backup task table under the condition that the writing of the first object data to the next storage node of the main storage node fails.
In one possible implementation manner of the present application, the method further includes:
reading a copy replenishment task, wherein the copy replenishment task is generated under the condition that the offline event of a storage node exists, and the copy replenishment task comprises node information of the offline storage node and an offline time point;
Inspecting index information in a local object index information table;
if the offline storage node is determined to be a storage node for storing second object data corresponding to target index information according to the node information, the offline time point and index information in the object index information table, the asynchronous backup task is recorded in the asynchronous backup task table based on the target index information, wherein the target index information is the index information in the object index information table.
In one possible implementation manner of the present application, the index information includes a storage time point of the corresponding object data and corresponding hash ring information, and the method further includes:
if the index information of which the corresponding storage time point is positioned before the offline time point exists in the object index information table, determining the index information of which the corresponding storage time point is positioned before the offline time point as the target index information;
and if the offline storage node is the last storage node of the first storage node or the offline storage node is the next storage node of the first storage node in the second hash ring corresponding to the target index information according to the node information and the hash ring information corresponding to the target index information, determining the offline storage node as a storage node for storing second object data corresponding to the target index information.
In one possible implementation manner of the present application, the method further includes:
receiving a read request, wherein the read request carries index information and the first hash ring information;
if the first object data corresponding to the index information exists locally, returning the first object data;
and if the first object data corresponding to the index information does not exist locally, reading the first object data according to the first hash ring information.
In one possible implementation manner of the present application, the read request carries a first hash parameter, the first hash ring information further includes version information of the first hash ring, and the reading the first object data according to the first hash ring information includes:
determining a next storage node of the first storage node in the first hash ring according to the first hash ring information;
if the first object data is not read from the next storage node of the first storage node, determining all hash rings with versions lower than the version of the first hash ring according to the version information of the first hash ring;
selecting hash rings from all the hash rings for a plurality of times according to the order of versions from high to low;
Each time a hash ring is selected, determining a storage node from the currently selected hash ring according to the currently selected hash ring and the first hash parameter, and reading the first object data from the determined storage node; until the first object data is read.
In another aspect, a backup device of object data is provided, configured in a first storage node, where the first storage node is any storage node in a cloud storage system, and the device includes:
the reading module is used for reading an asynchronous backup task in an asynchronous backup task table, wherein the asynchronous backup task comprises a first hash parameter and first hash ring information, the asynchronous backup task is a task for backing up first object data in the first storage node, and the first hash ring indicated by the first hash ring information comprises a plurality of storage nodes in the cloud storage system;
the determining module is used for determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data;
and the backup module is used for backing up the first object data to the second storage node.
In one possible implementation manner of the present application, the determining module is configured to:
determining whether other storage nodes exist in the first hash ring on the basis of the first hash ring information, wherein the other storage nodes refer to storage nodes except the first storage node;
if other storage nodes exist in the first hash ring on line, determining the number of the storage nodes in the first hash ring according to the first hash ring information;
performing hash operation according to the first hash parameter and the number of the storage nodes to obtain a hash value;
determining a storage node corresponding to the hash value from the first hash ring;
and if the storage node corresponding to the hash value is the first storage node and the next storage node of the first storage node in the first hash ring is online, determining the next storage node of the first storage node as the second storage node.
In one possible implementation manner of the present application, the determining module is configured to:
if the storage node corresponding to the hash value is the last storage node of the first storage node, and the last storage node of the first storage node is online, determining the last storage node of the first storage node as the second storage node; or,
And if the storage node corresponding to the hash value is the last storage node of the first storage node and the last storage node of the first storage node is not online, determining the next storage node of the first storage node as the second storage node if the next storage node of the first storage node is online.
In one possible implementation manner of the present application, the determining module is configured to:
if the storage node corresponding to the hash value is not the first storage node and is not the last storage node of the first storage node, determining the storage node corresponding to the hash value as the second storage node if the storage node corresponding to the hash value is online.
In one possible implementation manner of the present application, the determining module is configured to:
if no other storage nodes exist in the first hash ring, acquiring the latest hash ring information;
and determining the second storage node from the hash ring corresponding to the latest hash ring information based on the latest hash ring information and the first hash parameter.
In one possible implementation manner of the present application, the determining module is configured to:
Receiving a write request of the first object data, wherein the write request carries the first hash parameter and the first hash ring information;
determining a primary storage node based on the first hash parameter and the first hash ring information;
storing the first object data to the primary storage node;
determining a next storage node of the main storage node from the first hash ring under the condition that the first object data is successfully stored in the main storage node;
and if the next storage node of the main storage node is not online, recording the asynchronous backup task in the asynchronous backup task table.
In one possible implementation manner of the present application, the determining module is configured to:
if the next storage node of the main storage node is online, writing the first object data into the next storage node of the main storage node;
and recording the asynchronous backup task in the asynchronous backup task table under the condition that the writing of the first object data to the next storage node of the main storage node fails.
In one possible implementation manner of the present application, the determining module is configured to:
Reading a copy replenishment task, wherein the copy replenishment task is generated under the condition that the offline event of a storage node exists, and the copy replenishment task comprises node information of the offline storage node and an offline time point;
inspecting index information in a local object index information table;
if the offline storage node is determined to be a storage node for storing second object data corresponding to target index information according to the node information, the offline time point and index information in the object index information table, the asynchronous backup task is recorded in the asynchronous backup task table based on the target index information, wherein the target index information is the index information in the object index information table.
In one possible implementation manner of the present application, the determining module is configured to:
if the index information of which the corresponding storage time point is positioned before the offline time point exists in the object index information table, determining the index information of which the corresponding storage time point is positioned before the offline time point as the target index information;
and if the offline storage node is the last storage node of the first storage node or the offline storage node is the next storage node of the first storage node in the second hash ring corresponding to the target index information according to the node information and the hash ring information corresponding to the target index information, determining the offline storage node as a storage node for storing second object data corresponding to the target index information.
In one possible implementation manner of the present application, the reading module is configured to:
receiving a read request, wherein the read request carries index information and the first hash ring information;
if the first object data corresponding to the index information exists locally, returning the first object data;
and if the first object data corresponding to the index information does not exist locally, reading the first object data according to the first hash ring information.
In one possible implementation manner of the present application, the read request carries a first hash parameter, the first hash ring information further includes version information of the first hash ring, and the read module is configured to:
determining a next storage node of the first storage node in the first hash ring according to the first hash ring information;
if the first object data is not read from the next storage node of the first storage node, determining all hash rings with versions lower than the version of the first hash ring according to the version information of the first hash ring;
selecting hash rings from all the hash rings for a plurality of times according to the order of versions from high to low;
each time a hash ring is selected, determining a storage node from the currently selected hash ring according to the currently selected hash ring and the first hash parameter, and reading the first object data from the determined storage node; until the first object data is read.
In another aspect, a computer device is provided, where the computer device includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus, where the memory is used to store a computer program, and where the processor is used to execute the program stored on the memory, so as to implement the steps of the backup method of object data described above.
In another aspect, a computer readable storage medium is provided, in which a computer program is stored, which when executed by a processor, implements the steps of the method for backing up object data described above.
In another aspect, a computer program product is provided comprising instructions which, when run on a computer, cause the computer to perform the steps of the method of backup of object data described above.
The technical scheme that this application provided can bring following beneficial effect at least:
the method comprises the steps that a first storage node reads an asynchronous backup task in an asynchronous backup task table, wherein the asynchronous backup task comprises a first hash parameter and first hash ring information, the asynchronous backup task refers to a task for backing up first object data in the first storage node, and the first hash ring indicated by the first hash ring information comprises a plurality of storage nodes in the cloud storage system. And determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data, and backing up the first object data into the second storage node. In the application, the second storage node for backup can be dynamically determined, and the situation that certain object data can only be stored for one time can be avoided, so that the storage stability is ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a hash ring provided in an embodiment of the present application;
fig. 2 is a schematic architecture diagram of a cloud storage system according to an embodiment of the present application;
FIG. 3 is a flowchart of a backup method of object data according to an embodiment of the present application;
FIG. 4 is a schematic diagram of another hash ring provided in an embodiment of the present application;
FIG. 5 is a flowchart of another backup method of object data according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a backup device for object data according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a storage node according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Before explaining the backup method of the object data provided by the embodiment of the application in detail, related terms and implementation environments provided by the embodiment of the application are described.
First, related terms related to the embodiments of the present application will be briefly described.
Object file: is a basic storage unit in the cloud storage system, and each object file corresponds to a unique key value (object-key) through which corresponding object data can be accessed.
Duplicate supplementation: in the cloud storage system, one or more copies of each object data exist in different storage nodes, and if one storage node is abnormal, the object data on the storage node can be copied to other normal storage nodes, so that the object data is always backed up.
HASH ring (HASH ring): all online storage nodes in the cloud storage system are arranged according to rules to form a ring. When the object data is read and written, the client can calculate a hash value according to the hash parameter corresponding to the object data and the number of storage nodes in the hash ring, can position the storage nodes for storing the object data according to the hash value, and then directly connect the storage nodes to read and write the object data, wherein a certain sequence exists in the storage nodes in the hash ring, and the copy mutual backup relationship can be determined based on the sequence. For example, as shown in fig. 1, the storage nodes A, B, C, D, E form a hash ring, where the copy-backup relationship is AB, BC, CD, DE, EA, that is, the object data in a can be backed up to B, and so on, and the object data in E can be backed up to a.
Next, an implementation environment related to the embodiments of the present application will be briefly described.
The backup method of the object data is applied to a cloud storage system, the cloud storage system can be a cloud storage high-performance access cluster, also can be called a HAS cluster for short, and the cloud storage system is of a centerless distributed storage architecture. Referring to fig. 2, fig. 2 is a schematic architecture diagram of a cloud storage system according to an exemplary embodiment. The cloud storage system includes a plurality of storage nodes 210, clients 220, and EC (Erasure Code) storage 230. Wherein the client 220 may establish a communication connection with each storage node 210, respectively, and each storage node 210 establishes a communication connection with the EC storage device 230.
In a centreless cloud storage system, each storage node 210 stores index information of respective object data. The partial storage nodes 210 in the cloud storage system are provided with a management module and a storage module, and the management module can be responsible for maintaining state information of all storage nodes, generating hash rings, updating hash ring versions, and providing functions such as hash ring information inquiry for clients. The storage module can provide services such as reading, writing, deleting, inquiring and the like of object data for a client, is responsible for operations such as reading and writing a Disk of the object data and recording index information of the object data, and can also perform services such as copy copying, copy supplementing and the like.
In addition, some storage nodes 210 in the cloud storage system may also have no management module, and for such storage nodes without a management module, the storage nodes may be connected to a storage node with a management module, for example, may be connected to the management module, so as to synchronize data such as state information, hash ring information and the like of each storage node from the management module.
Wherein the client 220 may be provided with an SDK (Software DevelopmentKit ) to interact with the storage node 210 through the SDK for reading, writing, querying, and the like. The client 220 may also synchronize hash ring information, storage node information and status information of the storage node, etc., from a management module of the storage node through the SDK, where the storage node information may include, but is not limited to, a storage node address, a listening port. As an example, the management module in each storage node may map its own address to a specified virtual address, so that clients may synchronize hash ring information, and data such as storage node information and state information of the storage node from the specified virtual address. The designated virtual address can be set according to actual requirements.
In some embodiments, the client 220 may be a stand-alone device or may be configured in a terminal. As an example, the terminal may be any electronic product that can perform man-machine interaction with a user through one or more of a keyboard, a touch pad, a touch screen, a remote controller, a voice interaction or handwriting device, such as a PC (Personal Computer, a personal computer), a mobile phone, a smart phone, a PDA (Personal Digital Assistant, a personal digital assistant), a wearable device, a palm top computer PPC (Pocket PC), a tablet computer, a smart car machine, a smart television, a smart speaker, etc.
The EC storage device refers to a device that can recover lost data through erasure codes. In a cloud storage system, in order to improve the performance of writing object data by a user, the object data is firstly cached in an SSD and then asynchronously restored to an EC storage device under the condition that a certain condition is met.
In the embodiment of the present application, in order to ensure the security of the object data cached in the SSD and the performance of extracting the object data, the object data may be stored in the SSD of different storage nodes in a dual-copy manner. Specific implementations thereof can be seen in the following examples.
Having introduced related terms and implementation environments related to embodiments of the present application, a detailed explanation of a backup method of object data provided by embodiments of the present application will be provided below with reference to the accompanying drawings.
Referring to fig. 3, fig. 3 is a flowchart of a backup method of object data according to an embodiment of the present application, where the method is applied to the implementation environment shown in fig. 2, and is executed by a first storage node, and the first storage node is any storage node in the cloud storage system, and the method may include the following implementation steps.
Step 301: and reading an asynchronous backup task in an asynchronous backup task table, wherein the asynchronous backup task comprises a first hash parameter and first hash ring information, the asynchronous backup task refers to a task for backing up first object data in the first storage node, and the first hash ring indicated by the first hash ring information comprises a plurality of storage nodes in the cloud storage system.
The first hash parameter may include a resource pool identifier and a key value of the first object data, where the resource pool identifier may be pre-allocated by the system, and the key value of the first object data may be user-defined and set by a user. For example, the first hash parameter may include a socket and an object, where the socket is a resource pool identifier and the object is a key of the first object data, and in this embodiment, the first hash parameter uniquely corresponds to the first object data.
As an example, the asynchronous backup task may further include index information of the first object data to be backed up, in addition to the first hash parameter and the first hash ring information.
The asynchronous backup task table may include one or more asynchronous backup tasks, and the first storage node reads the asynchronous backup task from the asynchronous backup task table and implements the asynchronous backup task in a manner provided in this embodiment. After the current asynchronous backup task is completed, the first storage node can delete the completed asynchronous replication task, continuously read the next asynchronous backup task from the asynchronous backup task table, realize the next asynchronous backup task according to the mode provided by the application, and the like until all the asynchronous backup tasks in the asynchronous backup task table are completed.
Here, first, a description is given of a generation process of the asynchronous replication task. As an example, the generation of the asynchronous replication task may include the following several possible scenarios:
a first possible implementation: in the writing process of the first object data, the asynchronous replication task is generated under the condition that a certain condition is met.
In the process of writing the first object data, the first storage node receives a writing request of the first object data, wherein the writing request carries the first hash parameter and the first hash ring information. And determining a main storage node based on the first hash parameter and the first hash ring information, storing the first object data to the main storage node, and determining the next storage node of the main storage node from the first hash ring under the condition that the first object data is successfully stored to the main storage node. If the next storage node of the main storage node is not online, the asynchronous backup task is recorded in the asynchronous backup task table.
The first hash ring information may include version information of a first hash ring and a storage node list corresponding to the first hash ring, where the storage node list includes node information of storage nodes on the first hash ring. The version information of the first hash ring is version-1, and the storage node list corresponding to the first hash ring includes: service-id 1, service-id 2, service-id 3 …, service-id n. For example, the first hash ring information is server-6: serial-A, serial-C, serial-D, serial-E.
It should be understood that the write request further carries the first object data, and further, the write request may further carry object data description information such as a length, a data type, and the like of the first object data, which is not limited in the embodiment of the present application.
After receiving a writing request sent by a client, the first storage node can analyze the writing request to obtain the first hash parameter and the first hash ring information. Then, the first storage node may determine the number of storage nodes in the first hash ring according to the first hash ring information, and then perform hash calculation based on the first hash parameter and the number of storage nodes to obtain the hash value, for example, the hash value may be determined by the following formula (1):
Hash_index=HASH(bucket+objectkey)%hash(1)
wherein the hash_index represents the Hash value, the socket represents the resource pool identifier, the objectkey represents the key value of the first object data, the Hash represents the number of storage nodes, and the% represents the remainder operation.
The hash value is the index position of the storage node list corresponding to the first hash ring, so that the corresponding storage node can be determined from the first hash ring according to the hash value, and the main storage node is obtained. In this embodiment of the present application, a storage node determined from the first hash ring based on the hash value is referred to as a primary storage node.
The first storage node stores the first object data into the main storage node, and under the condition that storage is successful, the first storage node determines the next storage node of the main storage node from the first hash ring, namely, determines the storage node for backing up the first object data. If the next storage node of the main storage node in the first hash ring is not online, the first storage node can be considered to be unable to backup currently, in this case, the first storage node generates an asynchronous backup task and stores the asynchronous backup task in the asynchronous backup task table.
As an example, if the next storage node of the primary storage node is online, the first object data is written to the next storage node of the primary storage node, and if the writing of the first object data to the next storage node of the primary storage node fails, the asynchronous backup task is recorded in the asynchronous backup task table.
That is, in one possible implementation, the next storage node of the primary storage node in the first hash ring is online, in which case the first object data may be written to the next storage node of the primary storage node, i.e., the first object data may be backed up in the next storage node of the primary storage node. However, in some cases, if the backup fails, it is stated that the first object data needs to be backed up again, so at this time, an asynchronous backup task may be generated and recorded in the asynchronous backup task table.
It should be noted that, after determining the primary storage node, the first storage node may determine whether the first storage node is the primary storage node, and if the first storage node is the primary storage node, store the first object data into the local SSD. If the first storage node is not the main storage node, the first object data can be sent to the main storage node for storage, after the main storage node is successfully written, a writing success message can be returned, after the first storage node receives the writing success message, the next storage node of the main storage node can be determined, and the writing request is sent to the determined next storage node of the main storage node, so that the next storage node of the main storage node stores the first object data into an SSD of the main storage node, and the first object data is backed up.
In this embodiment of the present application, the storage node used for backing up the first object data is referred to as a backup storage node, that is, in the foregoing process, the next storage node of the primary storage node is the backup storage node.
Further, the first storage node may return a storage result of the first object data to the client, and if the first object data is successfully written into the primary storage node, a writing success message may be returned even if writing into the backup storage node fails. Of course, if the first storage node fails to write the first object data to the primary storage node, a write failure message may be returned to the client.
For example, referring to fig. 4, the client, storage node 1 and storage node 2 synchronize various versions of hash ring information from the management module. The client determines a corresponding storage node 1 according to the first hash parameter and the first hash ring information, writes first object data into the storage node 1, stores the first object data in the first storage node 1, and determines a storage node 2 for backing up the first object data from the first hash ring. The first storage node sends the first object data to the storage node 2, the storage node 2 backs up the first object data, and returns a storage result, if the storage result is a writing failure message, it is indicated that the storage node 2 fails to back up the first object data, and at this time, the storage node 1 records the asynchronous backup task.
A second possible implementation: if the primary storage node or the backup storage node for storing the first object data is offline, the asynchronous replication task is generated.
In some embodiments, there may be some anomalies in the storage nodes in the cloud storage system, such as a server crash, a system crash, etc., which results in the storage nodes going offline and failing to provide the object read-write service to the outside. If the primary storage node or the backup storage node for storing the first object data is offline, only one storage node in the cloud storage system is caused to store the first object data, that is, the cloud storage system does not have a backup of the first object data, in this case, copy replenishment is required, for this purpose, the first storage node generates an asynchronous replication task, and records the asynchronous replication task into an asynchronous replication task table.
In implementations, the first storage node may read a copy replenishment task that is generated if it is determined that there is a storage node offline event, the copy replenishment task including node information of the offline storage node and an offline point in time, and patrol index information in a local object index information table. If the offline storage node is determined to be a storage node for storing second object data corresponding to target index information according to the node information, the offline time point and index information in the object index information table, the asynchronous backup task is recorded in the asynchronous backup task table based on the target index information, wherein the target index information is index information in the object index information table.
As described above, a management module is configured in a part of storage nodes in the cloud storage system, and the management module can patrol the states of other storage nodes connected with the management module. If a storage node is offline, the management module will generate a new hash ring, for example, please refer to fig. 5, the list of storage nodes corresponding to the hash ring version 1 is: a- > B- > C- > D- > E; if the storage node B goes offline, the hash ring version 2 is generated, and the corresponding storage node list is: a- > C- > D- > E, new object data writes will be calculated and located in this queue.
As an example, the management module detects that a storage node is offline, may generate a storage node offline event that includes node information of the offline storage node and an offline point in time. Further, in order to avoid misjudgment of short offline of the storage node caused by occasional power failure, the management node may also regenerate the offline event of the storage node after detecting that the offline of the storage node exceeds a certain time threshold.
The time threshold may be set according to actual requirements, for example, the time threshold may be 2 hours, which is not limited in the embodiment of the present application.
After generating the storage node offline event, the management module may synchronize the storage node offline event to other online storage nodes.
For the first storage node, if the management module is configured in the first storage node, the first storage node may generate the storage node offline event when detecting that the storage node is offline (or offline exceeds a certain time threshold), or if the management module is not configured in the first storage node, the first storage node receives the storage node offline event sent by the management module.
After the first storage node determines that the storage node offline event exists, a copy supplementing task can be recorded in the copy supplementing task table. In this way, the first storage node may periodically patrol the copy supplement task table, read the copy supplement task, and patrol index information in the local object index information table, where the object index information table may store index information of all object data, that is, the number of index information in the object index information table may be multiple. The first storage node queries whether the offline storage node is a storage node for storing second object data corresponding to target index information according to node information of the offline storage node, offline time points and index information in an object index information table, if so, it is indicated that only one storage node in the current cloud storage system remains to store the second object data corresponding to the target index information, in this case, based on the target index information, the asynchronous backup task is generated, and the asynchronous backup task is added into the asynchronous backup task table, so that backup is performed subsequently, for example, if the management module detects that the storage node B is offline for more than 2 hours, a copy supplementing task is triggered, and at this time, the copy mutual backup relationship should be changed as follows: [ AC ], [ CD ], [ DE ], [ EA ].
As an example, the index information includes a storage time point of the corresponding object data and corresponding hash ring information, in which case, if index information in which the corresponding storage time point is located before the offline time point exists in the object index information table, the index information in which the corresponding storage time point is located before the offline time point is determined as the target index information. And if the offline storage node is the last storage node of the first storage node or the offline storage node is the next storage node of the first storage node in the second hash ring corresponding to the target index information according to the node information and the hash ring information corresponding to the target index information, determining that the offline storage node is a storage node for storing second object data corresponding to the target index information.
It should be understood that, if the index information table has index information whose corresponding storage time point is located before the offline time point, it indicates that there is object data stored in the first storage node before the offline time point, in this case, the object data may be stored in the offline storage node, and for further confirmation, the first storage node determines, as target index information, index information whose corresponding storage time point is located before the offline time point in the object index information table.
Then, a corresponding second hash ring may be determined according to the hash ring information corresponding to the target index information, and then, whether the offline storage node is a last storage node of the first storage node in the second hash ring is determined, if the offline storage node is a last storage node of the first storage node, it is explained that the offline storage node is a main storage node for storing the second object data, and it is easy to understand that the offline storage node may be determined to be a storage node for storing the second object data corresponding to the target index information. If the offline storage node is not the previous storage node of the first storage node, but the offline storage node is the next storage node of the first storage node, it is described that the offline storage node is a backup storage node for storing the second object data, and it is not easy to understand that the offline storage node may be determined to be a storage node for storing the second object data corresponding to the target index information.
Further, after the first storage node retrieves all index information in the object index information table, the record in the duplicate supplemental task table may be deleted.
Thus, after recording the asynchronous replication task in the asynchronous replication task table, the first storage node may periodically patrol the asynchronous replication task table, i.e., read the asynchronous replication task, in order to perform a replication copy operation, as described below.
Step 302: and determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data.
That is, after the first storage node reads the asynchronous backup task of the first object data, the storage node for backing up the first object data may be determined, that is, the second storage node may be determined, so that the first object data may be backed up subsequently, thereby completing the asynchronous backup task.
As an example, determining the second storage node from the first hash parameter and the first hash ring information may include:
3021: based on the first hash ring information, it is determined whether there are other storage nodes in the first hash ring that are on-line, the other storage nodes being storage nodes other than the first storage node.
The first hash ring information may include a list of storage nodes corresponding to the first hash ring, so that other storage nodes in the first hash ring may be determined according to the first hash ring information, and then, a state of the other storage nodes may be determined, so as to determine whether the other storage nodes are currently online.
As an example, if there are other storage nodes online in the first hash ring, the description may determine the second storage node from the first hash ring, in which case, execution proceeds as follows 3022-3025. If no other storage node exists in the first hash ring online, indicating that the second storage node cannot be determined from the first hash ring, step 3026 may be performed as follows.
3022: if other storage nodes exist in the first hash ring online, determining the number of the storage nodes in the first hash ring according to the first hash ring information, performing hash operation according to the first hash parameter and the number of the storage nodes to obtain a hash value, and determining the storage node corresponding to the hash value from the first hash ring.
In an implementation, the first storage node may count the number of storage nodes included in the storage node list corresponding to the first hash ring, to obtain the number of storage nodes in the first hash ring. Then, a hash operation may be performed according to the first hash parameter and the number of storage nodes, for example, a hash operation may be performed by the above formula (1) to obtain a hash value, where the hash value represents a subscript position of a storage node in the first hash ring, as described above, so that a corresponding storage node may be determined from the first hash ring according to the hash value.
3023: if the storage node corresponding to the hash value is the first storage node and the next storage node of the first storage node in the first hash ring is online, determining the next storage node of the first storage node as the second storage node.
That is, if the storage node corresponding to the hash value is the first storage node, it is indicated that the first storage node is the primary storage node originally used for storing the first object data, and at this time, if the next storage node of the first storage node in the first hash ring is online, the next storage node of the first storage node may be determined to be the second storage node.
3024: if the storage node corresponding to the hash value is the last storage node of the first storage node, and the last storage node of the first storage node is online, determining the last storage node of the first storage node as the second storage node.
If the storage node corresponding to the hash value is the last storage node of the first storage node, the last storage node of the first storage node is the primary storage node originally used for storing the first object data, so that the first storage node can be inferred to be the backup storage node originally used for storing the first object data.
3025: if the storage node corresponding to the hash value is the last storage node of the first storage node and the last storage node of the first storage node is not online, if the next storage node of the first storage node is online, determining the next storage node of the first storage node as the second storage node.
That is, if the first storage node is a standby storage node originally used to store the first object data, a primary storage node originally used to store the first object data is determined, if the primary storage node is not online, it may be determined whether a next storage node of the first storage node is online, and if online, it may be determined that the next storage node of the first storage node is a second storage node.
It should be noted that if the next storage node of the first storage node is not online, it may be continuously determined whether the next storage node of the first storage node is online, and if the next storage node of the first storage node is online, the next storage node of the first storage node is determined as the second storage node. If the next storage node of the first storage node is not online, the querying in this way is continued until the online storage node is queried from the first hash ring, and the queried online storage node is determined to be the second storage node.
As an example, if the storage node corresponding to the hash value is not the first storage node and is not the last storage node of the first storage node, if the storage node corresponding to the hash value is online, determining the storage node corresponding to the hash value as the second storage node.
That is, if the first storage node is not a primary storage node originally used to store the first object data, nor is it a backup storage node originally used to store the first object data, it may be determined whether the primary storage node originally used to store the first object data is online, and if so, the online primary storage node is determined to be the second storage node. If the primary storage node is not online, it may be determined from the first hash ring whether a next storage node of the storage node corresponding to the hash value is online, if it is determined that the next storage node of the storage node corresponding to the hash value is online, then the next storage node of the storage node corresponding to the hash value is determined to be a second storage node, if it is determined that the next storage node of the storage node corresponding to the hash value is not online, then querying is continued as to whether the next storage node of the storage node corresponding to the hash value is online, and so on, in this manner, until the online storage node is queried, then the determined online storage node is determined to be the second storage node.
3026: if no other storage nodes exist in the first hash ring, the latest hash ring information is acquired, and the second storage node is determined from the hash ring corresponding to the latest hash ring information based on the latest hash ring information and the first hash parameter.
It will be understood that if no other storage node exists in the first hash ring, it is indicated that the second storage node for backing up the first object data cannot be determined from the first hash ring, in which case the latest hash ring information may be obtained, and then the second storage node for backing up the first object data is determined from the hash ring corresponding to the latest hash ring information based on the latest hash ring information and the first hash parameter.
The specific implementation of determining the second storage node from the hash ring corresponding to the latest hash ring information based on the latest hash ring information and the first hash parameter may refer to determining the second storage node from the first hash ring based on the first hash ring information and the first hash parameter.
Step 303: and backing up the first object data to the second storage node.
After the first storage node determines the second storage node, the first object data is sent to the second storage node and stored by the second storage node, so that the first object data is backed up in the second storage node.
For example, as shown in fig. 5, in one possible implementation, the asynchronous backup task is generated when the storage node B is offline, in which case, according to the above implementation, the storage node C may be determined from the first hash ring as the second storage node, and then the first object data may be backed up into the storage node C.
In addition, it should be noted that, after a certain storage node in the cloud storage system goes offline, the management module may generate a new hash ring, where the new hash ring may exclude the offline storage node, and subsequent reading and writing may use the new hash ring to locate the storage node, so as to ensure reliability of the system. The new hash ring has a certain influence on the reading of the stored object data, for example, the new hash ring may not be used for successfully locating the storage node where the object data is located, so the system can maintain the hash rings of all versions, and if the client side has no object data through the storage node located by the hash ring of the latest version, the system can perform degradation reading.
As an example, the first storage node receives a read request, where the read request carries index information and the first hash ring information, returns the first object data if there is first object data corresponding to the index information locally, and reads the first object data according to the first hash ring information if there is no first object data corresponding to the index information locally.
That is, after the first storage node receives the read request of the first object data, it may query whether the first object data exists locally based on the index information of the first object data, and if the first object data exists locally, it may directly feed back the first object data to the client. Of course, if the index information does not exist locally, the first object data may be further read according to the first hash ring information.
As an example, the read request carries a first hash parameter, where the first hash ring information further includes version information of the first hash ring, and in this case, reading the first object data according to the first hash ring information may include: and determining the next storage node of the first storage node in the first hash ring according to the first hash ring information. If the first object data is not read from the next storage node of the first storage node, determining all hash rings with versions lower than the version of the first hash ring according to the version information of the first hash ring. Selecting hash rings from all the hash rings for a plurality of times according to the version sequence from high to low, each time selecting one hash ring, determining a storage node from the currently selected hash ring according to the currently selected hash ring and the first hash parameter, and reading the first object data from the determined storage node; until the first object data is read.
That is, the first storage node may determine, according to the first hash ring information, a next storage node of the first storage node in the first hash ring, where in a normal case, the next storage node of the first storage node is a standby storage node, so that the first storage node may read the first object data from the next storage node of the first storage node, for example, may send a read request to the next storage node of the first storage node, if the next storage node of the first storage node receives the read request, may query whether the first object data exists locally, and if so, send the first object data to the first storage node, where the first storage node receives the first object data and feeds back to the client.
Further, if the first object data does not exist in the next storage node of the first storage node, the next storage node of the first storage node may feed back a read failure message to the first storage node. After receiving the read failure message, the first storage node may select a hash ring that is one version lower than the first hash ring version according to the version information of the first hash ring, and then read the first object data from the selected hash ring according to the above manner, and if the first object data is read, return the first object data to the client.
If the first object data is not read, continuing to select a hash ring of two versions lower than the first hash ring version, then continuing to read the first object data from the selected hash ring in the manner described above, if the first object data is read, returning the first object data to the client, if the first object data is not read, continuing to select a hash ring of the next version in the manner, and reading the first object data until the first object data is read. Of course, if all versions of the hash ring have been traversed without reading the first object data, it is indicated that the first object data has failed to be read, in which case the first storage node returns a read failure message to the client.
In this embodiment of the present application, a first storage node reads an asynchronous backup task in an asynchronous backup task table, where the asynchronous backup task includes a first hash parameter and first hash ring information, the asynchronous backup task refers to a task of backing up first object data in the first storage node, and the first hash ring indicated by the first hash ring information includes a plurality of storage nodes in the cloud storage system. And determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data, and backing up the first object data into the second storage node. In the application, the second storage node for backup can be dynamically determined, and the situation that certain object data can only be stored for one time can be avoided, so that the storage stability is ensured.
Fig. 6 is a schematic structural diagram of a backup apparatus for object data according to an embodiment of the present application, where the backup apparatus for object data may be implemented as part or all of the first storage node by software, hardware, or a combination of both. Referring to fig. 6, the apparatus includes:
a reading module 610, configured to read an asynchronous backup task in an asynchronous backup task table, where the asynchronous backup task includes a first hash parameter and first hash ring information, the asynchronous backup task is a task of backing up first object data in the first storage node, and the first hash ring indicated by the first hash ring information includes a plurality of storage nodes in the cloud storage system;
a determining module 620, configured to determine a second storage node according to the first hash parameter and the first hash ring information, where the second storage node is a storage node used for backing up the first object data;
and a backup module 630, configured to backup the first object data to the second storage node.
In one possible implementation manner of the present application, the determining module 620 is configured to:
determining whether other storage nodes exist in the first hash ring on the basis of the first hash ring information, wherein the other storage nodes refer to storage nodes except the first storage node;
If other storage nodes exist in the first hash ring on line, determining the number of the storage nodes in the first hash ring according to the first hash ring information;
performing hash operation according to the first hash parameter and the number of the storage nodes to obtain a hash value;
determining a storage node corresponding to the hash value from the first hash ring;
and if the storage node corresponding to the hash value is the first storage node and the next storage node of the first storage node in the first hash ring is online, determining the next storage node of the first storage node as the second storage node.
In one possible implementation manner of the present application, the determining module 620 is configured to:
if the storage node corresponding to the hash value is the last storage node of the first storage node, and the last storage node of the first storage node is online, determining the last storage node of the first storage node as the second storage node; or,
and if the storage node corresponding to the hash value is the last storage node of the first storage node and the last storage node of the first storage node is not online, determining the next storage node of the first storage node as the second storage node if the next storage node of the first storage node is online.
In one possible implementation manner of the present application, the determining module 620 is configured to:
if the storage node corresponding to the hash value is not the first storage node and is not the last storage node of the first storage node, determining the storage node corresponding to the hash value as the second storage node if the storage node corresponding to the hash value is online.
In one possible implementation manner of the present application, the determining module 620 is configured to:
if no other storage nodes exist in the first hash ring, acquiring the latest hash ring information;
and determining the second storage node from the hash ring corresponding to the latest hash ring information based on the latest hash ring information and the first hash parameter.
In one possible implementation manner of the present application, the determining module 620 is configured to:
receiving a write request of the first object data, wherein the write request carries the first hash parameter and the first hash ring information;
determining a primary storage node based on the first hash parameter and the first hash ring information;
storing the first object data to the primary storage node;
Determining a next storage node of the main storage node from the first hash ring under the condition that the first object data is successfully stored in the main storage node;
and if the next storage node of the main storage node is not online, recording the asynchronous backup task in the asynchronous backup task table.
In one possible implementation manner of the present application, the determining module 620 is configured to:
if the next storage node of the main storage node is online, writing the first object data into the next storage node of the main storage node;
and recording the asynchronous backup task in the asynchronous backup task table under the condition that the writing of the first object data to the next storage node of the main storage node fails.
In one possible implementation manner of the present application, the determining module 620 is configured to:
reading a copy replenishment task, wherein the copy replenishment task is generated under the condition that the offline event of a storage node exists, and the copy replenishment task comprises node information of the offline storage node and an offline time point;
inspecting index information in a local object index information table;
if the offline storage node is determined to be a storage node for storing second object data corresponding to target index information according to the node information, the offline time point and index information in the object index information table, the asynchronous backup task is recorded in the asynchronous backup task table based on the target index information, wherein the target index information is the index information in the object index information table.
In one possible implementation manner of the present application, the determining module 620 is configured to:
if the index information of which the corresponding storage time point is positioned before the offline time point exists in the object index information table, determining the index information of which the corresponding storage time point is positioned before the offline time point as the target index information;
and if the offline storage node is the last storage node of the first storage node or the offline storage node is the next storage node of the first storage node in the second hash ring corresponding to the target index information according to the node information and the hash ring information corresponding to the target index information, determining the offline storage node as a storage node for storing second object data corresponding to the target index information.
In one possible implementation manner of the present application, the reading module 610 is configured to:
receiving a read request, wherein the read request carries index information and the first hash ring information;
if the first object data corresponding to the index information exists locally, returning the first object data;
and if the first object data corresponding to the index information does not exist locally, reading the first object data according to the first hash ring information.
In one possible implementation manner of the present application, the read request carries a first hash parameter, the first hash ring information further includes version information of the first hash ring, and the read module 610 is configured to:
determining a next storage node of the first storage node in the first hash ring according to the first hash ring information;
if the first object data is not read from the next storage node of the first storage node, determining all hash rings with versions lower than the version of the first hash ring according to the version information of the first hash ring;
selecting hash rings from all the hash rings for a plurality of times according to the order of versions from high to low;
each time a hash ring is selected, determining a storage node from the currently selected hash ring according to the currently selected hash ring and the first hash parameter, and reading the first object data from the determined storage node; until the first object data is read.
In this embodiment of the present application, a first storage node reads an asynchronous backup task in an asynchronous backup task table, where the asynchronous backup task includes a first hash parameter and first hash ring information, the asynchronous backup task refers to a task of backing up first object data in the first storage node, and the first hash ring indicated by the first hash ring information includes a plurality of storage nodes in the cloud storage system. And determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data, and backing up the first object data into the second storage node. In the application, the second storage node for backup can be dynamically determined, and the situation that certain object data can only be stored for one time can be avoided, so that the storage stability is ensured.
It should be noted that: in the backup device for object data provided in the above embodiment, only the division of the above functional modules is used for illustrating when the object data is backed up, in practical application, the above functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the backup device for the object data provided in the above embodiment and the backup method embodiment for the object data belong to the same concept, and the specific implementation process is detailed in the method embodiment, which is not repeated here.
Fig. 7 is a schematic structural diagram of a storage node according to an embodiment of the present application. The storage node 700 includes a Central Processing Unit (CPU) 701, a system memory 704 including a Random Access Memory (RAM) 702 and a Read Only Memory (ROM) 703, and a system bus 705 connecting the system memory 704 and the central processing unit 701. Storage node 700 also includes a basic input/output system (I/O system) 706, which facilitates the transfer of information between various devices within the computer, and a mass storage device 707 for storing an operating system 713, application programs 714, and other program modules 715.
The basic input/output system 706 includes a display 708 for displaying information and an input device 709, such as a mouse, keyboard, or the like, for a user to input information. Wherein both the display 708 and the input device 709 are coupled to the central processing unit 701 through an input output controller 710 coupled to the system bus 705. The basic input/output system 706 may also include an input/output controller 710 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, the input output controller 710 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 707 is connected to the central processing unit 701 through a mass storage controller (not shown) connected to the system bus 705. The mass storage device 707 and its associated computer-readable media provide non-volatile storage for the storage node 700. That is, the mass storage device 707 may include a computer readable medium (not shown) such as a hard disk or CD-ROM drive.
Computer readable media may include computer storage media and communication media without loss of generality. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will recognize that computer storage media are not limited to the ones described above. The system memory 704 and mass storage device 707 described above may be collectively referred to as memory.
According to various embodiments of the present application, storage node 700 may also operate by being connected to a remote computer on a network, such as the Internet. I.e., storage node 700, may be connected to network 712 through a network interface unit 711 coupled to system bus 705, or other types of networks or remote computer systems (not shown) may also be coupled using network interface unit 711.
The memory also includes one or more programs, one or more programs stored in the memory and configured to be executed by the CPU.
In some embodiments, there is also provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of the backup method of object data of the above embodiments. For example, the computer readable storage medium may be ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
It is noted that the computer readable storage medium mentioned in the present application may be a non-volatile storage medium, in other words, may be a non-transitory storage medium.
It should be understood that all or part of the steps to implement the above-described embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions may be stored in the computer-readable storage medium described above.
That is, in some embodiments, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps of the above-described method of backing up object data.
The above embodiments are provided for the purpose of not limiting the present application, but rather, any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application are intended to be included within the scope of the present application.

Claims (14)

1. A backup method of object data, applied to a first storage node, where the first storage node is any storage node in a cloud storage system, the method comprising:
reading an asynchronous backup task in an asynchronous backup task table, wherein the asynchronous backup task comprises a first hash parameter and first hash ring information, the asynchronous backup task is a task for backing up first object data in a first storage node, and the first hash ring indicated by the first hash ring information comprises a plurality of storage nodes in the cloud storage system;
determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data;
And backing up the first object data to the second storage node.
2. The method of claim 1, wherein the determining a second storage node based on the first hash parameter and the first hash ring information comprises:
determining whether other storage nodes exist in the first hash ring on the basis of the first hash ring information, wherein the other storage nodes refer to storage nodes except the first storage node;
if other storage nodes exist in the first hash ring on line, determining the number of the storage nodes in the first hash ring according to the first hash ring information;
performing hash operation according to the first hash parameter and the number of the storage nodes to obtain a hash value;
determining a storage node corresponding to the hash value from the first hash ring;
and if the storage node corresponding to the hash value is the first storage node and the next storage node of the first storage node in the first hash ring is online, determining the next storage node of the first storage node as the second storage node.
3. The method of claim 2, wherein after determining the storage node corresponding to the hash value from the first hash ring, further comprises:
If the storage node corresponding to the hash value is the last storage node of the first storage node, and the last storage node of the first storage node is online, determining the last storage node of the first storage node as the second storage node; or,
and if the storage node corresponding to the hash value is the last storage node of the first storage node and the last storage node of the first storage node is not online, determining the next storage node of the first storage node as the second storage node if the next storage node of the first storage node is online.
4. The method of claim 2, wherein after determining the storage node corresponding to the hash value from the first hash ring, further comprises:
if the storage node corresponding to the hash value is not the first storage node and is not the last storage node of the first storage node, determining the storage node corresponding to the hash value as the second storage node if the storage node corresponding to the hash value is online.
5. The method of claim 2, wherein after determining whether there are other storage nodes online in the first hash ring based on the first hash ring information, further comprising:
If no other storage nodes exist in the first hash ring, acquiring the latest hash ring information;
and determining the second storage node from the hash ring corresponding to the latest hash ring information based on the latest hash ring information and the first hash parameter.
6. The method of claim 1, wherein the method further comprises:
receiving a write request of the first object data, wherein the write request carries the first hash parameter and the first hash ring information;
determining a primary storage node based on the first hash parameter and the first hash ring information;
storing the first object data to the primary storage node;
determining a next storage node of the main storage node from the first hash ring under the condition that the first object data is successfully stored in the main storage node;
and if the next storage node of the main storage node is not online, recording the asynchronous backup task in the asynchronous backup task table.
7. The method of claim 6, wherein after determining the next storage node of the primary storage node from the first hash ring, further comprising:
If the next storage node of the main storage node is online, writing the first object data into the next storage node of the main storage node;
and recording the asynchronous backup task in the asynchronous backup task table under the condition that the writing of the first object data to the next storage node of the main storage node fails.
8. The method of claim 1, wherein the method further comprises:
reading a copy replenishment task, wherein the copy replenishment task is generated under the condition that the offline event of a storage node exists, and the copy replenishment task comprises node information of the offline storage node and an offline time point;
inspecting index information in a local object index information table;
if the offline storage node is determined to be a storage node for storing second object data corresponding to target index information according to the node information, the offline time point and index information in the object index information table, the asynchronous backup task is recorded in the asynchronous backup task table based on the target index information, wherein the target index information is the index information in the object index information table.
9. The method of claim 8, wherein the index information includes a storage time point of the corresponding object data, and corresponding hash-ring information, the method further comprising:
if the index information of which the corresponding storage time point is positioned before the offline time point exists in the object index information table, determining the index information of which the corresponding storage time point is positioned before the offline time point as the target index information;
and if the offline storage node is the last storage node of the first storage node or the offline storage node is the next storage node of the first storage node in the second hash ring corresponding to the target index information according to the node information and the hash ring information corresponding to the target index information, determining the offline storage node as a storage node for storing second object data corresponding to the target index information.
10. The method of claim 1, wherein the method further comprises:
receiving a read request, wherein the read request carries index information and the first hash ring information;
if the first object data corresponding to the index information exists locally, returning the first object data;
And if the first object data corresponding to the index information does not exist locally, reading the first object data according to the first hash ring information.
11. The method of claim 10, wherein the read request carries a first hash parameter, the first hash-ring information further includes version information of the first hash-ring, and the reading the first object data according to the first hash-ring information includes:
determining a next storage node of the first storage node in the first hash ring according to the first hash ring information;
if the first object data is not read from the next storage node of the first storage node, determining all hash rings with versions lower than the version of the first hash ring according to the version information of the first hash ring;
selecting hash rings from all the hash rings for a plurality of times according to the order of versions from high to low;
each time a hash ring is selected, determining a storage node from the currently selected hash ring according to the currently selected hash ring and the first hash parameter, and reading the first object data from the determined storage node; until the first object data is read.
12. A backup device for object data, configured on a first storage node, where the first storage node is any storage node in a cloud storage system, the device comprising:
the reading module is used for reading an asynchronous backup task in an asynchronous backup task table, wherein the asynchronous backup task comprises a first hash parameter and first hash ring information, the asynchronous backup task is a task for backing up first object data in the first storage node, and the first hash ring indicated by the first hash ring information comprises a plurality of storage nodes in the cloud storage system;
the determining module is used for determining a second storage node according to the first hash parameter and the first hash ring information, wherein the second storage node is used for backing up the first object data;
and the backup module is used for backing up the first object data to the second storage node.
13. A computer device comprising a processor, a communication interface, a memory and a communication bus, said processor, said communication interface and said memory performing communication with each other via said communication bus, said memory being adapted to store a computer program, said processor being adapted to execute the program stored on said memory to carry out the steps of the method according to any one of claims 1-11.
14. A computer-readable storage medium, characterized in that the storage medium has stored therein a computer program which, when executed by a processor, implements the steps of the method of any of claims 1-11.
CN202010349216.4A 2020-04-28 2020-04-28 Backup method, device, equipment and storage medium of object data Active CN111522883B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010349216.4A CN111522883B (en) 2020-04-28 2020-04-28 Backup method, device, equipment and storage medium of object data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010349216.4A CN111522883B (en) 2020-04-28 2020-04-28 Backup method, device, equipment and storage medium of object data

Publications (2)

Publication Number Publication Date
CN111522883A CN111522883A (en) 2020-08-11
CN111522883B true CN111522883B (en) 2023-04-28

Family

ID=71903572

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010349216.4A Active CN111522883B (en) 2020-04-28 2020-04-28 Backup method, device, equipment and storage medium of object data

Country Status (1)

Country Link
CN (1) CN111522883B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282243B (en) * 2021-06-09 2022-12-02 杭州海康威视系统技术有限公司 Method and device for storing object file

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106572153A (en) * 2016-10-21 2017-04-19 乐视控股(北京)有限公司 Data storage method and device of cluster
CN107707631A (en) * 2017-09-18 2018-02-16 北京潘达互娱科技有限公司 Data capture method and device
CN110096227A (en) * 2019-03-28 2019-08-06 北京奇艺世纪科技有限公司 Date storage method, data processing method, device, electronic equipment and computer-readable medium
CN110457263A (en) * 2019-08-13 2019-11-15 北京首都在线科技股份有限公司 A kind of date storage method and device
CN110968453A (en) * 2018-09-28 2020-04-07 杭州海康威视系统技术有限公司 Data storage method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8930320B2 (en) * 2011-09-30 2015-01-06 Accenture Global Services Limited Distributed computing backup and recovery system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106572153A (en) * 2016-10-21 2017-04-19 乐视控股(北京)有限公司 Data storage method and device of cluster
CN107707631A (en) * 2017-09-18 2018-02-16 北京潘达互娱科技有限公司 Data capture method and device
CN110968453A (en) * 2018-09-28 2020-04-07 杭州海康威视系统技术有限公司 Data storage method and device
CN110096227A (en) * 2019-03-28 2019-08-06 北京奇艺世纪科技有限公司 Date storage method, data processing method, device, electronic equipment and computer-readable medium
CN110457263A (en) * 2019-08-13 2019-11-15 北京首都在线科技股份有限公司 A kind of date storage method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
赵彩云.CSCloud云存储系统副本管理方法研究与实现.《中国优秀硕士学位论文全文数据库》.2019,全文. *

Also Published As

Publication number Publication date
CN111522883A (en) 2020-08-11

Similar Documents

Publication Publication Date Title
CN106776130B (en) Log recovery method, storage device and storage node
KR101602312B1 (en) Data sending method, data receiving method, and storage device
US9996421B2 (en) Data storage method, data storage apparatus, and storage device
EP2330519A1 (en) Distributed file system and data block consistency managing method thereof
US11093387B1 (en) Garbage collection based on transmission object models
CN102833281B (en) It is a kind of distributed from the implementation method counted up, apparatus and system
CN104077380A (en) Method and device for deleting duplicated data and system
US11429498B2 (en) System and methods of efficiently resyncing failed components without bitmap in an erasure-coded distributed object with log-structured disk layout
CN116917880A (en) Distributed database remote backup
CN111930716A (en) Database capacity expansion method, device and system
CN115756955A (en) Data backup and data recovery method and device and computer equipment
CN111522883B (en) Backup method, device, equipment and storage medium of object data
CN114721594A (en) Distributed storage method, device, equipment and machine readable storage medium
CN110121712B (en) Log management method, server and database system
WO2021082925A1 (en) Transaction processing method and apparatus
CN113986450A (en) Virtual machine backup method and device
CN117520278A (en) Multi-client high-precision directory quota control method for distributed file system
JP2019020816A (en) Method and system for recovering data in distributed computing system
CN116303789A (en) Parallel synchronization method and device for multi-fragment multi-copy database and readable medium
CN116049306A (en) Data synchronization method, device, electronic equipment and readable storage medium
CN107045426B (en) Multi-copy reading method and system
CN115470041A (en) Data disaster recovery management method and device
CN114880165A (en) Data recovery method and related device
JP2017208113A (en) Data storage method, data storage apparatus, and storage device
US11645333B1 (en) Garbage collection integrated with physical file verification

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant