Hyperledger Fabric Peer Join Channel

645 views Asked by At

The use case is:

  1. I created a network with Raft Ordering service having one channel say, channel1 with three Organisations (Org1, Org2 and Org3).
  2. Org1 and Org2 peers have joined the channel channel1.
  3. Org3 is just present in the channel config but not joined the channel yet.
  4. Now I added the new orderer endpoints in the system channel and channel1 config and removed the old orderer endpoints.
  5. My new orderers are working fine, able to fetch the config for both channels.
  6. I fetched the 0 block of channel1 from Org3 peer and issued the join command.
  7. The command works fine, but in the peer I am getting these error:
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

The Org3 peer is still trying to connect with the older orderer endpoints (as they were defined in the 0 block initially).

So how to sort out this problem?

One way I can think is to use the snapshot of the Org1/Org2 peer maybe.

What are your thoughts?

Thanks

2

There are 2 answers

0
Sahil On BEST ANSWER

I found the solution, so if anyone in the future needs it, can use this answer to join the channel when the orderer endpoints are updated in the channel configuration.

Method 1:

In the peer configuration you can override some of the variables to override the old orderer endpoint with the new orderer endpoints.

The link to the config file and params is: https://github.com/hyperledger/fabric/blob/main/sampleconfig/core.yaml#L382-L388

This method will allow you to join the peer using genesis block and is supported by older versions of Fabric (<=v2.2) which does not support joining by snapshot.

Method 2:

If you are on Fabric v2.2+, then you can either use the Method 1 or join the channel using a snapshot from another peer. There is tutorial in the official docs for that, please check it: https://hyperledger-fabric.readthedocs.io/en/release-2.3/peer_ledger_snapshot.html

Thanks, Sahil

1
Basil K Y On

From HLF docs

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