Hyperledger Blockchain Explorer-在 Endorser 上的截止日期之前无法连接,无法连接到远程 gRPC 服务器

问题描述 投票:0回答:5

我正在尝试使用 Hyperledger Explorer 设置 Hyperledger Fabric 网络。我使用 ubuntu 操作系统在数字海洋云上启动了一个虚拟机。从那里,我启动 3 个排序节点和 2 个对等节点。总共有 5 个节点。 (我正在使用 RAFT 设置)。

但是,当我尝试启动 hyperledger Fabric Explorer docker-container 镜像时遇到如下错误。

错误:

> [email protected] app-start /opt/explorer
> ./start.sh

[2021-02-18T07:32:21.828] [INFO] PgService - SSL to Postgresql disabled
[2021-02-18T07:32:21.829] [INFO] PgService - connecting to Postgresql postgres://hppoc:******@explorerdb.mynetwork.com:5432/fabricexplorer
[2021-02-18T07:32:21.898] [INFO] Platform -  network_config.id  test-network  network_config.profile  ./connection-profile/test-network.json
[2021-02-18T07:32:22.013] [INFO] FabricConfig - config.client.tlsEnable  true
[2021-02-18T07:32:22.013] [INFO] FabricConfig - FabricConfig, this.config.channels  airlinechannel
[2021-02-18T07:32:22.016] [INFO] FabricGateway - enrollUserIdentity: userName : exploreradmin
2021-02-18T07:32:25.221Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer1.acme.com, url:grpcs://peer1.acme.com:7051, connected:false, connectAttempted:true
2021-02-18T07:32:25.222Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.acme.com url:grpcs://peer1.acme.com:7051 timeout:3000
2021-02-18T07:32:25.223Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer1.acme.com due to Error: Failed to connect before the deadline on Endorser- name: peer1.acme.com, url:grpcs://peer1.acme.com:7051, connected:false, connectAttempted:true
2021-02-18T07:32:28.250Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Discoverer- name: peer1.acme.com, url:grpcs://peer1.acme.com:7051, connected:false, connectAttempted:true
2021-02-18T07:32:28.250Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.acme.com url:grpcs://peer1.acme.com:7051 timeout:3000
2021-02-18T07:32:28.250Z - error: [ServiceEndpoint]: ServiceEndpoint grpcs://peer1.acme.com:7051 reset connection failed :: Error: Failed to connect before the deadline on Discoverer- name: peer1.acme.com, url:grpcs://peer1.acme.com:7051, connected:false, connectAttempted:true
2021-02-18T07:32:28.251Z - error: [DiscoveryService]: send[airlinechannel] - no discovery results
[2021-02-18T07:32:28.251] [ERROR] FabricClient - Error: DiscoveryService has failed to return results
    at DiscoveryService.send (/opt/explorer/node_modules/fabric-network/node_modules/fabric-common/lib/DiscoveryService.js:370:10)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[2021-02-18T07:32:28.252] [INFO] FabricClient - ********* call to initializeDetachClient **********
[2021-02-18T07:32:28.253] [INFO] FabricClient - initializeDetachClient, network config)  { name: 'test-network',
  version: '1.0.0',
  client:
   { tlsEnable: true,
     adminCredential: { id: 'exploreradmin', password: 'exploreradminpw' },
     enableAuthentication: true,
     organization: 'AcmeMSP',
     connection: { timeout: [Object] } },
  channels: { airlinechannel: { peers: [Object] } },
  organizations:
   { AcmeMSP:
      { mspid: 'AcmeMSP',
        adminPrivateKey: [Object],
        peers: [Array],
        signedCert: [Object] } },
  peers:
   { 'peer1.acme.com': { tlsCACerts: [Object], url: 'grpcs://peer1.acme.com:7051' } } }
[2021-02-18T07:32:28.253] [INFO] FabricClient - ************************************* initializeDetachClient *************************************************
[2021-02-18T07:32:28.254] [INFO] FabricClient - Error : Failed to connect client peer, please check the configuration and peer status
[2021-02-18T07:32:28.254] [INFO] FabricClient - Info :  Explorer will continue working with only DB data
[2021-02-18T07:32:28.254] [INFO] FabricClient - ************************************** initializeDetachClient ************************************************
[2021-02-18T07:32:28.259] [INFO] Platform - initializeListener, network_id, network_client  test-network { name: 'test-network',
  version: '1.0.0',
  client:
   { tlsEnable: true,
     adminCredential: { id: 'exploreradmin', password: 'exploreradminpw' },
     enableAuthentication: true,
     organization: 'AcmeMSP',
     connection: { timeout: [Object] } },
  channels: { airlinechannel: { peers: [Object] } },
  organizations:
   { AcmeMSP:
      { mspid: 'AcmeMSP',
        adminPrivateKey: [Object],
        peers: [Array],
        signedCert: [Object] } },
  peers:
   { 'peer1.acme.com': { tlsCACerts: [Object], url: 'grpcs://peer1.acme.com:7051' } } }
[2021-02-18T07:32:28.260] [INFO] main - Please open web browser to access :http://localhost:8080/
[2021-02-18T07:32:28.261] [INFO] main - pid is 20
[2021-02-18T07:32:28.263] [ERROR] main - <<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>
[2021-02-18T07:32:28.263] [ERROR] main - Error :  [ 'Default client peer is down and no channel details available database' ]
[2021-02-18T07:32:30.264] [INFO] main - Received kill signal, shutting down gracefully
[2021-02-18T07:32:30.266] [INFO] Platform - <<<<<<<<<<<<<<<<<<<<<<<<<< Closing explorer  >>>>>>>>>>>>>>>>>>>>>
[2021-02-18T07:32:30.266] [INFO] main - Closed out connections

版本详情

  1. 超级账本结构:2.3.1
  2. Hyperledger Explorer:v1.1.1(最新标签)

第 1 部分:Docker 容器设置

a) Docker PS

CONTAINER ID   IMAGE                                                                                                                                                                  COMMAND                  CREATED          STATUS                   PORTS                                            NAMES
9e8768914140   hyperledger/explorer:latest                                                                                                                                            "docker-entrypoint.s…"   3 minutes ago    Up 3 minutes             0.0.0.0:8080->8080/tcp                           explorer.mynetwork.com
903c8c4a4326   hyperledger/explorer-db:latest                                                                                                                                         "docker-entrypoint.s…"   3 minutes ago    Up 3 minutes (healthy)   5432/tcp                                         explorerdb.mynetwork.com
9fed267ae9b1   dev-peer1.budget.com-gocc1.1.0-1.0-2593f1a95def85c64fdfed35e3d3b1051b92ed91549cfe789292ec5475d7db86-e014c6d933da036b6c79b53d29a800d8a6886e374ceb435a30642b885735f8f5   "chaincode -peer.add…"   21 minutes ago   Up 21 minutes                                                             dev-peer1.budget.com-gocc1.1.0-1.0-2593f1a95def85c64fdfed35e3d3b1051b92ed91549cfe789292ec5475d7db86
12407497fa4c   dev-peer1.acme.com-gocc1.1.0-1.0-2593f1a95def85c64fdfed35e3d3b1051b92ed91549cfe789292ec5475d7db86-a3b6caa9293bb826d231b1a31cc47437e58764abe5169a20ed0ee43f25c16b24     "chaincode -peer.add…"   21 minutes ago   Up 21 minutes                                                             dev-peer1.acme.com-gocc1.1.0-1.0-2593f1a95def85c64fdfed35e3d3b1051b92ed91549cfe789292ec5475d7db86
0448e71f68e1   hyperledger/fabric-peer:latest                                                                                                                                         "peer node start"        22 minutes ago   Up 22 minutes            0.0.0.0:8051->7051/tcp, 0.0.0.0:8052->7052/tcp   peer1.budget.com
3266ec37b360   hyperledger/fabric-peer:latest                                                                                                                                         "peer node start"        22 minutes ago   Up 22 minutes            0.0.0.0:7051-7052->7051-7052/tcp                 peer1.acme.com
47ebe9ad79d1   hyperledger/fabric-orderer:latest                                                                                                                                      "orderer"                22 minutes ago   Up 22 minutes            0.0.0.0:8050->7050/tcp                           orderer2.acme.com
09a5f771f47f   hyperledger/fabric-tools:latest                                                                                                                                        "/bin/bash"              22 minutes ago   Up 22 minutes                                                             tools
e132bb01ce22   hyperledger/fabric-orderer:latest                                                                                                                                      "orderer"                22 minutes ago   Up 22 minutes            0.0.0.0:9050->7050/tcp                           orderer3.acme.com
3c61b0316385   hyperledger/fabric-orderer:latest                                                                                                                                      "orderer"                22 minutes ago   Up 22 minutes

b) 我使用 3 个 docker-compose 文件进行配置设置。

$ docker-compose -f ./config/docker-compose-base.yaml -f ./tls/docker-compose-tls.yaml -f ./raft/docker-compose-raft.yaml up -d

  1. docker-compose-base.yaml

https://gist.github.com/Skyquek/03d1ffad5643d67d8da5b268a4814a7d

  1. docker-compose-tls.yaml

https://gist.github.com/Skyquek/b3b314cb2152ab541e822f72c60a2cbd

  1. docker-compose-raft.yaml

https://gist.github.com/Skyquek/7f8ec2d4d1876283f4a9444675971be8

c) Core.yaml

  1. acme core.yaml

https://gist.github.com/Skyquek/8cdcbc4ee3d53a2277b1c34bb2fca704

第 2 部分:区块链浏览器设置

1.连接配置文件.json

{
        "name": "test-network",
        "version": "1.0.0",
        "client": {
                "tlsEnable": true,
                "adminCredential": {
                        "id": "exploreradmin",
                        "password": "exploreradminpw"
                },
                "enableAuthentication": true,
                "organization": "AcmeMSP",
                "connection": {
                        "timeout": {
                                "peer": {
                                        "endorser": "300"
                                },
                                "orderer": "300"
                        }
                }
        },
        "channels": {
                "airlinechannel": {
                        "peers": {
                                "peer1.acme.com": {}
                        }
                }
        },
        "organizations": {
                "AcmeMSP": {
                        "mspid": "AcmeMSP",
                        "adminPrivateKey": {
                                "path": "/tmp/crypto/peerOrganizations/acme.com/users/[email protected]/msp/keystore/priv_sk"
                        },
                        "peers": ["peer1.acme.com"],
                        "signedCert": {
                                "path": "/tmp/crypto/peerOrganizations/acme.com/users/[email protected]/msp/signcerts/[email protected]"
                        }
                }
        },
        "peers": {
                "peer1.acme.com": {
                        "tlsCACerts": {
                                "path": "/tmp/crypto/peerOrganizations/acme.com/tlsca/tlsca.acme.com-cert.pem"
                        },
                        "url": "grpcs://peer1.acme.com:7051"
                }
        }
}

2. docker-compose.yaml


# SPDX-License-Identifier: Apache-2.0
version: '2.1'

volumes:
  pgdata:
  walletstore:

networks:
  mynetwork.com:
    external:
      name: acloudfan_airline

services:

  explorerdb.mynetwork.com:
    image: hyperledger/explorer-db:latest
    container_name: explorerdb.mynetwork.com
    hostname: explorerdb.mynetwork.com
    environment:
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWORD=password
    healthcheck:
      test: "pg_isready -h localhost -p 5432 -q -U postgres"
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - pgdata:/var/lib/postgresql/data
    networks:
      - mynetwork.com

  explorer.mynetwork.com:
    image: hyperledger/explorer:latest
    container_name: explorer.mynetwork.com
    hostname: explorer.mynetwork.com
    environment:
      - DATABASE_HOST=explorerdb.mynetwork.com
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWD=password
      - LOG_LEVEL_APP=debug
      - LOG_LEVEL_DB=debug
      - LOG_LEVEL_CONSOLE=info
      - LOG_CONSOLE_STDOUT=true
      - DISCOVERY_AS_LOCALHOST=true
    volumes:
      - ./config.json:/opt/explorer/app/platform/fabric/config.json
      - ./connection-profile:/opt/explorer/app/platform/fabric/connection-profile
      - ./organizations:/tmp/crypto
      - walletstore:/opt/explorer/wallet
    ports:
      - 8080:8080
    depends_on:
      explorerdb.mynetwork.com:
        condition: service_healthy
    networks:
      - mynetwork.com

我尝试过的解决方案

1.更改 tlscs 证书路径

如所述 Hyperledger Fabric 2.0.1:错误:在 Discoverer 截止日期之前无法连接 - 名称:

问题很可能是由于路径错误造成的。但问题依然存在。

2.将环境变量 DISCOVERY_AS_LOCALHOST=true 更改为 false

他们中的一些人提到这可以解决问题。但我似乎无法通过这种方式解决它。

3.尝试使用 hyperledger Fabric 2.0 测试网络

我尝试使用织物样本测试网络运行,它运行得很好。

4. docker exec -it sh 到 explorer.mynetwork.com 以 ping 对等点

ping 可以完美运行。

/opt/explorer # ping peer1.acme.com:7051
PING peer1.acme.com:7051 (172.23.0.6): 56 data bytes
64 bytes from 172.23.0.6: seq=0 ttl=64 time=0.138 ms
64 bytes from 172.23.0.6: seq=1 ttl=64 time=0.087 ms
64 bytes from 172.23.0.6: seq=2 ttl=64 time=0.090 ms
64 bytes from 172.23.0.6: seq=3 ttl=64 time=0.089 ms
64 bytes from 172.23.0.6: seq=4 ttl=64 time=0.101 ms
64 bytes from 172.23.0.6: seq=5 ttl=64 time=0.088 ms
^C
--- peer1.acme.com:7051 ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 0.087/0.098/0.138 ms

一直显示对端已宕机或与对端的连接失败

我已经为这个错误苦苦挣扎了几天。希望有人能帮助我找出问题所在。非常感谢。

docker docker-compose hyperledger-fabric blockchain hyperledger-explorer
5个回答
4
投票

我认为你应该仔细检查你的网络。 Explorer 应与 Fabric 运行在同一网络上,以便对等点和其他节点可以连接。要检查 Fabric 网络名称,您应该签入设置它的 docker-compose 文件并查找

CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE
,或者您可以导航到 CLI 并运行
docker network ls
。您应该能够找到带有
DRIVER
的结构网络名称,它应该是
bridge

此外,在启动 Explorer 之前,您应该确保 Fabric 网络已启动并正常运行。


2
投票

出现类似的错误,我遇到的问题是网络的密钥和证书与区块链浏览器的密钥和证书不同步。在运行测试网络时,这是一个特别重要的问题,因为每当您重新启动网络时,密钥和证书都会(AFAICT)重新生成,并且测试网络比生产网络重新启动的频率要高得多。

将所有内容复制到

organizations
目录中,或者无论你怎么称呼它;每次打开要使用资源管理器的网络时,请重复此操作。符号链接也可以工作,尽管这可能更脆弱,我不想在生产中依赖它。


0
投票

所有配置看起来都不错,但是你必须升级explorer版本才能与hyperledger Fabric版本兼容。

所以请使用v1.1.4而不是v1.1.1

还要确保您已正确安装加密配置,尝试访问容器内的此路径

/tmp/crypto/peerOrganizations/acme.com/tlsca/tlsca.acme.com-cert.pem

尝试更改

tlsCACerts
路径以使用对等 tls ca.crt
/tmp/crypto/peerOrganizations/acme.com/peers/peer1.acme.com/tls/ca.crt

您已经提到,相同的配置适用于 Hyperledger Fabric v2,如果您在本地而不是在同一服务器上尝试过,所以我请禁用服务器上的防火墙并尝试一下

要检查您是否可以访问域名和端口,请尝试此操作

cat > /dev/tcp/peer1.acme.com/7051

检查这个 https://support.bluemedora.com/s/article/Using-Bash-to-test-if-a-TCP-port-on-a-remote-system-is-open


0
投票

我遇到了这个错误

[INFO] FabricClient - Error : Failed to connect client peer, please check the configuration and peer status
...
Error :  [ 'Default client peer is down and no channel details available database' ]

我发现当我们使用 256 位与 384 位密钥长度时,会出现错误。

设置

local
/
host
没有区别。

我使用的是v1.1.4。可能很快就会用 v1.1.5 进行相同的测试,并怀疑它会有同样的问题。


0
投票

此错误也可能是由于通道名称设置错误造成的。 默认通道名称为

mychannel
,即测试网默认通道名称。 如果您以不同的方式命名频道,则必须相应地修改
test-network.json
文件的内容。

© www.soinside.com 2019 - 2024. All rights reserved.