使用mongodb ini hyperledger composer使用持久数据源时发生错误

时间:2018-08-29 12:54:03

标签: mongodb hyperledger-fabric hyperledger blockchain hyperledger-composer

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.

我不明白问题是什么,我在做什么错,因为我已经成功完成了Hyperledger Composer文档中的所有步骤。...

是因为我在ubuntu小滴上使用它吗?任何人的帮助

编辑

我遵循了this tutorial中提到的所有步骤 但不是使用谷歌身份验证,而是使用github身份验证。 我也将本地主机更改为connection.json文件以及此命令中ubuntu drop的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/

bt仍然没有成功!我现在收到以下错误.....

webuser @ ubuntu16:〜$ docker日志休息 [2018-08-30T05:03:02.916Z] PM2日志:在无守护程序模式下启动 [2018-08-30T05:03:02.989Z] PM2日志:应用程序名称:composer-rest-server id:0的-fork模式-开始执行序列 [2018-08-30T05:03:02.997Z] PM2日志:应用名称:composer-rest-server id:0在线 警告:NODE_APP_INSTANCE值'0'与任何实例配置文件名都不匹配。 警告:请参见https://github.com/lorenwest/node-config/wiki/Strict-Mode 从业务网络定义中发现类型... (节点:15)DeprecationWarning:不建议使用当前的URL字符串解析器,并将在以后的版本中将其删除。要使用新的解析器,请将选项{useNewUrlParser:true}传递给MongoClient.connect。 发现退货交易 从业务网络定义中发现的类型 为业务网络定义中的所有类型生成模式... 为业务网络定义中的所有类型生成的模式 将所有类型的架构添加到Loopback ... 为环回添加了所有类型的架构 SyntaxError:JSON中位置92处的字符串意外     在JSON.parse()     然后在Promise.then(/home/composer/.npm-global/lib/node_modules/composer-rest-server/server/server.js:141:34)     在     在process._tickDomainCallback(内部/进程/next_tick.js:228:7) [2018-08-30T05:03:09.942Z] PM2日志:ID为[0]和pid [15]的应用[composer-rest-server],通过信号[SIGINT] 1退出>

1 个答案:

答案 0 :(得分:1)

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

原因有很多:

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

您是否遵循Composer文档中的this tutorial?如果完全遵循,它将避免上述三个问题。