虚拟化多台主机上的超级账本网络的问题

时间:2019-07-25 07:31:59

标签: postgresql blockchain hyperledger-explorer

我已遵循并完成了本教程

https://medium.com/@malliksarvepalli/hyperledger-fabric-1-2-on-multiple-hosts-using-docker-swarm-and-compose-11c13635e69e

,我连接了3台主机,所有服务都启动了。在PC2主机中运行./script.sh时,我得到了正确的结果。 现在,我正在关注下一个教程:

https://medium.com/@malliksarvepalli/hyperledger-explorer-with-fabric-1-2-running-on-multiple-hosts-89c5af691b7e

有人可以启发本教程吗?我发现我应该使用ubuntu 16.04创建一个新主机并安装以下前提条件:

nodejs 8.11.x

PostgreSQL 9.5或更高版本

Jq

我是对的吗?

然后在explorerconfig.json中,我更新了postgres变量:

主机:192.168.1.136(第4个虚拟机IP), 端口:5432, 用户名:postgres, 密码:psql, 数据库:面料

他们正确吗?

我还修改了config.json文件中的Orderer,Org1 [peer0&peer1),Org2(peer0&peer1)IP地址,其中前三个Vms的IP地址已建立并正在运行。

并按照其余说明和测试进行操作,但是当我运行命令./start.sh时,我在控制台中有以下日志:

false 'ssl-certs' '/home/database/blockchain-explorer/ssl-certs'

postgres://christy:christy@192.168.1.136:5432/fabric

error when connecting to db: { Error: connect ECONNREFUSED 192.168.1.136:5432

at Object._errnoException (util.js:992:11)

at _exceptionWithHostPort (util.js:1014:20)

at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)

code: 'ECONNREFUSED',

errno: 'ECONNREFUSED',

syscall: 'connect',

address: '192.168.1.136',

port: 5432 }

******* Initialization started for hyperledger fabric platform ******, { 

'network-1': 

 { version: '1.0',

 clients: { 'client-1': [Object] },

 channels: { mychannel: [Object] },

 organizations: { Org1MSP: [Object], Org2MSP: [Object], OrdererMSP: 
 [Object] },

  peers: 

   { 'peer0.org1.ntua.com': [Object],

    'peer1.org1.ntua.com': [Object],

    'peer0.org2.ntua.com': [Object],

    'peer1.org2.ntua.com': [Object] },

    orderers: { 'orderer.ntua.com': [Object] } },

    'network-2': {} }

   client_configs.name  undefined  client_configs.profile  undefined

   FabricUtils.createFabricClient 

   <<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>

   Error :  [ 'Invalid platform configuration, Please check the log' ]

   error when connecting to db: TypeError: Cannot read property 'on' of 
   undefined

  at Timeout.handleDisconnect [as _onTimeout] (/home/database/blockchain-

  explorer/app/persistence/postgreSQL/PgService.js:68:16)

  at ontimeout (timers.js:498:11)

  at tryOnTimeout (timers.js:323:5)

  at Timer.listOnTimeout (timers.js:290:5)


  <<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>

  TypeError: "callback" argument must be a function

  at setTimeout (timers.js:450:11)

  at Timeout.handleDisconnect [as _onTimeout] (/home/database/blockchain-

  explorer/app/persistence/postgreSQL/PgService.js:85:5)

  at ontimeout (timers.js:498:11)

  at tryOnTimeout (timers.js:323:5)

  at Timer.listOnTimeout (timers.js:290:5)

  Received kill signal, shutting down gracefully

  Closed out connections

  false 'ssl-certs' '/home/database/blockchain-explorer/ssl-certs'

   postgres://christy:christy@192.168.1.136:5432/fabric

   error when connecting to db: { Error: connect ECONNREFUSED 192.168.1.136:5432

   at Object._errnoException (util.js:992:11)

   at _exceptionWithHostPort (util.js:1014:20)

   at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)

   code: 'ECONNREFUSED',

   errno: 'ECONNREFUSED',

   syscall: 'connect',

   address: '192.168.1.136',

   port: 5432 }


   ******* Initialization started for hyperledger fabric platform ******, 
  { 

  'network-1': 

  { version: '1.0',

   clients: { 'client-1': [Object] },

   channels: { mychannel: [Object] },

   organizations: { Org1MSP: [Object], Org2MSP: [Object], OrdererMSP: 

   [Object] },

   peers: 

   { 'peer0.org1.ntua.com': [Object],

     'peer1.org1.ntua.com': [Object],

     'peer0.org2.ntua.com': [Object],

     'peer1.org2.ntua.com': [Object] },

    orderers: { 'orderer.ntua.com': [Object] } },

    'network-2': {} }

    client_configs.name  undefined  client_configs.profile  undefined

    FabricUtils.createFabricClient 

    <<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>

    Error :  [ 'Invalid platform configuration, Please check the log' ]

    error when connecting to db: TypeError: Cannot read property 'on' of 
    undefined

   at Timeout.handleDisconnect [as _onTimeout] (/home/database/blockchain-

   explorer/app/persistence/postgreSQL/PgService.js:68:16)

   at ontimeout (timers.js:498:11)

   at tryOnTimeout (timers.js:323:5)

   at Timer.listOnTimeout (timers.js:290:5)

   <<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>

   TypeError: "callback" argument must be a function

   at setTimeout (timers.js:450:11)

   at Timeout.handleDisconnect [as _onTimeout] (/home/database/blockchain-

   explorer/app/persistence/postgreSQL/PgService.js:85:5)

   at ontimeout (timers.js:498:11)

   at tryOnTimeout (timers.js:323:5)

   at Timer.listOnTimeout (timers.js:290:5)

   Received kill signal, shutting down gracefully

   Received kill signal, shutting down gracefully

   Closed out connections

如果还需要其他日志,请告诉我。任何帮助都会有所帮助。非常感谢。

1 个答案:

答案 0 :(得分:1)

我可以给您一些方面,以供您检查您的环境。

  • 首先,您需要检查是否能够从试图启动Hyperledger Explorer的虚拟机访问postgresql DB(第四虚拟机)。如果没有,我认为您需要更改postgres配置(postgresql.conf / pg_hba.conf)以启用外部访问。

    $ sudo -u postgres psql -h 192.168.1.136 -d fabric -c'table peer'

  • 第二,请确认您确实在第四台VM上运行了./createdb.sh。如果更改了数据库名称,则还需要对齐脚本

    $ cd app / persistence / fabric / postgreSQL / db /

    $ ./createdb.sh