Hyperledger Composer add a new peer

2019-02-21 04:43发布

问题:

I am modifying existing docker-compose.yml, crypto-config.yaml and configtx.yaml to add a extra peer to the existing hyperledger composer sample, located under hlfv11 folder of the fabric-tools/fabric-scripts.

I regenerated required certificates and genesis block and it generates the peer container without any issue.

However I am having difficulty adding this peer to a channel. I modified startFabric.sh to join this peer to a channel, however I am getting an error with following message:

Error getting endorser client channel: endorser client failed to connect to peer1.org1.example.com:8051: failed to create a new connection: context deadline exceeded.

Can someone please help or advise?

回答1:

I was trying to join me additional peer to channel directly through PEER CHANELL JOIN command. It actually requires to fetch the channel through orderer on new peer and then it can join it.

Code update follows:

# Create the channel
docker exec peer0.org1.example.com peer channel create -o 
orderer.example.com:7050 -c composerchannel -f 
/etc/hyperledger/configtx/composer-channel.tx

# Join peer0.org1.example.com to the channel.
docker exec -e "CORE_PEER_MSPCONFIGPATH= 
/etc/hyperledger/msp/users/Admin@org1.example.com/msp 
peer0.org1.example.com peer channel join -b composerchannel.block

# Create the channel
docker exec -e "CORE_PEER_MSPCONFIGPATH= 
/etc/hyperledger/msp/users/Admin@org1.example.com/msp" 
peer1.org1.example.com peer channel fetch config -o orderer.example.com:7050 
-c composerchannel

# Join peer1.org1.example.com to the channel.
docker exec -e "CORE_PEER_MSPCONFIGPATH= 
/etc/hyperledger/msp/users/Admin@org1.example.com/msp 
peer1.org1.example.com peer channel join -b composerchannel_config.block