Hyperledger explorer in docker-compose is not work

2019-03-06 08:45发布

问题:

I am trying to get hyperledger explorer to work with docker-compose, hyperledger blockchain explorer did not connect to the hyperledger blockchain network. It says "Failed to connect client peer, please check the configuration and peer status". However I followed all instructions I could find to get it to connect.

The Hyperledger explorer starts up and I can access it at http://localhost:8090/ but it does not connect to the blockchain.

Here is the github project where it is not working.

https://github.com/contractpendev/hyperledger-basic-network

Blockchain Explorer comes from here.

https://github.com/hyperledger/blockchain-explorer

回答1:

I would add a comment asking for more info, but since I don´t have enough rep yet to comment, I guess I'll try an answer instead!

All of the following assume that Blockchain Explorer is run in a docker container, using the supplied deploy_explorer.sh script. All examples below should work with the first-network sample network from fabric-samples, assuming that fabric-samples has been cloned to ~/fabric/fabric-samples.

Firstly, are there any more detailed errors reported in either the docker logs (docker logs {container-name}) or the log file in the container (/opt/logs/app/app.log)?

Have you done the following?

  • Confirm that you are using the correct Blockchain Explorer version for your fabric version - e.g. explorer 3.7 for fabric 1.2.
  • Clean-up any existing Blockchain Explorer installation - if you had a previous version installed, you should remove it first using the supplied deployment script, i.e.

    cd ~/fabric/blockchain-explorer
    ./deploy_explorer.sh --clean

  • Clone and/or check-out the correct release of the blockchain explorer repository - e.g.

    cd ~/fabric
    git clone https://github.com/hyperledger/blockchain-explorer.git
    cd blockchain-explorer
    git checkout release-3.7

  • Create a folder under "blockchain-explorer/examples" for your network - e.g.

    cd ~/fabric/blockchain-explorer/examples
    mkdir first-network

  • Create a config.json file for your network (in the folder created above). You can take a copy of the sample file from ~/fabric/blockchain-explorer/examples/net1/config.json and modify it accordingly.
  • Create a symbolic link to crypto-config (in the same folder), e.g.

    cd ~/fabric/blockchain-explorer/examples/first-network
    ln -fs ~/fabric/fabric-samples/crypto-config crypto

  • Deploy Blockchain Explorer - specifying the name of the folder containing your config, and the name of your docker network, e.g.

    cd ~/fabric/blockchain-explorer
    ./deploy_explorer.sh first-network net_byfn

You should now be able to connect to explorer at http://localhost:8080/. If the page still doesn't load, check the docker logs for any errors (docker logs blockchain-explorer).

See https://github.com/hyperledger/blockchain-explorer/blob/master/README.md for more details (replacing "master" with the label for release you are using, e.g. "release-3.7").

Also, please note that the port exposed when using deploy_explorer.sh has changed between release-3.7 and release-3.8 from 8080 to 8090. This one caught me out for quite some time!