REST多用户模式下的Hyperledger Composer ping:ECONNREFUSED用于来自单用户REST的已发布身份

时间:2019-07-24 16:57:24

标签: hyperledger-fabric hyperledger hyperledger-composer

以下情况:https://hyperledger.github.io/composer/v0.19/tutorials/google_oauth2_rest

我有以下相同的问题:

Hyperledger Composer multi-user mode: ECONNREFUSED for issued identities

基本上,我有两个休息服务器,当我从端口3001(管理卡单用户)发出ID时,然后导入并尝试对端口3000(多用户)执行ping操作,出现相同的错误。好像卡是用错误的主机名导入的。

但是我不能做到与用户所说的相同: “我在那边更改了URL,而不是在创建卡之后修改了卡。这解决了问题,因为现在卡是使用正确的容器URL而不是本地主机生成的。”

当我这样做

composer identity issue -c admin@amachains -f restadmin.card -u restadmin -a "resource:org.hyperledger.composer.system.NetworkAdmin#restadmin"

composer card import -f restadmin.card

composer network ping -c restadmin@amachains

cd ..

sed -e 's/localhost:7051/peer0.org1.example.com:7051/' -e 's/localhost:7053/peer0.org1.example.com:7053/' -e 's/localhost:7054/ca.org1.example.com:7054/'  -e 's/localhost:7050/orderer.example.com:7050/'  < $HOME/.composer/cards/restadmin@amachains/connection.json  > /tmp/connection.json && cp -p /tmp/connection.json $HOME/.composer/cards/restadmin@amachains/ 

然后将其导出并导入到3000个其余服务器中,可以ping通。

这是我启动整个项目的脚本:

# !/bin/bash
sudo kill $(sudo lsof -t -i:3000)

sudo kill $(sudo lsof -t -i:3001)

sudo kill $(sudo lsof -t -i:4200)

# Stop Fabric & Teardown Fabric
~/fabric-dev-servers/stopFabric.sh && ~/fabric-dev-servers/teardownFabric.sh

# Clean Composer
rm -rf ~/.composer

# Clean Docker containers
docker kill $(docker ps -q)

docker rm $(docker ps -aq)

# Clean Docker images
docker rmi $(docker images dev-* -q)

# Clean Docker images
docker rmi $(docker images amachains/* -q)

# Start Fabric & Create Peer Admin Card
~/fabric-dev-servers/startFabric.sh && ~/fabric-dev-servers/createPeerAdminCard.sh

docker run -d --name mongo --network composer_default -p 27017:27017 mongo

cd dockertmp

docker build -t amachains/amachains-rest-server .

cd ..

# Install BNA on Hyperledger Faric with Hyperledger Composer
cd ./amachains-bna

composer archive create -t dir -n .

composer network install --card PeerAdmin@hlfv1 --archiveFile amachains@0.0.1.bna

composer network start --networkName amachains --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card

composer card import --file networkadmin.card

composer network ping -c admin@amachains

composer participant add -c admin@amachains -d '{"$class":"org.hyperledger.composer.system.NetworkAdmin", "participantId":"restadmin"}'

composer identity issue -c admin@amachains -f restadmin.card -u restadmin -a "resource:org.hyperledger.composer.system.NetworkAdmin#restadmin"

composer card import -f restadmin.card

composer network ping -c restadmin@amachains

cd ..

sed -e 's/localhost:7051/peer0.org1.example.com:7051/' -e 's/localhost:7053/peer0.org1.example.com:7053/' -e 's/localhost:7054/ca.org1.example.com:7054/'  -e 's/localhost:7050/orderer.example.com:7050/'  < $HOME/.composer/cards/restadmin@amachains/connection.json  > /tmp/connection.json && cp -p /tmp/connection.json $HOME/.composer/cards/restadmin@amachains/ 

source envvars.txt

docker run \
-d \
-e COMPOSER_CARD=${COMPOSER_CARD} \
-e COMPOSER_NAMESPACES=${COMPOSER_NAMESPACES} \
-e COMPOSER_AUTHENTICATION=${COMPOSER_AUTHENTICATION} \
-e COMPOSER_MULTIUSER=${COMPOSER_MULTIUSER} \
-e COMPOSER_PROVIDERS="${COMPOSER_PROVIDERS}" \
-e COMPOSER_DATASOURCES="${COMPOSER_DATASOURCES}" \
-v ~/.composer:/home/composer/.composer \
--name rest \
--network composer_default \
-p 3000:3000 \
amachains/amachains-rest-server

# docker ps |grep rest

# docker logs -f rest

cd amachains-client/

composer-rest-server -c admin@amachains -p 3001 & npm start

在其余服务器端口3000上的系统/ ping应该处于正常状态,但是我得到了:

ERROR Error: Uncaught (in promise): HttpErrorResponse: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":500,"statusText":"Internal Server Error","url":"http://localhost:3000/api/system/ping","ok":false,"name":"HttpErrorResponse","message":"Http failure response for http://localhost:3000/api/system/ping: 500 Internal Server Error","error":{"error":{"statusCode":500,"name":"Error","message":"Error trying login and get user Context. Error: Error trying to enroll user. Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]","stack":"Error: Error trying login and get user Context. Error: Error trying to enroll user. Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]\n    at HLFConnection.login (/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:477:30)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:189:7)"}}}

0 个答案:

没有答案