Hyperledger Fabric Peer 加入频道

Hyperledger Fabric Peer Join Channel

用例是:

  1. 我用 Raft Ordering 服务创建了一个网络,它有一个通道,比如 channel1 和三个组织(Org1、Org2 和 Org3)。
  2. Org1 和 Org2 节点已加入频道 channel1.
  3. Org3 刚刚出现在频道配置中,但尚未加入频道。
  4. 现在我在系统通道和通道 1 配置中添加了新的排序端点,并删除了旧的排序端点。
  5. 我的新订购者工作正常,能够为两个渠道获取配置。
  6. 我从 Org3 peer 获取了 channel1 的 0 块并发出了加入命令。
  7. 该命令运行良好,但在对等节点中出现以下错误:
2022-04-20 05:28:18.210 UTC 006b WARN [peer.blocksprovider] func1 -> Encountered an error reading from deliver stream: EOF channel=channel1 orderer-address=orderer.example.com:7050
2022-04-20 05:28:18.210 UTC 006c WARN [peer.blocksprovider] DeliverBlocks -> Got error while attempting to receive blocks: received bad status SERVICE_UNAVAILABLE from orderer channel=channel1 orderer-address=orderer.example.com:7050

Org3 节点仍在尝试连接旧的排序端点(因为它们最初是在 0 块中定义的)。

那么如何解决这个问题呢?

我能想到的一种方法是使用 Org1/Org2 对等方的快照。

你有什么想法?

谢谢

来自 HLF 文档

joining by snapshot will provide a peer with the latest channel configuration, which may be important if the channel configuration has changed since the genesis block. For example, the peer may need the orderer endpoints or CA certificates from the latest channel configuration before it can successfully pull blocks from the ordering service.

Taking ledger snapshots and using them to join channels

我找到了解决方案,所以如果将来有人需要它,可以在通道配置中更新订购者端点时使用此答案加入通道。

方法一:

在对等配置中,您可以覆盖一些变量,以使用新的排序端点覆盖旧的排序端点。

配置文件和参数的link是: https://github.com/hyperledger/fabric/blob/main/sampleconfig/core.yaml#L382-L388

此方法将允许您使用创世块加入对等点,并且受不支持通过快照加入的旧版本 Fabric (<=v2.2) 支持。

方法二:

如果您使用的是 Fabric v2.2+,那么您可以使用方法 1 或使用来自另一个节点的快照加入频道。 官方文档中有教程,请查看: https://hyperledger-fabric.readthedocs.io/en/release-2.3/peer_ledger_snapshot.html

谢谢, 萨希尔