在Hyperledger Fabric中为RAFT订购服务添加新的订购者节点

时间:2020-03-06 10:58:03

标签: hyperledger-fabric hyperledger raft

我正在按照here的步骤操作,将新的Orderer节点添加到现有的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的订购程序。但是容器崩溃了,并在调试模式下为我提供了以下日志:

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文档中给出的步骤,但仍然会引发此错误。如果我在执行给定步骤时出错了,请纠正我。

1 个答案:

答案 0 :(得分:0)

将卷安装到新订购者容器时出现问题。因为我一直拉下“ byfn.sh”脚本并再次使用它来建立网络,所以它正在为新订购者使用现有卷。

但是,当与新安装架一起使用时,文档中给定的步骤可以正常工作。