WO2020220540A1 - 基于点对点网络的数据存储方法、装置、介质及终端设备 - Google Patents
基于点对点网络的数据存储方法、装置、介质及终端设备 Download PDFInfo
- Publication number
- WO2020220540A1 WO2020220540A1 PCT/CN2019/103295 CN2019103295W WO2020220540A1 WO 2020220540 A1 WO2020220540 A1 WO 2020220540A1 CN 2019103295 W CN2019103295 W CN 2019103295W WO 2020220540 A1 WO2020220540 A1 WO 2020220540A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- node
- hash
- point
- peer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operations
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
- G06F11/1464—Management of the backup or restore process for networked environments
-
- 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/104—Peer-to-peer [P2P] networks
- H04L67/1074—Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
- H04L67/1078—Resource delivery mechanisms
- H04L67/108—Resource delivery mechanisms characterised by resources being split in blocks or fragments
-
- 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/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
Definitions
- This application belongs to the field of computer technology, and in particular relates to a data storage method, device, computer non-volatile readable storage medium, and terminal equipment based on a peer-to-peer network.
- the redundancy of the data needs to be increased, and multiple copies of the same data are often distributed to the point-to-point network, and as a storage space consumer, one piece of data is repeated many times Transmission will consume a large amount of its bandwidth, causing a waste of its bandwidth resources.
- the embodiments of the present application provide a data storage method and device based on a peer-to-peer network, a computer non-volatile readable storage medium, and terminal equipment to solve the cumbersome operation of existing office applications and a relatively more user experience. Poor problem.
- the first aspect of the embodiments of the present application provides a data storage method based on a peer-to-peer network.
- the method is applied to a peer-to-peer network including more than two nodes.
- the method includes:
- the source node divides the data to be stored into data fragments and determines the number of backups of each data fragment, and the source node is any node in the peer-to-peer network;
- the source node determines the first-level storage node corresponding to the s-th data slice in the peer-to-peer network, and sends a data storage request to the first-level storage node, and the data storage request includes a count value and A set of storage nodes, the count value is equal to the number of backups of the s-th data fragment, the set of storage nodes is empty, 1 ⁇ s ⁇ SN, and SN is the number of data fragments;
- the level 1 storage node After receiving the data storage request, the level 1 storage node downloads and stores the s-th data segment from the source node, and adds the node identifier of the level 1 storage node to the storage node set , And subtract one counting unit from the count value;
- the nth level storage node determines the n+1th level storage node corresponding to the sth data slice in the point-to-point network, and sends a data storage request to the n+1th level storage node, where n is a positive integer;
- the n+1th level storage node After receiving the data storage request, the n+1th level storage node downloads and stores the sth data slice from each target node, and adds the node identification of the n+1th level storage node to the In the storage node set, one counting unit is subtracted from the count value until the count value is 0, and the target node is the node corresponding to each node identifier in the storage node set of the data storage request. .
- the second aspect of the embodiments of the present application provides a data storage device, which may include a module for implementing the steps of the foregoing data storage method.
- the third aspect of the embodiments of the present application provides a computer non-volatile readable storage medium, the computer non-volatile readable storage medium stores computer readable instructions, and the computer readable instructions are executed by a processor When realizing the functions of the above-mentioned data storage device.
- the fourth aspect of the embodiments of the present application provides a terminal device, including a memory, a processor, and computer-readable instructions stored in the memory and running on the processor, and the processor executes the computer
- the function of the above-mentioned data storage device is realized when the instruction is readable.
- FIG. 1 is a flowchart of an embodiment of a data storage method based on a peer-to-peer network in an embodiment of the application;
- FIG. 2 is a schematic flowchart of determining the first-level storage node corresponding to the s-th data slice in the point-to-point network
- Figure 3 is a schematic diagram of a hash ring
- Figure 4 is a schematic diagram of nodes in a peer-to-peer network mapped to a hash ring;
- Figure 5 is a schematic diagram of searching for a level 1 storage node on a hash ring
- FIG. 6 is a structural diagram of an embodiment of a data storage device in an embodiment of the application.
- FIG. 7 is a schematic block diagram of a terminal device in an embodiment of the application.
- an embodiment of a data storage method based on a peer-to-peer network in an embodiment of the present application may include:
- Step S101 The source node divides the data to be stored into each data segment, and determines the number of backups of each data segment.
- the source node is any node in the peer-to-peer network.
- terminal device ie the source node
- a specific application that can be installed on his terminal device Select the data to be stored in the program and click the OK button to inform the source node to perform the data storage operation.
- the source node may perform fragmentation processing on the data to be stored, that is, according to certain rules, divide a data set (that is, the data to be stored) into a plurality of independent and orthogonal data subsets (that is, each Data fragmentation) to facilitate distributed storage.
- the source node may first calculate the number of data fragments according to the following formula:
- DataBytes is the number of bytes of the data to be stored
- MaxShard is the maximum number of bytes of data fragments.
- the specific value can be set according to the actual situation, for example, it can be set to 1024, 2048, 4096 or other Value
- Ceil is a round-up function
- SN is the number of data fragments.
- s is the serial number of each data segment
- 1 ⁇ s ⁇ SN ShdBytes s is the number of bytes of the sth data segment
- Max is the maximum value function
- Min is the minimum value function
- Thresh is the preset
- the specific value of the ratio threshold can be set according to actual conditions, for example, it can be set to 0.1, 0.2, 0.3 or other values.
- the source node may assign a segmentation identifier to each data segmentation, and the identifier of each data segmentation is unique in the entire point-to-point network, any two data segments
- the shard IDs are all different.
- the greater the number of backups in the peer-to-peer network the greater the redundancy.
- one or more storage nodes storing the data fragments in the peer-to-peer network fail, there are still more The other storage nodes that store the data shards are running normally, the higher the data security is.
- the number of backups of these data fragments in the peer-to-peer network is too large, it will occupy a large amount of network storage resources. Therefore, it is necessary to weigh the two and choose an appropriate number of backups.
- the number of backups of data fragments in the peer-to-peer network can be determined according to the user's level, and the users are divided into multiple levels such as ordinary users, paid users, and VIP users, and each level has a corresponding The number of backups for users, and the higher the level of users, the more backups of their data fragments in the peer-to-peer network.
- the number of backups of each data segment can be calculated by the following formula:
- NodesNum is the total number of nodes in the peer-to-peer network
- BaseNdNum is the preset number of reference nodes
- HsShardNum is the total number of data shards stored in the peer-to-peer network based on historical records
- HsDmgSdNum is based on the history Record the total number of data fragments that are lost or damaged in the point-to-point network obtained by recording statistics
- c is the sequence number of the user level from high to low
- ClassNum is the total number of user levels
- ClassCoef c is the first The weight coefficients of c user levels. The higher the level, the larger the corresponding coefficient.
- BkpNum c is the number of backups of data fragments of the c-th user level in the peer-to-peer network.
- Step S102 The source node determines a level 1 storage node corresponding to the s-th data slice in the peer-to-peer network, and sends a data storage request to the level 1 storage node.
- the source node may determine the level 1 storage node corresponding to the s-th data slice in the peer-to-peer network through the process shown in FIG. 2:
- Step S1021 Use the preset first hash function to calculate the hash value of the s-th data segment.
- the hash value of the s-th data segment can be calculated according to the following formula:
- ShardID s is the shard ID of the s-th data shard
- FsHashFunc is the first hash function
- ShardHash s is the hash value of the s-th data shard.
- hash functions have the following basic characteristic: if two hash values are not the same (according to the same hash function), then the original input of the two hash values is also different. This feature gives the hash function a deterministic result. But on the other hand, the input and output of the hash function are not uniquely corresponding. If the two hash values are the same, the two input values are likely to be the same, but they may also be different. This situation is called “hash collision ", this is usually two different input values, deliberately calculated the same output value. However, for the commonly used hash functions in the prior art, the probability of collision is extremely low, almost negligible.
- the first hash function and other hash functions in this embodiment may include, but are not limited to, any hash function commonly used in the prior art such as MD4, MD5, and SHA1.
- Step S1022 Determine the target position point on the preset hash ring corresponding to the hash value of the s-th data segment.
- the hash ring is a ring formed by connecting all the function values of the first hash function clockwise or counterclockwise in order from small to large, that is, each position on the hash ring is equal to Corresponding to a function value of the first hash function, if the value range of the first hash function is [0, N] and is arranged in a clockwise order, it can form a hash function as shown in FIG. 3 Greek ring.
- Step S1023 Obtain each reference position point on the Hash ring.
- each reference location point is a location point corresponding to a node in the point-to-point network.
- the setting process of the reference position point includes:
- the identity of a node can be the International Mobile Equipment Identity (IMEI) of the node, which is an electronic serial number composed of 15 digits, which corresponds to each terminal device one-to-one , And the code is unique in the world.
- IMEI International Mobile Equipment Identity
- Each terminal device will be assigned a globally unique number after assembly. This number will be recorded by the manufacturer from production to delivery.
- each node is expressed as: NodeID 1 , NodeID 2 , ..., NodeID m , ..., NodeID M , where m is the serial number of each node, 1 ⁇ m ⁇ NodesNum, and NodeID m is the mth The identity of the node.
- a preset second hash function is used to hash the identity of each node in the peer-to-peer network to obtain the hash value of each node.
- the hash value of each node can be calculated separately according to the following formula:
- NodeHash m SdHashFunc(NodeID m )
- SdHashFunc is the second hash function
- the value range of the second hash function is consistent with the value range of the first hash function, so as to ensure that the two can be mapped to the same hash ring
- NodeHash m is the hash value of the mth node.
- the location point on the hash ring corresponding to the hash value of the mth node is determined as the reference location point corresponding to the mth node.
- Figure 4 shows the situation where the hash values of the four nodes are respectively mapped to the hash ring, and the position points corresponding to NodeHash 1 , NodeHash 2 , NodeHash 3 and NodeHash 4 are the respective reference position points.
- Step S1024 Search for the reference location point clockwise or counterclockwise from the target location point, and determine the node corresponding to the first reference location point found as the first data segment corresponding to the sth data segment. Level storage node.
- the source node may send a data storage request to the level 1 storage node.
- the data storage request includes a count value, a set of storage nodes, and a fragment identifier of the s-th data segment.
- the count value is equal to the number of backups of the s-th data segment, and the storage node set Is empty.
- Step S103 After receiving the data storage request, the first-level storage node downloads and stores the s-th data slice from the source node, and adds the node identifier of the first-level storage node to the Store the node set, and subtract one counting unit from the count value.
- NodeSet NodeSet ⁇ NodeID(1)
- Step S104 The nth level storage node determines the n+1th level storage node corresponding to the sth data slice in the peer-to-peer network, and sends a data storage request to the n+1th level storage node.
- the process for the n-th storage node to determine the n+1th-level storage node corresponding to the s-th data slice is similar to the process shown in FIG. 2, and the details can be referred to the foregoing content, which will not be repeated here.
- the reference location point corresponding to each node in the storage node set needs to be removed from the hash ring, otherwise, the finally determined n+1 level storage node remains Will be a node in the storage node set.
- Step S105 After receiving the data storage request, the n+1th level storage node downloads and stores the sth data slice from each target node, and adds the node identifier of the n+1th level storage node Into the storage node set, and subtract one counting unit from the count value.
- the target node is a node corresponding to each node identifier in the storage node set of the data storage request. It should be noted that the n+1th level storage node simultaneously downloads the sth data segment from each target node in a concurrent download mode to speed up the download speed.
- NodeID(n+1) the node identifier of the n+1th level storage node is marked as NodeID(n+1), then:
- NodeSet NodeSet ⁇ NodeID(n+1);
- Step S106 Determine whether the count value is 0.
- step S107 If the count value is not 0, it means that the number of backups of data fragments has not been completed. At this time, proceed to step S107. If the count value is 0, it means that the number of backups of data fragments has been completed. Step S108.
- Step S107 Increase n by one counting unit.
- Step S108 End the data storage process.
- the source node first divides the data to be stored into each data segment, and determines the number of backups of each data segment, and then determines the number of data segments in the peer-to-peer network.
- the level 1 storage node corresponding to the slice, and sends a data storage request to the level 1 storage node.
- the data storage request includes a count value and a storage node set, and the count value is equal to the backup of the sth data slice. Number, the storage node set is empty.
- the first-level storage node After the first-level storage node receives the data storage request, it first downloads and stores the s-th data segment from the source node, adds its own node identifier to the storage node set, and stores all One counting unit is subtracted from the count value, and then the second-level storage node corresponding to the s-th data slice is determined in the peer-to-peer network, and a data storage request is sent to the second-level storage node, and the second After receiving the data storage request, the secondary storage node downloads and stores the sth data segment from each target node (that is, the node corresponding to each node identifier in the storage node set of the data storage request),... ..., repeat the above process continuously until the count value is 0.
- FIG. 6 shows a structural diagram of an embodiment of a data storage device provided in an embodiment of the present application.
- a data storage device may include:
- the data fragmentation module 601 is configured to divide the data to be stored into data fragments
- the backup number determining module 602 is used to determine the backup number of each data segment
- the first determining module 603 is configured to determine the first-level storage node corresponding to the s-th data slice in the peer-to-peer network, and send a data storage request to the first-level storage node, in the data storage request It includes a count value and a storage node set, the count value is equal to the number of backups of the s-th data fragment, the storage node set is empty, 1 ⁇ s ⁇ SN, and SN is the number of data fragments;
- the first processing module 604 is configured to download and store the sth data slice after receiving the data storage request, add the local node identifier to the storage node set, and subtract the count value A counting unit;
- the second determining module 605 is configured to determine the next-level storage node corresponding to the s-th data slice in the peer-to-peer network, and send a data storage request to the next-level storage node;
- the second processing module 606 is configured to download and store the s-th data segment from each target node after receiving the data storage request, add the local node identifier to the storage node set, and add the A counting unit is subtracted from the count value, and the target node is a node corresponding to each node identifier in the storage node set of the data storage request.
- the first determining module may include:
- the slice hash value calculation unit is configured to calculate the hash value of the s-th data slice using the preset first hash function
- the target location point determination unit is configured to determine a target location point on a preset hash ring corresponding to the hash value of the s-th data segment, where the hash ring is determined by the first hash function All the function values of is connected clockwise or counterclockwise in order from small to large to form a circular ring, that is, each position point on the hash ring corresponds to a function value of the first hash function;
- a reference location point acquiring unit configured to acquire each reference location point on the Hash ring, where each reference location point is a location point corresponding to a node in the point-to-point network;
- the reference position point searching unit is configured to search for the reference position point clockwise or counterclockwise from the target position point, and determine the node corresponding to the first reference position point found to be the same as the sth data point The first level storage node corresponding to the slice.
- the first determining module may further include:
- An identity acquiring unit configured to acquire the identity of each node in the peer-to-peer network
- the hash operation unit is configured to use a preset second hash function to perform a hash operation on the identity of each node in the peer-to-peer network to obtain the hash value of each node.
- the second hash function is The value range is consistent with the value range of the first hash function;
- the reference position point determining unit is configured to determine the position point on the hash ring corresponding to the hash value of the mth node as the reference position point corresponding to the mth node, 1 ⁇ m ⁇ NodesNum.
- the data segmentation module may include:
- the number of fragments calculation unit is used to calculate the number of data fragments
- the data slice dividing unit is configured to divide the data to be stored into SN data slices.
- FIG. 7 shows a schematic block diagram of a terminal device provided by an embodiment of the present application. For ease of description, only parts related to the embodiment of the present application are shown.
- the terminal device 7 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
- the terminal device 7 may include: a processor 70, a memory 71, and computer-readable instructions 72 stored in the memory 71 and running on the processor 70, such as those that execute the aforementioned data storage method based on a peer-to-peer network.
- Computer readable instructions When the processor 70 executes the computer-readable instructions 72, the functions of the modules/units in the foregoing device embodiments are implemented, for example, the functions of the modules 601 to 606 shown in FIG. 6.
- the computer-readable instructions 72 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 71 and executed by the processor 70, To complete the present invention.
- the one or more modules/units may be a series of computer-readable instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 72 in the terminal device 7.
- the processor 70 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
- the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
- the memory 71 may be an internal storage unit of the terminal device 7, such as a hard disk or a memory of the terminal device 7.
- the memory 71 may also be an external storage device of the terminal device 7, such as a plug-in hard disk equipped on the terminal device 7, a smart memory card (Smart Media Card, SMC), and a Secure Digital (SD) Card, Flash Card, etc. Further, the memory 71 may also include both an internal storage unit of the terminal device 7 and an external storage device.
- the memory 71 is used to store the computer-readable instructions and other instructions and data required by the terminal device 7.
- the memory 71 can also be used to temporarily store data that has been output or will be output.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
- the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through computer-readable instructions.
- the computer-readable instructions can be stored in a non-volatile computer. Readable storage medium.
- Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
- Volatile memory may include random access memory (RAM) or external cache memory.
- RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请属于计算机技术领域,尤其涉及一种基于点对点网络的数据存储方法、装置、计算机非易失性可读存储介质及终端设备。在所述方法中,源节点将待存储数据划分为各个数据分片,并确定其备份数目;所述源节点确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求;第n级存储节点确定与第s个数据分片对应的第n+1级存储节点,并向所述第n+1级存储节点发送数据存储请求;所述第n+1级存储节点在接收到所述数据存储请求后,从各个目标节点下载及存储第s个数据分片,将所述第n+1级存储节点的节点标识添加入所述存储节点集合中,并将计数值减去一个计数单元,直至计数值为0为止,从而减少了对源节点带宽资源的占用。
Description
本申请要求于2019年4月28日提交中国专利局、申请号为201910347818.3、发明名称为“基于点对点网络的数据存储方法、装置、介质及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请属于计算机技术领域,尤其涉及一种基于点对点网络的数据存储方法、装置、计算机非易失性可读存储介质及终端设备。
在点对点网络中进行存储中,为了保证数据的安全性,需要增加数据的冗余度,常常会把同一个数据分发多份到点对点网络中,而作为存储空间消费者,一份数据多次反复传输会耗用其大量的带宽,造成对其带宽资源的浪费。
有鉴于此,本申请实施例提供了一种基于点对点网络的数据存储方法、装置、计算机非易失性可读存储介质及终端设备,以解决现有的办公应用程序操作比较繁琐,用户体验较差的问题。
本申请实施例的第一方面提供了一种基于点对点网络的数据存储方法,所述方法应用于包括两个以上节点的点对点网络中,所述方法包括:
源节点将待存储数据划分为各个数据分片,并确定各个数据分片的备份数目,所述源节点为所述点对点网络中的任意一个节点;
所述源节点在所述点对点网络中确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求,所述数据存储请求中包括计数值和存储节点集合,所述计数值等于第s个数据分片的备份数目,所述存储节点集合为空,1≤s≤SN,SN为数据分片的数目;
所述第1级存储节点在接收到所述数据存储请求后,从所述源节点下载及存储第s个数据分片,将所述第1级存储节点的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元;
第n级存储节点在所述点对点网络中确定与第s个数据分片对应的第n+1级存储节点,并向所述第n+1级存储节点发送数据存储请求,n为正整数;
所述第n+1级存储节点在接收到所述数据存储请求后,从各个目标节点下载及存储第s个数据分片,将所述第n+1级存储节点的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元,直至所述计数值为0为止,所述目标节点为所述 数据存储请求的存储节点集合中的各个节点标识分别所对应的节点。
本申请实施例的第二方面提供了一种数据存储装置,可以包括用于实现上述数据存储方法的步骤的模块。
本申请实施例的第三方面提供了一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述数据存储装置的功能。
本申请实施例的第四方面提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述数据存储装置的功能。
在本申请实施例中,作为存储消费者(也即所述源节点)只用发送一份数据到点对点网络中,网络中的其它节点自行进行数据分发且逐次增大并发数,从而达到快速分发的效果,减少了对其带宽资源的占用。
图1为本申请实施例中一种基于点对点网络的数据存储方法的一个实施例流程图;
图2为在点对点网络中确定与第s个数据分片对应的第1级存储节点的示意流程图;
图3为哈希环的示意图;
图4为点对点网络中的节点映射至哈希环上的示意图;
图5为在哈希环上查找第1级存储节点的示意图;
图6为本申请实施例中一种数据存储装置的一个实施例结构图;
图7为本申请实施例中一种终端设备的示意框图。
请参阅图1,本申请实施例中一种基于点对点网络的数据存储方法的一个实施例可以包括:
步骤S101、源节点将待存储数据划分为各个数据分片,并确定各个数据分片的备份数目。
所述源节点为所述点对点网络中的任意一个节点。在实际使用过程中,若某一用户需要将其手机、平板、电脑等等终端设备(即所述源节点)中的数据存储到所述点对点网络中,可以在其终端设备上安装的特定应用程序中选定待存储数据,并点击确定按钮,以告知所述源节点进行数据存储操作。
所述源节点可以对所述待存储数据进行分片处理,即按照一定的规则,将一个数 据集(即所述待存储数据)划分成多个相互独立、正交的数据子集(即各个数据分片),以便于分布式存储。
具体地,所述源节点可以首先根据下式计算数据分片的数目:
其中,DataBytes为所述待存储数据的字节数,MaxShard为数据分片的最大字节数,其具体取值可以根据实际情况进行设置,例如,可以将其设置为1024、2048、4096或者其它取值,Ceil为向上取整函数,SN为数据分片的数目。
然后,将所述待存储数据划分为满足以下条件的SN个数据分片:
其中,s为各个数据分片的序号,1≤s≤SN,ShdBytes
s为第s个数据分片的字节数,Max为求最大值函数,Min为求最小值函数,Thresh为预设的比例阈值,其具体取值可以根据实际情况进行设置,例如,可以将其设置为0.1、0.2、0.3或者其它取值。
在完成数据分片的划分之后,所述源节点可以为每个数据分片均分配一个分片标识,且各个数据分片的标识在整个点对点网络中均是唯一的,任意两个数据分片的分片标识均不相同。
对于这些数据分片而言,其在点对点网络中备份的数目越多,冗余度越大,当点对点网络中存储该数据分片的一个或多个存储节点出现故障时,仍有较多的其它的存储该数据分片的存储节点正常运行,则其数据的安全性也越高。但是,若这些数据分片在点对点网络中备份的数目过多,则会占用大量的网络存储资源,因此,需要对这两者进行权衡,选择合适的备份数目。
在本实施例中,可以根据用户的等级来确定其数据分片在点对点网络中的备份数目,将用户划分为普通用户、付费用户、VIP用户等多个等级,每个等级均有与之对应的备份数目,且等级越高的用户,其数据分片在点对点网络中的备份数目也越多。
例如,可以设置普通用户的数据分片在点对点网络中的备份数目为3、付费用户的数据分片在点对点网络中的备份数目为5、VIP用户的数据分片在点对点网络中的备份数目为10等等。
优选地,在本实施例中可以通过下式来计算各个数据分片的备份数目:
其中,NodesNum为所述点对点网络中的节点总数,BaseNdNum为预设的基准节点数目,HsShardNum为根据历史记录统计得到的在所述点对点网络中存储的数据分片的总数,HsDmgSdNum为根据所述历史记录统计得到的在所述点对点网络中丢失或损毁的数据分片的总数,c为用户等级按照从高到低排列的序号,1≤c≤ClassNum,ClassNum为用户等级的总数,ClassCoef
c为第c个用户等级的权重系数,等级越高,则对应的系数也越大,具体的系数取值可以根据实际情况进行设置,例如,可以设置ClassCoef
1=0.001,ClassCoef
2=0.0005,ClassCoef
3=0.0003,……,依次类推,BkpNum
c为第c个用户等级的数据分片在所述点对点网络中的备份数目。
步骤S102、所述源节点在所述点对点网络中确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求。
其中,1≤s≤SN。具体地,所述源节点可以通过如图2所示的过程在所述点对点网络中确定与第s个数据分片对应的第1级存储节点:
步骤S1021、使用预设的第一哈希函数计算第s个数据分片的哈希值。
在本实施例中,可以根据下式分别计算第s个数据分片的哈希值:
ShardHash
s=FsHashFunc(ShardID
s)
其中,ShardID
s为第s个数据分片的分片标识,FsHashFunc为所述第一哈希函数,ShardHash
s为第s个数据分片的哈希值。
所有的哈希函数都有如下一个基本特性:如果两个哈希值是不相同的(根据同一哈希函数),那么这两个哈希值的原始输入也是不相同的。这个特性使哈希函数具有确定性的结果。但另一方面,哈希函数的输入和输出不是唯一对应关系的,如果两个哈希值相同,两个输入值很可能是相同的,但也可能不同,这种情况称为“哈希碰撞”,这通常是两个不同的输入值,刻意计算出相同的输出值。但对于现有技术中常用的哈希函数而言,其发生碰撞的概率极低,几乎可以忽略不计,输入一些数据计算出哈希值,然后部分改变输入值,一个具有强混淆特性的哈希函数会产生一个完全不同的哈希值。本实施例中的第一哈希函数以及其它哈希函数可以包括但不限于MD4、MD5、SHA1等任意一个现有技术中常用的哈希函数。
步骤S1022、将预设的哈希环上与第s个数据分片的哈希值对应的位置点确定目标位置点。
所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,即所述哈希环上的每个位置点均对应于所述第一哈希函数的一个函数值,若所述第一哈希函数的值域为[0,N],且以顺时针的顺序排列,则可构成如图3所示的哈希环。
步骤S1023、获取所述哈希环上的各个基准位置点。
其中,每个基准位置点均为与所述点对点网络中的一个节点对应的位置点。所述基准位置点的设置过程包括:
首先,获取所述点对点网络中的各个节点的身份标识。
某一节点的身份标识可以为该节点的国际移动设备身份码(International Mobile Equipment Identity,IMEI),国际移动设备身份码是由15位数字组成的电子串号,它与每个终端设备一一对应,而且该码是全世界唯一的。每一个终端设备在组装完成后都将被赋予一个全球唯一的号码,这个号码从生产到交付使用都将被制造生产的厂商所记录。
将获取到的各个节点的身份标识分别表示为:NodeID
1、NodeID
2、…、NodeID
m、…、NodeID
M,其中,m为各个节点的序号,1≤m≤NodesNum,NodeID
m为第m个节点的身份标识。
然后,使用预设的第二哈希函数分别对所述点对点网络中的各个节点的身份标识进行哈希运算,得到各个节点的哈希值。
具体地,可以根据下式分别计算各个节点的哈希值:
NodeHash
m=SdHashFunc(NodeID
m)
其中,SdHashFunc为所述第二哈希函数,且所述第二哈希函数的值域与所述第一哈希函数的值域一致,以此保证两者可以映射到同一个哈希环上,NodeHash
m为第m个节点的哈希值。
最后,将所述哈希环上与第m个节点的哈希值对应的位置点确定为与第m个节点对应的基准位置点。
图4所示为4个节点的哈希值分别映射至哈希环上的情形,NodeHash
1、NodeHash
2、NodeHash
3、NodeHash
4所对应的位置点即为各个基准位置点。
步骤S1024、从所述目标位置点开始顺时针或者逆时针查找所述基准位置点,并将查找到的第一个基准位置点所对应的节点确定为与第s个数据分片对应的第1级存储节点。
以图5为例,从第1个数据分片的哈希值ShardHash
1对应的目标位置点开始顺时针查找,找到的第一个基准位置点为NodeHash
2对应的位置点,则将所述点对点网络中的第2个节点确定为与第1个数据分片对应的第1级存储节点。
通过上述方法,可以确定出以下的存储对应关系:
| 数据分片 | 第1级存储节点 |
| 数据分片1、数据分片2 | 节点2 |
| 数据分片3 | 节点3 |
| 数据分片4、数据分片5 | 节点4 |
| 数据分片6、数据分片7 | 节点1 |
若采用逆时针查找的方法,其具体过程与逆时针查找的过程类似,具体可参照上述过程,此处不再赘述。
在确定出所述第1级存储节点之后,所述源节点可以向所述第1级存储节点发送数据存储请求。所述数据存储请求中包括计数值和存储节点集合以及第s个数据分片的分片标识,在初始状态下,所述计数值等于第s个数据分片的备份数目,所述存储节点集合为空。
步骤S103、所述第1级存储节点在接收到所述数据存储请求后,从所述源节点下载及存储第s个数据分片,将所述第1级存储节点的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元。
将所述存储节点集合记为NodeSet,将所述第1级存储节点的节点标识记为NodeID(1),将所述计数值记为Count,则有:
NodeSet=NodeSet∪NodeID(1);
Count=Count-1。
步骤S104、第n级存储节点在所述点对点网络中确定与第s个数据分片对应的第n+1级存储节点,并向所述第n+1级存储节点发送数据存储请求。
n为正整数,初始状态下,设置n=1。
其中,第n级存储节点确定与第s个数据分片对应的第n+1级存储节点的过程与图2所示的过程类似,具体可参见前述内容,此处不再赘述。但需要注意的是,在这一过程中,需要将所述存储节点集合中的各个节点所对应的基准位置点从哈希环中剔除,否则,最终确定出的第n+1级存储节点仍会为所述存储节点集合中的节点。
步骤S105、所述第n+1级存储节点在接收到所述数据存储请求后,从各个目标节点下载及存储第s个数据分片,将所述第n+1级存储节点的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元。
所述目标节点为所述数据存储请求的存储节点集合中的各个节点标识分别所对应的节点。需要注意的是,所述第n+1级存储节点是采用并发下载的方式同时从各个目标节点下载第s个数据分片,以加快下载速度。
在下载及存储完成之后,将所述第n+1级存储节点的节点标识记为NodeID(n+1),则有:
NodeSet=NodeSet∪NodeID(n+1);
Count=Count-1。
步骤S106、判断所述计数值是否为0。
若所述计数值不为0,则说明数据分片的备份数目还未完成,此时继续执行步骤S107,若所述计数值为0,则说明数据分片的备份数目已经完成,此时执行步骤S108。
步骤S107、将n增加一个计数单元。
即执行:n=n+1,然后返回执行步骤S104及其后续步骤,直至所述计数值为0为止。
步骤S108、结束数据存储过程。
综上所述,在本申请实施例中,源节点首先将待存储数据划分为各个数据分片,并确定各个数据分片的备份数目,然后在所述点对点网络中确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求,所述数据存储请求中包括计数值和存储节点集合,所述计数值等于第s个数据分片的备份数目,所述存储节点集合为空。所述第1级存储节点在接收到所述数据存储请求后,首先从所述源节点下载及存储第s个数据分片,将自己的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元,然后在所述点对点网络中确定与第s个数据分片对应的第2级存储节点,并向所述第2级存储节点发送数据存储请求,所述第2级存储节点在接收到所述数据存储请求后,从各个目标节点(即所述数据存储请求的存储节点集合中的各个节点标识分别所对应的节点)下载及存储第s个数据分片,……,不断重复以上过程,直至所述计数值为0为止。通过这样的方式,作为存储消费者(也即所述源节点)只用发送一份数据到点对点网络中,网络中的其它节点自行进行数据分发且逐次增大并发数,从而达到快速分发的效果,减少了对其带宽资源的占用。
对应于上文实施例所述的一种基于点对点网络的数据存储方法,图6示出了本申请实施例提供的一种数据存储装置的一个实施例结构图。
本实施例中,一种数据存储装置可以包括:
数据分片划分模块601,用于将待存储数据划分为各个数据分片;
备份数目确定模块602,用于确定各个数据分片的备份数目;
第一确定模块603,用于在所述点对点网络中确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求,所述数据存储请求中包括计数值和存储节点集合,所述计数值等于第s个数据分片的备份数目,所述存储节点集合为空,1≤s≤SN,SN为数据分片的数目;
第一处理模块604,用于在接收到所述数据存储请求后,下载及存储第s个数据分片,将本地的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单 元;
第二确定模块605,用于在所述点对点网络中确定与第s个数据分片对应的下一级存储节点,并向下一级存储节点发送数据存储请求;
第二处理模块606,用于在接收到所述数据存储请求后,从各个目标节点下载及存储第s个数据分片,将本地的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元,所述目标节点为所述数据存储请求的存储节点集合中的各个节点标识分别所对应的节点。
进一步地,所述第一确定模块可以包括:
分片哈希值计算单元,用于使用预设的第一哈希函数计算第s个数据分片的哈希值;
目标位置点确定单元,用于将预设的哈希环上与第s个数据分片的哈希值对应的位置点确定目标位置点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,即所述哈希环上的每个位置点均对应于所述第一哈希函数的一个函数值;
基准位置点获取单元,用于获取所述哈希环上的各个基准位置点,其中,每个基准位置点均为与所述点对点网络中的一个节点对应的位置点;
基准位置点查找单元,用于从所述目标位置点开始顺时针或者逆时针查找所述基准位置点,并将查找到的第一个基准位置点所对应的节点确定为与第s个数据分片对应的第1级存储节点。
进一步地,所述第一确定模块还可以包括:
身份标识获取单元,用于获取所述点对点网络中的各个节点的身份标识;
哈希运算单元,用于使用预设的第二哈希函数分别对所述点对点网络中的各个节点的身份标识进行哈希运算,得到各个节点的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;
基准位置点确定单元,用于将所述哈希环上与第m个节点的哈希值对应的位置点确定为与第m个节点对应的基准位置点,1≤m≤NodesNum。
进一步地,所述数据分片划分模块可以包括:
分片数目计算单元,用于计算数据分片的数目;
数据分片划分单元,用于将所述待存储数据划分为SN个数据分片。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置,模块和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
图7示出了本申请实施例提供的一种终端设备的示意框图,为了便于说明,仅示 出了与本申请实施例相关的部分。
在本实施例中,所述终端设备7可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该终端设备7可包括:处理器70、存储器71以及存储在所述存储器71中并可在所述处理器70上运行的计算机可读指令72,例如执行上述的基于点对点网络的数据存储方法的计算机可读指令。所述处理器70执行所述计算机可读指令72时实现上述各装置实施例中各模块/单元的功能,例如图6所示模块601至606的功能。
示例性的,所述计算机可读指令72可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器71中,并由所述处理器70执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机可读指令72在所述终端设备7中的执行过程。
所述处理器70可以是中央处理单元(Central Processing Unit,CPU),还可以是其它通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器71可以是所述终端设备7的内部存储单元,例如终端设备7的硬盘或内存。所述存储器71也可以是所述终端设备7的外部存储设备,例如所述终端设备7上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器71还可以既包括所述终端设备7的内部存储单元也包括外部存储设备。所述存储器71用于存储所述计算机可读指令以及所述终端设备7所需的其它指令和数据。所述存储器71还可以用于暂时地存储已经输出或者将要输出的数据。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记 载的部分,可以参见其它实施例的相关描述。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机非易失性可读存储介质中。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机非易失性可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。
Claims (20)
- 一种基于点对点网络的数据存储方法,其特征在于,所述方法应用于包括两个以上节点的点对点网络中,所述方法包括:源节点将待存储数据划分为各个数据分片,并确定各个数据分片的备份数目,所述源节点为所述点对点网络中的任意一个节点;所述源节点在所述点对点网络中确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求,所述数据存储请求中包括计数值和存储节点集合,所述计数值等于第s个数据分片的备份数目,所述存储节点集合为空,1≤s≤SN,SN为数据分片的数目;所述第1级存储节点在接收到所述数据存储请求后,从所述源节点下载及存储第s个数据分片,将所述第1级存储节点的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元;第n级存储节点在所述点对点网络中确定与第s个数据分片对应的第n+1级存储节点,并向所述第n+1级存储节点发送数据存储请求,n为正整数;所述第n+1级存储节点在接收到所述数据存储请求后,从各个目标节点下载及存储第s个数据分片,将所述第n+1级存储节点的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元,直至所述计数值为0为止,所述目标节点为所述数据存储请求的存储节点集合中的各个节点标识分别所对应的节点。
- 根据权利要求1所述的数据存储方法,其特征在于,所述确定各个数据分片的备份数目包括:根据下式计算各个数据分片的备份数目:其中,NodesNum为所述点对点网络中的节点总数,BaseNdNum为预设的基准节点数目,HsShardNum为根据历史记录统计得到的在所述点对点网络中存储的数据分片的总数,HsDmgSdNum为根据所述历史记录统计得到的在所述点对点网络中丢失或损毁的数据分片的总数,c为用户等级按照从高到低排列的序号,1≤c≤ClassNum,ClassNum为用户等级的总数,ClassCoef c为第c个用户等级的权重系数,BkpNum c为第c个用户等级的数据分片在所述点对点网络中的备份数目。
- 根据权利要求1所述的数据存储方法,其特征在于,所述在所述点对点网络中确定与第s个数据分片对应的第1级存储节点包括:使用预设的第一哈希函数计算第s个数据分片的哈希值;将预设的哈希环上与第s个数据分片的哈希值对应的位置点确定目标位置点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,即所述哈希环上的每个位置点均对应于所述第一哈希函数的一个函数值;获取所述哈希环上的各个基准位置点,其中,每个基准位置点均为与所述点对点网络中的一个节点对应的位置点;从所述目标位置点开始顺时针或者逆时针查找所述基准位置点,并将查找到的第一个基准位置点所对应的节点确定为与第s个数据分片对应的第1级存储节点。
- 根据权利要求3所述的数据存储方法,其特征在于,所述基准位置点的设置过程包括:获取所述点对点网络中的各个节点的身份标识;使用预设的第二哈希函数分别对所述点对点网络中的各个节点的身份标识进行哈希运算,得到各个节点的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;将所述哈希环上与第m个节点的哈希值对应的位置点确定为与第m个节点对应的基准位置点,1≤m≤NodesNum。
- 一种数据存储装置,其特征在于,包括:数据分片划分模块,用于将待存储数据划分为各个数据分片;备份数目确定模块,用于确定各个数据分片的备份数目;第一确定模块,用于在点对点网络中确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求,所述数据存储请求中包括计数值和存储节点集合,所述计数值等于第s个数据分片的备份数目,所述存储节点集合为空,1≤s≤SN,SN为数据分片的数目;第一处理模块,用于在接收到所述数据存储请求后,下载及存储第s个数据分片,将本地的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元;第二确定模块,用于在所述点对点网络中确定与第s个数据分片对应的下一级存储节点,并向下一级存储节点发送数据存储请求;第二处理模块,用于在接收到所述数据存储请求后,从各个目标节点下载及存储第s个数据分片,将本地的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元,所述目标节点为所述数据存储请求的存储节点集合中的各个节点标识分别所对应的节点。
- 根据权利要求6所述的数据存储装置,其特征在于,所述备份数目确定模块具体用于根据下式计算各个数据分片的备份数目:其中,NodesNum为所述点对点网络中的节点总数,BaseNdNum为预设的基准节点数目,HsShardNum为根据历史记录统计得到的在所述点对点网络中存储的数据分片的总数,HsDmgSdNum为根据所述历史记录统计得到的在所述点对点网络中丢失或损毁的数据分片的总数,c为用户等级按照从高到低排列的序号,1≤c≤ClassNum,ClassNum为用户等级的总数,ClassCoef c为第c个用户等级的权重系数,BkpNum c为第c个用户等级的数据分片在所述点对点网络中的备份数目。
- 根据权利要求6所述的数据存储装置,其特征在于,所述第一确定模块包括:分片哈希值计算单元,用于使用预设的第一哈希函数计算第s个数据分片的哈希值;目标位置点确定单元,用于将预设的哈希环上与第s个数据分片的哈希值对应的位置点确定目标位置点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,即所述哈希环上的每个位置点均对应于所述第一哈希函数的一个函数值;基准位置点获取单元,用于获取所述哈希环上的各个基准位置点,其中,每个基 准位置点均为与所述点对点网络中的一个节点对应的位置点;基准位置点查找单元,用于从所述目标位置点开始顺时针或者逆时针查找所述基准位置点,并将查找到的第一个基准位置点所对应的节点确定为与第s个数据分片对应的第1级存储节点。
- 根据权利要求8所述的数据存储装置,其特征在于,所述第一确定模块还包括:身份标识获取单元,用于获取所述点对点网络中的各个节点的身份标识;哈希运算单元,用于使用预设的第二哈希函数分别对所述点对点网络中的各个节点的身份标识进行哈希运算,得到各个节点的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;基准位置点确定单元,用于将所述哈希环上与第m个节点的哈希值对应的位置点确定为与第m个节点对应的基准位置点,1≤m≤NodesNum。
- 一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:将待存储数据划分为各个数据分片;确定各个数据分片的备份数目;在点对点网络中确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求,所述数据存储请求中包括计数值和存储节点集合,所述 计数值等于第s个数据分片的备份数目,所述存储节点集合为空,1≤s≤SN,SN为数据分片的数目;在接收到所述数据存储请求后,下载及存储第s个数据分片,将本地的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元;在所述点对点网络中确定与第s个数据分片对应的下一级存储节点,并向下一级存储节点发送数据存储请求;在接收到所述数据存储请求后,从各个目标节点下载及存储第s个数据分片,将本地的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元,所述目标节点为所述数据存储请求的存储节点集合中的各个节点标识分别所对应的节点。
- 根据权利要求11所述的计算机非易失性可读存储介质,其特征在于,所述确定各个数据分片的备份数目包括:根据下式计算各个数据分片的备份数目:其中,NodesNum为所述点对点网络中的节点总数,BaseNdNum为预设的基准节点数目,HsShardNum为根据历史记录统计得到的在所述点对点网络中存储的数据分片的总数,HsDmgSdNum为根据所述历史记录统计得到的在所述点对点网络中丢失或损毁的数据分片的总数,c为用户等级按照从高到低排列的序号,1≤c≤ClassNum,ClassNum为用户等级的总数,ClassCoef c为第c个用户等级的权重系数,BkpNum c为第c个用户等级的数据分片在所述点对点网络中的备份数目。
- 根据权利要求11所述的计算机非易失性可读存储介质,其特征在于,所述在所述点对点网络中确定与第s个数据分片对应的第1级存储节点包括:使用预设的第一哈希函数计算第s个数据分片的哈希值;将预设的哈希环上与第s个数据分片的哈希值对应的位置点确定目标位置点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,即所述哈希环上的每个位置点均对应于所述第一哈希函数的一个函数值;获取所述哈希环上的各个基准位置点,其中,每个基准位置点均为与所述点对点网络中的一个节点对应的位置点;从所述目标位置点开始顺时针或者逆时针查找所述基准位置点,并将查找到的第一个基准位置点所对应的节点确定为与第s个数据分片对应的第1级存储节点。
- 根据权利要求13所述的计算机非易失性可读存储介质,其特征在于,所述基 准位置点的设置过程包括:获取所述点对点网络中的各个节点的身份标识;使用预设的第二哈希函数分别对所述点对点网络中的各个节点的身份标识进行哈希运算,得到各个节点的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;将所述哈希环上与第m个节点的哈希值对应的位置点确定为与第m个节点对应的基准位置点,1≤m≤NodesNum。
- 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:将待存储数据划分为各个数据分片;确定各个数据分片的备份数目;在点对点网络中确定与第s个数据分片对应的第1级存储节点,并向所述第1级存储节点发送数据存储请求,所述数据存储请求中包括计数值和存储节点集合,所述计数值等于第s个数据分片的备份数目,所述存储节点集合为空,1≤s≤SN,SN为数据分片的数目;在接收到所述数据存储请求后,下载及存储第s个数据分片,将本地的节点标识 添加入所述存储节点集合中,并将所述计数值减去一个计数单元;在所述点对点网络中确定与第s个数据分片对应的下一级存储节点,并向下一级存储节点发送数据存储请求;在接收到所述数据存储请求后,从各个目标节点下载及存储第s个数据分片,将本地的节点标识添加入所述存储节点集合中,并将所述计数值减去一个计数单元,所述目标节点为所述数据存储请求的存储节点集合中的各个节点标识分别所对应的节点。
- 根据权利要求16所述的终端设备,其特征在于,所述确定各个数据分片的备份数目包括:根据下式计算各个数据分片的备份数目:其中,NodesNum为所述点对点网络中的节点总数,BaseNdNum为预设的基准节点数目,HsShardNum为根据历史记录统计得到的在所述点对点网络中存储的数据分片的总数,HsDmgSdNum为根据所述历史记录统计得到的在所述点对点网络中丢失或损毁的数据分片的总数,c为用户等级按照从高到低排列的序号,1≤c≤ClassNum,ClassNum为用户等级的总数,ClassCoef c为第c个用户等级的权重系数,BkpNum c为第c个用户等级的数据分片在所述点对点网络中的备份数目。
- 根据权利要求16所述的终端设备,其特征在于,所述在所述点对点网络中确定与第s个数据分片对应的第1级存储节点包括:使用预设的第一哈希函数计算第s个数据分片的哈希值;将预设的哈希环上与第s个数据分片的哈希值对应的位置点确定目标位置点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,即所述哈希环上的每个位置点均对应于所述第一哈希函数的一个函数值;获取所述哈希环上的各个基准位置点,其中,每个基准位置点均为与所述点对点网络中的一个节点对应的位置点;从所述目标位置点开始顺时针或者逆时针查找所述基准位置点,并将查找到的第一个基准位置点所对应的节点确定为与第s个数据分片对应的第1级存储节点。
- 根据权利要求18所述的终端设备,其特征在于,所述基准位置点的设置过程包括:获取所述点对点网络中的各个节点的身份标识;使用预设的第二哈希函数分别对所述点对点网络中的各个节点的身份标识进行哈 希运算,得到各个节点的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;将所述哈希环上与第m个节点的哈希值对应的位置点确定为与第m个节点对应的基准位置点,1≤m≤NodesNum。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910347818.3 | 2019-04-28 | ||
| CN201910347818.3A CN110099112B (zh) | 2019-04-28 | 2019-04-28 | 基于点对点网络的数据存储方法、装置、介质及终端设备 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020220540A1 true WO2020220540A1 (zh) | 2020-11-05 |
Family
ID=67446019
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/103295 Ceased WO2020220540A1 (zh) | 2019-04-28 | 2019-08-29 | 基于点对点网络的数据存储方法、装置、介质及终端设备 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN110099112B (zh) |
| WO (1) | WO2020220540A1 (zh) |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113794558A (zh) * | 2021-09-16 | 2021-12-14 | 烽火通信科技股份有限公司 | 一种XMSS算法中的L-tree计算方法、装置及系统 |
| CN113868434A (zh) * | 2021-09-28 | 2021-12-31 | 北京百度网讯科技有限公司 | 图数据库的数据处理方法、设备和存储介质 |
| CN114138475A (zh) * | 2021-11-19 | 2022-03-04 | 郑州云海信息技术有限公司 | 一种数据传输负载均衡方法、装置、设备及存储介质 |
| CN115329009A (zh) * | 2022-09-02 | 2022-11-11 | 中国银行股份有限公司 | 一种数据处理方法及装置、电子设备、存储介质 |
| CN121598435A (zh) * | 2026-01-27 | 2026-03-03 | 上海荣数信息技术有限公司 | 一种面向权益交付的短链接后缀高强度随机生成方法及系统 |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110099112B (zh) * | 2019-04-28 | 2022-03-29 | 平安科技(深圳)有限公司 | 基于点对点网络的数据存储方法、装置、介质及终端设备 |
| CN112231398B (zh) * | 2020-09-25 | 2024-07-23 | 北京金山云网络技术有限公司 | 数据存储方法、装置、设备及存储介质 |
| CN116362955A (zh) * | 2022-05-19 | 2023-06-30 | 北京百度网讯科技有限公司 | 图数据存储、访问、处理方法、训练方法、设备及介质 |
| CN119166362B (zh) * | 2024-11-18 | 2025-04-22 | 苏州吉呗思数据技术有限公司 | 数据存储方法、装置、设备、介质和程序产品 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103634401A (zh) * | 2013-12-03 | 2014-03-12 | 北京京东尚科信息技术有限公司 | 一种存储数据副本的方法和终端装置以及服务器装置 |
| US20140281215A1 (en) * | 2011-11-30 | 2014-09-18 | Huawei Technologies Co., Ltd. | Storage method and storage apparatus |
| CN105511801A (zh) * | 2015-11-12 | 2016-04-20 | 长春理工大学 | 数据存储的方法和装置 |
| CN107678688A (zh) * | 2017-09-27 | 2018-02-09 | 柏域信息科技(上海)有限公司 | 一种基于云存储系统中的管理冗余副本的方法、装置和存储介质 |
| CN108062419A (zh) * | 2018-01-06 | 2018-05-22 | 深圳市网心科技有限公司 | 一种文件存储方法、电子设备、系统和介质 |
| CN110099112A (zh) * | 2019-04-28 | 2019-08-06 | 平安科技(深圳)有限公司 | 基于点对点网络的数据存储方法、装置、介质及终端设备 |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101771715B (zh) * | 2008-12-26 | 2014-04-16 | 华为技术有限公司 | 分布式网络构建存储的方法、装置和系统 |
| WO2018119587A1 (zh) * | 2016-12-26 | 2018-07-05 | 深圳前海达闼云端智能科技有限公司 | 数据处理方法、装置、系统及信息采集设备 |
| CN107404541B (zh) * | 2017-09-20 | 2020-08-04 | 苏州浪潮智能科技有限公司 | 一种对等网络传输邻居节点选择的方法及系统 |
| CN107547657A (zh) * | 2017-09-27 | 2018-01-05 | 柏科数据技术(深圳)股份有限公司 | 一种基于云存储系统中单点数据编号的方法、装置以及存储介质 |
| CN108681583A (zh) * | 2018-05-11 | 2018-10-19 | 北京奇虎科技有限公司 | 基于区块链的数据持有证明方法、装置及可读存储介质 |
| GB2574076B (en) * | 2018-09-21 | 2022-07-13 | Nationwide Building Soc | Distributed data storage |
| CN109388351B (zh) * | 2018-12-18 | 2024-11-26 | 平安科技(深圳)有限公司 | 一种分布式数据存储的方法及相关装置 |
-
2019
- 2019-04-28 CN CN201910347818.3A patent/CN110099112B/zh active Active
- 2019-08-29 WO PCT/CN2019/103295 patent/WO2020220540A1/zh not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20140281215A1 (en) * | 2011-11-30 | 2014-09-18 | Huawei Technologies Co., Ltd. | Storage method and storage apparatus |
| CN103634401A (zh) * | 2013-12-03 | 2014-03-12 | 北京京东尚科信息技术有限公司 | 一种存储数据副本的方法和终端装置以及服务器装置 |
| CN105511801A (zh) * | 2015-11-12 | 2016-04-20 | 长春理工大学 | 数据存储的方法和装置 |
| CN107678688A (zh) * | 2017-09-27 | 2018-02-09 | 柏域信息科技(上海)有限公司 | 一种基于云存储系统中的管理冗余副本的方法、装置和存储介质 |
| CN108062419A (zh) * | 2018-01-06 | 2018-05-22 | 深圳市网心科技有限公司 | 一种文件存储方法、电子设备、系统和介质 |
| CN110099112A (zh) * | 2019-04-28 | 2019-08-06 | 平安科技(深圳)有限公司 | 基于点对点网络的数据存储方法、装置、介质及终端设备 |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113794558A (zh) * | 2021-09-16 | 2021-12-14 | 烽火通信科技股份有限公司 | 一种XMSS算法中的L-tree计算方法、装置及系统 |
| CN113794558B (zh) * | 2021-09-16 | 2024-02-27 | 烽火通信科技股份有限公司 | 一种XMSS算法中的L-tree计算方法、装置及系统 |
| CN113868434A (zh) * | 2021-09-28 | 2021-12-31 | 北京百度网讯科技有限公司 | 图数据库的数据处理方法、设备和存储介质 |
| CN114138475A (zh) * | 2021-11-19 | 2022-03-04 | 郑州云海信息技术有限公司 | 一种数据传输负载均衡方法、装置、设备及存储介质 |
| CN115329009A (zh) * | 2022-09-02 | 2022-11-11 | 中国银行股份有限公司 | 一种数据处理方法及装置、电子设备、存储介质 |
| CN121598435A (zh) * | 2026-01-27 | 2026-03-03 | 上海荣数信息技术有限公司 | 一种面向权益交付的短链接后缀高强度随机生成方法及系统 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110099112B (zh) | 2022-03-29 |
| CN110099112A (zh) | 2019-08-06 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2020220540A1 (zh) | 基于点对点网络的数据存储方法、装置、介质及终端设备 | |
| CN110489405B (zh) | 数据处理的方法、装置和服务器 | |
| US11627207B2 (en) | Systems and methods for data deduplication by generating similarity metrics using sketch computation | |
| CN110347651B (zh) | 基于云存储的数据同步方法、装置、设备及存储介质 | |
| US11650990B2 (en) | Method, medium, and system for joining data tables | |
| US11245774B2 (en) | Cache storage for streaming data | |
| CN110570311A (zh) | 区块链的共识方法、装置及设备 | |
| US11995050B2 (en) | Systems and methods for sketch computation | |
| US12423307B1 (en) | System and method for storing data for, and providing, rapid database join functions and aggregation statistics | |
| US20150278543A1 (en) | System and Method for Optimizing Storage of File System Access Control Lists | |
| CN113282941A (zh) | 获取对象标识的方法、装置、电子设备及存储介质 | |
| US20210191640A1 (en) | Systems and methods for data segment processing | |
| WO2021114025A1 (zh) | 增量数据确定方法、确定装置、服务器及终端设备 | |
| CN115203255B (zh) | 数据查询方法、装置、电子设备及存储介质 | |
| CN116303343A (zh) | 数据分片方法、装置、电子设备及存储介质 | |
| CN104956340B (zh) | 可扩展数据重复删除 | |
| CN117875425A (zh) | 一种神经网络模型的推理方法、装置及相关设备 | |
| US11151128B2 (en) | Data partitioning and transfer system | |
| US20170316024A1 (en) | Extended attribute storage | |
| CN112799978A (zh) | 缓存设计管理方法、装置、设备和计算机可读存储介质 | |
| US11308038B2 (en) | Copying container images | |
| CN115510067A (zh) | 一种元数据存储方法、装置及数据库 | |
| CN115391581A (zh) | 索引创建、图像存储、图像检索方法、装置及电子设备 | |
| CN116795790A (zh) | 小文件合并的方法、装置、电子设备及存储介质 | |
| US9824105B2 (en) | Adaptive probabilistic indexing with skip lists |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19927451 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19927451 Country of ref document: EP Kind code of ref document: A1 |




