IPFS将所有数据存储在哪里? [英] Where does IPFS store all the data?

查看:746
本文介绍了IPFS将所有数据存储在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试实现和理解IPFS的工作,并且有一些不清楚的地方.

I've been trying to implement and understand the working of IPFS and have a few things that aren't clear.

我尝试过的事情:
在我的系统上实现了IPFS并在其上存储了文件.即使我从系统中删除文件并关闭ipfs守护程序,我仍然能够通过IPFS从其他计算机访问文件.
我注意到主目录中有一个 .ipfs 文件夹,其中包含我添加到IPFS的部分数据块.

Things i've tried:
Implemented IPFS on my system and stored files on it. Even if I delete the files from my system and close the ipfs daemon, I am still able to access the files from a different machine through IPFS.
I've noticed there's a .ipfs folder in my home directory that contains the part of blocks of data that i add to IPFS.

问题:
1.这些块也存储在我的系统上吗?
2.数据还存储在哪里?在我连接的其他同伴上?因为如果关闭ipfs守护程序,我仍然可以访问该文件.
3.如果是这样,并且数据存储在多个位置,那么如果所有对等点都从网络断开连接,丢失数据的可能性仍然存在吗?
4.网络上的每个对等端都存储整个文件还是仅存储文件的一部分?
5.如果数据副本正在整个p2p网络中分发,是否意味着该数据被重复多次?在存储方面,这种效率如何?
6.我们也存储其他同行上传的数据吗?
7.运行IPFS的最低系统要求?我们只需要足够的存储空间,不一定是功能强大的系统?

Questions:
1. Are the blocks stored locally on my system too?
2. Where else is the data stored? On other peers that I am connected to? Because I'm still able to access the file if I close my ipfs daemon.
3. If this is true, and data is stored at several places, possibility of losing my data is still there, if all the peers disconnect from the network?
4. Does every peer on the network store the entire file or just a part of the file?
5. If copy of data is being distributed across the p2p network, it means the data is being duplicated multiple times? How is this efficient in terms of storage?
6. We store data uploaded by other peers too?
7. Minimum System requirements for running IPFS? We just need abundant storage, not necessarily a powerful system?

预先感谢!

推荐答案

上载内容时,文件会被ipfs 分块并存储在缓存文件夹(.ipfs)中.

When you upload something, the file is chunked by ipfs and stored in your cache folder (.ipfs).

如果您尝试在网络的另一个对等方(例如主网关ipfs.io)上查看该文件,该对等方会向您请求文件,并且也缓存.

If you try to see the file on another peer of the network (say the main gateway, ipfs.io) that peer requests the file to you and caches it too.

如果您随后关闭守护程序,则仍可能在网关上看到该文件,这可能是因为网关或网络上的其他对等服务器仍对其进行了缓存.

If you then switch off your daemon you can still see the file on the gateway probably because the gateway or some other peer on the web still has it cached.

当同伴想要下载文件但内存不足(无法再缓存)时,最旧使用的文件会被忘记释放空间.

When a peer wants to download a file but it's out of memory (it can no longer cache), the oldest used files get forgotten to free space.

...实际上,要扩展到更大的范围要比这复杂得多:

... Actually, it's more complex than that, to have a wider scope I point you to check:

  • git的工作原理
  • 去中心化哈希表
  • kademlia
  • 梅克尔树
  • ...

但是后者应该使您大致了解该机制的工作原理.

But the latter should give you an idea of how the mechanism works more or less.

  1. 所有请求您文件的同级文件对其进行缓存
  2. 当不再有可能从一部分已被缓存的所有同位体(包括您自己)重新构造您的文件时,您将丢失文件
  3. 一个人只能得到其中的一部分,想象一下您正在看电影,而在一半处停止或多或少停下来...就是这样,您只缓存了其中一半.
  4. 当您在YouTube上观看视频时,您的浏览器会对其进行缓存(这意味着复制!)... ipfs在流量方面更为有效,假设您关闭浏览器,然后在2分钟后要再次观看它. Ipfs从您的缓存中获取它,YouTube则让您再次下载它.关于增量存储(与git相关)还有一个有趣的问题,是从何处获得的(可能在您的局域网内……这意味着快速燃烧),但我不会深入探讨它.
  5. 如果获取数据,则将其缓存...
  6. 主守护程序是用go编写的. Go是高效的,但不如用C ++,C,Rust编写它.而且,这项技术还很年轻,并且会随着时间的推移而改进.您拥有的空间越多,可以缓存的内容就越多,CPU的功能就不那么重要了.
  1. Yes
  2. All the peers that request your file cache it
  3. You lose the file when it's no longer possible to reconstitute your file from all the peers that had a part of it cached (including yourself)
  4. One can get just a part of it, imagine you are watching a movie and you stop more, or less, at the half... that's it, you've cached just half of it.
  5. When you watch a video on YouTube your browser caches it (that means a replication!)... ipfs is more efficient in terms of traffic, let's say you switch off the browser and 2 minutes later you want to watch it again. Ipfs gets it from your cache, YouTube makes you download it again. There's also an interesting matter on the delta storage (related to git) and from where you get it (could be inside your lan... that means blazing fast) but I won't dive into it.
  6. If you get data, you cache it so...
  7. The main daemon is written in go. Go is efficient but not as much as writing it on C++, C, Rust... Also, the tech is pretty young and it will improve with time. The more space you have the more you can cache, CPU power isn't THAT important.

如果您对以p2p方式存储数据的方式感兴趣,请点击此处,链接到有趣的项目.

If you are interested in ways to store data in a p2p manner, here some links to interesting projects.

  • https://filecoin.io/
  • https://storj.io/
  • https://maidsafe.net/
  • https://www.ethereum.org/ and it's related storage layer
  • https://ethersphere.github.io/swarm-home/

这篇关于IPFS将所有数据存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆