Anchor peer vs CORE_PEER_GOSSIP_EXTERNALENDPOINT?

做~自己de王妃 提交于 2019-12-11 06:04:28

问题


Why should one use Anchor peers when the cross org communication can be acheived by setting CORE_PEER_GOSSIP_EXTERNALENDPOINT in every peer?

Can anyone explain the correct way one should be used?


回答1:


Let me clearly explains you

In the hyperledger fabric there are total Three Types of peers

  • Endorsing Peers
  • Committing Peers
  • Orderer Peer (Orderer is also a Peer)

Something Hidden is:

  • Anchor Peers
  • Leader Peers

Anchor Peers are for cross-organization peer-to-peer communication, to setup Anchor Peers you need to setup Anchor Peers and use ENV

Step-By-Step

  - &org1
    Name: org1
    ID: org1MSP
    MSPDir: ./data/orgs/org1/msp
    AnchorPeers:
      - Host: org1-peer
      - Port: 7051 

  # generate anchor peer transaction
  configtxgen -profile OrgsChannel -outputAnchorPeersUpdate ./crypto-config/org1Anchors.tx -channelID publicchannel -asOrg org1
  if [ "$?" -ne 0 ]; then
  echo "Failed to generate anchor peer update for maersksea..."
  exit 1org1     fi

Now you need to send a transaction inorder to setup Anchor Peers Check this >> https://hyperledger-fabric.readthedocs.io/en/release-1.1/commands/peerchannel.html#peer-channel-update

If you want to make other peers in your organization known to other organizations, you need to set the

CORE_PEER_GOSSIP_EXTERNALENDPOINT

What They Do:

High-level, peer-to-peer communication happens through gossip protocol and Anchor Peers are the key to gossip communication.

  • Make sure peers in different organizations know about each other through gossip protocol.
  • One Can use Private Data Concept using Anchor Peers because gossip distributes the private data peer-to-peer across authorized organizations, it is required to set up anchor peers on the channel

Read below mentioned docs - https://hyperledger-fabric.readthedocs.io/en/release-1.4/private-data/private-data.html - https://hyperledger-fabric.readthedocs.io/en/release-1.4/glossary.html


LeaderPeers are the main entry point for orderer to ship blocks to peers

One can set up leader Peers or Peers can elect one by its own

Two Types

  • Static leader election
  • Dynamic leader election

Static leader election

Static leader election allows you to manually define one or more peers within an organization as leader peers. Please note, however, that having too many peers connect to the ordering service may result in inefficient use of bandwidth.

export CORE_PEER_GOSSIP_USELEADERELECTION=false
export CORE_PEER_GOSSIP_ORGLEADER=true

Dynamic leader election

Dynamic leader election enables organization peers to elect one peer which will connect to the ordering service and pull out new blocks. This leader is elected for an organization’s peers independently.

export CORE_PEER_GOSSIP_USELEADERELECTION=true
export CORE_PEER_GOSSIP_ORGLEADER=false


来源:https://stackoverflow.com/questions/57686480/anchor-peer-vs-core-peer-gossip-externalendpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!