咨询Hyperledger Fabric中Anchor Peer的定义、作用及具体含义
Great question—Anchor Peers are a critical but often misunderstood component of Hyperledger Fabric, especially when you're wrapping your head around how channel-level peer discovery works. Let's break this down simply:
First, remember that in Fabric, channels isolate transaction data between groups of organizations. Each organization can run multiple peer nodes that join a channel, but by default, peers from one organization don't automatically know about peers from another organization in the same channel. That's where Anchor Peers come in.
Core Purpose of Anchor Peers
Anchor Peers act as a public "directory entry" for an organization within a channel. Here's the exact workflow you're curious about:
- When an organization joins a channel, it designates one or more of its peers as Anchor Peers (this is configured in the channel's genesis block or via channel update transactions).
- Peers from other organizations in the channel will query these Anchor Peers to get a full list of all peer nodes belonging to that organization in the channel.
- Once they have that list, they can directly communicate with any of those peers for tasks like chaincode execution, transaction endorsement, or data syncing.
Real-World Example
Let’s say we have two organizations: Org1 and Org2, both part of the supplychain channel. Org1 has peers peer0.org1 (Anchor Peer) and peer1.org1. When Org2's peer0.org2 needs an endorsement from Org1 for a transaction, it first queries peer0.org1 (the Anchor Peer) to find out that Org1 also has peer1.org1. Now peer0.org2 can send endorsement requests to either of Org1's peers, depending on availability or load.
Key Notes
- You can set multiple Anchor Peers per organization for redundancy—if one goes down, others can handle discovery requests.
- Anchor Peers only handle peer discovery within a channel; they don’t participate in transaction validation or endorsement unless explicitly configured to do so (they’re just regular peers with an extra discovery role).
- Without Anchor Peers, cross-organization peer communication would rely on hardcoding peer addresses, which isn’t scalable or practical in a distributed network.
内容的提问来源于stack exchange,提问作者Thinker

