You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在多机环境下为Hyperledger Composer网络新增Peer节点

Hey there! Let's walk through how to add a new Peer node on a separate machine to your existing Hyperledger Composer blockchain network. Since you mentioned the multi-org tutorial relies on Docker, I’ll break this down into actionable steps that work whether your original setup uses Docker or not (we’ll cover both scenarios where relevant):

Step 1: Prep the New Machine’s Environment
  • First, install matching versions of all required tools on the new machine—version mismatches are one of the biggest headaches here:
    • Hyperledger Fabric binaries and Docker images (if using containerized peers): Use the official Fabric install script, substituting your network’s exact versions:
      curl -sSL https://bit.ly/2ysbOFE | bash -s -- <fabric-version> <ca-version> <thirdparty-version>
      
    • Hyperledger Composer CLI: Install via npm with the same version as your existing network:
      npm install -g composer-cli@<your-composer-version>
      
  • Ensure the new machine can reach your existing network’s orderer and at least one peer (check firewall rules for ports 7050, 7051, and 7054).
Step 2: Configure the New Peer Node
  • Copy crypto material from your existing network’s Certificate Authority (CA) to the new machine:
    • Transfer the CA’s root certificate (ca-cert.pem) to ~/crypto-config/peerOrganizations/<your-org>/ca/ on the new machine.
    • Generate a unique identity for the new peer using your existing CA:
      composer identity request -c admin@<your-network-name> -u peer-new -s <peer-secret> -d peer-new
      
  • Set up the peer configuration:
    • If using Docker: Create a docker-compose.yaml service for the new peer, mapping ports, mounting crypto material volumes, and setting environment variables to match your existing network (e.g., CORE_PEER_ID=peer-new.org1.example.com, CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051).
    • If using a native peer: Edit the core.yaml file to set a unique peer.id, point peer.networkId to your network’s ID, and set peer.gossip.bootstrap to the address of an existing peer in your network.
Step 3: Join the Peer to Your Channel
  • Fetch the channel genesis block from an existing peer on your network (run this on the new machine):
    peer channel fetch 0 <your-channel-name>.block -o <orderer-address>:7050 -c <your-channel-name> --tls --cafile <path-to-orderer-ca-cert>
    
  • Join the new peer to the channel:
    peer channel join -b <your-channel-name>.block
    
  • Verify the join was successful with:
    peer channel list
    
    You should see your channel listed in the output.
Step 4: Sync the Business Network Definition
  • On your original machine, package your business network if you don’t have the .bna file handy:
    composer archive create -t dir -n <path-to-your-business-network>
    
  • Copy the generated .bna file to the new machine, then install the business network on the new peer:
    composer network install -c PeerAdmin@<your-network-name> -a <your-network-name>.bna
    
  • Confirm the chaincode is installed with:
    peer chaincode list --installed
    
Step 5: Update Your REST Server (Optional)
  • If you want the new peer to be used by your existing composer-rest-server, update your connection profile JSON file on the server machine:
    • Add the new peer’s address, crypto paths, and TLS settings to the profile.
    • Restart the REST server with the updated profile:
      composer-rest-server -c <updated-connection-profile> -n <network-name> -i <admin-username> -s <admin-secret> -N never
      
Quick Troubleshooting Tips
  • If the peer can’t join the channel: Double-check the gossip bootstrap address and ensure firewall rules allow inbound/outbound traffic on peer ports.
  • If chaincode sync fails: Reinstall the business network on the new peer and verify the chaincode container (if using Docker) is running.
  • Always validate versions: Cross-check that Composer, Fabric, and CA versions are identical across all nodes in the network.

内容的提问来源于stack exchange,提问作者peterDalis. st

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 03:56:37