Hyperledger Fabric重建后peer0.org1加入mychannel失败求助
解决Hyperledger Fabric节点加入通道失败(Application capability V2_5 is required but not supported)
问题场景
完成《Using Private Data in Fabric》实验后目录丢失,执行以下步骤重建环境:
mkdir fabric-samples cd fabric-samples curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh ./install-fabric.sh docker samples ./install-fabric.sh binary cd fabric-samples/test-network ./network.sh up ./network.sh createChannel
执行./network.sh createChannel时,peer0.org1多次尝试后无法加入mychannel,报错:
./network.sh createChannel Joining org1 peer to the channel... Using organization 1 + peer channel join -b ./channel-artifacts/mychannel.block + res=1 + peer channel join -b ./channel-artifacts/mychannel.block + res=1 + peer channel join -b ./channel-artifacts/mychannel.block + res=1 + peer channel join -b ./channel-artifacts/mychannel.block + res=1 2023-01-24 11:17:52.305 AEDT 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized Error: proposal failed (err: bad proposal response 500: "JoinChain" for channelID = mychannel failed because of validation of configuration block, because of Failed capabilities check: [Application capability V2_5 is required but not supported]) After 5 attempts, peer0.org1 has failed to join channel 'mychannel'
预期结果:
Channel 'mychannel' created Joining org1 peer to the channel... Joining org2 peer to the channel... Anchor peer set for org 'Org1MSP' on channel 'mychannel' Anchor peer set for org 'Org2MSP' on channel 'mychannel' Channel 'mychannel' joined
问题原因
报错核心是Application capability V2_5 is required but not supported,本质是Fabric二进制文件与Docker镜像版本不匹配:
./install-fabric.sh docker samples拉取的是最新版Fabric镜像(默认启用V2_5应用能力)- 单独执行
./install-fabric.sh binary可能安装了更低版本的peer二进制,导致节点不支持V2_5能力,无法通过通道配置块的校验
解决方案
1. 清理现有不一致环境
# 删除fabric-samples目录 rm -rf fabric-samples # 停止并删除所有Fabric容器 docker stop $(docker ps -aq) docker rm $(docker ps -aq) # 删除Hyperledger Fabric相关镜像 docker rmi $(docker images | grep hyperledger/fabric- | awk '{print $3}') # 删除本地Fabric二进制文件(若已添加到系统PATH,需手动从PATH配置中移除对应路径) rm -rf ~/fabric-samples/bin
2. 同步版本重新安装
使用单条命令同时安装Docker镜像、samples和二进制文件,保证版本完全一致:
mkdir fabric-samples && cd fabric-samples curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh # 一次性完成docker、samples、binary安装 ./install-fabric.sh docker samples binary
3. 重新启动网络并创建通道
cd test-network # 确保环境完全清理 ./network.sh down # 启动网络并创建通道 ./network.sh up ./network.sh createChannel
执行完成后若出现预期的Channel 'mychannel' joined提示,说明问题已解决。
内容的提问来源于stack exchange,提问作者DavidZ
相关产品推荐
相关产品推荐

