0 votes
1 view
in Blockchain by (14.4k points)

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

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

Kindly let me know how to configure multiple anchor peers.

1 Answer

0 votes
by (14.4k points)

Fo having more than one anchor peer per organization, the configuration should be done with configtx.yaml

For example, 

Organizations:

    - &Org1

        # DefaultOrg defines the organization 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 usable peers

            # for cross org gossip communication.  Note, this value is only encoded in the genesis block in the Application section

            - Host: peer0.org1.example.com

              Port: 7051

            - Host: peer1.org1.example.com

              Port: 7051

    - &Org2

        # DefaultOrg defines the organization 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 usable peers for cross org gossip   communication. Note, this value is only encoded in the genesis block in the Application section

            - Host: peer0.org2.example.com

              Port: 7051

            - Host: peer1.org2.example.com

              Port: 7051

Two anchor peers per each organization will be defined with the above code. Further, use configtxgen to produce config update transaction for including those anchors peers for both organizations:

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

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

For updating the channel: 

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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...