Christy Nakou
Christy Nakou

Reputation: 413

Problem on virtualize hyperledger network on multiple hosts

I have followed and finished the tutorial

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

and I have 3 hosts connected and all services are up. I had the correct result when I run the ./script.sh in the PC2 host. Now I am following the next tutorial which is:

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

Can anyone please enlighten me in this tutorial? I have figured out that I should create a new host with ubuntu 16.04 and install the following prerequites:

nodejs 8.11.x

PostgreSQL 9.5 or greater

Jq

Am I right?

And in the exploreconfig.json I updated postgres variables:

host:192.168.1.136(4th's vm ip), port:5432, username:postgres, password:psql, database:fabric

Are they correct?

I have also modified Orderer, Org1 [peer0 & peer1), Org2(peer0 & peer1) IP address in config.json file with the ips of first three Vms where the network is up and running.

And follow the rest instructions and tests but when I run the command ./start.sh I have logs in console which are:

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

postgres://christy:[email protected]: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:[email protected]: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

If the other logs are also needed please let me know. Any help will be helpful. Thanks a lot.

Upvotes: 0

Views: 240

Answers (1)

nekia
nekia

Reputation: 64

I can give you some aspects to be checked on your environment.

  • First you need to do check if you are able to access postgresql DB(4th's vm) from the vm where you are trying to launch Hyperledger Explorer. If not, you need to change your postgres configuration (postgresql.conf/pg_hba.conf) for enabling external access, I think.

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

  • Second, please confirm that you did run ./createdb.sh on 4th VM. If you changed database name, you also need to align the script

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

    $ ./createdb.sh

Upvotes: 1

Related Questions