部署Hyperledger Fabric 1.0 出现 Attempting to Query PEER0 ...61 secs

这个错误,折磨了我久……
网上的方法都试过了,就是跑不通,宛如大便干燥……

结论先行

是由于Docker镜像的版本号不统一导致的,注意IMAGE ID

错误再现

在first-network目录下执行 byfn.sh -m up 命令

出现了 Query result on PEER0 is INVALID 这个错误,上网上查了一下,各种说法都有,什么二进制文件没安装、docker版本低、docker镜像版本的问题……

我执行docker images 查看镜像,发现版本号都是一样的,也按照网上其他也有说到“将版本号统一”

docker images

为什么还报错呢?一起看日志吧……

root@xxx:Go/src/github.com/hyperledger/fabric-samples/first-network$ byfn.sh -m up 
Starting with channel 'mychannel' and CLI timeout of '10'
Continue (y/n)? y
proceeding ...
/Go/bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
org1.example.com
org2.example.com

/WorkSpace/Go/bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
2019-12-02 17:52:43.427 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2019-12-02 17:52:43.448 CST [common/configtx/tool] doOutputBlock -> INFO 002 Generating genesis block
2019-12-02 17:52:43.449 CST [common/configtx/tool] doOutputBlock -> INFO 003 Writing genesis block

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
2019-12-02 17:52:43.485 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2019-12-02 17:52:43.492 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2019-12-02 17:52:43.493 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 003 Writing new channel tx

#################################################################
#######    Generating anchor peer update for Org1MSP   ##########
#################################################################
2019-12-02 17:52:43.531 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2019-12-02 17:52:43.540 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2019-12-02 17:52:43.540 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update

#################################################################
#######    Generating anchor peer update for Org2MSP   ##########
#################################################################
2019-12-02 17:52:43.571 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2019-12-02 17:52:43.575 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2019-12-02 17:52:43.575 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update

Creating network "net_byfn" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Pulling orderer.example.com (hyperledger/fabric-orderer:latest)...
latest: Pulling from hyperledger/fabric-orderer
b8f262c62ec6: Already exists
9c2dad781fe8: Already exists
7e48a048d895: Already exists
4b5f2a9ec0f7: Pull complete
a38d313ebb74: Pull complete
391a02b02202: Pull complete
Digest: sha256:f7715923e2ca67cee526c21638d86b21480e179419e9d6c20078caabb241b20e
Status: Downloaded newer image for hyperledger/fabric-orderer:latest
Pulling peer0.org1.example.com (hyperledger/fabric-peer:latest)...
latest: Pulling from hyperledger/fabric-peer
b8f262c62ec6: Already exists
9c2dad781fe8: Already exists
7e48a048d895: Already exists
4b5f2a9ec0f7: Already exists
9332c2443003: Pull complete
f8823b03421b: Pull complete
Digest: sha256:92c2bef91e80f54f6d73a89b796eab1b616f372e2258431f17d50dd0c2ce316b
Status: Downloaded newer image for hyperledger/fabric-peer:latest
Pulling cli (hyperledger/fabric-tools:latest)...
latest: Pulling from hyperledger/fabric-tools
7ddbc47eeb70: Pull complete
c1bbdc448b72: Pull complete
8c3b70e39044: Pull complete
45d437916d57: Pull complete
b5035666b1cd: Pull complete
94c898b5fdef: Pull complete
bee7bd3eb18f: Pull complete
9dc56c5637b5: Pull complete
31f2b9e8b256: Pull complete
89c4701a4f5f: Pull complete
18467825df3e: Pull complete
Digest: sha256:822418c5ad61473ecfa911dfe4b100264500c504c78def52730106a717be71cb
Status: Downloaded newer image for hyperledger/fabric-tools:latest
Creating peer1.org2.example.com ... done
Creating peer0.org1.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer1.org1.example.com ... done
Creating orderer.example.com    ... done
Creating cli                    ... done

 ____    _____      _      ____    _____
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |
 ___) |   | |    / ___ \  |  _ <    | |
|____/    |_|   /_/   \_\ |_| \_\   |_|

Build your first network (BYFN) end-to-end test

Channel name : mychannel
Creating channel...
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:56:43.622 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:43.673 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:43.687 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2019-12-02 09:56:43.737 UTC [cli.common] readBlock -> INFO 004 Received block: 0
===================== Channel "mychannel" is created successfully =====================

Having all peers join the channel...
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:56:44.085 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:44.236 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:44.257 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2019-12-02 09:56:44.364 UTC [channelCmd] executeJoin -> INFO 004 Successfully submitted proposal to join channel
===================== PEER0 joined on the channel "mychannel" =====================

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer1.org1.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:56:47.466 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:47.506 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:47.518 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2019-12-02 09:56:47.584 UTC [channelCmd] executeJoin -> INFO 004 Successfully submitted proposal to join channel
===================== PEER1 joined on the channel "mychannel" =====================

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:56:50.657 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:50.706 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:50.716 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2019-12-02 09:56:50.759 UTC [channelCmd] executeJoin -> INFO 004 Successfully submitted proposal to join channel
===================== PEER2 joined on the channel "mychannel" =====================

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:56:53.849 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:53.906 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:53.934 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2019-12-02 09:56:53.993 UTC [channelCmd] executeJoin -> INFO 004 Successfully submitted proposal to join channel
===================== PEER3 joined on the channel "mychannel" =====================

Updating anchor peers for org1...
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:56:57.097 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:57.140 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:56:57.148 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2019-12-02 09:56:57.175 UTC [channelCmd] update -> INFO 004 Successfully submitted channel update
===================== Anchor peers for org "Org1MSP" on "mychannel" is updated successfully =====================

Updating anchor peers for org2...
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:57:00.250 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:57:00.322 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:57:00.335 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2019-12-02 09:57:00.360 UTC [channelCmd] update -> INFO 004 Successfully submitted channel update
===================== Anchor peers for org "Org2MSP" on "mychannel" is updated successfully =====================

Installing chaincode on org1/peer0...
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:57:03.509 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:57:03.559 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:57:03.580 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-12-02 09:57:03.580 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2019-12-02 09:57:04.069 UTC [chaincodeCmd] install -> INFO 005 Installed remotely response:
===================== Chaincode is installed on remote peer PEER0 =====================

Install chaincode on org2/peer2...
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:57:04.152 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:57:04.197 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:57:04.221 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-12-02 09:57:04.221 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2019-12-02 09:57:04.588 UTC [chaincodeCmd] install -> INFO 005 Installed remotely response:
===================== Chaincode is installed on remote peer PEER2 =====================

Instantiating chaincode on org2/peer2...
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
2019-12-02 09:57:04.678 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:57:04.717 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:57:04.750 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-12-02 09:57:04.750 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
===================== Chaincode Instantiation on PEER2 on channel 'mychannel' is successful =====================

Querying chaincode on org1/peer0...
===================== Querying on PEER0 on channel 'mychannel'... =====================
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_PEER_TLS_ENABLED=true
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_ID=cli
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
Attempting to Query PEER0 ...3 secs
Attempting to Query PEER0 ...37 secs
Attempting to Query PEER0 ...40 secs
Attempting to Query PEER0 ...43 secs
Attempting to Query PEER0 ...46 secs
Attempting to Query PEER0 ...49 secs
Attempting to Query PEER0 ...52 secs
Attempting to Query PEER0 ...56 secs
Attempting to Query PEER0 ...59 secs
Attempting to Query PEER0 ...62 secs

2019-12-02 09:59:01.545 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-12-02 09:59:01.615 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
100
!!!!!!!!!!!!!!! Query result on PEER0 is INVALID !!!!!!!!!!!!!!!!
================== ERROR !!! FAILED to execute End-2-End Scenario ==================

其实,仔细查看上面的日志会发现:

...
Pulling orderer.example.com (hyperledger/fabric-orderer:latest)...
...
Pulling peer0.org1.example.com (hyperledger/fabric-peer:latest)...
...
Pulling cli (hyperledger/fabric-tools:latest)...
...

我们在看看docker镜像,会发现……

$   docker images
REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE
hyperledger/fabric-tools       latest              7552e1968c0b        2 weeks ago         1.49GB
hyperledger/fabric-ccenv       latest              ca4780293e4c        2 weeks ago         1.37GB
hyperledger/fabric-orderer     latest              dbc9f65443aa        2 weeks ago         120MB
hyperledger/fabric-peer        latest              9756aed98c6b        2 weeks ago         128MB
hyperledger/fabric-baseos      amd64-0.4.18        c256a6aad46f        3 weeks ago         80.8MB
hyperledger/fabric-tools       x86_64-1.0.0        0403fd1c72c7        2 years ago         1.32GB
hyperledger/fabric-couchdb     x86_64-1.0.0        2fbdbf3ab945        2 years ago         1.48GB
hyperledger/fabric-kafka       x86_64-1.0.0        dbd3f94de4b5        2 years ago         1.3GB
hyperledger/fabric-zookeeper   x86_64-1.0.0        e545dbf1c6af        2 years ago         1.31GB
hyperledger/fabric-orderer     x86_64-1.0.0        e317ca5638ba        2 years ago         179MB
hyperledger/fabric-peer        x86_64-1.0.0        6830dcd7b9b5        2 years ago         182MB
hyperledger/fabric-javaenv     x86_64-1.0.0        8948126f0935        2 years ago         1.42GB
hyperledger/fabric-ccenv       x86_64-1.0.0        7182c260a5ca        2 years ago         1.29GB
hyperledger/fabric-ca          x86_64-1.0.0        a15c59ecda5b        2 years ago         238MB

注意imageID! 注意imageID! 注意imageID!

是的,的确和猜想一样,下载了标签为latest的镜像,这有的是用x86_64-1.0.0,有的用的是latest,怎么可能统一嘛

解决方案

下面操作会用到 docker tag命令,不会的看这里

  1. 先记录都有那个镜像是latest的
  2. 然后删除latest镜像docker rmi 7552e1968c0b ca4780293e4c dbc9f65443aa 9756aed98c6b(注意要填写你自己的image id)
  3. 将现有的x86_64-1.0.0的镜像,改tag为latest。比如我的需要改fabric-tools、fabric-ccenv、fabric-peer、fabric-orderer
docker tag  hyperledger/fabric-tools:x86_64-1.0.0 hyperledger/fabric-tools:latest
docker tag  hyperledger/fabric-ccenv:x86_64-1.0.0 hyperledger/fabric-ccenv:latest
docker tag  hyperledger/fabric-peer:x86_64-1.0.0 hyperledger/fabric-peer:latest
docker tag  hyperledger/fabric-orderer:x86_64-1.0.0 hyperledger/fabric-orderer:latest

改过之后,查看一下镜像docker images

REPOSITORY                            TAG                 IMAGE ID            CREATED             SIZE
hyperledger/fabric-baseos             amd64-0.4.18        c256a6aad46f        3 weeks ago         80.8MB
hyperledger/fabric-tools              latest              0403fd1c72c7        2 years ago         1.32GB
hyperledger/fabric-tools              x86_64-1.0.0        0403fd1c72c7        2 years ago         1.32GB
hyperledger/fabric-couchdb            x86_64-1.0.0        2fbdbf3ab945        2 years ago         1.48GB
hyperledger/fabric-kafka              x86_64-1.0.0        dbd3f94de4b5        2 years ago         1.3GB
hyperledger/fabric-zookeeper          x86_64-1.0.0        e545dbf1c6af        2 years ago         1.31GB
hyperledger/fabric-orderer            latest              e317ca5638ba        2 years ago         179MB
hyperledger/fabric-orderer            x86_64-1.0.0        e317ca5638ba        2 years ago         179MB
hyperledger/fabric-peer               latest              6830dcd7b9b5        2 years ago         182MB
hyperledger/fabric-peer               x86_64-1.0.0        6830dcd7b9b5        2 years ago         182MB
hyperledger/fabric-javaenv            x86_64-1.0.0        8948126f0935        2 years ago         1.42GB
hyperledger/fabric-ccenv              latest              7182c260a5ca        2 years ago         1.29GB
hyperledger/fabric-ccenv              x86_64-1.0.0        7182c260a5ca        2 years ago         1.29GB
hyperledger/fabric-ca                 x86_64-1.0.0        a15c59ecda5b        2 years ago         238MB
hyperledger/fabric-baseos             x86_64-0.3.1        4b0cab202084        2 years ago         157MB

注意imageID! 注意imageID! 注意imageID!

现在再执行一下byfn.sh -m up

...
...
...
===================== Chaincode is installed on remote peer PEER3 =====================

Querying chaincode on org2/peer3...
===================== Querying on PEER3 on channel 'mychannel'... =====================
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
Attempting to Query PEER3 ...3 secs

2019-12-02 10:23:37.604 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2019-12-02 10:23:37.605 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2019-12-02 10:23:37.605 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-12-02 10:23:37.605 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2019-12-02 10:23:37.605 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A91070A6708031A0C08A9CC93EF0510...6D7963631A0A0A0571756572790A0161
2019-12-02 10:23:37.605 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: E132D9A02A23EAC394FA7048DBA18E34CAACE178C9683614447AAE95F489A291
Query Result: 90
2019-12-02 10:24:01.358 UTC [main] main -> INFO 007 Exiting.....
===================== Query on PEER3 on channel 'mychannel' is successful =====================

========= All GOOD, BYFN execution completed ===========


 _____   _   _   ____
| ____| | \ | | |  _ \
|  _|   |  \| | | | | |
| |___  | |\  | | |_| |
|_____| |_| \_| |____/

有木有上完厕所,浑身轻松的感觉?

总结

由于粗心,没有仔细查看日志。找到网上说的解决方案后,没有仔细对比IMAGE ID

你可能感兴趣的:(部署Hyperledger Fabric 1.0 出现 Attempting to Query PEER0 ...61 secs)