Search code examples
hyperledger-fabrichyperledgerhyperledger-chaincodehyperledger-fabric-sdk-go

Can hyperledger-fabric get the peer node running status without entering the docker container?


Can hyperledger-fabric get the peer node running status without entering the docker container? If so, how should I get it?


Solution

  • In docker-compose file, for peer service add following env variable. (You may add a different port for different services)

    - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9440
    

    expose the port(You may expose port number as per availability). Export different port for different peer

    ports:
      - 9440:9440
    

    Once all services up hit the following path for specific service(As per port defined)

    curl -X GET localhost:9440/healthz
    

    You will get a following response if the service is running.

        {
          "status": "OK",
          "time": "2009-11-10T23:00:00Z"
        }
    

    If service is not available, you will get the following response.

     {
      "status": "Service Unavailable",
      "time": "2009-11-10T23:00:00Z",
      "failed_checks": [
        {
          "component": "docker",
          "reason": "failed to connect to Docker daemon: invalid endpoint"
        }
      ]
    }