0

我有两个测试测试,一个阅读和一个在区块链上的写作。我得到两个不同的错误,一个在测试开始时,一个在写作测试中。阅读测试工作正常,没有问题。

初始错误:

2021.12.21-16:43:01.870 info  [caliper] [round-orchestrator]    Preparing worker connections
2021.12.21-16:43:01.870 info  [caliper] [worker-orchestrator]   Launching worker 1 of 2
2021.12.21-16:43:01.878 info  [caliper] [worker-orchestrator]   Launching worker 2 of 2
2021.12.21-16:43:01.884 info  [caliper] [worker-orchestrator]   Messenger not configured, entering configure phase...
2021.12.21-16:43:01.885 info  [caliper] [worker-orchestrator]   No existing workers detected, entering worker launch phase...
2021.12.21-16:43:01.885 info  [caliper] [worker-orchestrator]   Waiting for 2 workers to be connected...
2021.12.21-16:43:02.426 info  [caliper] [cli-launch-worker]     Set workspace path: /home/ubuntu/caliper/caliper-benchmarks/monitor
2021.12.21-16:43:02.427 info  [caliper] [cli-launch-worker]     Set benchmark configuration path: /home/ubuntu/caliper/caliper-benchmarks/monitor/config.yaml
2021.12.21-16:43:02.427 info  [caliper] [cli-launch-worker]     Set network configuration path: /home/ubuntu/caliper/caliper-benchmarks/monitor/network.yaml
2021.12.21-16:43:02.427 info  [caliper] [cli-launch-worker]     Set SUT type: fabric
2021.12.21-16:43:02.444 info  [caliper] [cli-launch-worker]     Set workspace path: /home/ubuntu/caliper/caliper-benchmarks/monitor
2021.12.21-16:43:02.446 info  [caliper] [cli-launch-worker]     Set benchmark configuration path: /home/ubuntu/caliper/caliper-benchmarks/monitor/config.yaml
2021.12.21-16:43:02.446 info  [caliper] [cli-launch-worker]     Set network configuration path: /home/ubuntu/caliper/caliper-benchmarks/monitor/network.yaml
2021.12.21-16:43:02.447 info  [caliper] [cli-launch-worker]     Set SUT type: fabric
2021.12.21-16:43:02.505 info  [caliper] [worker-orchestrator]   2 workers connected, progressing to worker assignment phase.
2021.12.21-16:43:02.505 info  [caliper] [worker-orchestrator]   Workers currently unassigned, awaiting index assignment...
2021.12.21-16:43:02.506 info  [caliper] [worker-orchestrator]   Waiting for 2 workers to be assigned...
2021.12.21-16:43:02.559 info  [caliper] [worker-orchestrator]   2 workers assigned, progressing to worker initialization phase.
2021.12.21-16:43:02.560 info  [caliper] [worker-orchestrator]   Waiting for 2 workers to be ready...
2021.12.21-16:43:03.629 info  [caliper] [worker-message-handler]        Initializing Worker#1...
2021.12.21-16:43:03.629 info  [caliper] [fabric-connector]      Initializing gateway connector compatible with installed SDK: 2.2.3
2021.12.21-16:43:03.629 info  [caliper] [IdentityManager]       Adding User1 (admin=false) as User1 for organization Org1MSP
2021.12.21-16:43:03.629 info  [caliper] [worker-message-handler]        Worker#1 initialized
2021.12.21-16:43:03.683 info  [caliper] [worker-orchestrator]   2 workers ready, progressing to test preparation phase.
2021.12.21-16:43:03.684 info  [caliper] [round-orchestrator]    Started round 1 (Set)
2021.12.21-16:43:03.690 info  [caliper] [worker-message-handler]        Preparing Worker#1 for Round#0
2021.12.21-16:43:03.696 info  [caliper] [connectors/v2/FabricGateway]   Connecting user with identity User1 to a Network Gateway
2021.12.21-16:43:04.005 info  [caliper] [worker-message-handler]        Initializing Worker#0...
2021.12.21-16:43:04.005 info  [caliper] [fabric-connector]      Initializing gateway connector compatible with installed SDK: 2.2.3
2021.12.21-16:43:04.005 info  [caliper] [IdentityManager]       Adding User1 (admin=false) as User1 for organization Org1MSP
2021.12.21-16:43:04.005 info  [caliper] [worker-message-handler]        Worker#0 initialized
2021.12.21-16:43:04.006 info  [caliper] [worker-message-handler]        Preparing Worker#0 for Round#0
2021.12.21-16:43:04.006 info  [caliper] [connectors/v2/FabricGateway]   Connecting user with identity User1 to a Network Gateway
2021.12.21-16:43:04.007 info  [caliper] [connectors/v2/FabricGateway]   Successfully connected user with identity User1 to a Network Gateway
2021.12.21-16:43:04.008 info  [caliper] [connectors/v2/FabricGateway]   Generating contract map for user User1
2021.12.21-16:43:04.018 info  [caliper] [connectors/v2/FabricGateway]   Successfully connected user with identity User1 to a Network Gateway
2021.12.21-16:43:04.019 info  [caliper] [connectors/v2/FabricGateway]   Generating contract map for user User1
2021-12-21T16:43:07.083Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpc://localhost:7050, connected:false, connectAttempted:true
2021-12-21T16:43:07.086Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer.example.com:7050 url:grpc://localhost:7050 timeout:3000
2021-12-21T16:43:07.088Z - error: [DiscoveryService]: _buildOrderer[channelall] - Unable to connect to the discovered orderer orderer.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpc://localhost:7050, connected:false, connectAttempted:true
2021-12-21T16:43:07.085Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpc://localhost:7050, connected:false, connectAttempted:true
2021-12-21T16:43:07.090Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer.example.com:7050 url:grpc://localhost:7050 timeout:3000
2021-12-21T16:43:07.092Z - error: [DiscoveryService]: _buildOrderer[channelall] - Unable to connect to the discovered orderer orderer.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpc://localhost:7050, connected:false, connectAttempted:true

写作测试中出现的第二个错误如下:

2021.12.21-16:43:07.112 info  [caliper] [worker-orchestrator]   2 workers prepared, progressing to test phase.
2021.12.21-16:43:07.112 info  [caliper] [round-orchestrator]    Monitors successfully started
2021.12.21-16:43:07.115 info  [caliper] [worker-message-handler]        Worker#1 is starting Round#0
2021.12.21-16:43:07.116 info  [caliper] [worker-message-handler]        Worker#0 is starting Round#0
2021.12.21-16:43:07.123 info  [caliper] [caliper-worker]        Worker #1 starting workload loop
2021.12.21-16:43:07.126 info  [caliper] [caliper-worker]        Worker #0 starting workload loop
2021.12.21-16:43:07.941 error [caliper] [connectors/v2/FabricGateway]   Failed to perform submit transaction [set] using arguments [node1,{'CPU':50,'MEM':50,'STG':50.0,'DAT':'2020-11-17T00:10:00Z'}],  with error: Error: No endorsement plan available
    at DiscoveryHandler.endorse (/home/ubuntu/caliper/node_modules/fabric-network/node_modules/fabric-common/lib/DiscoveryHandler.js:208:10)
    at process._tickCallback (internal/process/next_tick.js:68:7)

连接文件

---
name: fabric
version: 2.0.0
client:
  organization: Org1
  connection:
    timeout:
      peer:
        endorser: '300'
organizations:
  Org1:
    mspid: Org1MSP
    peers:
    - peer0.org1.example.com
    certificateAuthorities:
    - ca.org1.example.com
orderers:
  orderer.example.com:
    url: grpc://192.169.0.9:7050
    grpcOptions:
      ssl-target-name-override: orderer.example.com
peers:
  peer0.org1.example.com:
    url: grpc://192.169.0.7:7051
    tlsCACerts:
      path: peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    grpcOptions:
      ssl-target-name-override: peer0.org1.example.com
certificateAuthorities:
  ca.org1.example.com:
    url: https://192.169.0.7:7054
    caName: ca-org1
    tlsCACerts:
      path: peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    httpOptions:
      verify: false

网络文件

name: Fabric
version: '2.0.0'
caliper:
   blockchain: fabric
   sutOptions:
     mutualTls: false
organizations:
  - mspid: Org1MSP
    identities:
      certificates:
      - name: 'User1'
        clientPrivateKey:
          path: 'peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk'
        clientSignedCert:
          path: 'peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem'
    connectionProfile:
      path: 'connection_files/connection-org1.yaml'
      discover: true
orderers:
    orderer.example.com:
        url: grpc://192.169.0.9:7050
        grpcOptions:
            ssl-target-name-override: orderer.example.com
channels:
  - channelName: channelall
    contracts:
    - id: monitor

我恳请任何提示,以便我可以解决这些问题并跟踪开发。

4

2 回答 2

0

从网络文件中您发布了几点

  1. 您不能在其中定义任何节点(例如,您添加了订购者)。他们被忽略
  2. 您已通过在网络文件中将 discover 设置为 true 来指定您的连接配置文件是动态配置文件,这意味着它将使用发现来确定网络拓扑,并且可能不会使用您在连接配置文件中明确定义的节点。如果您想在您的连接配置文件中明确(并因此定义一个静态连接配置文件),就像您在上面的示例中一样,您应该设置discover为 false,这有望解决您的问题。

附带说明一下,如果您使用发现,则默认情况下,node-sdk(由 caliper 使用)和 caliper 会将所有发现的节点主机转换为localhost,这就是您看到它尝试联系的原因localhost。要禁用此功能,请参阅https://hyperledger.github.io/caliper/v0.4.2/fabric-config/new/中的运行时设置

于 2021-12-21T21:56:28.947 回答
0

问题出在连接文件中。

旧文件是:

---
name: fabric
version: 2.0.0
client:
  organization: Org1
  connection:
    timeout:
      peer:
        endorser: '300'
      orderer: '10000'
organizations:
  Org1:
    mspid: Org1MSP
    peers:
    - peer0.org1.example.com
    certificateAuthorities:
    - ca.org1.example.com
orderers:
  orderer.example.com:
    url: grpc://192.169.0.9:7050
    grpcOptions:
      ssl-target-name-override: orderer.example.com
peers:
  peer0.org1.example.com:
    url: grpc://192.169.0.7:7051
    tlsCACerts:
      path: crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    grpcOptions:
      ssl-target-name-override: peer0.org1.example.com
certificateAuthorities:
  ca.org1.example.com:
    url: http://192.169.0.7:7054
    caName: ca-org1
    tlsCACerts:
      path: crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    httpOptions:
      verify: false

我创建的新连接文件是这样的:

---
name: fabric
description: "Sample connection profile for documentation topic"
version: 2.0.0
channels:
  channelall:
    orderers:
      - orderer.example.com
    peers:
      peer0.org1.example.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
  
      peer0.org2.example.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
    
      peer0.org3.example.com:
        endorsingPeer: false
        chaincodeQuery: false
        ledgerQuery: true
        eventSource: true
organizations:
  Org1:
    mspid: Org1MSP
    peers:
      - peer0.org1.example.com
  Org2:
    mspid: Org2MSP
    peers:
      - peer0.org2.example.com
  Org3:
    mspid: Org3MSP
    peers:
      - peer0.org3.example.com
orderers:
  orderer.example.com: 
    url: grpc://192.169.0.9:7050  
    grpcOptions:
      ssl-target-name-override: orderer.example.com
peers:
  peer0.org1.example.com:
    url: grpc://192.169.0.7:7051
    grpcOptions:
      ssl-target-name-override: peer0.org1.example.com
      request-timeout: 120001 
  peer0.org2.example.com:
    url: grpc://192.169.0.10:7051
    grpcOptions:
      ssl-target-name-override: peer0.org2.example.com
      request-timeout: 120001 
  peer0.org3.example.com:
    url: grpc://192.169.0.11:7051
    grpcOptions:
      ssl-target-name-override: peer0.org3.example.com
      request-timeout: 120001

包含有关同行和订购者的所有信息。

谢谢大家的帮助。

于 2022-01-08T15:18:24.690 回答