Search code examples
hyperledger-fabrichyperledgerraft

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


I am following steps given here to add a new Orderer node to the existing RAFT ordering service.

  1. I am using first-network from the fabric-samples (version: master/latest) github repository.
  2. I modified the files in the first-network folder to start initially a RAFT service with 3 ORDERERS.
  3. After successful end-to-end execution of the byfn.sh script, I docker exec into the CLI container. In the CLI, I do the following:

Set following environment variables:

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/[email protected]/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

Followed by which I fetch config block, decode it, and the following JSON segment in the consenters section in the decoded JSON file.

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

Have hidden the certificate values for now. NOTE: I have not modified the OrdererAddresses section still.

The modified JSON is used to update the SYSTEM CHANNEL configuration. Then I fetch the latest channel configuration block for the updated byfn-sys-channel. I exit the CLI and do docker cp to fetch the latest config block from the CLI container into the channel-artifacts directory.

I start the orderer named, orderer4.example.com with the bootstrap file path corresponding to the latest fetched config block. But the container crashes and gives me following logs in DEBUG mode:

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]

I am following the steps given in the latest Hyperledger Documentation and still it is throwing this error. Please correct me if somewhere I am making a mistake to execute the given steps.


Solution

  • There was an issue with respect to the volumes being mount to the new orderer container. It was using an existing volume for the new orderer, because I kept pulling down the "byfn.sh" script and using it again to up the network.

    But the given steps in the documentation are working perfectly when used with fresh mounts.