使用mongodb ini hyperledger composer使用持久数据源时出错

问题描述 投票:-1回答:1

I am trying to use persistent datasource using mongoDB in hyperledger composer on a UBUNTU droplet but after starting the rest server and den after issuing a command docker logs -f rest i am getting the following error(i have provided a link to the image)

webuser@ubuntu16:~$ docker logs -f rest
    [2018-08-29T12:38:31.278Z] PM2 log: Launching in no daemon mode
    [2018-08-29T12:38:31.351Z] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
    [2018-08-29T12:38:31.359Z] PM2 log: App name:composer-rest-server id:0 online
    WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
    WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
    Discovering types from business network definition ...
    (node:15) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
    Connection fails: Error: Error trying to ping. Error: Failed to connect before the deadline
    It will be retried for the next request.
    Exception: Error: Error trying to ping. Error: Failed to connect before the deadline
    Error: Error trying to ping. Error: Failed to connect before the deadline
        at _checkRuntimeVersions.then.catch (/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:806:34)
        at <anonymous>
    [2018-08-29T12:38:41.021Z] PM2 log: App [composer-rest-server] with id [0] and pid [15], exited with code [1] via signal [SIGINT]
    [2018-08-29T12:38:41.024Z] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
    [2018-08-29T12:38:41.028Z] PM2 log: App name:composer-rest-server id:0 online
    WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
    WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
    Discovering types from business network definition ...
    (node:40) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
    Connection fails: Error: Error trying to ping. Error: Failed to connect before the deadline

    It will be retried for the next request.

我不明白是什么问题以及我在做什么错,因为我已经成功地遵循了超级编曲文件中的所有步骤....

Is it because I am using it on ubuntu droplet....?? anyone help

编辑

我按照this tutorial中提到的所有步骤,但不是使用谷歌身份验证我使用github身份验证。此外,我已将本地主机更改为connection.json文件中的ubuntu droplet以及此命令中的ip

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@trade-network/connection.json> / tmp /connection.json&& cp -p /tmp/connection.json $HOME/.composer/cards/restadmin@trade-network/

但还没有成功!我现在得到以下错误.....

webuser @ ubuntu16:〜$ docker logs rest [2018-08-30T05:03:02.916Z]PM2日志:在无守护进程模式下启动[2018-08-30T05:03:02.989Z]PM2日志:在-fork中启动执行顺序mode- for app name:composer-rest-server id:0 [2018-08-30T05:03:02.997Z] PM2 log:app name:composer-rest-server id:0 online警告:NODE_APP_INSTANCE值为'0'不匹配任何实例配置文件名。警告:请参阅https://github.com/lorenwest/node-config/wiki/Strict-Mode从业务网络定义中发现类型...(节点:15)DeprecationWarning:不推荐使用当前URL字符串解析器,并将在以后的版本中删除。要使用新的解析器,请将选项{useNewUrlParser:true}传递给MongoClient.connect。发现返回事务。从业务网络定义中发现的类型为业务网络定义中的所有类型生成模式...为业务网络定义中的所有类型生成模式将所有类型的模式添加到Loopback ...为Loopback添加所有类型的模式SyntaxError:在Promise.then的JSON.parse()位置92的JSON中的意外字符串(/home/composer/.npm-global/lib/node_modules/composer-rest-server/server/server.js:141:34) at at process._tickDomainCallback(internal / process / next_tick.js:228:7)[2018-08-30T05:03:09.942Z] PM2 log:App [composer-rest-server],id [0]和pid [15 ],通过信号[SIGINT]退出代码1

mongodb hyperledger-fabric hyperledger blockchain hyperledger-composer
1个回答
1
投票

此错误Error trying to ping. Error: Failed to connect before the deadline表示容器中的composer-rest-server无法在用于启动REST服务器的卡的connection.json中的URL处查看/连接到底层Fabric。

原因有很多:

  • Fabric未启动
  • 您正在使用在connection.json的URL中具有localhost的业务网卡,而localhost只是重定向回到其余容器中。
  • 您的rest容器在与Fabric容器不同的Docker网桥上启动,无法连接到Fabric。

您是否在Composer文档中关注过this tutorial?如果完全遵循它将避免上述3个问题。

© www.soinside.com 2019 - 2024. All rights reserved.