Hyperledger Fabric节点SDK无法与订购者容器通信

时间:2018-12-23 19:27:42

标签: hyperledger-fabric

我已经使用docker swarm network在多台机器上设置了Hyperledger Fabric网络。现在,当尝试将节点sdk与现有的运行中的Fabric网络集成时,它无法与订购者端点或任何其他docker端点进行通信(通过主机名或IP地址),并不断出现context deadline exceeded错误。 这是我的network-config.yaml文件。

Fabric-client只能与系统上本地运行的对等方通信,而不能使用主机名或通过ip地址(docker容器ip)进行任何远程连接

---
#
# The network connection profile provides client applications the information about the target
# blockchain network that are necessary for the applications to interact with it. These are all
# knowledge that must be acquired from out-of-band sources. This file provides such a source.
#
name: "balance-transfer"

#
# Any properties with an "x-" prefix will be treated as application-specific, exactly like how naming
# in HTTP headers or swagger properties work. The SDK will simply ignore these fields and leave
# them for the applications to process. This is a mechanism for different components of an application
# to exchange information that are not part of the standard schema described below. In particular,
# the "x-type" property with the "hlfv1" value example below is used by Hyperledger Composer to
# determine the type of Fabric networks (v0.6 vs. v1.0) it needs to work with.
#
x-type: "hlfv1"

#
# Describe what the target network is/does.
#
description: "Balance Transfer Network"

#
# Schema version of the content. Used by the SDK to apply the corresponding parsing rules.
#
version: "1.0"

#
# The client section will be added on a per org basis see org1.yaml and org2.yaml
#
#client:

#
# [Optional]. But most apps would have this section so that channel objects can be constructed
# based on the content below. If an app is creating channels, then it likely will not need this
# section.
#
channels:
  # name of the channel
  obaid:
    # Required. list of orderers designated by the application to use for transactions on this
    # channel. This list can be a result of access control ("org1" can only access "ordererA"), or
    # operational decisions to share loads from applications among the orderers.  The values must
    # be "names" of orgs defined under "organizations/peers"
    orderers:
      - node_orderer1st
      - node_orderer2nd

    # Required. list of peers from participating orgs
    peers:
      node_examinationpeerfirst:
        # [Optional]. will this peer be sent transaction proposals for endorsement? The peer must
        # have the chaincode installed. The app can also use this property to decide which peers
        # to send the chaincode install request. Default: true
        endorsingPeer: true

        # [Optional]. will this peer be sent query proposals? The peer must have the chaincode
        # installed. The app can also use this property to decide which peers to send the
        # chaincode install request. Default: true
        chaincodeQuery: true

        # [Optional]. will this peer be sent query proposals that do not require chaincodes, like
        # queryBlock(), queryTransaction(), etc. Default: true
        ledgerQuery: true

        # [Optional]. will this peer be the target of the SDK's listener registration? All peers can
        # produce events but the app typically only needs to connect to one to listen to events.
        # Default: true
        eventSource: true

      node_examinationpeersecond:
        endorsingPeer: false
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: false


    # [Optional]. what chaincodes are expected to exist on this channel? The application can use
    # this information to validate that the target peers are in the expected state by comparing
    # this list with the query results of getInstalledChaincodes() and getInstantiatedChaincodes()
    chaincodes:
      # the format follows the "cannonical name" of chaincodes by fabric code
      - mycc:v2.0

#
# list of participating organizations in this network
#
organizations:
  Examination:
    mspid: ExaminationMsp

    peers:
      - node_examinationpeerfirst
      - node_examinationpeersecond

    # [Optional]. Certificate Authorities issue certificates for identification purposes in a Fabric based
    # network. Typically certificates provisioning is done in a separate process outside of the
    # runtime network. Fabric-CA is a special certificate authority that provides a REST APIs for
    # dynamic certificate management (enroll, revoke, re-enroll). The following section is only for
    # Fabric-CA servers.
    certificateAuthorities:
      - NeduetCertficateServer

    # [Optional]. If the application is going to make requests that are reserved to organization
    # administrators, including creating/updating channels, installing/instantiating chaincodes, it
    # must have access to the admin identity represented by the private key and signing certificate.
    # Both properties can be the PEM string or local path to the PEM file. Note that this is mainly for
    # convenience in development mode, production systems should not expose sensitive information
    # this way. The SDK should allow applications to set the org admin identity via APIs, and only use
    # this route as an alternative when it exists.
    adminPrivateKey:
      path: artifacts/examinationneduet/peer1/keystore/926c45a6a8746e77c2ed81aa74d58a17ca24022c01084bed4c9f1a6ebc965627_sk
    signedCert:
      path: artifacts/examinationneduet/peer1/signcerts/cert.pem

orderers:
  node_orderer1st:
    url: grpc://node_orderer1st:7050

    # these are standard properties defined by the gRPC library
    # they will be passed in as-is to gRPC client constructor
    grpcOptions:
      ssl-target-name-override: node_orderer1st


  node_orderer2nd:
    url: grpc://node_orderer2nd:8050

    # these are standard properties defined by the gRPC library
    # they will be passed in as-is to gRPC client constructor
    grpcOptions:
      ssl-target-name-override: node_orderer2nd



#
# List of peers to send various requests to, including endorsement, query
# and event listener registration.
#
peers:
  node_examinationpeerfirst:
    # this URL is used to send endorsement and query requests
    url: grpc://node_examinationpeerfirst:7051

    grpcOptions:
      ssl-target-name-override: node_examinationpeerfirst

  node_examinationpeersecond:
    url: grpc://node_examinationpeersecond:7056
    grpcOptions:
      ssl-target-name-override: node_examinationpeersecond

#
# Fabric-CA is a special kind of Certificate Authority provided by Hyperledger Fabric which allows
# certificate management to be done via REST APIs. Application may choose to use a standard
# Certificate Authority instead of Fabric-CA, in which case this section would not be specified.
#
certificateAuthorities:
  NeduetCertficateServer:
    url: http://xxx-xx-xxx-114-210.compute-1.amazonaws.com:7054
    # the properties specified under this object are passed to the 'http' client verbatim when
    # making the request to the Fabric-CA server
    httpOptions:
      verify: false

    # Fabric-CA supports dynamic user enrollment via REST APIs. A "root" user, a.k.a registrar, is
    # needed to enroll and invoke new users.
    registrar:
      - enrollId: admin
        enrollSecret: adminpw
    # [Optional] The optional name of the CA.
    caName: NeduetCertficateServer

任何解决此问题的解决方案:)谢谢

0 个答案:

没有答案