Skip to content

Adding a new peer to existing organization in Hyperledger Fabric

Prerequisites

To add a new peer a fully configured Fabric network must be present already, i.e. a Fabric network which has Orderers, Peers, Channels (with all Peers already in the channels) and the organization to which the peer is being added. The corresponding crypto materials should also be present in their respective Hashicorp Vault.


NOTE: Addition of a new peer has been tested on an existing network which is created by Bevel. Networks created using other methods may be suitable but this has not been tested by Bevel team.


Modifying Configuration File

A Sample configuration file for adding new peer is available here. Please go through this file and all the comments there and edit accordingly.

For generic instructions on the Fabric configuration file, refer this guide.

While modifying the configuration file(network.yaml) for adding new peer, all the existing peers should have peerstatus tag as existing and the new peers should have peerstatus tag as new under network.channels e.g.

  # The channels defined for a network with participating peers in each channel
  channels:
  - channel:
    consortium: SupplyChainConsortium
    channel_name: AllChannel
    chaincodes:
      - "chaincode_name"
    orderers: 
      - supplychain
    participants:
    - organization:
      name: carrier
      type: creator       # creator organization will create the channel and instantiate chaincode, in addition to joining the channel and install chaincode
      org_status: existing  # org_status must be existing when adding peer
      peers:
      - peer:
        name: peer0
        peerstatus: existing    # old peers should have status as existing
        gossipAddress: peer1.carrier-net.org3proxy.blockchaincloudpoc.com:443  # Must include port, External or internal URI of the gossip peer
        peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
      - peer:
        name: peer1
        peerstatus: new         # new peers should have status as new
        gossipAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443  # Must include port, External or internal URI of the gossip peer
        peerAddress: peer1.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
      ordererAddress: orderer1.org1proxy.blockchaincloudpoc.com:443             # Must include port, External or internal URI of the orderer    
    genesis:
      name: OrdererGenesis

and under network.organizations as

    - organization:
      name: carrier
      country: GB
      state: London
      location: London
      subject: "O=Carrier,OU=Carrier,L=51.50/-0.13/London,C=GB"
      type: peer
      external_url_suffix: org3proxy.blockchaincloudpoc.com
      org_status: existing  # org_status must be existing when adding peer
      orderer_org: supplychain # Name of the organization that provides the ordering service
      ..
      ..
      services:
        peers:
        - peer:
          name: peer0
          type: anchor    # This can be anchor/nonanchor. Atleast one peer should be anchor peer.    
          gossippeeraddress: peer1.carrier-net.org3proxy.blockchaincloudpoc.com:443 # No change from original configuration
          peerAddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
          peerstatus: existing    # old peers should have status as existing
          ..
          ..
        - peer:
          name: peer1
          type: nonanchor    # This can be anchor/nonanchor. Atleast one peer should be anchor peer.    
          gossippeeraddress: peer0.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External address of the existing anchor peer
          peerAddress: peer1.carrier-net.org3proxy.blockchaincloudpoc.com:443 # Must include port, External URI of the peer
          peerstatus: new     # new peers should have status as new
          ..
          ..

The network.yaml file should contain the specific network.organization details. Orderer information is needed if you are going to install/upgrade the existing chaincodes, otherwise it is not needed. And the org_status must be existing when adding peer.

Ensure the following is considered when adding the new peer on a different cluster: - The CA server is accessible publicly or at least from the new cluster. - The CA server public certificate is stored in a local path and that path provided in network.yaml. - There is a single Hashicorp Vault and both clusters (as well as ansible controller) can access it. - Admin User certs have been already generated and store in Vault (this is taken care of by deploy-network.yaml playbook if you are using Bevel to setup the network). - The network.env.type is different for different clusters. - The GitOps release directory gitops.release_dir is different for different clusters.

Run playbook

The add-peer.yaml playbook is used to add a new peer to an existing organization in the existing network. This can be done using the following command

ansible-playbook platforms/hyperledger-fabric/configuration/add-peer.yaml --extra-vars "@path-to-network.yaml"

NOTE: The peerstatus is not required when the network is deployed for the first time but is mandatory for addition of new peer. If you have additional applications, please deploy them as well.


Chaincode Installation

Use the same network.yaml if you need to install chaincode on the new peers.


NOTE: With Fabric 2.2 and 2.5 chaincode lifecyle, re-installing chaincode on new peer is not needed as when the blocks are synced, the new peer will have access to already committed chaincode. If still needed, you can upgrade the version of the chaincode and install on all peers.


Refer Install chaincode guide or Install external chaincode guide for details on installing chaincode.