Connection timeout when installing chaincode using fabric-sdk-go

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 20:17:27

问题


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:

lscc.getinstalledchaincodes failed: SendProposal failed: Transaction processing for endorser [localhost:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection timed out [localhost:7051]

ENV:

Mac OSX

docker version: 18.03.1-ce

docker-compose version 1.21.1, build 5a3f1a3

fabric-sdk-go: master

The local fabric network is set up by the official fabric-ca example.

docker-compose.yaml: Gist

local network-config.yaml: Gist

client go app: Gist

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

What I've tried:

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

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

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

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

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

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

  7. Failed....

Answer: Someone from the rocket.chat told me:

  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.


回答1:


Refer https://github.com/hyperledger/fabric-sdk-go/tree/master/test/fixtures/config/overrides for 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.

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.




回答2:


You could try change localhost to domain in network. Ex: with peer: localhost -> peer1-xiaoyudian... with orderer: localhost -> orderer1-themis... same with ca, and use entity matcher to map peer name, orderer, ca with your ip address.



来源:https://stackoverflow.com/questions/50792520/connection-timeout-when-installing-chaincode-using-fabric-sdk-go

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!