CN114764405A - Transaction data consistency storage method of distributed application program - Google Patents
Transaction data consistency storage method of distributed application program Download PDFInfo
- Publication number
- CN114764405A CN114764405A CN202011615800.6A CN202011615800A CN114764405A CN 114764405 A CN114764405 A CN 114764405A CN 202011615800 A CN202011615800 A CN 202011615800A CN 114764405 A CN114764405 A CN 114764405A
- Authority
- CN
- China
- Prior art keywords
- key
- value
- transaction
- transaction data
- node
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 23
- 230000000977 initiatory effect Effects 0.000 claims abstract description 27
- 230000000694 effects Effects 0.000 abstract description 4
- 230000001360 synchronised effect Effects 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2255—Hash tables
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a transaction data consistency storage method of a distributed application program, which comprises a distributed consistency storage method of transaction data based on a p2p network kademlia protocol, and is characterized in that: the transaction initiating node can store a key value pair transaction data to a plurality of nodes meeting the condition that the logical exclusive or distance of the nodes is relatively nearest on the p2p network, so as to ensure that the storage nodes of the transaction data on the p2p network are effectively and symmetrically stored in a distributed manner, and thus, the consistent storage effect of multi-node distributed synchronous storage data is achieved.
Description
Technical Field
The invention relates to a distributed storage technology in a p2p network, in particular to a transaction data consistency storage method of a distributed application program.
Background
Distributed storage is an important component of the blockchain technology, and the consistency problem of distributed storage is related to the effect and performance of distributed storage. The transaction data consistency storage method of the distributed application program ensures that the storage nodes of the transaction data on the p2p network are effectively and symmetrically stored in a distributed manner, and achieves the consistency storage effect of synchronously storing the data by multiple nodes.
Disclosure of Invention
In order to make up for the defects of the prior art, the invention aims to design a synchronization technical solution of distributed transaction data storage, which is simple in method and convenient to implement, so as to solve the effectiveness of distributed consistent storage under the existing kademlia protocol.
The technical problem of the invention is solved by the following technical scheme.
A transaction data consistency storage method of a distributed application program comprises a transaction data consistency storage method based on a p2p network kademlia protocol, and is characterized in that: one node can store transaction data of a key, value and key value pair to a plurality of nodes which satisfy the logical exclusive or of the nodes with relatively nearest distance on a p2p network so as to ensure that the storage nodes of the transaction data on the p2p network can store the transaction data effectively and symmetrically in a distributed way, and the algorithm steps are as follows:
the first step is as follows: constructing a < key, value > key-value pair relationship of transactional data
Is provided with
A transaction initiating node A for generating a transaction data
Define < key, value > key-value pairs, order
The hash value of the transaction data is a primary key: key = hash (data)
The transaction data is the value: value = data
The second step is that: define key as resource ID (resource ID), let
resourceID = key
The third step: firstly, k local neighbor nodes (localClosedNodeID) with logical XOR distance nearest to the resource ID (resourceID) are found from the kademlia routing table of the transaction initiating node AiI =1 to k), having
localClosedNodeIDi = xor(nodeIDi,resourceID)
i ϵ [1~k]
According to the kademlia protocol, the transaction initiating node A uses the find node lookup command to the k local neighbor nodes (localClosedNodeID) of the p2p networkiI = 1-k) searching for resource id (resource id);
the fourth step: the k neighbor nodes receive the find of the transaction initiating node AAfter the node searches the command, respectively according to the kademlia routing table, according to the method of the third step, k neighbor nodes (closed node ID) with the nearest logical exclusive or distance to the resource ID (resource ID) are found again iI = 1-k), and replies to the transaction initiating node A;
the fifth step: the transaction initiating node A receives k nearest neighbor nodes sent by k local neighbor nodes in total, and n (closed NodeID) nodes are countedjJ =1 to n), having
closedNodeIDj j ϵ [1~n]
And a sixth step: the transaction initiating node A randomly selects 1 as a transaction service node (workServiceNode) from the n nearest neighbor nodes; at the same time will<key,value>Key-value pair transaction data and n nearest neighbor nodes (closed NodeID)jJ = 1-n) message is sent to a transaction service node (workServiceNode);
the seventh step: the transaction service node (workServiceNode) receives the transaction initiating node A<key,value>Key-value pair transaction data and n nearest neighbor nodes (closed NodeID)jJ =1 to n) message and is responsible for the message to be transmitted<key,value>Carrying out relevant service processing on the transaction data locally by the key value;
the eighth step: after the transaction service node (workServiceNode) completes the local related service processing, it will process the local related service<key,value>Sending the key-value pair transaction data to the n nearest neighbor nodes (closed NodeID)j,j = 1~n);
The ninth step: the n nearest neighbor nodes (closed NodeID)jJ =1 to n) respectively received from the transaction service node (workServiceNode)<key,value>Storing the key-value pair transaction data into a local database, and storing the key-value pair transaction data into the p2p network by using a store command of a kademlia protocol;
the technical problem of the present invention is solved by the following further technical solutions.
The neighbor node with the nearest XOR distance is the result of XOR operation between the node ID value and the resource ID (resource ID) value in the current kademlia protocol routing table, and counts the count value with the continuous bits being zero from the high bit, wherein the larger the number of the zero, the smaller the value.
The technical problem of the present invention is solved by the following further technical solutions.
The k values of the k nearest neighbor nodes typically take 3 or 5.
The method for storing the transaction data consistency of the distributed application program is characterized in that:
the invention is characterized in that a technical solution of distributed consistent storage with simple method and convenient realization is designed to solve the validity of distributed consistent storage under the existing kademlia protocol.
Compared with the prior art, the invention has the beneficial effects that:
the method for storing the transaction data consistency of the distributed application program ensures that the storage nodes of the transaction data on the p2p network can be effectively and symmetrically stored in a distributed manner, and achieves the effect of consistent storage when the multi-node synchronous storage data is accessed.
Drawings
FIG. 1 is a flow diagram of a transaction data consistent store for a distributed application;
FIG. 2 is a transaction data consistency storage timing diagram for a distributed application;
Detailed Description
The invention is described below with reference to the accompanying drawings in conjunction with the following embodiments.
The method for storing transaction data consistency of the distributed application program in the embodiment includes a method for storing transaction data consistency based on a p2p network kademlia protocol, and is characterized in that: one node can store transaction data of a key, value and key value pair to a plurality of nodes which satisfy the logical exclusive or of the nodes with relatively nearest distance on a p2p network so as to ensure that the storage nodes of the transaction data on the p2p network can store the transaction data effectively and symmetrically in a distributed way, and the algorithm steps are as follows:
the first step is as follows: constructing a < key, value > key-value pair relationship of transactional data
Is provided with
A transaction initiating node A for generating a transaction data
Define < key, value > key-value pairs, order
The hash value of the transaction data is a primary key: key = hash (data)
The transaction data is the value: value = data
The second step is that: define key as resource ID (resource ID), let
resourceID = key
The third step: firstly, k local neighbor nodes (localClosedNodeID) with logical XOR distance nearest to the resource ID (resourceID) are found from the kademlia routing table of the transaction initiating node AiI =1 to k), having
localClosedNodeIDi = xor(nodeIDi,resourceID)
i ϵ [1~k]
According to the kademlia protocol, the transaction initiating node A uses the find node lookup command to the k local neighbor nodes (localClosedNodeID) of the p2p networkiI = 1-k) finding a resource ID (resourceID);
the fourth step: after the k neighbor nodes receive the find node searching command of the transaction initiating node A, the k neighbor nodes find k neighbor nodes (closed node IDs) with the logic XOR nearest to the resource ID (resource ID) according to the kademlia routing table and the method of the third step again iI = 1-k), and replies to the transaction initiating node A;
the fifth step: the transaction initiating node A receives k nearest neighbor nodes sent by k local neighbor nodes in total, and n (closed NodeID)jJ =1 to n), there are
closedNodeIDj j ϵ [1~n]
And a sixth step: the transaction initiating node A randomly selects 1 as a transaction service node (workServiceNode) from the n nearest neighbor nodes; at the same time will<key,value>Key-value pair transaction data and n nearest neighbor nodes (closed NodeID)jJ = 1-n) message is sent to a transaction service node (workServiceNode);
the seventh step: transaction service node (w)orkServiceNode) receives the transaction initiating node a<key,value>Key-value pair transaction data and n nearest neighbor nodes (closed NodeID)jJ =1 to n) message and is responsible for the message to be transmitted<key,value>The key value carries out relevant service processing on the transaction data locally;
the eighth step: after the transaction service node (workServiceNode) completes the local related service processing, it will process the local related service<key,value>Sending the key-value pair transaction data to the n nearest neighbor nodes (closed NodeID)j,j = 1~n);
The ninth step: the n nearest neighbor nodes (closed NodeID)jJ =1 to n) respectively received from the transaction service node (workServiceNode)<key,value>After the key-value pair transaction data is stored in the local database, the key-value pair transaction data is stored on the p2p network by using a store command of the kademlia protocol.
The neighbor node with the nearest xor distance in the present embodiment is a result of performing xor operation on a node ID value and a resource ID (resourced ID) value in a current kademlia protocol routing table, and counts a count value with consecutive bits being zero from a high bit, where the larger the number of zeros, the smaller the value.
The k values of the k nearest neighbor nodes of this embodiment typically take 3 or 5.
The foregoing is a more detailed description of the invention in connection with specific preferred embodiments and it is not intended that the invention be limited to these specific details. For those skilled in the art to which the invention pertains, several equivalent substitutions or obvious changes may be made without departing from the spirit of the invention, and all changes that come within the meaning and range of equivalency of the claims are to be embraced within their scope.
Claims (3)
1. A transaction data consistency storage method of a distributed application program comprises a distributed consistency storage method of transaction data under a p2p network kademlia protocol, and is characterized in that: the transaction initiating node can store a key, value and transaction data to a plurality of nodes which satisfy the logical exclusive or of the nodes and are relatively nearest to each other on the p2p network, so as to ensure that the storage nodes of the transaction data on the p2p network can store the transaction data effectively and symmetrically in a distributed manner, and the algorithm steps are as follows:
the first step is as follows: constructing a < key, value > key-value pair relationship for transactional data
Is provided with
A transaction initiating node A for generating a transaction data
Define < key, value > key-value pairs, order
The hash value of the transaction data is a primary key: key = hash (data)
The transaction data is the value: value = data
The second step: define key as resource ID (resource ID), let
resourceID = key
The third step: firstly, k local neighbor nodes (localClosedNodeID) with logical XOR distance nearest to the resource ID (resourceID) are found from the kademlia routing table of the transaction initiating node AiI =1 to k), having
localClosedNodeIDi = xor(nodeIDi,resourceID)
i ϵ [1~k]
According to the kademlia protocol, the transaction initiating node A uses the find node lookup command to the k local neighbor nodes (localClosedNodeID) of the p2p networkiI = 1-k) searching for resource id (resource id);
the fourth step: after the k neighbor nodes receive the find node searching command of the transaction initiating node A, the k neighbor nodes find k neighbor nodes (closed node IDs) with the logic XOR nearest to the resource ID (resource ID) according to the kademlia routing table and the method of the third step again iI = 1-k), and replies to the transaction initiating node A;
the fifth step: the transaction initiating node A receives k nearest neighbor nodes sent by k local neighbor nodes in total, and n (closed NodeID)jJ =1 to n), having
closedNodeIDj j ϵ [1~n]
And a sixth step: transaction initiating node a slaveRandomly selecting 1 of the n nearest neighbor nodes as a transaction service node (workServiceNode); at the same time will<key,value>Key-value pair transaction data and n nearest neighbor nodes (closed NodeID)jJ = 1-n) message is sent to a transaction service node (workServiceNode);
the seventh step: the transaction service node (workServiceNode) receives the transaction initiating node A<key,value>Key-value pair transaction data and n nearest neighbor nodes (closed NodeID)jJ =1 to n) message and is responsible for the message to be transmitted<key,value>Carrying out relevant service processing on the transaction data locally by the key value;
eighth step: after the transaction service node (workServiceNode) completes the local relevant service processing, the transaction service node (workServiceNode) will execute the local relevant service processing<key,value>Sending the key-value pair transaction data to the n nearest neighbor nodes (closed NodeID)j,j = 1~n);
The ninth step: the n nearest neighbor nodes (closed NodeID)jJ =1 to n) respectively received from the transaction service node (workServiceNode)<key,value>Storing the key value pair transaction data in a local database, and storing the key value pair transaction data in a p2p network by using a store command of a kademlia protocol;
the first to ninth steps ensure the distributed and consistent storage requirement of the transaction data of the transaction initiating node A.
2. The method for the consistent storage of transaction data for distributed applications according to claim 1, wherein:
the neighbor node with the nearest XOR distance is the result of XOR operation between the node ID value and the resource ID (resource ID) value in the current kademlia protocol routing table, and counts the count value with the continuous bits being zero from the high bit, wherein the larger the number of the zero, the smaller the value.
3. The method for the consistent storage of transaction data for distributed applications according to claim 1, wherein:
the k values of the k nearest neighbor nodes typically take 3 or 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011615800.6A CN114764405B (en) | 2020-12-31 | 2020-12-31 | Transaction data consistency storage method of distributed application program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011615800.6A CN114764405B (en) | 2020-12-31 | 2020-12-31 | Transaction data consistency storage method of distributed application program |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114764405A true CN114764405A (en) | 2022-07-19 |
CN114764405B CN114764405B (en) | 2024-04-26 |
Family
ID=82362832
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011615800.6A Active CN114764405B (en) | 2020-12-31 | 2020-12-31 | Transaction data consistency storage method of distributed application program |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114764405B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160321294A1 (en) * | 2015-04-30 | 2016-11-03 | Vmware, Inc. | Distributed, Scalable Key-Value Store |
CN108596768A (en) * | 2018-05-09 | 2018-09-28 | 神州数码融信软件有限公司 | A kind of distributed transaction processing method, apparatus and system |
CN109857924A (en) * | 2019-02-28 | 2019-06-07 | 重庆科技学院 | A kind of big data analysis monitor information processing system and method |
CN110795506A (en) * | 2019-10-23 | 2020-02-14 | 广州巨杉软件开发有限公司 | Distributed database management method and device based on distributed logic timestamp |
-
2020
- 2020-12-31 CN CN202011615800.6A patent/CN114764405B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160321294A1 (en) * | 2015-04-30 | 2016-11-03 | Vmware, Inc. | Distributed, Scalable Key-Value Store |
CN108596768A (en) * | 2018-05-09 | 2018-09-28 | 神州数码融信软件有限公司 | A kind of distributed transaction processing method, apparatus and system |
CN109857924A (en) * | 2019-02-28 | 2019-06-07 | 重庆科技学院 | A kind of big data analysis monitor information processing system and method |
CN110795506A (en) * | 2019-10-23 | 2020-02-14 | 广州巨杉软件开发有限公司 | Distributed database management method and device based on distributed logic timestamp |
Non-Patent Citations (1)
Title |
---|
王康;李东静;陈海光;: "分布式存储系统中改进的一致性哈希算法", 计算机技术与发展, no. 07, 22 June 2016 (2016-06-22) * |
Also Published As
Publication number | Publication date |
---|---|
CN114764405B (en) | 2024-04-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11018980B2 (en) | Data-interoperability-oriented trusted processing method and system | |
US20210124734A1 (en) | Trusted storage method and system based on directed acyclic graph structure | |
JP5049344B2 (en) | Inter-region communication within a rendezvous federation | |
US20070233832A1 (en) | Method of distributed hash table node ID collision detection | |
CN101202746B (en) | Method for generating node identifier and method and device of load balancing | |
CN104734962B (en) | A kind of resource search method of non-structural P 2 P network | |
JP2009543447A5 (en) | ||
JP2009089369A (en) | Optimal operation of hierarchical peer-to-peer networks | |
WO2010127618A1 (en) | System and method for implementing streaming media content service | |
Gai et al. | Broose: a practical distributed hashtable based on the de-bruijn topology | |
WO2020207176A1 (en) | Adaptive frequency control method, apparatus and device, and computer-readable storage medium | |
CN112860799A (en) | Management method for data synchronization of distributed database | |
CN103401951B (en) | Based on the elastic cloud distribution method of peer-to-peer architecture | |
CN114764405A (en) | Transaction data consistency storage method of distributed application program | |
EP1926276A1 (en) | Load balancing in a peer-to-peer system | |
CN101605094B (en) | Ring model based on point-to-point network and routing algorithm thereof | |
CN113934933B (en) | Message forwarding method, device and storage medium with low delay | |
Amad et al. | Application layer multicast based services on hierarchical peer to peer architecture | |
CN112257285B (en) | Lightweight DDS automatic discovery method for large-scale distributed simulation | |
Banno et al. | An efficient routing method for range queries in skip graph | |
Hautakorpi et al. | A feasibility study of an arbitrary search in structured peer-to-peer networks | |
CN101521597B (en) | Data statistical approach and system of mixed P2P network | |
Li et al. | Domain‐based autoconfiguration framework for large‐scale MANETs | |
Wang et al. | A new strategy of resource searching in unstructured p2p network | |
Ding et al. | Analysis and improvement on Chord protocol for structured P2P |
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 |