5

I learned form this site that each member on a channel can have multiple anchor peers to prevent SPOF.

I would like to try multiple anchor peer in fabcar-demo.

Kindly let me know how to configure multiple anchor peers.

SKuri
  • 183
  • 1
  • 2
  • 10

1 Answers1

9

In order to have more than one anchor peer per organization you need to configure it with configtx.yaml, e.g. you should add new anchor peers into the following section:

Organizations:

    - &Org1
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: Org1MSP

        # ID to load the MSP definition as
        ID: Org1MSP

        MSPDir: crypto-config/peerOrganizations/org1.example.com/msp

        AnchorPeers:
            # AnchorPeers defines the location of peers which can be used
            # for cross org gossip communication.  Note, this value is only
            # encoded in the genesis block in the Application section context
            - Host: peer0.org1.example.com
              Port: 7051
            - Host: peer1.org1.example.com
              Port: 7051


    - &Org2
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: Org2MSP

        # ID to load the MSP definition as
        ID: Org2MSP

        MSPDir: crypto-config/peerOrganizations/org2.example.com/msp

        AnchorPeers:
            # AnchorPeers defines the location of peers which can be used
            # for cross org gossip communication.  Note, this value is only
            # encoded in the genesis block in the Application section context
            - Host: peer0.org2.example.com
              Port: 7051
            - Host: peer1.org2.example.com
              Port: 7051

This will define two anchor peers per each organization. Next you need to use configtxgen to produce config update transaction to include those anchors peers for both orgs:

configtxgen -profile TwoOrgsChannel -channelID mychannel -outputAnchorPeersUpdate=Org1MSPanchors.tx -asOrg=Org1MSP
configtxgen -profile TwoOrgsChannel -channelID mychannel -outputAnchorPeersUpdate=Org2MSPanchors.tx -asOrg=Org2MSP

To update channel run:

# updating anchors for Org1
CORE_PEER_ADDRESS=peer0.org.example.com peer channel update -f Org1MSPanchors.tx -c mychannel -o orderer.example.com:7050

against endorsing peer of each org respectively.

Artem Barger
  • 40,769
  • 9
  • 59
  • 81
  • 1
    Hi...I am facing the same issue now while setting up anchor peers of the org in my network. Followed the same approach as above. The anchor peers are being recognized but they are not able to connect with one another. Error in peer logs {Could not connect to {ip-172-31-22-132:7051 [] [] ip-172-31-22-132:7051 } : context deadline exceeded. [33m2018-09-15 15:03:32.315 UTC [gossip/gossip] func1 -> WARN 0b0[0m Deep probe of ip-172-31-22-132:7051 failed: context deadline exceeded github.com/hyperledger/fabric/gossip/gossip(*gossipServiceImpl).learnAnchorPeers.func1 } Any thoughts?@Artem – msingh Sep 15 '18 at 19:32