DHT 节点 ID 生成?
我刚刚开始研究 DHT 实现和理论,并专注于节点启动并连接到网络时如何生成节点 id。我读到 ID 是来自某些哈希范围的随机哈希,但是它是唯一的哈希吗?哈希生成的数据是否接近该节点存储的数据?帮我解决这个问题。
I just start studying DHT implementation and theory and stuck on on part, how generates node id when node startup and connect to network. I read that ID is random hash from some hashes range but, is it unique hash? and is hash generates close no the data which this node store? Help me with this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在大的值空间上使用良好的散列函数自行生成节点 ID 是 DHT/P2P 系统中使用的常用技术。由于哈希保证了良好的随机分布,因此发生冲突的概率很小。从统计上看,ID(几乎总是)是唯一的。
该哈希值独立于节点存储的数据。
Self-generation of the node ID using a good hash function over a large space of values is a common technique used in DHT/P2P systems. Since the hash guarantees good random distribution, the probability of a collision is very small. Statistically, the ID will (almost always) be unique.
That hash is independent from the data stored of the node.
正如前面的答案中所述,节点的 ID 是通过对其 IP 地址进行散列生成的(一般来说,DHT 中就是这种情况,例如 Chord) 或其他唯一可识别信息。
由于它在节点加入或离开 n 网络时使用一致性哈希,因此仅
1/n
密钥需要重新映射,因此它适合高度动态的网络拓扑,例如点对点。从技术上讲,生成的哈希并不传达有关存储在该节点上的数据的任何信息。相反,某个键(或数据存储中的条目,如果用于此目的)的散列源自对关键字(或文件名或文件内容)进行散列。
作为一致性哈希的直接结果,出现了键之间距离的抽象概念。 (如此处所述)节点拥有其标识密钥 (ID) 的所有密钥根据距离度量最接近。
As said in the previous answers, the ID of a node is generated by hashing it's IP address (generally speaking, such is the case in a DHT like Chord) or other uniquely identifiable information.
And since it uses Consistent Hashing when a node will join or leave the n-network, only
1/n
keys needs to be remapped, thus it lends itself to highly dynamic network topologies, such as peer-to-peer.Technically, the hash generated doesn't convey any information about the data that is stored on this node. Rather the hash for a certain key (or entry in a data store, if used for such purpose) originates from hashing the keyword (or the filename or the file contents).
As a direct consequence of the Consistent Hashing, the abstract concept of distance between keys emerges. (As stated here) A node owns all the keys for which its identifying key (ID) is the closest to according to the distance metric.