hyperledger_fabric 第一个网络失败 BAD_REQUEST
hyperledger_fabric first-network fails with BAD_REQUEST
此题类似于 except that I am attempting to run the automated scripts as described here: http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html,而不是手动执行steps。
当我 运行 提供的脚本时,我得到以下输出:
Build your first network (BYFN) end-to-end test
Channel name : mychannel
Creating channel...
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_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_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/org1.example.com/users/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2017-08-14 16:41:43.613 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-08-14 16:41:43.613 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-14 16:41:43.620 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 19B305348F751FF3B0C1B71929C28A1C70F05748093E5A68E7DED43F7C3619ED
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608C7A5C7CC0522...E601917DB4E717688C2A98F6A85BB2C8
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 6C4EDDCB459279CFBB9D696D2179A95D00FE85F80E01375E94D4A66A50A9ABF5
Error: Got unexpected status: BAD_REQUEST
为了解决这个问题,我回到了开始,删除了所有 docker 容器和图像,并在下载平台特定图像二进制文件步骤重新启动了进程:
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap-1.0.1.sh | bash
===> Please note, google shortened URL (goo.gl/eYdRbX) ran afoul of the Whosebug editor, so has been replaced with the URL to which it points
无论如何,我仍然会在第一个网络设置过程中的同一点得到相同的 BAD_REQUEST 响应。在我解决这个问题之前,我完全停滞不前。
我确实注意到,在这个脚本的顶部,在创建不同的 docker 图像的地方,create cli 出现了两次,之后 'Recreating cli' 也是如此。不知道这是否与此问题有关。
Creating network "net_byfn" with the default driver
Creating peer1.org2.example.com ...
Creating peer1.org1.example.com ...
Creating peer0.org2.example.com ...
Creating peer0.org1.example.com ...
Creating orderer.example.com ...
Creating peer1.org2.example.com
Creating peer0.org2.example.com
Creating peer1.org1.example.com
Creating orderer.example.com
Creating peer1.org1.example.com ... done
Creating cli ...
Creating cli ... done
WARNING: The DELAY variable is not set. Defaulting to a blank string.
peer1.org1.example.com is up-to-date
peer0.org2.example.com is up-to-date
orderer.example.com is up-to-date
peer1.org2.example.com is up-to-date
peer0.org1.example.com is up-to-date
Recreating cli ...
Recreating cli ... done
docker ps -a 执行 load from (goo.gl/eYdRbX 后的结果
):
===> List out hyperledger docker images
hyperledger/fabric-ca latest 5f30bda5f7ee 4 days ago 238MB
hyperledger/fabric-ca x86_64-1.0.1 5f30bda5f7ee 4 days ago 238MB
hyperledger/fabric-tools latest 259847d24868 4 days ago 1.34GB
hyperledger/fabric-tools x86_64-1.0.1 259847d24868 4 days ago 1.34GB
hyperledger/fabric-couchdb latest dd645e1e92c7 4 days ago 1.48GB
hyperledger/fabric-couchdb x86_64-1.0.1 dd645e1e92c7 4 days ago 1.48GB
hyperledger/fabric-kafka latest cbdc916590a0 4 days ago 1.3GB
hyperledger/fabric-kafka x86_64-1.0.1 cbdc916590a0 4 days ago 1.3GB
hyperledger/fabric-zookeeper latest eb07e5cc9674 4 days ago 1.31GB
hyperledger/fabric-zookeeper x86_64-1.0.1 eb07e5cc9674 4 days ago 1.31GB
hyperledger/fabric-orderer latest bbf2708c9487 4 days ago 179MB
hyperledger/fabric-orderer x86_64-1.0.1 bbf2708c9487 4 days ago 179MB
hyperledger/fabric-peer latest abb05def5cfb 4 days ago 182MB
hyperledger/fabric-peer x86_64-1.0.1 abb05def5cfb 4 days ago 182MB
hyperledger/fabric-javaenv latest 2bd60859415d 4 days ago 1.42GB
hyperledger/fabric-javaenv x86_64-1.0.1 2bd60859415d 4 days ago 1.42GB
hyperledger/fabric-ccenv latest 7e2019cf8174 4 days ago 1.29GB
hyperledger/fabric-ccenv x86_64-1.0.1 7e2019cf8174 4 days ago 1.29GB
docker ps 结果:
c6025a23ab46 hyperledger/fabric-tools "/bin/bash -c './s..." 13 seconds ago Up 11 seconds cli
a132bd2f4fed hyperledger/fabric-peer "peer node start" 27 seconds ago Up 25 seconds 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
a9e9078c381c hyperledger/fabric-orderer "orderer" 27 seconds ago Up 26 seconds 0.0.0.0:7050->7050/tcp orderer.example.com
48768f75bcb0 hyperledger/fabric-peer "peer node start" 27 seconds ago Up 26 seconds 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.org2.example.com
bb14fd33c8a2 hyperledger/fabric-peer "peer node start" 27 seconds ago Up 26 seconds 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer1.org2.example.com
f20582c065a0 hyperledger/fabric-peer "peer node start" 27 seconds ago Up 25 seconds 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
运行configtxgen --version
,输出是1.0.0还是1.0.1?
版本 1.0.0 不包含使 1.0.1 图像工作所需的 mod_policy 内容,您需要重新下载工具。
如果输出是 1.0.1,请您重新运行 手动完成所有操作,除非您启动容器:
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=<pick_a_value> docker-compose -f docker-compose-cli.yaml up -d
确保 运行 它最后没有 -d
参数,所以命令现在是:
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=<pick_a_value> docker-compose -f docker-compose-cli.yaml up
这将在终端中显示日志。现在打开一个新的终端选项卡并再次设置环境变量(即 CHANNEL_NAME 和 FABRIC_CFG_PATH)并继续手动设置。当你运行频道创建命令:
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
在另一个选项卡上查看日志的最后几行,post 将它们放在这里。
当前版本的 byfn.sh 文件中有一行额外的代码用于 first-network。 networkUp 函数当前如下所示:
# Generate the needed certificates, the genesis block and start the network.
function networkUp () {
# generate artifacts if they don't exist
if [ ! -d "crypto-config" ]; then
generateCerts
replacePrivateKey
generateChannelArtifacts
fi
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
if [ "${IF_COUCHDB}" == "couchdb" ]; then
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
else
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE up -d 2>&1
fi
if [ $? -ne 0 ]; then
echo "ERROR !!!! Unable to start network"
docker logs -f cli
exit 1
fi
docker logs -f cli
}
此执行程序中有两个错误。第一个是当前文件中的第 113 行,它在 IF_COUCHDB
测试之前立即发出 docker-compose 请求。这一行应该是removed/commented出来的。此 exec 中的第二个错误是没有为 if 语句中的任何一个 docker-compose 请求设置 DELAY 参数。
此 exec 的代码应更新为以下内容:
# Generate the needed certificates, the genesis block and start the network.
function networkUp () {
# generate artifacts if they don't exist
if [ ! -d "crypto-config" ]; then
generateCerts
replacePrivateKey
generateChannelArtifacts
fi
# CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
if [ "${IF_COUCHDB}" == "couchdb" ]; then
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
else
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
fi
if [ $? -ne 0 ]; then
echo "ERROR !!!! Unable to start network"
docker logs -f cli
exit 1
fi
docker logs -f cli
}
在这里您可以看到额外的 docker-compose 语句(第 113 行)已被注释掉,DELAY 参数现在被正确地传递给 docker-compose 请求。
此题类似于
当我 运行 提供的脚本时,我得到以下输出:
Build your first network (BYFN) end-to-end test
Channel name : mychannel
Creating channel...
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_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_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/org1.example.com/users/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2017-08-14 16:41:43.613 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-08-14 16:41:43.613 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-14 16:41:43.620 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 19B305348F751FF3B0C1B71929C28A1C70F05748093E5A68E7DED43F7C3619ED
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608C7A5C7CC0522...E601917DB4E717688C2A98F6A85BB2C8
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 6C4EDDCB459279CFBB9D696D2179A95D00FE85F80E01375E94D4A66A50A9ABF5
Error: Got unexpected status: BAD_REQUEST
为了解决这个问题,我回到了开始,删除了所有 docker 容器和图像,并在下载平台特定图像二进制文件步骤重新启动了进程:
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap-1.0.1.sh | bash
===> Please note, google shortened URL (goo.gl/eYdRbX) ran afoul of the Whosebug editor, so has been replaced with the URL to which it points
无论如何,我仍然会在第一个网络设置过程中的同一点得到相同的 BAD_REQUEST 响应。在我解决这个问题之前,我完全停滞不前。
我确实注意到,在这个脚本的顶部,在创建不同的 docker 图像的地方,create cli 出现了两次,之后 'Recreating cli' 也是如此。不知道这是否与此问题有关。
Creating network "net_byfn" with the default driver
Creating peer1.org2.example.com ...
Creating peer1.org1.example.com ...
Creating peer0.org2.example.com ...
Creating peer0.org1.example.com ...
Creating orderer.example.com ...
Creating peer1.org2.example.com
Creating peer0.org2.example.com
Creating peer1.org1.example.com
Creating orderer.example.com
Creating peer1.org1.example.com ... done
Creating cli ...
Creating cli ... done
WARNING: The DELAY variable is not set. Defaulting to a blank string.
peer1.org1.example.com is up-to-date
peer0.org2.example.com is up-to-date
orderer.example.com is up-to-date
peer1.org2.example.com is up-to-date
peer0.org1.example.com is up-to-date
Recreating cli ...
Recreating cli ... done
docker ps -a 执行 load from (goo.gl/eYdRbX 后的结果 ):
===> List out hyperledger docker images
hyperledger/fabric-ca latest 5f30bda5f7ee 4 days ago 238MB
hyperledger/fabric-ca x86_64-1.0.1 5f30bda5f7ee 4 days ago 238MB
hyperledger/fabric-tools latest 259847d24868 4 days ago 1.34GB
hyperledger/fabric-tools x86_64-1.0.1 259847d24868 4 days ago 1.34GB
hyperledger/fabric-couchdb latest dd645e1e92c7 4 days ago 1.48GB
hyperledger/fabric-couchdb x86_64-1.0.1 dd645e1e92c7 4 days ago 1.48GB
hyperledger/fabric-kafka latest cbdc916590a0 4 days ago 1.3GB
hyperledger/fabric-kafka x86_64-1.0.1 cbdc916590a0 4 days ago 1.3GB
hyperledger/fabric-zookeeper latest eb07e5cc9674 4 days ago 1.31GB
hyperledger/fabric-zookeeper x86_64-1.0.1 eb07e5cc9674 4 days ago 1.31GB
hyperledger/fabric-orderer latest bbf2708c9487 4 days ago 179MB
hyperledger/fabric-orderer x86_64-1.0.1 bbf2708c9487 4 days ago 179MB
hyperledger/fabric-peer latest abb05def5cfb 4 days ago 182MB
hyperledger/fabric-peer x86_64-1.0.1 abb05def5cfb 4 days ago 182MB
hyperledger/fabric-javaenv latest 2bd60859415d 4 days ago 1.42GB
hyperledger/fabric-javaenv x86_64-1.0.1 2bd60859415d 4 days ago 1.42GB
hyperledger/fabric-ccenv latest 7e2019cf8174 4 days ago 1.29GB
hyperledger/fabric-ccenv x86_64-1.0.1 7e2019cf8174 4 days ago 1.29GB
docker ps 结果:
c6025a23ab46 hyperledger/fabric-tools "/bin/bash -c './s..." 13 seconds ago Up 11 seconds cli
a132bd2f4fed hyperledger/fabric-peer "peer node start" 27 seconds ago Up 25 seconds 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
a9e9078c381c hyperledger/fabric-orderer "orderer" 27 seconds ago Up 26 seconds 0.0.0.0:7050->7050/tcp orderer.example.com
48768f75bcb0 hyperledger/fabric-peer "peer node start" 27 seconds ago Up 26 seconds 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.org2.example.com
bb14fd33c8a2 hyperledger/fabric-peer "peer node start" 27 seconds ago Up 26 seconds 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer1.org2.example.com
f20582c065a0 hyperledger/fabric-peer "peer node start" 27 seconds ago Up 25 seconds 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
运行configtxgen --version
,输出是1.0.0还是1.0.1?
版本 1.0.0 不包含使 1.0.1 图像工作所需的 mod_policy 内容,您需要重新下载工具。
如果输出是 1.0.1,请您重新运行 手动完成所有操作,除非您启动容器:
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=<pick_a_value> docker-compose -f docker-compose-cli.yaml up -d
确保 运行 它最后没有 -d
参数,所以命令现在是:
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=<pick_a_value> docker-compose -f docker-compose-cli.yaml up
这将在终端中显示日志。现在打开一个新的终端选项卡并再次设置环境变量(即 CHANNEL_NAME 和 FABRIC_CFG_PATH)并继续手动设置。当你运行频道创建命令:
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
在另一个选项卡上查看日志的最后几行,post 将它们放在这里。
当前版本的 byfn.sh 文件中有一行额外的代码用于 first-network。 networkUp 函数当前如下所示:
# Generate the needed certificates, the genesis block and start the network.
function networkUp () {
# generate artifacts if they don't exist
if [ ! -d "crypto-config" ]; then
generateCerts
replacePrivateKey
generateChannelArtifacts
fi
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
if [ "${IF_COUCHDB}" == "couchdb" ]; then
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
else
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE up -d 2>&1
fi
if [ $? -ne 0 ]; then
echo "ERROR !!!! Unable to start network"
docker logs -f cli
exit 1
fi
docker logs -f cli
}
此执行程序中有两个错误。第一个是当前文件中的第 113 行,它在 IF_COUCHDB
测试之前立即发出 docker-compose 请求。这一行应该是removed/commented出来的。此 exec 中的第二个错误是没有为 if 语句中的任何一个 docker-compose 请求设置 DELAY 参数。
此 exec 的代码应更新为以下内容:
# Generate the needed certificates, the genesis block and start the network.
function networkUp () {
# generate artifacts if they don't exist
if [ ! -d "crypto-config" ]; then
generateCerts
replacePrivateKey
generateChannelArtifacts
fi
# CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
if [ "${IF_COUCHDB}" == "couchdb" ]; then
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
else
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
fi
if [ $? -ne 0 ]; then
echo "ERROR !!!! Unable to start network"
docker logs -f cli
exit 1
fi
docker logs -f cli
}
在这里您可以看到额外的 docker-compose 语句(第 113 行)已被注释掉,DELAY 参数现在被正确地传递给 docker-compose 请求。