请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

连接超时

我在main.go 中 设置router.Run(“0.0.0.0:8088”),这样从外面可以访问这个url,但是报了这个错误,应该是config.yaml中peer的url 和event url设置不对,我设置是这两个,改成0.0.0.0:7051也是报这样的错误
url: peer0.org1.example.com:7051
# eventUrl is only needed when using eventhub (default is delivery service)
eventUrl: peer0.org1.example.com:7053

event service creation failed: could not get chConfig cache reference: QueryBlockConfig failed: queryChaincode failed: Transaction processing for endorser [peer0.org1.example.com:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection timed out [peer0.org1.example.com:7051]

正在回答 回答被采纳积分+3

2回答

自游蜗牛 2020-03-24 15:52:18

用docker-compose的话,直接用service的名字加端口访问

0 回复 有任何疑惑可以回复我~
  • 提问者 慕丝6063840 #1
    em,老师麻烦可以说的仔细一点吗,没看明白是什么意思
    回复 有任何疑惑可以回复我~ 2020-03-26 11:13:37
  • 自游蜗牛 回复 提问者 慕丝6063840 #2
    docker-compose启动的服务间是可以通过服务名互相访问的,因为他们都被限制在同一个网络中了。不明白的话,贴出你的docker-compose文件以及出错的那个配置文件
    回复 有任何疑惑可以回复我~ 2020-03-26 15:33:17
  • 提问者 慕丝6063840 #3
    这是config.yaml peer的配置信息 
    peers:
      peer0.org1.example.com:
        # this URL is used to send endorsement and query requests
        url: grpc://localhost:7051
        # eventUrl is only needed when using eventhub (default is delivery service)
        eventUrl: grpc://localhost:7053
    
        grpcOptions:
          ssl-target-name-override: peer0.org1.example.com
          # These parameters should be set in coordination with the keepalive policy on the server,
          # as incompatible settings can result in closing of connection.
          # When duration of the 'keep-alive-time' is set to 0 or less the keep alive client parameters are disabled
          keep-alive-time: 0s
          keep-alive-timeout: 20s
          keep-alive-permit: false
          fail-fast: false
          # allow-insecure will be taken into consideration if address has no protocol defined, if true then grpc or else grpcs
          allow-insecure: true
        tlsCACerts:
          # Certificate location absolute path
          path: ./crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    回复 有任何疑惑可以回复我~ 2020-03-31 15:42:17
提问者 慕丝6063840 2020-03-24 13:38:51

改成0.0.0.0 后是连接超时Description: dialing connection timed out [0.0.0.0:7051],改成本机ip地址也是这个错误CONNECTION_FAILED. Description: dialing connection timed out [192.168.0.101:7051]

0 回复 有任何疑惑可以回复我~
  • 下回别自己回答,可以贴到题目描述里。不然我可能看不到
    回复 有任何疑惑可以回复我~ 2020-03-24 15:53:28
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信