ACI IPFS节点连接问题

发布于 2025-02-05 02:26:57 字数 1474 浏览 3 评论 0原文

我遵循 /a>有关如何在Azure容器中设置IPFS节点以设置两个IPFS节点,一个在欧洲,一个在美国进行一些基准测试,以对在节点上检索CID需要多长时间。我创建了一个简单的脚本,用于使用 ipfs-http-http---http--- http----客户

// write.js
import * as IPFS from 'ipfs-http-client';

const main = async () => {
  const ipfs = IPFS.create({
    host: '<eu host>',
    port: '5001',
    protocol: 'http',
  });

  const { cid } = await ipfs.add(
    `Hello at ${new Date().toISOString()}`
  );

  console.log(cid);
};

main();
// read.js
import * as IPFS from 'ipfs-http-client';

const main = async () => {
  const ipfs = IPFS.create({
    host: '<us host>',
    port: '5001',
    protocol: 'http',
  });

  for await (const c of ipfs.cat(
    '<cid>'
  )) {
    console.log(new TextDecoder().decode(c));
  }
};

main();

但是,如果我读取并写入相同的节点,则可以正常工作,但是,一个节点中存储的数据似乎无法从任何其他任何节点访问,就好像节点无法正确连接一样。

我还尝试使用相同的代码片段将数据写入Infura-ipfs网关,并通过IPFS.IO网关将其检索。这可能意味着我刚刚配置了错误的节点,但是我不知道如何解决这个问题。我尝试过多种解决方案以在线获得IPFS节点,但到目前为止,我还没有成功。最佳情况下,我需要任何两个应用程序才能从所选列表中随机选择任何对等,并跨节点共享相同的数据,最好使用PubSub。

I have followed this tutorial for how to set up an IPFS node in an Azure container to set up two IPFS nodes, one in Europe and one in the US to do some benchmarking on how long it takes to retrieve a CID across the nodes. I have created a simple script for adding and retrieving data from these two nodes using ipfs-http-client.

// write.js
import * as IPFS from 'ipfs-http-client';

const main = async () => {
  const ipfs = IPFS.create({
    host: '<eu host>',
    port: '5001',
    protocol: 'http',
  });

  const { cid } = await ipfs.add(
    `Hello at ${new Date().toISOString()}`
  );

  console.log(cid);
};

main();
// read.js
import * as IPFS from 'ipfs-http-client';

const main = async () => {
  const ipfs = IPFS.create({
    host: '<us host>',
    port: '5001',
    protocol: 'http',
  });

  for await (const c of ipfs.cat(
    '<cid>'
  )) {
    console.log(new TextDecoder().decode(c));
  }
};

main();

If I read and write to the same node it works fine, however, the data stored in one node does not seem to be accessible from any other node anywhere, as if the nodes are not properly connected.

I have also tried using the same snippets of code to write data to the infura-ipfs gateway and retrieving it through the ipfs.io gateway which seems to work. This probably means I have just configured my nodes wrong, however I have no idea how to work around this issue. I have tried multiple solution to just get an IPFS node online but I have not succeeded in any way so far. Optimally, I need any two applications to be able to select any peer at random from a selected list and share the same data across nodes, preferably using pubsub.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兲鉂ぱ嘚淚 2025-02-12 02:26:57

我以为IPF可以自动发现内容,但是通过运行ipfs swarm connect&lt; multiaDdr&gt;,每个节点可以手动连接它们,我最终使它起作用。如果有任何方法可以使每个节点自动发现彼此及其内容,那将是惊人的,但是至少我已经进一步了。

I assumed that IPFS would be able to discover content automatically, but by running the ipfs swarm connect <multiaddr> for each node to manually connect them to each other I finally got it working. If there is any way to make each node automatically discover each other and their content that would be amazing, but at least I have gotten one step further.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文