не удалось получить службу обнаружения: не удалось получить ссылку на кэш chConfig: не удалось прочитать конфигурацию для пиров канала - PullRequest
0 голосов
/ 01 мая 2019

При попытке установить и создать экземпляр цепочки я получаю сообщение об ошибке ниже:

ошибка в WSL (подсистема Windows для Linux)

Невозможно установить и создать цепной код: не удалось создать цепной код: не удалось получить службу обнаружения: не удалось получить ссылку на кэш chConfig: не удалось прочитать конфигурацию для равноправных каналов

ошибка в Ubuntu 16.04

Невозможно установить и создать цепной код: не удалось создать цепной код: не удалось получить службу обнаружения: не удалось получить ссылку на кэш chConfig: для канала [mychannel] не настроены одноранговые узлы

Я следую примеру chainHero. ниже приведен полный вывод после запуска команды make.

Build done
Start environment ...
Creating network "firstproject-network_default" with the default driver
Creating orderer.firstproject.com ... done
Creating ca.org1.firstproject.com ... done
Creating peer0.org1.firstproject.com ... done
Creating peer1.org1.firstproject.com ... done
Docker environment up
Start app and initializing skd with local network...
SDK created
Resource management client created

value of req is:  {mychannel <nil> /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/artifacts/channel.tx [0xc0001d4fa0]}
Value of setup.Orderer is:  orderer.firstproject.com
Channel created
Channel joined
Initialization Successful
ccPkg created
Chaincode installed
Unable to install and instantiate the chaincode: failed to instantiate the chaincode: failed to get discovery service: could not get chConfig cache reference: read configuration for channel peers failed

config.yaml

name: "firstproject-network"

version: 1.0.0
client:
  organization: org1

  logging:
    level: info
  peer:
    timeout:
      connection: 10s
      response: 180s
      discovery:
        greylistExpiry: 10s
  eventService:
    timeout:
      connection: 15s
      registrationResponse: 15s
  orderer:
    timeout:
      connection: 15s
      response: 15s
  cryptoconfig:
    path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config

    credentialStore:
    path: /tmp/firstproject-store

    cryptoStore:
      path: /tmp/firstproject-msp

  BCCSP:
    security:
     enabled: true
     default:
      provider: "SW"
     hashAlgorithm: "SHA2"
     softVerify: true
     level: 256

  tlsCerts:
    systemCertPool: false

    client:
      keyfile:
      certfile:

channels:
  OneOrgChannel:
    peers:
      peer0.org1.firstproject.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true

      peer1.org1.firstproject.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true

    policies:
      queryChannelConfig:
        minResponses: 1
        maxTargets: 1
        retryOpts:
          attempts: 5
          initialBackoff: 500ms
          maxBackoff: 5s
          backoffFactor: 2.0

# list of participating organizations in this network
organizations:
  org1:
    mspid: Org1MSP
    cryptoPath: peerOrganizations/org1.firstproject.com/users/{userName}@org1.firstproject.com/msp
    peers:
      - peer0.org1.firstproject.com
      - peer1.org1.firstproject.com

    certificateAuthorities:
      - ca.org1.firstproject.com

orderers:
  orderer.firstproject.com:
    url: grpcs://localhost:7050

    grpcOptions:
      ssl-target-name-override: orderer.firstproject.com
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      keep-alive-permit: false
      fail-fast: false
      allow-insecure: false

    tlsCACerts:
      # Certificate location absolute path
      path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/ordererOrganizations/firstproject.com/tlsca/tlsca.firstproject.com-cert.pem
peers:
  peer0.org1.firstproject.com:
    # this URL is used to send endorsement and query requests
    url: grpcs://localhost:7051
    # eventUrl is only needed when using eventhub (default is delivery service)
    eventUrl: grpcs://localhost:7053

    grpcOptions:
      ssl-target-name-override: peer0.org1.firstproject.com
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      keep-alive-permit: false
      fail-fast: false
      allow-insecure: false

    tlsCACerts:
      path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/peerOrganizations/org1.firstproject.com/tlsca/tlsca.org1.firstproject.com-cert.pem

  peer1.org1.firstproject.com:
    url: grpcs://localhost:8051
    eventUrl: grpcs://localhost:8053

    grpcOptions:
      ssl-target-name-override: peer1.org1.firstproject.com
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      keep-alive-permit: false
      fail-fast: false
      allow-insecure: false

    tlsCACerts:
      path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/peerOrganizations/org1.firstproject.com/tlsca/tlsca.org1.firstproject.com-cert.pem

certificateAuthorities:
  ca.org1.firstproject.com:
    url: http://localhost:7054
    httpOptions:
      verify: false
    registrar:
      enrollId: admin
      enrollSecret: adminpw
    caName: ca.org1.firstproject.com
    tlsCACerts:
      path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/peerOrganizations/org1.firstproject.com/ca/ca.org1.firstproject.com-cert.pem

entityMatchers:
  peer:
    - pattern: (\w*)peer0.org1.firstproject.com(\w*)
      urlSubstitutionExp: grpcs://localhost:7051
      eventUrlSubstitutionExp: grpcs://localhost:7053
      sslTargetOverrideUrlSubstitutionExp: peer0.org1.firstproject.com
      mappedHost: peer0.org1.firstproject.com

    - pattern: (\w*)peer1.org1.firstproject.com(\w*)
      urlSubstitutionExp: grpcs://localhost:8051
      eventUrlSubstitutionExp: grpcs://localhost:8053
      sslTargetOverrideUrlSubstitutionExp: peer1.org1.firstproject.com
      mappedHost: peer1.org1.firstproject.com

  orderer:
    - pattern: (\w+).firstproject.(\w+):(\d+)
      urlSubstitutionExp: grpcs://localhost:7050
      sslTargetOverrideUrlSubstitutionExp: orderer.firstproject.com
      mappedHost: orderer.firstproject.com  

    - pattern: (\w+).firstproject.(\w+)
      urlSubstitutionExp: grpcs://localhost:7050
      sslTargetOverrideUrlSubstitutionExp: orderer.firstproject.com
      mappedHost: orderer.firstproject.com


  certificateAuthorities:
    - pattern: (\w*)ca.org1.firstproject.com(\w*)
      urlSubstitutionExp: http://localhost:7054
      mappedHost: ca.org1.firstproject.com

докер-compose.yaml

version: '2'

networks:
  default:

services:
  orderer.firstproject.com:
    container_name: orderer.firstproject.com
    extends:
      file: peer-base.yaml
      service: orderer-base
    volumes:
      - ./crypto-config/ordererOrganizations/firstproject.com/orderers/orderer.firstproject.com/msp:/var/hyperledger/orderer/msp
      - ./artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
      - ./crypto-config/ordererOrganizations/firstproject.com/orderers/orderer.firstproject.com/tls:/var/hyperledger/orderer/tls

    ports:
      - 7050:7050


  ca.org1.firstapplication.com:
    image: hyperledger/fabric-ca:latest
    container_name: ca.org1.firstproject.com
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca.org1.firstproject.com
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.firstproject.com-cert.pem
      - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/78da3186373e52832b71dd83ec4d36ef84722a3e3ed15e8df214b482fe2723e7_sk
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.firstproject.com-cert.pem
      - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/78da3186373e52832b71dd83ec4d36ef84722a3e3ed15e8df214b482fe2723e7_sk
    ports:
      - 7054:7054
    command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
    volumes:
      - ./crypto-config/peerOrganizations/org1.firstproject.com/ca/:/etc/hyperledger/fabric-ca-server-config


  peer0.org1.firstproject.com:
    container_name: peer0.org1.firstproject.com
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:

      - CORE_PEER_NETWORKID=firstproject
      - CORE_PEER_ID=peer0.org1.firstproject.com
      - CORE_PEER_ADDRESSAUTODETECT=true
      - CORE_PEER_ADDRESS=peer0.org1.firstproject.com:7051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.firstproject.com:7051
      - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
      - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0.org1.firstproject.com
      #- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.firstapplication.com:7051

    volumes:
        - ./var/run/:/host/var/run/
        - ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer0.org1.firstproject.com/msp:/var/hyperledger/msp
        - ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer0.org1.firstproject.com/tls:/var/hyperledger/tls

    ports:
      - 7051:7051
      - 7053:7053
    depends_on:
      - orderer.firstproject.com
    links:
      - orderer.firstproject.com  
    networks:
      default:
        aliases:
          - peer0.org1.firstproject.com  


  peer1.org1.firstproject.com:
    container_name: peer1.org1.firstproject.com
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:

      - CORE_PEER_NETWORKID=firstproject
      - CORE_PEER_ID=peer1.org1.firstproject.com
      - CORE_PEER_ADDRESSAUTODETECT=true
      - CORE_PEER_ADDRESS=peer1.org1.firstproject.com:7051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.firstproject.com:7051
      - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
      - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer1.org1.firstproject.com
      #- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.firstapplication.com:7051

    volumes:
        - /var/run/:/host/var/run/
        - ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer1.org1.firstproject.com/msp:/var/hyperledger/msp
        - ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer1.org1.firstproject.com/tls:/var/hyperledger/tls

    ports:
      - 8051:7051
      - 8053:7053
    depends_on:
      - orderer.firstproject.com
    links:
      - orderer.firstproject.com  
    networks:
      default:
        aliases:
          - peer1.org1.firstproject.com  

одноранговой base.yaml

version: '2'

services:
  peer-base:
    image: hyperledger/fabric-peer:latest
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_VM_DOCKER_ATTACHSTDOUT=true
      - FABRIC_LOGGING_SPEC=DEBUG
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/tls/server.key  
      - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/msp

    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start

  orderer-base:
    image: hyperledger/fabric-orderer:latest
    environment:
      - FABRIC_LOGGING_SPEC=DEBUG
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_GENESISMETHOD=file
      - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
      - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
      - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
      # enabled TLS
      - ORDERER_GENERAL_TLS_ENABLED=true
      - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
      - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    command: orderer  

1 Ответ

2 голосов
/ 13 мая 2019

Вы используете неправильное имя канала для создания цепного кода, в config.yaml вы определили канал OneOrgChannel с peer peer0, peer1. Однако вы, похоже, используете канал mychannel для создания цепочки кода.

Либо измените имя канала на OneOrgChannel, либо добавьте mychannel в config.yaml.

...