【问题标题】:Hyper Fabric [fabric-sdk-go] Error: CONNECTION_FAILED. Description: dialing connection timed outHyper Fabric [fabric-sdk-go] 错误:CONNECTION_FAILED。说明:拨号连接超时
【发布时间】:2019-04-25 15:12:34
【问题描述】:

当我尝试创建请求(提案)并使用 Execute 发送时,

    ctxCh := sdk.ChannelContext("mychannel", fabsdk.WithUser("user1"))
    chClient, err := channel.New(ctxCh)
    if err != nil {
        log.Fatalln("error from New channel", err)
    }

    req := channel.Request{
        ChaincodeID: "fabcar",
        Fcn:         "createCar",
        Args:        [][]byte{[]byte("CAR10"), []byte("Honda"), []byte("Accord"), []byte("Black"), []byte("Tom")},
    }
    resp, err := chClient.Execute(req)
    if err != nil {
        log.Fatalln("error from Execute =", err)
    }

我收到此错误:

调用 orderer 'orderer.example.com:7050' 失败:Orderer Client 状态码:(2) CONNECTION_FAILED。说明:拨号连接 超时 [orderer.example.com:7050]

我的 config.yaml

channels:
  # name of the channel
  mychannel:
    orderers:
      - orderer.example.com

orderers:
  orderer.example.com:
    url: grpc://localhost: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: orderer.example.com

    tlsCACerts:
      # Certificate location absolute path
      path: ./crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem

我认为 Execute 函数试图与 orderer 服务 'orderer.example.com:7050' 连接,但找不到, 如果我是对的,那么我如何将 orderer.example.com:7050 更改为 grpc://localhost:7050

【问题讨论】:

    标签: hyperledger-fabric hyperledger


    【解决方案1】:

    来自rocketchat, 解决这个问题添加到 config.yaml

    entityMatchers:
     orderer:
       - pattern: (\w+).example.(\w+)
         urlSubstitutionExp: grpc://localhost:7050
         sslTargetOverrideUrlSubstitutionExp: orderer.example.com
         mappedHost: orderer.example.com
    

    grpc://localhost:7050 映射到orderer.example.com

    【讨论】:

      猜你喜欢
      • 2018-11-20
      • 2019-06-28
      • 1970-01-01
      • 1970-01-01
      • 2015-02-13
      • 2021-02-22
      • 2018-12-05
      • 2023-03-21
      • 1970-01-01
      相关资源
      最近更新 更多