首页 > 解决方案 > 向 Hyperledger Fabric 中的 RAFT 排序服务添加新的排序节点

问题描述

我正在按照此处给出的步骤将新的 Orderer 节点添加到现有的 RAFT 订购服务。

  1. 我使用first-network的是 fabric-samples(版本:master/latest)github 存储库。
  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

然后我获取配置块,对其进行解码,以及consenters解码后的 JSON 文件部分中的以下 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我使用与最新获取的配置块相对应的引导文件路径启动名为的排序程序。但是容器崩溃并在调试模式下给我以下日志:

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 文档中给出的步骤进行操作,但它仍然抛出此错误。如果在某处我在执行给定步骤时出错,请纠正我。

标签: hyperledger-fabrichyperledgerraft

解决方案


将卷安装到新的 orderer 容器时存在问题。它正在为新订购者使用现有卷,因为我不断拉下“byfn.sh”脚本并再次使用它来启动网络。

但是文档中的给定步骤在与新安装一起使用时可以完美运行。


推荐阅读