Hyperledger Fabric Operations Service Tutorial

source: https://medium.com/@jushuspace/hyperledger-fabric-operations-service-tutorial-7a845257368d

Goal: Operation Service 기능을 byfn network에서 실행

Environment

  • Ubuntu 18.04 LTS

  • Hyperledger Fabric v2.0.0

Configuration

peer와 orderer의 설정 파일에서 listenAddress, metrics provider와 TLS 설정을 확인 및 변경한다.

  • peer: fabric-samples/config/core.yaml

###############################################################################
#
#    Operations section
#
###############################################################################
operations:
    # host and port for the operations server
    listenAddress: 127.0.0.1:9443

    # TLS configuration for the operations endpoint
    tls:
        # TLS enabled
        enabled: false

        # path to PEM encoded server certificate for the operations server
        cert:
            file:

        # path to PEM encoded server key for the operations server
        key:
            file:

        # most operations service endpoints require client authentication when TLS
        # is enabled. clientAuthRequired requires client certificate authentication
        # at the TLS layer to access all resources.
        clientAuthRequired: false

        # paths to PEM encoded ca certificates to trust for client authentication
        clientRootCAs:
            files: []

###############################################################################
#
#    Metrics section
#
###############################################################################
metrics:
    # metrics provider is one of statsd, prometheus, or disabled
    provider: prometheus

    # statsd configuration
    statsd:
        # network type: tcp or udp
        network: udp

        # statsd server address
        address: 127.0.0.1:8125

        # the interval at which locally cached counters and gauges are pushed
        # to statsd; timings are pushed immediately
        writeInterval: 10s

        # prefix is prepended to all emitted statsd metrics
        prefix: 
  • orderer: fabric-samples/config/orderer.yaml

  • 모니터링을 위한 container(peer 및 orderer) 환경 변수 설정: ~/fabric-samples/first-network/base/docker-compose-base.yaml

    1. CORE_OPERATIONS_LISTENADDRESS

    2. CORE_METRICS_PROVIDER

설정을 끝냈다면 byfn network를 실행 후 cli container로 접속한다.

logspec API

docker container 안에 curl이 설치되지 않은 경우에는 curl command를 사용할 수 없음

healthz API

metrics API

metrics API를 요청하면 https://hyperledger-fabric.readthedocs.io/en/release-1.4/metrics_reference.htm에 따른 peer/orderer 별 수집 가능한 메트릭 이름과 값이 전부 출력됨

Last updated