如何配置多个锚点对等点

SKu*_*uri 4 blockchain hyperledger hyperledger-fabric

我从该站点了解到,频道中的每个成员可以具有多个锚点对等点,以防止SPOF。

我想在fabcar-demo中尝试多个锚点同位体。

请让我知道如何配置多个锚点对等点。

Art*_*ger 5

为了每个组织拥有多个锚点,您需要使用配置它configtx.yaml,例如,您应该在以下部分中添加新的锚点:

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
Run Code Online (Sandbox Code Playgroud)

这将为每个组织定义两个锚点对等点。接下来,您需要使用它configtxgen来生成配置更新事务,以包括两个组织的那些锚点对等点:

configtxgen -profile TwoOrgsChannel -channelID mychannel -outputAnchorPeersUpdate=Org1MSPanchors.tx -asOrg=Org1MSP
configtxgen -profile TwoOrgsChannel -channelID mychannel -outputAnchorPeersUpdate=Org2MSPanchors.tx -asOrg=Org2MSP
Run Code Online (Sandbox Code Playgroud)

要更新频道,请运行:

# updating anchors for Org1
CORE_PEER_ADDRESS=peer0.org.example.com peer channel update -f Org1MSPanchors.tx -c mychannel -o orderer.example.com:7050
Run Code Online (Sandbox Code Playgroud)

分别反对认可每个组织的同伴。