如何配置多个锚点对等体

时间:2017-08-10 09:50:20

标签: blockchain hyperledger hyperledger-fabric

我学习了this site形式,通道上的每个成员都可以拥有多个锚点对等点以防止SPOF。

我想在fabcar-demo中尝试多个主播同伴。

请告诉我如何配置多个锚点对等。

1 个答案:

答案 0 :(得分:4)

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

DT <- mtcars
gethc <- function(i) {
  hc <- highchart() %>%
    hc_title(text = 'prueba',
             style = list(fontSize = "15px")) %>% 
    hc_chart(type = 'pie') %>% 
    hc_xAxis(categories = DT[[i]]) %>% 
    hc_add_series(DT[[i]], name = "Market", showInLegend = FALSE)
    hc
}
a = list()
for(i in seq_along(DT)) {
  a[[i]] <- gethc(i)

}

htmltools::tagList(a) 

这将为每个组织定义两个锚点对等体。接下来,您需要使用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

分别支持每个组织的同行。