Distributed data restorative procedure, device, network node and storage medium
Technical field
The present invention relates to distributed technical field more particularly to a kind of distributed data restorative procedures, device, network node
And storage medium.
Background technique
Distributed memory system generally uses the distributed storage strategy of more copies, is guaranteed by more copy redundant storages
The reliability of data.For example, initial data can be stored therein on a back end using 3 parts of copy storages, and
Other 2 parts of copies are stored on other back end.
But after disk failures or nodes break down cause copy to be lost, needs to rely on subsequent user and read behaviour
Make triggering to repair, failure copy can not be repaired in time.When the dsc data that the data and non-user of loss often access
In the case of, then this data will keep the insufficient state of copy for a long time.And in this section of longer time, if other nodes or magnetic
Disk failure causes other copy to be lost, then will lead to loss of data can not access, thus the reliability of data you can't get
Guarantee.
Therefore, it is necessary to provide a kind of new strategy, nothing is lost to solve copy in acentric distributed memory system
The technical issues of method is quickly repaired.
Summary of the invention
The main purpose of the present invention is to provide a kind of distributed data restorative procedure, device, network node and storages to be situated between
Matter, it is intended to the technical issues of copy loss can not be repaired quickly in acentric distributed memory system is solved, so as to number of copies
When amount is reduced, quickly copy can be repaired, the quantity of copy is maintained to balance, to guarantee acentric distributed number
According to reliability.
To achieve the above object, the first aspect of the present invention provides a kind of distributed data restorative procedure, is applied to storage
Have in the first network node of copy, the first network node is stored with the second network node and extremely of copy at least one
The few one not stored third network node communication for having copy, which comprises
Whether the quantity for detecting the copy is reduced;
When the quantity of the copy is reduced, target network section is filtered out from least one described third network node
Point;
The copy target network node is sent to according to default reparation rule to store to complete the pair
This reparation.
According to a preferred embodiment of the present invention, whether the quantity of the detecting copy, which is reduced, includes:
Periodically inquire the first quantity of the copy at least one described second network node;
Judge whether first quantity is less than preset quantity threshold value;
When first quantity is less than or equal to the preset quantity threshold value, determine that the quantity of the copy is reduced;
When first quantity is greater than preset quantity threshold value, determine that the quantity of the copy is not reduced.
According to a preferred embodiment of the present invention, described to filter out target from least one described third network node
Network node includes:
Obtain the network topology and linkage length in pre-stored routing table;
According to the network topology and linkage length using default route selection algorithm calculate the first network node with
The path of at least one third network node;
The corresponding third network node of shortest path in the path is filtered out as target network node.
According to a preferred embodiment of the present invention, described that the copy is sent to by institute according to the default reparation rule
Stating target network node includes:
The network node that copy loss does not occur in the first network node and second network node is arranged
Sequence;
Judge whether the first network node is the network node of sequence up front;
When determining the first network node is the network node of sequence up front, the copy is sent to described
Target network node;
When determining the first network node not is the network node of sequence up front, stop waiting polling cycle.
According to a preferred embodiment of the present invention, after the stopping waits polling cycle, the method also includes:
It detects and whether has been stored with the copy in the target network node;
When in the target network node it is not stored have the copy when, the copy is sent to the target network section
Point.
According to a preferred embodiment of the present invention, the polling cycle is determining in the following manner:
Calculate the second quantity of network node of the sequence before the first network node;
The corresponding first object duration of second quantity is determined according to quantity and the corresponding relationship of duration;
Using the first object duration as polling cycle.
It according to a preferred embodiment of the present invention, is being the net of sequence up front when the determining first network node
When network node, after the copy is sent to the target network node, the method also includes:
Calculate the third quantity that the network node of copy loss does not occur in second network node;
The corresponding second target duration of the third quantity is determined according to quantity and the corresponding relationship of duration;
It detects and whether has stored the copy in the target network node after the second target duration;
When in the target network node it is not stored have the copy when, the copy is sent to the target network again
Network node.
To achieve the above object, the second aspect of the present invention provides a kind of distributed data prosthetic device, runs on storage
Have in the first network node of copy, the first network node is stored with the second network node and extremely of copy at least one
The few one not stored third network node communication for having copy, described device include:
Whether detecting module, the quantity for detecting the copy are reduced;
Screening module, for being screened from least one described third network node when the reduction of the quantity of the copy
Target network node out;
Sending module is stored for the copy to be sent to the target network node according to default reparation rule
To complete the reparation of the copy.
To achieve the above object, the third aspect of the present invention provides a kind of network node, and the network node includes storage
Device and processor are stored with the downloading program for the distributed data reparation that can be run on the processor on the memory,
The distributed data restorative procedure is realized when the downloading program of the distributed data reparation is executed by the processor.
To achieve the above object, the fourth aspect of the present invention provides a kind of computer readable storage medium, the computer
The downloading program of distributed data reparation is stored on readable storage medium storing program for executing, the downloading program of the distributed data reparation can quilt
One or more processor is executed to realize the distributed data restorative procedure.
Distributed data restorative procedure, device, network node and storage medium described in the embodiment of the present invention, by real-time
When detecting the quantity reduction of copy, target network section is filtered out from least one not stored third network node for having copy
Point;The copy target network node is sent to according to default reparation rule to store to complete repairing for the copy
It is multiple.Based on the characteristic of the complete decentralization of DHT network, so that some network node breaks down when copy being caused to be lost, energy
Copy is quickly enough sent to other network nodes to store, to maintain the balance of copy amount in DHT network, to protect
Demonstrate,prove the reliability of acentric distributed data;Further, since the technical solution of the distributed data reparation goes to center completely
Change, does not need deployment central server, be greatly saved server resource, further reduced acentric distributed system
Maintenance cost.
Detailed description of the invention
Fig. 1 is the flow diagram of the distributed data restorative procedure of first embodiment of the invention;
Fig. 2 is the DHT schematic network structure of the embodiment of the present invention;
Fig. 3 is the structural schematic diagram of the distributed data prosthetic device of second embodiment of the invention;
Fig. 4 is the schematic diagram of internal structure for the network node that third embodiment of the invention discloses.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not
For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work
Every other embodiment obtained is put, shall fall within the protection scope of the present invention.
The description and claims of this application and term " first " in above-mentioned attached drawing, are for distinguishing at " second "
Similar object, without being used to describe a particular order or precedence order.It should be understood that the data used in this way are in appropriate feelings
It can be interchanged under condition, so that the embodiments described herein can be real with the sequence other than the content for illustrating or describing herein
It applies.In addition, term " includes " and " having " and their any deformation, it is intended that cover it is non-exclusive include, for example, packet
The process, method, system, product or equipment for having contained a series of steps or units those of be not necessarily limited to be clearly listed step or
Unit, but may include other steps being not clearly listed or intrinsic for these process, methods, product or equipment or
Unit.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and cannot
It is interpreted as its relative importance of indication or suggestion or implicitly indicates the quantity of indicated technical characteristic.Define as a result, " the
One ", the feature of " second " can explicitly or implicitly include at least one of the features.In addition, the skill between each embodiment
Art scheme can be combined with each other, but must be based on can be realized by those of ordinary skill in the art, when technical solution
Will be understood that the combination of this technical solution is not present in conjunction with there is conflicting or cannot achieve when, also not the present invention claims
Protection scope within.
Embodiment one
As shown in Figure 1, the flow chart of the distributed data restorative procedure provided for the embodiment of the present invention one.
The distributed data restorative procedure is applied to be stored in the first network node of copy, specifically includes following step
Suddenly, the sequence of step can change in the flow chart according to different requirements, and certain steps can be omitted.
Whether S11, the quantity for detecting copy are reduced.
Network node in the present embodiment refers to distributed hashtable (Distributed Hash Table, DHT) network
In node.The network node can be client, is also possible to server, does not do any restrictions herein.
The DHT is a kind of distributed storage method, in the case where not needing deployment central server, each network section
Point is responsible for a small-scale routing, and is responsible for storage sub-fraction data, to realize the addressing of entire DHT network and deposit
Storage.It can mutually be communicated between the all-network node being added in DHT network, any one network node can find DHT
The network node being newly added in network, it has also been discovered that whether original network node in DHT network breaks down.In order to
Guarantee the reliability of data, is all stored with copy in multiple network nodes in DHT network, i.e., by data with the shape of multiple copies
Formula is stored in multiple network nodes, and so can guarantee leads to be stored in the network node when some network node breaks down
In copy occur lose or damage when, failure copy can be repaired by being stored with other network nodes of copy
It is multiple.
It should be noted that the network of copy will be stored in DHT network for the ease of the succinct and clear of subsequent descriptions
Node is referred to as first network node, and using any one network node in first network node as institute of the embodiment of the present invention
The executing subject for the distributed data restorative procedure stated, other network nodes for being stored with copy in addition to this are then referred to as the
The not stored network node for having copy is referred to as third network node by two network nodes.
Refering to DHT network shown in Fig. 2, the network node being added in DHT network has: network node A, network node B, net
Network node C, network node D, network node E, network node F.Wherein, in network node A, network node B and network node F
It is stored with copy.Which network node any one of DHT network network node, which can be known in, is stored with copy.
In an alternative embodiment, whether the quantity of the detecting copy, which is reduced, includes:
Periodically inquire the first quantity of the copy at least one described second network node;
Judge whether first quantity is less than preset quantity threshold value;
When first quantity is less than or equal to the preset quantity threshold value, determine that the quantity of the copy is reduced;
When first quantity is greater than preset quantity threshold value, determine that the quantity of the copy is not reduced.
In the present embodiment, since first network node can know the information of other network nodes in DHT network, example
Such as, which network node is stored with copy, which network node is not stored copy, is stored with the quantity of the network node of copy
Deng.First network node can periodically inquire the first quantity of the copy in second network node, and in copy reparation
In the process, the quantity of copy will increase again, thus by judging whether the first quantity is less than preset quantity threshold value and can determine pair
Whether this quantity is reduced.
S12 filters out target network section from least one third network node when the quantity of the copy is reduced
Point.
Copy in the present embodiment, when the quantity of the copy is reduced, at least one possible second network node
It is lost, is never stored in the third network node of copy and filters out a target network node, be based on the target network
Node carries out the reparation of copy, to maintain the balance of the copy amount in DHT network.Illustratively, it is assumed that network node B hair
Raw failure, such as go offline, when the copy in network node B being caused to be lost, other network nodes (A, C, D, E and F) can be known
Copy in network node B is lost, and knows that the copy amount in DHT network becomes 2.
In an alternative embodiment, described to filter out target network section from least one described third network node
It puts and includes:
Obtain the network topology and linkage length in pre-stored routing table;
According to the network topology and linkage length using default route selection algorithm calculate the first network node with
The path of at least one third network node;
The corresponding third network node of shortest path in the path is filtered out as target network node.
In a computer network, routing table (routing table) or routing information base (Routing
Information Base, RIB), it is the electrical form being stored in router or Net-connected computer (file) or class
Database.The path that routing table stores direction particular network address (in some cases, also records the route metric for having path
Value).Contain the topology information of network perimeter in routing table.The main target that routing table is established is to realize Routing Protocol and quiet
State Route Selection.It may include network topology and linkage length, such as purpose network address, network of relation section in the routing table
Point, to certain paths satisfaction, expectation path information, purpose network, mask, metric, administrative distance, address etc..
The default route selection algorithm can for bellman-ford algorithm or dijkstra's algorithm or other
What calculates the algorithm in path, and the present invention does not do any restrictions herein.
It is calculated between the third network node in first network node and DHT network by default route selection algorithm
Behind path, that is, it can determine the third network node apart from first network node shortest path, and the third network that will be determined
Node is as target network node.
Copy is sent to the target network node according to default reparation rule and stored to complete the pair by S13
This reparation.
In the present embodiment, after having filtered out a target network node at least one third network node,
Copy can be sent to target network node by one network node.The target network node is deposited after receiving the copy
Storage, is repaired with the copy to loss, to ensure that the copy amount in DHT network remains unchanged.
In an alternative embodiment, described that the copy is sent to by the target according to the default reparation rule
Network node includes:
The network node that copy loss does not occur in the first network node and second network node is arranged
Sequence;
Judge whether the first network node is the network node of sequence up front;
When determining the first network node is the network node of sequence up front, the copy is sent to described
Target network node;
When determining the first network node not is the network node of sequence up front, stop waiting polling cycle.
If network node A and network node F while sticking patch, it will cause copy and become more or copy maintenance confusion.
Needing to coordinate network node A and network node F to send copy at this time with staggering time section not stored has copy to other
Network node.But network node A and network node F by mutually send out message coordination will cause efficiency reduction, especially when
Largely network nodes need to carry out universal time coordinated efficiency lower, or even cause biggish bandwidth cost.At this point it is possible to be based on network section
The mark of point establishes reparation rule, sends copy according to the reparation rule established.
It can be according to pre-set ordering rule to not sent out in the first network node and second network node
The network node that raw copy is lost is ranked up, for example, being ranked up according to node identification.Illustratively, it is assumed that network node A
First identifier be a, the first identifier of network node B is b, and the first identifier of network node C is c, the first mark of network node D
Knowing is d, and the first identifier of network node E is e, and the first identifier of network node F is f, wherein the size order identified are as follows: a <b <
C < d < e < f, the network node for being stored with copy is network node A, network node B, network node F, the target network filtered out
Node is network node E.If network node A has found that the copy in network node B is lost, due to the mark of network node A
Minimum, then the copy for being stored in itself is sent to network node E by network node A.If network node F has found network node B
In copy when losing, due to the mark of network node F be not it is minimum, then after network node F needs to wait a polling cycle
The copy for being stored in itself is sent to network node E.
Further, after the stopping waits polling cycle, the method also includes:
It detects and whether has been stored with the copy in the target network node;
When in the target network node it is not stored have the copy when, the copy is sent to the target network section
Point.
After first network node waits a polling cycle, the copy for being stored in itself is being sent to target network section
Before point, need first to judge whether be stored with copy in the target network node.When in the target network node
It has been stored with copy, has shown that the copy for there are other network nodes to be stored in itself has been sent to target network node and institute
It states target network node successfully to store, the copy in DHT network has had reached balance, then first network node is without again
Copy is sent to target network node, the number of copies quantitative change that otherwise will lead in DHT network is more.When in the target network node
It is not stored to have copy, show there are other network nodes that the copy for being stored in itself is not sent to target network node, or
Though other network nodes by the copy for being stored in itself be sent to target network node the target network node not at
Function storage, then first network node needs to send copy to target network node, guarantees that the copy in DHT network reaches flat with this
Weighing apparatus.
In an alternative embodiment, the polling cycle is determining in the following manner:
Calculate the second quantity of network node of the sequence before the first network node;
The corresponding first object duration of second quantity is determined according to quantity and the corresponding relationship of duration;
Using the first object duration as polling cycle.
In the present embodiment, in order to avoid meaningless waiting, the waiting time can be calculated according to the mark in network node
To be polled.It identifies smaller, sends copy to target network node with higher priority, identify bigger, have
Lower priority sends copy to target network node.
The corresponding relationship between quantity and duration is pre-set, quantity is bigger, and corresponding duration is longer, and quantity is smaller,
Corresponding duration is shorter.When the quantity for the second network node before first network node of determining to sort, that is, can determine
Polling cycle out first sends copy to target network node to wait other to be stored with the network node of copy.
It further, will be described when determining the first network node is sequence network node up front
Copy is sent to after the target network node, the method also includes:
Calculate the third quantity that the network node of copy loss does not occur in second network node;
The corresponding second target duration of the third quantity is determined according to quantity and the corresponding relationship of duration;
It detects and whether has stored the copy in the target network node after the second target duration;
When in the target network node it is not stored have the copy when, the copy is sent to the target network again
Network node.
In the present embodiment, since first network node sequencing is up front (for example, corresponding first identifier is the smallest mark
Know), there is the first network node highest priority the copy of storage is sent to the target network node, but
There may be the case where target network node does not receive copy or the target network node receive copy but
The case where storing the copy not successfully is waiting all the second network node copies for being stored with copy to be sent to institute at this time
It states target network node and then secondary judges whether be stored with copy in the target network node.
It should be noted that the technical solution of above-described embodiment is primarily adapted for use in the hair of the copy in second network node
Raw the case where losing, when the copy for having multiple second network nodes while when losing, without the network node in DHT network
Between coordinated, be that the second net that copy is lost occurs in each according to certain strategy using poll thought of the invention
Network node distributes copy repair time, reduces the Cost for Coordination between the network node in DHT network, saves bandwidth,
It prevents when copy is repaired between multinode and the phenomenon that confusion occurs.
In conclusion distributed data restorative procedure described in the embodiment of the present invention, passes through the quantity of detecting real-time copy
When reduction, target network node is filtered out from least one not stored third network node for having copy;According to default reparation
The copy is sent to the target network node and stored to complete the reparation of the copy by rule.Based on DHT network
The characteristic of complete decentralization, so that some network node breaks down when copy being caused to be lost, it can be quickly by copy
It is sent to other network nodes to be stored, to maintain the balance of copy amount in DHT network, to guarantee acentric distribution
The reliability of formula data;Further, since the complete decentralization of technical solution of the distributed data reparation, does not need in deployment
Central server is greatly saved server resource, further reduced the maintenance cost of acentric distributed system.
Embodiment two
As shown in fig.3, the functional block diagram of the distributed data prosthetic device disclosed for the embodiment of the present invention.
In some embodiments, the distributed data prosthetic device 30 is run in network node.The distribution number
It may include multiple functional modules as composed by program code segments according to prosthetic device 30.The distributed data prosthetic device 30
In the program code of each program segment can store in the memory of network node, and by least one described processor institute
It executes, the reparation with execution (being detailed in Fig. 1 description) to distributed data.
In the present embodiment, function of the distributed data prosthetic device 30 according to performed by it can be divided into more
A functional module.The functional module may include: detecting module 301, screening module 302, sending module 303 and computing module
304.The so-called module of the present invention, which refers to, a kind of performed by least one processor and can complete fixed function
Series of computation machine program segment, storage is in memory.It in the present embodiment, will be in subsequent reality about the function of each module
It applies in example and is described in detail.
Whether detecting module 301, the quantity for detecting copy are reduced.
Network node in the present embodiment refers to distributed hashtable (Distributed Hash Table, DHT) network
In node.The network node can be client, is also possible to server, does not do any restrictions herein.
The DHT is a kind of distributed storage method, in the case where not needing deployment central server, each network section
Point is responsible for a small-scale routing, and is responsible for storage sub-fraction data, to realize the addressing of entire DHT network and deposit
Storage.It can mutually be communicated between the all-network node being added in DHT network, any one network node can find DHT
The network node being newly added in network, it has also been discovered that whether original network node in DHT network breaks down.In order to
Guarantee the reliability of data, is all stored with copy in multiple network nodes in DHT network, i.e., by data with the shape of multiple copies
Formula is stored in multiple network nodes, and so can guarantee leads to be stored in the network node when some network node breaks down
In copy occur lose or damage when, failure copy can be repaired by being stored with other network nodes of copy
It is multiple.
It should be noted that the network of copy will be stored in DHT network for the ease of the succinct and clear of subsequent descriptions
Node is referred to as first network node, and using any one network node in first network node as institute of the embodiment of the present invention
The executing subject for the distributed data restorative procedure stated, other network nodes for being stored with copy in addition to this are then referred to as the
The not stored network node for having copy is referred to as third network node by two network nodes.
Refering to DHT network shown in Fig. 2, the network node being added in DHT network has: network node A, network node B, net
Network node C, network node D, network node E, network node F.Wherein, in network node A, network node B and network node F
It is stored with copy.Which network node any one of DHT network network node, which can be known in, is stored with copy.
In an alternative embodiment, whether the quantity that the detecting module 301 detects copy, which is reduced, includes:
Periodically inquire the first quantity of the copy at least one described second network node;
Judge whether first quantity is less than preset quantity threshold value;
When first quantity is less than or equal to the preset quantity threshold value, determine that the quantity of the copy is reduced;
When first quantity is greater than preset quantity threshold value, determine that the quantity of the copy is not reduced.
In the present embodiment, since first network node can know the information of other network nodes in DHT network, example
Such as, which network node is stored with copy, which network node is not stored copy, is stored with the quantity of the network node of copy
Deng.First network node can periodically inquire the first quantity of the copy in second network node, and in copy reparation
In the process, the quantity of copy will increase again, thus by judging whether the first quantity is less than preset quantity threshold value and can determine pair
Whether this quantity is reduced.
Screening module 302, for being filtered out from least one third network node when the reduction of the quantity of the copy
Target network node.
Copy in the present embodiment, when the quantity of the copy is reduced, at least one possible second network node
It is lost, is never stored in the third network node of copy and filters out a target network node, be based on the target network
Node carries out the reparation of copy, to maintain the balance of the copy amount in DHT network.Illustratively, it is assumed that network node B hair
Raw failure, such as go offline, when the copy in network node B being caused to be lost, other network nodes (A, C, D, E and F) can be known
Copy in network node B is lost, and knows that the copy amount in DHT network becomes 2.
In an alternative embodiment, the screening module 302 is screened from least one described third network node
Target network node includes: out
Obtain the network topology and linkage length in pre-stored routing table;
According to the network topology and linkage length using default route selection algorithm calculate the first network node with
The path of at least one third network node;
The corresponding third network node of shortest path in the path is filtered out as target network node.
In a computer network, routing table (routing table) or routing information base (Routing
Information Base, RIB), it is the electrical form being stored in router or Net-connected computer (file) or class
Database.The path that routing table stores direction particular network address (in some cases, also records the route metric for having path
Value).Contain the topology information of network perimeter in routing table.The main target that routing table is established is to realize Routing Protocol and quiet
State Route Selection.It may include network topology and linkage length, such as purpose network address, network of relation section in the routing table
Point, to certain paths satisfaction, expectation path information, purpose network, mask, metric, administrative distance, address etc..
The default route selection algorithm can for bellman-ford algorithm or dijkstra's algorithm or other
What calculates the algorithm in path, and the present invention does not do any restrictions herein.
It is calculated between the third network node in first network node and DHT network by default route selection algorithm
Behind path, that is, it can determine the third network node apart from first network node shortest path, and the third network that will be determined
Node is as target network node.
Sending module 303 is stored for copy to be sent to the target network node according to default reparation rule
To complete the reparation of the copy.
In the present embodiment, after having filtered out a target network node at least one third network node,
Copy can be sent to target network node by one network node.The target network node is deposited after receiving the copy
Storage, is repaired with the copy to loss, to ensure that the copy amount in DHT network remains unchanged.
In an alternative embodiment, the sending module 303 sends out the copy according to the default reparation rule
It send to the target network node and includes:
The network node that copy loss does not occur in the first network node and second network node is arranged
Sequence;
Judge whether the first network node is the network node of sequence up front;
When determining the first network node is the network node of sequence up front, the copy is sent to described
Target network node;
When determining the first network node not is the network node of sequence up front, stop waiting polling cycle.
If network node A and network node F while sticking patch, it will cause copy and become more or copy maintenance confusion.
Needing to coordinate network node A and network node F to send copy at this time with staggering time section not stored has copy to other
Network node.But network node A and network node F by mutually send out message coordination will cause efficiency reduction, especially when
Largely network nodes need to carry out universal time coordinated efficiency lower, or even cause biggish bandwidth cost.At this point it is possible to be based on network section
The mark of point establishes reparation rule, sends copy according to the reparation rule established.
It can be according to pre-set ordering rule to not sent out in the first network node and second network node
The network node that raw copy is lost is ranked up, for example, being ranked up according to node identification.Illustratively, it is assumed that network node A
First identifier be a, the first identifier of network node B is b, and the first identifier of network node C is c, the first mark of network node D
Knowing is d, and the first identifier of network node E is e, and the first identifier of network node F is f, wherein the size order identified are as follows: a <b <
C < d < e < f, the network node for being stored with copy is network node A, network node B, network node F, the target network filtered out
Node is network node E.If network node A has found that the copy in network node B is lost, due to the mark of network node A
Minimum, then the copy for being stored in itself is sent to network node E by network node A.If network node F has found network node B
In copy when losing, due to the mark of network node F be not it is minimum, then after network node F needs to wait a polling cycle
The copy for being stored in itself is sent to network node E.
Further, after the stopping waits polling cycle, the detecting module 301 is also used to detect the target network
Whether the copy has been stored in network node;
The sending module 303, be also used to when in the target network node it is not stored have the copy when, by the pair
Originally it is sent to the target network node.
After first network node waits a polling cycle, the copy for being stored in itself is being sent to target network section
Before point, need first to judge whether be stored with copy in the target network node.When in the target network node
It has been stored with copy, has shown that the copy for there are other network nodes to be stored in itself has been sent to target network node and institute
It states target network node successfully to store, the copy in DHT network has had reached balance, then first network node is without again
Copy is sent to target network node, the number of copies quantitative change that otherwise will lead in DHT network is more.When in the target network node
It is not stored to have copy, show there are other network nodes that the copy for being stored in itself is not sent to target network node, or
Though other network nodes by the copy for being stored in itself be sent to target network node the target network node not at
Function storage, then first network node needs to send copy to target network node, guarantees that the copy in DHT network reaches flat with this
Weighing apparatus.
In an alternative embodiment, the polling cycle is determining in the following manner:
Calculate the second quantity of network node of the sequence before the first network node;
The corresponding first object duration of second quantity is determined according to quantity and the corresponding relationship of duration;
Using the first object duration as polling cycle.
In the present embodiment, in order to avoid meaningless waiting, the waiting time can be calculated according to the mark in network node
To be polled.It identifies smaller, sends copy to target network node with higher priority, identify bigger, have
Lower priority sends copy to target network node.
The corresponding relationship between quantity and duration is pre-set, quantity is bigger, and corresponding duration is longer, and quantity is smaller,
Corresponding duration is shorter.When the quantity for the second network node before first network node of determining to sort, that is, can determine
Polling cycle out first sends copy to target network node to wait other to be stored with the network node of copy.
It further, will be described when determining the first network node is sequence network node up front
Copy is sent to after the target network node, described device further include:
Computing module 304, for calculating the third that the network node of copy loss does not occur in second network node
Quantity;The corresponding second target duration of the third quantity is determined according to quantity and the corresponding relationship of duration;
The detecting module 301, be also used to detect after the second target duration in the target network node whether
The copy is stored;
The sending module 303, be also used to when in the target network node it is not stored have the copy when, by the pair
This is sent to the target network node again.
In the present embodiment, since first network node sequencing is up front (for example, corresponding first identifier is the smallest mark
Know), there is the first network node highest priority the copy of storage is sent to the target network node, but
There may be the case where target network node does not receive copy or the target network node receive copy but
The case where storing the copy not successfully is waiting all the second network node copies for being stored with copy to be sent to institute at this time
It states target network node and then secondary judges whether be stored with copy in the target network node.
It should be noted that the technical solution of above-described embodiment is primarily adapted for use in the hair of the copy in second network node
Raw the case where losing, when the copy for having multiple second network nodes while when losing, without the network node in DHT network
Between coordinated, be that the second net that copy is lost occurs in each according to certain strategy using poll thought of the invention
Network node distributes copy repair time, reduces the Cost for Coordination between the network node in DHT network, saves bandwidth,
It prevents when copy is repaired between multinode and the phenomenon that confusion occurs.
In conclusion distributed data prosthetic device described in the embodiment of the present invention, passes through the quantity of detecting real-time copy
When reduction, target network node is filtered out from least one not stored third network node for having copy;According to default reparation
The copy is sent to the target network node and stored to complete the reparation of the copy by rule.Based on DHT network
The characteristic of complete decentralization, so that some network node breaks down when copy being caused to be lost, it can be quickly by copy
It is sent to other network nodes to be stored, to maintain the balance of copy amount in DHT network, to guarantee acentric distribution
The reliability of formula data;Further, since the complete decentralization of technical solution of the distributed data reparation, does not need in deployment
Central server is greatly saved server resource, further reduced the maintenance cost of acentric distributed system.
Embodiment three
Fig. 4 is the schematic diagram of internal structure for the network node that the embodiment of the present invention discloses.
In the present embodiment, network node 4 can be client, be also possible to server, can also be that other electronics are set
It is standby.
The network node 4 may include memory 41, processor 42 and bus 43.
Wherein, memory 41 include at least a type of readable storage medium storing program for executing, the readable storage medium storing program for executing include flash memory,
Hard disk, multimedia card, card-type memory (for example, SD or DX memory etc.), magnetic storage, disk, CD etc..Memory 41
It can be the internal storage unit of the network node 4, such as the hard disk of the network node 4 in some embodiments.Storage
Device 41 is also possible to the External memory equipment of the network node 4 in further embodiments, such as matches on the network node 4
Standby plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD)
Card, flash card (Flash Card) etc..Further, memory 41 can also both include the storage inside of the network node 4
Unit also includes External memory equipment.Memory 41 can be not only used for the application application that storage is installed on the network node 4
Program and Various types of data, such as the code etc. and modules of distributed data prosthetic device 30, can be also used for temporarily depositing
Store up the data that has exported or will export.
Processor 42 can be in some embodiments a central processing unit (Central Processing Unit,
CPU), controller, microcontroller, microprocessor or other data processing chips, the downloading for being stored in run memory 41
Program or processing data.
The bus 43 can be Peripheral Component Interconnect standard (peripheral component interconnect, PCI)
Bus or expanding the industrial standard structure (extended industry standard architecture, EISA) bus etc..It should
Bus can be divided into address bus, data/address bus, control bus etc..Only to be indicated with a thick line in Fig. 4 convenient for indicating, but
It is not offered as only a bus or a type of bus.
Further, the network node 4 can also include network interface, and network interface optionally may include wired connects
Mouthful and/or wireless interface (such as WI-FI interface, blue tooth interface), commonly used in the network node 4 and other network nodes it
Between establish communication connection.
Optionally, the network node 4 can also include user interface, user interface may include display (Display),
Input unit such as keyboard (Keyboard), optional user interface can also include standard wireline interface and wireless interface.It can
Selection of land, in some embodiments, display can be light-emitting diode display, liquid crystal display, touch-control liquid crystal display and OLED
(Organic Light-Emitting Diode, Organic Light Emitting Diode) touches device etc..Wherein, display can also be appropriate
Referred to as display screen or display unit, for showing the message handled in the network node and for showing visual use
Family interface.
Fig. 4 illustrates only the network node 4 with component 41-43, it will be appreciated by persons skilled in the art that figure
Structure shown in 4 does not constitute the restriction to the network node 4, either bus topology, is also possible to star structure,
The network node 4 can also include perhaps combining certain components or different portions than illustrating less perhaps more components
Part arrangement.Other electronic products that are existing or being likely to occur from now on are such as adaptable to the present invention, should also be included in of the invention
Within protection scope, and it is incorporated herein by reference.
In the above-described embodiments, can come wholly or partly by application program, hardware, firmware or any combination thereof
It realizes.When being realized using application program, can entirely or partly realize in the form of a computer program product.
The computer program product includes one or more computer instructions.Load and execute on computers the meter
When calculation machine program instruction, entirely or partly generate according to process or function described in the embodiment of the present invention.The computer can
To be general purpose computer, special purpose computer, computer network or other programmable devices.The computer instruction can be deposited
Storage in a computer-readable storage medium, or from a computer readable storage medium to another computer readable storage medium
Transmission, for example, the computer instruction can pass through wired (example from a web-site, computer, server or data center
Such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as infrared, wireless, microwave) mode to another website
Website, computer, server or data center are transmitted.The computer readable storage medium can be computer and can deposit
Any usable medium of storage either includes that the data storages such as one or more usable mediums integrated server, data center are set
It is standby.The usable medium can be magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or partly lead
Body medium (such as solid state hard disk Solid State Disk (SSD)) etc..
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unit
It closes or communicates to connect, can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also be realized in the form of function of application unit.
If the integrated unit realized in the form of function of application unit and as independent product sale or
In use, can store in a computer readable storage medium.Based on this understanding, the technical solution sheet of the application
The all or part of the part that contributes to existing technology or the technical solution can be produced in other words with application program in matter
The form of product embodies, which is stored in a storage medium, including some instructions are to make
It obtains a network node (can be personal computer, server or the network equipment etc.) and executes each embodiment institute of the application
State all or part of the steps of method.And storage medium above-mentioned includes: USB flash disk, hard disk, read-only memory (ROM, Read-Only
Memory), random access memory (RAM, Random Access Memory), magnetic or disk etc. are various can store journey
The medium of sequence code.
It should be noted that the serial number of the above embodiments of the invention is only for description, do not represent the advantages or disadvantages of the embodiments.And
The terms "include", "comprise" herein or any other variant thereof is intended to cover non-exclusive inclusion, so that packet
Process, device, article or the method for including a series of elements not only include those elements, but also including being not explicitly listed
Other element, or further include for this process, device, article or the intrinsic element of method.Do not limiting more
In the case where, the element that is limited by sentence "including a ...", it is not excluded that including process, device, the article of the element
Or there is also other identical elements in method.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.