Metadata management method and system based on block chain
By using a consistent hash ring in the blockchain to store metadata and verify the storage location of data, the problems of low efficiency of metadata query and large storage overhead in existing blockchain storage systems are solved, and efficient metadata management and data sharing in multi-cloud environments are realized.
Patent Information
- Application Number
- CN202411872067.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-18
AI Technical Summary
In existing blockchain storage systems, metadata query efficiency is low and storage overhead is high, especially when data sharing is performed in multi-cloud environments.
By using a consistent hash ring in the blockchain to store metadata and verify the storage location of the data, the client can directly query the target metadata or verify the storage location of the data, reducing the traversal of the entire blockchain and reducing query overhead. At the same time, by storing metadata and verification data by partitioning, the amount of data stored by each node is reduced and the storage overhead is reduced.
Improves the efficiency of metadata query, reduces query overhead and storage overhead, and is suitable for data sharing in multi-cloud environments.
Smart Images

Figure CN119807201A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer storage technology, and more specifically, to a metadata management method and system based on blockchain. Background Art
[0002] With the advent of the big data era, new technologies such as cloud computing, 5G, the Internet of Things, and artificial intelligence are booming, and the scale of storage is also getting larger and larger. Compared with traditional storage methods, cloud storage has become the mainstream solution for data storage due to its low storage cost (no need to purchase and maintain storage devices by yourself), convenient and fast use (pay on demand, pay as you go), and high data availability (relying on data fault tolerance technology and can be deployed remotely). Many companies choose a multi-cloud strategy for cloud storage architecture. How to integrate multiple clouds and realize efficient and reliable sharing of data in a multi-cloud environment has always been the core issue of multi-cloud data management.
[0003] Blockchain is used to solve the problem of trusted data sharing because of its immutability. Existing blockchain storage management systems usually store metadata on the blockchain to reduce data storage overhead. However, as the scale of cloud storage continues to increase, the magnitude of metadata has also become very large (for example, PB-level data usually generates TB-level metadata), and each node of the blockchain needs to store a complete copy of metadata, resulting in high storage overhead for the entire system. However, if metadata is not stored, metadata security cannot be guaranteed, which in turn affects data security.
[0004] In the current blockchain storage system, the blockchain ledger mainly records the metadata of the data stored in each cloud storage system, and the query efficiency of metadata determines the performance of the entire system. When it is necessary to query the data in the blockchain ledger, there are usually two query methods for the blockchain: direct query (Direct Query) and indirect query (Indirect Query). Direct query will first query the most recent block. If the most recent block does not contain the data currently needed to be found, it will continue to traverse the entire blockchain until the target data is found. For example, if you need to find the data blocks stored in the first few blocks of the blockchain, you need to traverse the entire blockchain from the last block of the current blockchain, and each backtracking query block needs to be verified, resulting in huge query overhead. The indirect query method uses a key-value database to store an additional copy of the ledger data, quickly search the ledger data through the key-value database, and then use the blockchain for verification. However, when the amount of stored data is too large, the magnitude of the metadata is also very large (for example, PB-level data usually generates TB-level metadata), and each node in the blockchain network will store a complete blockchain ledger. The direct use of the blockchain ledger to store system metadata has a large storage overhead, and the indirect query method will greatly increase the storage overhead. Summary of the invention
[0005] In view of the defects of the prior art, the purpose of this application is to provide a metadata management method and system based on blockchain, which aims to solve the problems of low query efficiency and high storage overhead in the existing blockchain query method.
[0006] To achieve the above objectives, in a first aspect, the present application provides a metadata management method based on blockchain, comprising:
[0007] Sending a first request to a consistent hash ring in the blockchain, where the consistent hash ring is used to store the target metadata to be queried or the storage location of the target verification data corresponding to the target metadata, and the first request carries the target metadata;
[0008] Receive target metadata or target verification data sent by blockchain;
[0009] Obtain target metadata according to target metadata or target verification data.
[0010] In some embodiments, the above method further comprises:
[0011] Sending a second request to the blockchain, where the second request is used to perform an integrity audit on the metadata stored in the server corresponding to each node;
[0012] Receive the root hash value of the Merkle tree in the server corresponding to each node sent by the blockchain, and the leaf node of the Merkle tree is used to store the hash value of the metadata or the verification data corresponding to the metadata;
[0013] According to the root hash value of the Merkle tree in the server corresponding to each node sent by the received blockchain, the integrity audit of the metadata stored in the server corresponding to each node is performed.
[0014] In a second aspect, the present application provides a metadata management method based on blockchain, comprising:
[0015] Receive a first request sent by a client to a consistent hash ring, where the consistent hash ring is used to store target metadata to be queried or a storage location of target verification data corresponding to the target metadata, and the first request carries the target metadata;
[0016] In response to the first request, the target metadata or the target verification data is sent to the client, so that the client can obtain the target metadata according to the target metadata or the target verification data.
[0017] In some embodiments, the above method further comprises:
[0018] receiving a second request sent by the client, where the second request is used to perform an integrity audit on metadata stored in the server corresponding to each node;
[0019] In response to the second request, the root hash value of the Merkle tree in the server corresponding to each node is sent to the client, so that the client can perform an integrity audit on the metadata stored in the server corresponding to each node based on the root hash value of the Merkle tree in the server corresponding to each node sent by the received blockchain. The leaf nodes of the Merkle tree are used to store the hash value of the metadata or the verification data corresponding to the metadata.
[0020] In some embodiments, in response to the first request, sending the target metadata or the target verification data to the client includes:
[0021] In response to the first request, determining a target stable node for storing target metadata from each stable node included in the storage location and determining a target unstable node for storing target verification data from each unstable node included in the storage location;
[0022] The target metadata in the target stable node and / or the target verification data in the target unstable node are sent to the client.
[0023] In some embodiments, the above method further comprises:
[0024] According to the failure frequency of the server corresponding to each node, each node is divided into a stable node and an unstable node. The stable node is used to store metadata, and the unstable node is used to store the verification data corresponding to the metadata.
[0025] In a third aspect, the present application provides a metadata management system based on blockchain, including:
[0026] A first sending module is used to send a first request to a consistent hash ring in the blockchain, where the consistent hash ring is used to store the target metadata to be queried or the storage location of the target verification data corresponding to the target metadata, and the first request carries the target metadata;
[0027] A first receiving module, used to receive target metadata or target verification data sent by the blockchain;
[0028] The data acquisition module is used to acquire target metadata according to target metadata or target verification data.
[0029] In a fourth aspect, the present application provides a metadata management system based on blockchain, comprising:
[0030] A second receiving module is used to receive a first request sent by a client to a consistent hash ring, where the consistent hash ring is used to store the target metadata to be queried or the storage location of the target verification data corresponding to the target metadata, and the first request carries the target metadata;
[0031] The second sending module is used to send the target metadata or the target verification data to the client in response to the first request, so that the client can obtain the target metadata according to the target metadata or the target verification data.
[0032] In a fifth aspect, the present application provides an electronic device comprising: at least one memory for storing programs; and at least one processor for executing the programs stored in the memory. When the programs stored in the memory are executed, the processor is used to execute the method described in any embodiments of the first aspect or the second aspect.
[0033] In a sixth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method described in any embodiment of the first aspect or the second aspect.
[0034] In a seventh aspect, the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the method described in any embodiments of the first aspect or the second aspect.
[0035] In general, the above technical solutions conceived by this application have the following beneficial effects compared with the prior art:
[0036] The application provides a metadata management method and system based on blockchain. The client sends a first request to the consistent hash ring in the blockchain for storing the target metadata and the storage location of the target verification data corresponding to the target metadata; the blockchain obtains the target metadata or target verification data according to the storage location of the target metadata to be queried and the corresponding target verification data carried in the first request sent by the client; the client receives the target metadata or target verification data sent by the blockchain, and obtains the target metadata to be queried according to the received target metadata or target verification data. Compared with the existing blockchain direct query method, there is no need to traverse the entire blockchain, which reduces the query overhead and improves the query efficiency. Compared with the existing blockchain indirect query method, the nodes in the blockchain do not need to store an additional complete account book data, which reduces the storage overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is one of the flowcharts of the metadata management method based on blockchain provided in the embodiment of the present application;
[0038] Figure 2 This is the second flow chart of the metadata management method based on blockchain provided in the embodiment of the present application;
[0039] Figure 3 It is a schematic diagram of an arity hash ring and a check hash ring provided in an embodiment of the present application;
[0040] Figure 4 This is the third flow chart of the metadata management method based on blockchain provided in the embodiment of the present application;
[0041] Figure 5 It is a schematic diagram comparing the metadata management method based on blockchain provided in the embodiment of the present application with the metadata storage method of the traditional blockchain method;
[0042] Figure 6 This is the fourth flow chart of the metadata management method based on blockchain provided in the embodiment of the present application;
[0043] Figure 7 This is one of the structural schematic diagrams of the metadata management device based on blockchain provided in the embodiment of the present application;
[0044] Figure 8 This is the second structural diagram of the metadata management device based on blockchain provided in the embodiment of the present application;
[0045] Fig. 9 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0047] The term "and / or" in this article is a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.
[0048] The terms "first", "second", etc. in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of objects. For example, a first request and a second request are used to distinguish different requests rather than to describe a specific order of requests.
[0049] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0050] In the description of the embodiments of the present application, unless otherwise specified, “plurality” means two or more than two.
[0051] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.
[0052] See also Figure 1 , an embodiment of the present application provides a metadata management method based on blockchain, including step 110, step 120 and step 130.
[0053] Step 110 sends a first request to the consistent hash ring in the blockchain, where the consistent hash ring is used to store the target metadata to be queried or the storage location of the target verification data corresponding to the target metadata, and the first request carries the target metadata;
[0054] Step 120 receives target metadata or target verification data sent by the blockchain;
[0055] Step 130 obtains target metadata according to the target metadata or target verification data.
[0056] It should be noted that the execution subject of the above method can be a client.
[0057] The blockchain-based metadata management method provided in the embodiment of the present application can be applied to a distributed cloud storage environment and can achieve efficient metadata storage and management.
[0058] In the embodiment of the present application, the blockchain is responsible for storing the root hash value of the Merkle tree in the consistent hash ring and the server of each node, protecting the metadata routing security through the tamper-proof property of the data stored in the blockchain, and ensuring the security of the metadata through metadata integrity verification.
[0059] The consistent hash ring includes a metadata hash ring and a check hash ring. The metadata hash ring is used to manage stable nodes, and the check hash ring is used to manage unstable nodes.
[0060] The stable node is used to store metadata, more specifically, to store metadata blocks corresponding to the metadata. The metadata blocks are obtained by the server corresponding to each node packaging the metadata stored therein into data blocks of fixed size.
[0061] The unstable node is used to store the verification data corresponding to the metadata, and more specifically, to store the verification data block corresponding to the metadata. The verification data block is generated by encoding the metadata block using an erasure code.
[0062] In the embodiment of the present application, the distributed storage of metadata is realized through two consistent hash rings (metadata hash ring and verification data ring respectively). Consistent hashing is used to manage metadata, and blockchain is used to store consistent hashing and Merkle tree root hash of metadata of each node to ensure metadata security. In order to solve the problem of frequent entry and exit of the system caused by unstable nodes in the system, a multi-hash ring redundancy strategy based on erasure code is used to organize system nodes. Through the idea of divide and conquer, the stable nodes and unstable nodes in the system are divided into two consistent hash rings for management, which realizes efficient storage and management of metadata, improves reliability and reduces the system's additional storage cost, greatly improving the performance and reliability of the system.
[0063] In the embodiment of the present application, each server in the decentralized metadata server cluster serves as a node of the blockchain. The decentralized metadata server cluster includes multiple servers, and the server can be used to store metadata or verification data corresponding to the metadata. Both metadata and verification data can be stored through a Merkle tree. Specifically, the leaf nodes of the Merkle tree are used to store the hash value of metadata or verification data corresponding to metadata, and the integrity of metadata is quickly audited through the root hash value. Data exchange and collaboration are performed between decentralized metadata server clusters through a secure communication protocol.
[0064] In the embodiment of the present application, the metadata and the verification data corresponding to the metadata are mapped to the corresponding nodes in the consistent hash ring in the blockchain through the consistent hash algorithm module for storage. According to the location of the hash value of the metadata or verification data mapped to the consistent hash ring, the node location where the metadata or verification data is stored is determined.
[0065] The consistent hash algorithm module is used to map metadata and verification data to corresponding nodes of the consistent hash ring for storage.
[0066] Specifically, the metadata is integrated into a fixed-size data block (i.e., metadata block) through the encoding and decoding module, and the metadata block is encoded to generate a check data block through the erasure code. The metadata block and the check data block are mapped to the metadata hash ring and the check hash ring respectively through the consistent hash algorithm module.
[0067] The client sends a first request to the consistent hash ring in the blockchain, and the first request carries the target metadata to be queried.
[0068] After receiving the first request, the consistent hash ring in the blockchain locates the node position (i.e., storage location) of the target metadata or the target verification data storage corresponding to the target metadata.
[0069] The node in the metadata hash ring in the blockchain used to store the above-mentioned target metadata and the node in the verification hash ring used to store the above-mentioned target verification data synchronously send the target metadata and the target verification data to the client.
[0070] Since each node of the metadata hash ring stores the data block corresponding to the metadata, i.e., the metadata block, and each node of the verification hash ring stores the data block corresponding to the verification data, i.e., the verification data block, the above-mentioned target metadata and target verification data are also sent to the client in the form of corresponding data blocks.
[0071] If the client receives the data block corresponding to the target metadata first, the target metadata can be obtained according to the data block.
[0072] If the client receives the data block corresponding to the target verification data first, it needs to decode the data block to obtain the target metadata corresponding to the data block.
[0073] When a node fails and goes offline, the data of the offline node can be restored to other nodes for storage;
[0074] When a node fails and goes offline, the metadata can be read through the metadata blocks or check data blocks stored on other nodes;
[0075] When a stable node goes offline, the information of the offline stable node is recorded, and the node recovery metadata is retrieved from the verification hash ring;
[0076] When an unstable node goes offline, the unstable node information is recorded, and the node is retrieved from the metadata hash ring to restore the metadata.
[0077] The metadata management method based on blockchain provided by the embodiment of the present application is that the client sends a first request to the consistent hash ring in the blockchain for storing the target metadata and the storage location of the target verification data corresponding to the target metadata; the blockchain obtains the target metadata or target verification data according to the storage location of the target metadata to be queried and the corresponding target verification data carried in the first request sent by the client; the client receives the target metadata or target verification data sent by the blockchain, and obtains the target metadata to be queried according to the received target metadata or target verification data. Compared with the existing blockchain direct query method, there is no need to traverse the entire blockchain, which reduces the query overhead and improves the query efficiency. Compared with the existing blockchain indirect query method, the nodes in the blockchain do not need to store an additional complete account book data, which reduces the storage overhead.
[0078] Furthermore, in some embodiments, the above method further includes:
[0079] Sending a second request to the blockchain, where the second request is used to perform an integrity audit on the metadata stored in the server corresponding to each node;
[0080] Receive the root hash value of the Merkle tree in the server corresponding to each node sent by the blockchain, and the leaf node of the Merkle tree is used to store the hash value of the metadata or the verification data corresponding to the metadata;
[0081] According to the root hash value of the Merkle tree in the server corresponding to each node sent by the received blockchain, the integrity audit of the metadata stored in the server corresponding to each node is performed.
[0082] In the embodiment of the present application, each node needs to audit whether the metadata stored in the node has been tampered with through the smart contract of the blockchain after a period of time; during the audit, a quick audit is performed through the root hash value of the Merkle tree of each node stored in the blockchain, which is specifically implemented as follows:
[0083] The client sends a second request to the blockchain, which can be used to perform an integrity audit on the metadata stored in the server corresponding to each node.
[0084] The integrity audit of the metadata stored in the server can be implemented through the root hash value of the Merkle tree of the hash value of the metadata stored in the blockchain, or through the root hash value of the Merkle tree of the hash value of the verification data corresponding to the metadata stored in the blockchain.
[0085] The client receives the root hash value of the Merkle tree storing the hash value of the metadata sent by the blockchain (hereinafter referred to as the first root hash value) or the root hash value of the Merkle tree storing the hash value of the verification data corresponding to the metadata (hereinafter referred to as the second root hash value). The client compares the received first root hash value with the root hash value of the Merkle tree storing the hash value of the metadata in the server. If they are consistent, the metadata passes the integrity audit. Otherwise, the metadata fails the integrity audit.
[0086] The client compares the received second root hash value with the root hash value of the Merkle tree of hash values used to store verification data in the server. If they are consistent, the metadata passes the integrity audit; otherwise, the metadata fails the integrity audit.
[0087] Please see further Figure 2 , the method may include:
[0088] The client organizes metadata into metadata blocks of fixed size, and encodes the metadata blocks into corresponding check blocks and metadata blocks to form stripes through erasure coding.
[0089] The metadata block and the check block are mapped to different consistent hash rings, and different consistent hash rings include different storage nodes (such as Figure 3 The stable node set shown (including stable nodes N1, N2 and N3) and the unstable node set (including unstable nodes N4, N5 and N6)).
[0090] The client queries the consistent hash ring stored in the blockchain to obtain the storage location of the target metadata to be queried or the target verification data corresponding to the target metadata, and sends a first request to the node corresponding to the storage location in the consistent hash ring.
[0091] Receive the target metadata or target verification data sent by the blockchain. The client sends a first request to the metadata hash ring and the verification hash ring at the same time. After receiving the first request, the nodes of the metadata hash ring and the verification hash ring return the target metadata or target verification data at the same time.
[0092] Please see further Figure 4 , the method further comprises:
[0093] Nodes in the blockchain maintain the Merkle tree of their own metadata and regularly update the Merkle tree to the blockchain for metadata integrity auditing.
[0094] When a node fails, the failed node information is recorded and data stored in the failed node (such as metadata or verification data) is recovered and migrated.
[0095] Preferably, in this step, a node with a fast response speed is also selected from the metadata hash ring and the verification hash ring for data recovery, and the recovered data is mapped to a new node for storage.
[0096] Update the consistent hash ring information and store the new consistent hash ring on the blockchain.
[0097] Please see further Figure 5 , which is a comparative diagram of the metadata management method based on blockchain provided in the embodiment of the present application and the traditional blockchain method for storing metadata. The traditional blockchain method stores all metadata on the blockchain, and the query overhead is large. For example, when metadata block A needs to be queried, the system needs to backtrack the entire blockchain for query, and the backtracking process takes a long time. At the same time, since all nodes in the blockchain must store a complete blockchain, the storage overhead is large. However, the present application only stores the root hash value of the consistent hash ring and the Merkle tree on the blockchain. When querying metadata, only the consistent hash in the last block of the blockchain in the figure is queried, thereby reducing the query overhead.
[0098] The blockchain-based metadata management method provided in the embodiment of the present application uses the root hash value of the Merkle tree of metadata or verification data stored in the server corresponding to each node to send a second request to the blockchain for performing an integrity audit on the metadata stored in the server, and performs an integrity audit on the metadata, thereby ensuring the security of the metadata, and is suitable for a decentralized storage environment.
[0099] See also Figure 6 , an embodiment of the present application provides a metadata management method based on blockchain, including: step 210 and step 220.
[0100] Step 210 receives a first request sent by a client to a consistent hash ring, where the consistent hash ring is used to store the target metadata to be queried or the storage location of the target verification data corresponding to the target metadata, and the first request carries the target metadata;
[0101] In step 220 , in response to the first request, the target metadata or the target verification data is sent to the client, so that the client can obtain the target metadata according to the target metadata or the target verification data.
[0102] It should be noted that the executor of the above method is blockchain.
[0103] In an embodiment of the present application, a blockchain client sends a first request to a consistent hash ring, and the first request carries target metadata to be queried.
[0104] After receiving the first request, the consistent hash ring in the blockchain responds to the first request and locates the node position (i.e., storage location) of the target metadata or the target verification data storage corresponding to the target metadata.
[0105] The node in the metadata hash ring in the blockchain used to store the above-mentioned target metadata and the node in the verification hash ring used to store the above-mentioned target verification data synchronously send the target metadata and the target verification data to the client.
[0106] Since each node of the metadata hash ring stores a data block corresponding to the metadata, i.e., the metadata block, and each node of the verification hash ring stores a data block corresponding to the verification data, i.e., the verification data block, the above-mentioned target metadata and target verification data are also sent to the client in the form of corresponding data blocks, so that the client can obtain the target metadata based on the received data block corresponding to the target metadata or the data block corresponding to the target verification data.
[0107] If the client receives the data block corresponding to the target metadata first, the target metadata can be obtained according to the data block.
[0108] If the client receives the data block corresponding to the target verification data first, it needs to decode the data block to obtain the target metadata corresponding to the data block.
[0109] The metadata management method based on blockchain provided by the embodiment of the present application, the blockchain receives a first request for a consistent hash ring sent by a client for storing target metadata and the storage location of target verification data corresponding to the target metadata; and obtains the target metadata or target verification data according to the storage location of the target metadata to be queried and its corresponding target verification data carried in the first request; and sends the target metadata or target verification data to the client, so that the client can obtain the target metadata to be queried according to the received target metadata or target verification data. Compared with the existing blockchain direct query method, there is no need to traverse the entire blockchain, which reduces the query overhead and improves the query efficiency. Compared with the existing blockchain indirect query method, the nodes in the blockchain do not need to store an additional complete account book data, which reduces the storage overhead.
[0110] Furthermore, in some embodiments, the above method further includes:
[0111] receiving a second request sent by the client, where the second request is used to perform an integrity audit on metadata stored in the server corresponding to each node;
[0112] In response to the second request, the root hash value of the Merkle tree in the server corresponding to each node is sent to the client, so that the client can perform an integrity audit on the metadata stored in the server corresponding to each node based on the root hash value of the Merkle tree in the server corresponding to each node sent by the received blockchain. The leaf nodes of the Merkle tree are used to store the hash value of the metadata or the verification data corresponding to the metadata.
[0113] In the embodiment of the present application, each node needs to audit whether the metadata stored in the node has been tampered with through the smart contract of the blockchain after a period of time; during the audit, a quick audit is performed through the root hash value of the Merkle tree of each node stored in the blockchain, which is specifically implemented as follows:
[0114] A second request sent by the client is received, where the second request can be used to perform an integrity audit on metadata stored in a server corresponding to each node.
[0115] The integrity audit of the metadata stored in the server can be implemented through the root hash value of the Merkle tree of the hash value of the metadata stored in the blockchain, or through the root hash value of the Merkle tree of the hash value of the verification data corresponding to the metadata stored in the blockchain.
[0116] In response to the second request, the blockchain sends the root hash value of the Merkle tree storing the hash value of the metadata (hereinafter referred to as the first root hash value) or the root hash value of the Merkle tree storing the hash value of the verification data corresponding to the metadata (hereinafter referred to as the second root hash value) to the client, so that the client compares the received first root hash value with the root hash value of the Merkle tree used to store the hash value of the metadata in the server, and when it is judged that they are consistent, it is determined that the metadata has passed the integrity audit; when it is judged that they are inconsistent, it is determined that the metadata has not passed the integrity audit.
[0117] Alternatively, the client compares the received second root hash value with the root hash value of the Merkle tree of hash values used to store verification data in the server, and when they are judged to be consistent, determines that the metadata has passed the integrity audit; when they are judged to be inconsistent, determines that the metadata has not passed the integrity audit.
[0118] The blockchain-based metadata management method provided in the embodiment of the present application utilizes the root hash value of the Merkle tree of metadata or verification data stored in the server corresponding to each node, receives a second request sent by the client for performing an integrity audit on the metadata stored in the server, and performs an integrity audit on the metadata, thereby ensuring the security of the metadata, and is suitable for a decentralized storage environment.
[0119] Further, in some embodiments, in response to the first request, sending the target metadata or target verification data to the client includes:
[0120] In response to the first request, determining a target stable node for storing target metadata from each stable node included in the storage location and determining a target unstable node for storing target verification data from each unstable node included in the storage location;
[0121] The target metadata in the target stable node and / or the target verification data in the target unstable node are sent to the client.
[0122] In the embodiment of the present application, in response to the first request sent by the client, the blockchain finds a stable node for storing the target metadata to be queried from each stable node storing the metadata, and the stable node is the target stable node. From each unstable node storing the verification data corresponding to the metadata, an unstable node for storing the target verification data corresponding to the target metadata to be queried is found, and the unstable node is the target unstable node.
[0123] After the blockchain locates the node where the target metadata or target verification data is located, the target metadata in the target stable node and / or the target verification data in the target unstable node can be sent to the client.
[0124] Furthermore, in some embodiments, the above method further includes:
[0125] According to the failure frequency of the server corresponding to each node, each node is divided into a stable node and an unstable node. The stable node is used to store metadata, and the unstable node is used to store the verification data corresponding to the metadata.
[0126] Please continue to see Figure 3 , the original node set (i.e., the set of nodes corresponding to each server) is divided into a stable node set and an unstable node set, and the stable node set (i.e., the set consisting of stable nodes N1, N2, and N3) and the unstable node set (the set consisting of unstable nodes N4, N5, and N6) are organized respectively through two consistent hash rings. The stable node set is organized into a metadata hash ring for storing metadata blocks, and the unstable node set is organized into a verification hash ring for storing verification data blocks.
[0127] Specifically, the original node set is divided into a stable node set and an unstable node set using the following method for determining stable nodes and unstable nodes based on Poisson distribution. The failure frequency of the server corresponding to each node is recorded, and the stability of the node is rated according to Poisson distribution to divide the stable nodes and unstable nodes.
[0128] For example, assume that the number of server failures corresponding to each node is recorded through blockchain (annual failure frequency, the server cluster failed an average of 2.4 times per year between 2010 and 2019), the average annual failure frequency of the node is calculated, and then the stability of the node is rated according to the Poisson distribution. The corresponding Poisson distribution formula is as follows:
[0129]
[0130] Where X is a discrete random variable, here is a node, λ is the variance, here is the average annual failure frequency, and P(X=k) is the probability that node X fails k times within 1 year.
[0131] Assuming that 1 year is divided into n parts, the probability of a node failure in 1n years approaches 0, so the Poisson distribution can be used. Here, λ is equal to the average annual failure frequency. Substituting it into the above formula, we can get the probability distribution of the number of failures of the corresponding node in 1 year, and then evaluate the stability of the node by the probability of k failures. For example, P(X=2)≤0.5 means that node X is a stable node, otherwise node X is an unstable node.
[0132] In the embodiment of the present application, the stable node is used to store metadata, and the unstable node is used to store verification data corresponding to the metadata.
[0133] The following is a description of the blockchain-based metadata management system provided by the present application. The blockchain-based metadata management system described below and the blockchain-based metadata management method described above can refer to each other.
[0134] See also Figure 7 , an embodiment of the present application provides a metadata management system based on blockchain, including: a first sending module 710, a first receiving module 720 and a data acquisition module 730.
[0135] A first sending module 710 is used to send a first request to a consistent hash ring in the blockchain, where the consistent hash ring is used to store the target metadata to be queried or the storage location of the target verification data corresponding to the target metadata, and the first request carries the target metadata;
[0136] A first receiving module 720, configured to receive target metadata or target verification data sent by the blockchain;
[0137] The data acquisition module 730 is used to acquire target metadata according to the target metadata or target verification data.
[0138] The metadata management system based on blockchain provided by the embodiment of the present application is that the client sends a first request to the consistent hash ring in the blockchain for storing the target metadata and the storage location of the target verification data corresponding to the target metadata; the blockchain obtains the target metadata or target verification data according to the storage location of the target metadata to be queried and the target verification data corresponding to the target metadata carried in the first request sent by the client; the client receives the target metadata or target verification data sent by the blockchain, and obtains the target metadata to be queried according to the received target metadata or target verification data. Compared with the existing blockchain direct query method, there is no need to traverse the entire blockchain, which reduces the query overhead and improves the query efficiency. Compared with the existing blockchain indirect query method, the nodes in the blockchain do not need to store an additional complete account book data, which reduces the storage overhead.
[0139] See also Figure 8 , an embodiment of the present application provides a metadata management system based on blockchain, including: a second receiving module 810 and a second sending module 820.
[0140] The second receiving module 810 is used to receive a first request sent by a client to a consistent hash ring, where the consistent hash ring is used to store the target metadata to be queried or the storage location of the target verification data corresponding to the target metadata, and the first request carries the target metadata;
[0141] The second sending module 820 is used to send the target metadata or the target verification data to the client in response to the first request, so that the client can obtain the target metadata according to the target metadata or the target verification data.
[0142] The blockchain-based metadata management system provided in the embodiment of the present application utilizes the root hash value of the Merkle tree of metadata or verification data stored in the server corresponding to each node, receives a second request sent by the client for performing an integrity audit on the metadata stored in the server, performs an integrity audit on the metadata, thereby ensuring the security of the metadata, and is suitable for a decentralized storage environment.
[0143] It can be understood that the detailed functional implementation of each of the above-mentioned units / modules can be found in the introduction of the aforementioned method embodiment, and will not be repeated here.
[0144] It should be understood that the above-mentioned device is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method, which will not be repeated here.
[0145] Based on the method in the above embodiment, the embodiment of the present application provides an electronic device, which may include: a processor (Processor) 910, a communication interface (CommunicationsInterface) 920, a memory (Memory) 930 and a communication bus 940, wherein the processor 910, the communication interface 920, and the memory 930 communicate with each other through the communication bus 940. The processor 910 can call the logic instructions in the memory 930 to execute the method in the above embodiment.
[0146] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0147] Based on the method in the above embodiment, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.
[0148] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the method in the above embodiment.
[0149] It is understandable that the processor in the embodiment of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0150] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0151] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can 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. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
[0152] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.
[0153] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A metadata management method based on blockchain, characterized in that: include: Sending a first request to a consistent hash ring in a blockchain, where the consistent hash ring is used to store the target metadata to be queried or a storage location of target verification data corresponding to the target metadata, and the first request carries the target metadata; Receiving the target metadata or the target verification data sent by the blockchain; The target metadata is acquired according to the target metadata or the target verification data.
2. The metadata management method based on blockchain according to claim 1, characterized in that: The method further comprises: Sending a second request to the blockchain, where the second request is used to perform an integrity audit on metadata stored in a server corresponding to each node; Receive the root hash value of the Merkle tree in the server corresponding to each node sent by the blockchain, where the leaf nodes of the Merkle tree are used to store the hash value of the metadata or the verification data corresponding to the metadata; According to the root hash value of the Merkle tree in the server corresponding to each node sent by the blockchain, an integrity audit is performed on the metadata stored in the server corresponding to each node.
3. A metadata management method based on blockchain, characterized in that: include: Receive a first request sent by a client to a consistent hash ring, where the consistent hash ring is used to store target metadata to be queried or a storage location of target verification data corresponding to the target metadata, where the first request carries the target metadata; In response to the first request, the target metadata or the target verification data is sent to the client, so that the client can obtain the target metadata according to the target metadata or the target verification data.
4. The metadata management method based on blockchain as claimed in claim 3, characterized in that: The method further comprises: receiving a second request sent by the client, where the second request is used to perform an integrity audit on metadata stored in a server corresponding to each node; In response to the second request, the root hash value of the Merkle tree in the server corresponding to each node is sent to the client, so that the client can perform an integrity audit on the metadata stored in the server corresponding to each node according to the root hash value of the Merkle tree in the server corresponding to each node sent by the blockchain. The leaf nodes of the Merkle tree are used to store the hash value of the metadata or the verification data corresponding to the metadata.
5. The metadata management method based on blockchain as claimed in claim 3, characterized in that: The sending the target metadata or the target verification data to the client in response to the first request includes: In response to the first request, determining a target stable node for storing the target metadata from each stable node included in the storage location and determining a target unstable node for storing the target verification data from each unstable node included in the storage location; The target metadata in the target stable node and / or the target verification data in the target unstable node are sent to the client.
6. The metadata management method based on blockchain as claimed in claim 4, characterized in that: The method further comprises: According to the failure frequency of the server corresponding to each node, each node is divided into a stable node and an unstable node. The stable node is used to store metadata, and the unstable node is used to store verification data corresponding to the metadata.
7. A metadata management system based on blockchain, characterized in that: include: A first sending module, configured to send a first request to a consistent hash ring in a blockchain, wherein the consistent hash ring is used to store a storage location of target metadata to be queried or target verification data corresponding to the target metadata, and the first request carries the target metadata; A first receiving module, configured to receive the target metadata or the target verification data sent by the blockchain; A data acquisition module is used to acquire the target metadata according to the target metadata or the target verification data.
8. A metadata management system based on blockchain, characterized in that: include: A second receiving module is used to receive a first request sent by a client to a consistent hash ring, where the consistent hash ring is used to store the target metadata to be queried or the storage location of the target verification data corresponding to the target metadata, and the first request carries the target metadata; The second sending module is used to send the target metadata or the target verification data to the client in response to the first request, so that the client can obtain the target metadata according to the target metadata or the target verification data.
9. An electronic device, characterized in that: include: at least one memory for storing a computer program; At least one processor is used to execute the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method as described in any one of claims 1-2 or 3-6.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program runs on a processor, the processor is caused to execute the method according to any one of claims 1-2 or 3-6.
Citation Information
Patent Citations
Block chain data verification method, device and system
CN111428277A
Data storage method and device based on block chain technology
CN114385746A
Information auditing method and device, electronic equipment and storage medium
CN115408718A
Data management method and data management system
CN118246068A
Cloud edge collaborative distributed storage method and device based on double-layer Raft consistency protocol
CN118606357A