【问题标题】:Connection timeout when installing chaincode using fabric-sdk-go使用 fabric-sdk-go 安装链码时连接超时
【发布时间】:2018-11-20 09:31:00
【问题描述】:

我有一个问题,即使用 fabric-sdk-go 安装链码时总是出现 grpcs 超时。 GRCPS 请求是从本地机器向其 docker 容器发出的。

错误消息:

lscc.getinstalledchaincodes failed: SendProposal failed: Transaction processing for endorser [localhost:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED。说明:拨号连接超时[localhost:7051]

环境:

Mac OSX

docker 版本:18.03.1-ce

docker-compose 版本 1.21.1,构建 5a3f1a3

fabric-sdk-go: master

本地结构网络由official fabric-ca example 设置。

docker-compose.yaml: Gist

本地网络配置.yaml:Gist

客户端去应用:Gist

我的 network-config.yaml 有什么问题吗???

我的尝试:

  1. 尝试在 docker-compose.yaml 中禁用 CORE_PEER_TLS_CLIENTAUTHREQUIRED,失败..

  2. 已编辑 /etc/hosts 文件中的 127.0.0.1 peer1-xiaoyudian... 行,失败..

  3. 增加了 network-config.yaml 中的 peer.timeout.connections 和其他超时选项,失败..

  4. 增加 network-config.yaml 中的 grpcOptions.keep-alive-time,失败..

  5. 将 peers.xxxx.url 的主机从 localhost 更改为 network-config.yaml 中的域,失败...

  6. 在 network-config.yaml 中添加了 entityMathcers,失败...

  7. 失败....

回答: 来自rocket.chat 的人告诉我:

  1. 运行:导出 GRPC_GO_LOG_SEVERITY_LEVEL=error
  2. 运行:导出 GRPC_GO_LOG_VERBOSITY_LEVEL=2
  3. 在客户端代码中添加这一行: grpclog.SetLogger(logger)

日志说这是与同行握手的证书问题。

【问题讨论】:

  • 帮助!!!!!!!!!!!!!!!

标签: hyperledger-fabric hyperledger-fabric-sdk-go


【解决方案1】:

参考https://github.com/hyperledger/fabric-sdk-go/tree/master/test/fixtures/config/overrides 了解如何覆盖 URL 以使用 localhost。在您的情况下,您必须在提供的示例中使用 local_entity_matchers.yamllocal_orderers_peers_ca.yaml

我在您的network-config.yaml 中注意到的另一件事,映射的主机名与实际的对等名称相同。实体匹配器不会在这里发挥作用。请参阅上面给出的示例中使用的实体匹配器。

【讨论】:

  • 谢谢。我将其更改为不同的映射主机名,实体匹配器工作..但超时问题仍然存在。
【解决方案2】:

您可以尝试将 localhost 更改为网络中的域。例如:with peer: localhost -> peer1-xiaoyudian... with orderer: localhost -> orderer1-themis... 和 ca 一样,用entity matcher 映射 peer name, orderer, ca 和你的 ip 地址。

【讨论】:

  • entityMatchers: peer: - 模式: (\w+)-xiaoyudian:(\d+) urlSubstitutionExp: localhost:$2 sslTargetOverrideUrlSubstitutionExp: $1-xiaoyudian mappedHost: peer1-xiaoyudian - 模式: (\w+)-xiaoyudian :(\d+) urlSubstitutionExp: localhost:$2 sslTargetOverrideUrlSubstitutionExp: $1-xiaoyudian mappedHost: peer2-xiaoyudian
  • 请查看最新的问题编辑以获得更好的格式。
  • 我认为您应该将所有部分 orderer、peer、ca 中的“localhost”更改为其域,因为当所有这些组件相互通信时,它会通过域调用。可以尝试这样编辑: orderers: orderer1-themis: url: grpcs://orderer1-themis:7050 ... peers: peer1-xiaoyudian: url: grpcs://peer1-xiaoyudian:7051 eventUrl: grpcs://peer1 -xiaoyudian:7053 ...
  • latest network-config.yaml 还是不行。
  • if err = c.verifyPeerConfig(p, peerName, endpoint.IsTLSEnabled(p.URL)); err != nil { logger.Debugf("Could not verify Peer for [%s], try with Entity Matchers", peerName) matchingPeerConfig, matchErr := c.tryMatchingPeerConfig(peerName) 我调试到 sdk-go 代码中实体匹配器将永远不会被使用,因为“verifyPeerConfig”不会返回零错误
猜你喜欢
  • 1970-01-01
  • 2019-10-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-01-11
  • 2019-06-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多