本文介绍了使用fabric-sdk-go安装chaincode时的连接超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a problem that there is always a grpcs timeout when installing the chaincode using fabric-sdk-go. The GRCPS request is made from the local machine to its docker containers.

ErrorMsg:

ENV:

docker版本:18.03.1-ce

docker version: 18.03.1-ce

docker-compose版本1.21.1,内部版本5a3f1a3

docker-compose version 1.21.1, build 5a3f1a3

fabric-sdk-go:大师

fabric-sdk-go: master

本地结构网络由设置.官方的fabric-ca示例.

docker-compose.yaml:要点

docker-compose.yaml: Gist

本地网络配置.yaml:要点

local network-config.yaml: Gist

client go app:要点

client go app: Gist

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

Is there anything wrong with my network-config.yaml???

我尝试过的事情:

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

  1. Tried to disable CORE_PEER_TLS_CLIENTAUTHREQUIRED in docker-compose.yaml, failed..

编辑的/etc/hosts文件,其行为127.0.0.1 peer1-xiaoyudian ...,失败..

Edited /etc/hosts file with the line 127.0.0.1 peer1-xiaoyudian..., failed..

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

Increased the peer.timeout.connections and others timeout options in network-config.yaml, failed..

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

Increased the grpcOptions.keep-alive-time in network-config.yaml, failed..

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

Changed the host of peers.xxxx.url from localhost to the domain in network-config.yaml, failed...

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

Added the entityMathcers in network-config.yaml, failed...

失败....

答案:火箭上的某人告诉我:

Answer:Someone from the rocket.chat told me:

  1. 运行:导出GRPC_GO_LOG_SEVERITY_LEVEL =错误
  2. 运行:导出GRPC_GO_LOG_VERBOSITY_LEVEL = 2
  3. 在客户端代码中添加以下行: grpclog.SetLogger(logger)
  1. run: export GRPC_GO_LOG_SEVERITY_LEVEL=error
  2. run: export GRPC_GO_LOG_VERBOSITY_LEVEL=2
  3. in the client code add this line: grpclog.SetLogger(logger)

日志显示这是一个与同级握手的证书问题.

And the log says it a certificate issue for handshaking with peers.

推荐答案

引用 https://github.com/hyperledger/fabric-sdk-go/tree/master/test/fixtures/config/overrides 有关如何重写URL以使用localhost的信息.就您而言,您必须使用local_entity_matchers.yaml& local_orderers_peers_ca.yaml结合在提供的样本中.

Refer https://github.com/hyperledger/fabric-sdk-go/tree/master/test/fixtures/config/overridesfor how URLs are overridden to use localhost. In your case, you have to use local_entity_matchers.yaml & local_orderers_peers_ca.yaml combined in samples provided.

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

One more thing I noticed in your network-config.yaml, mapped host name is same as actual peer name. Entity matcher doesn't kick in here. Refer the entity matchers used in the sample given above.

这篇关于使用fabric-sdk-go安装chaincode时的连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 00:03