2017-08-10 38 views
2

我學會了this site的表格,即一個通道上的每個成員都可以有多個錨點點來防止SPOF。如何配置多個錨點Peer

我想試試fabcar-demo中的多個錨點。

請讓我知道如何配置多個錨點。

回答

2

爲了讓每個組織具有多個錨點,您需要使用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 

這將爲每個組織定義兩個錨點。接下來,您需要使用configtxgen產生配置更新事務包括那些同行錨兩個機構單位:

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

要更新通道運行:

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

分別對每個認可組織的同行。