向 Hyperledger Fabric 中的 RAFT 排序服务添加一个新的排序节点

Adding a new Orderer Node to the RAFT ordering service in Hyperledger Fabric

我正在按照给定的步骤 here 将新的排序节点添加到现有的 RAFT 排序服务。

  1. 我正在使用 fabric-samples(版本:master/latest)github 存储库中的 first-network
  2. 我修改了 first-network 文件夹中的文件,以最初启动具有 3 个 ORDERERS 的 RAFT 服务。
  3. byfn.sh脚本成功端到端执行后,我docker exec进入CLI容器。在 CLI 中,我执行以下操作:

设置以下环境变量:

export CORE_PEER_ADDRESS=orderer.example.com:7050
export CORE_PEER_LOCALMSPID=OrdererMSP
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/users/Admin@example.com/msp
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
export CHANNEL_NAME=byfn-sys-channel

然后我获取配置块,对其进行解码,然后在解码的 JSON 文件的 consenters 部分中的以下 JSON 段。

{
    "client_tls_cert": "xxx",
    "host": "orderer4.example.com",
    "port": 10050,
    "server_tls_cert": "xxx"
}

暂时隐藏了证书值。注意:我还没有修改 OrdererAddresses 部分。

修改后的JSON用于更新SYSTEM CHANNEL配置。然后我为更新的 byfn-sys-channel 获取最新的通道配置块。我退出 CLI 并执行 docker cp 从 CLI 容器中获取最新的配置块到 channel-artifacts 目录中。

我启动名为 orderer4.example.com 的排序器,其中 bootstrap 文件路径对应于最新获取的配置块。但是容器崩溃并在 DEBUG 模式下给我以下日志:

2020-03-06 10:48:58.535 UTC [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 5b6 orderer2.example.com:8050 is at block sequence of 2 channel=byfn-sys-channel       
2020-03-06 10:48:58.536 UTC [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 5b7 orderer3.example.com:9050 is at block sequence of 2 channel=byfn-sys-channel       
2020-03-06 10:48:58.539 UTC [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 5b8 orderer.example.com:7050 is at block sequence of 2 channel=byfn-sys-channel        
2020-03-06 10:48:58.539 UTC [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 5b9 Connected to orderer.example.com:7050 with last block seq of 2 channel=byfn-sys-channel
2020-03-06 10:48:58.539 UTC [msp.identity] Sign -> DEBU 5ba Sign: plaintext: 0AF5060A3E08051A06089AD588F30522...0D1A0B08FFFFFFFFFFFFFFFFFF012001
2020-03-06 10:48:58.539 UTC [msp.identity] Sign -> DEBU 5bb Sign: digest: DFBDC201427E47056FA06F3E39B61750C8E874F6E09FE30BBFB38380F5F0A96D
2020-03-06 10:48:58.540 UTC [orderer.common.cluster.replication] obtainStream -> INFO 5bc Sending request for block [1] to orderer.example.com:7050 channel=byfn-sys-channel      
2020-03-06 10:48:58.540 UTC [grpc] infof -> DEBU 5bd transport: loopyWriter.run returning. connection error: desc = "transport is closing"
2020-03-06 10:48:58.540 UTC [grpc] infof -> DEBU 5be transport: loopyWriter.run returning. connection error: desc = "transport is closing"
2020-03-06 10:48:58.546 UTC [orderer.common.cluster.replication] pullBlocks -> INFO 5bf Got block [1] of size 25 KB from orderer.example.com:7050 channel=byfn-sys-channel        
2020-03-06 10:48:58.548 UTC [orderer.common.cluster.replication] pullBlocks -> INFO 5c0 Got block [2] of size 35 KB from orderer.example.com:7050 channel=byfn-sys-channel        
2020-03-06 10:48:58.551 UTC [orderer.common.cluster] BlockCommitted -> DEBU 5c1 Committed block [1] for channel byfn-sys-channel that is not a config block
2020-03-06 10:48:58.551 UTC [orderer.common.cluster] appendBlock -> PANI 5c2 Failed to write block [1]: unexpected Previous block hash. Expected PreviousHash = [v1], PreviousHash referred in the latest block= [v2]
panic: Failed to write block [1]: unexpected Previous block hash. Expected PreviousHash = [v1], PreviousHash referred in the latest block= [v2]

我正在按照最新的 Hyperledger 文档中给出的步骤进行操作,但它仍然抛出此错误。如果我在执行给定步骤时出错,请纠正我。

挂载到新排序容器的卷存在问题。它正在为新订购者使用现有卷,因为我一直拉下 "byfn.sh" 脚本并再次使用它来建立网络。

但是文档中的给定步骤在与新安装一起使用时效果很好。