Hyperledger: ошибка при подключении к сети (byfn.sh up) - PullRequest
0 голосов
/ 05 июня 2018

У меня ранее была запущенная простая сеть на локальном хосте: 3000, и для этого я использовал разные ссылки для предварительных условий и этапов установки, а не http://hyperledger -fabric.readthedocs.io/en/latest/build_network.html, из-за которого я никогда не работал с папкой fabric-samples.При подключении к сети я получил свою [первую ошибку] ​​[1]

. Соответственно, я открыл /home/himani/fabric-samples/first-network/docker-compose-cli.yaml и внес изменения., изменив имена контейнеров с peer0.org1.example.com и orderer.example.com на peer000.org001.example.com и orderer000.example.com соответственно.

После внесения изменений при выполнении команды: ./byfn.sh up она может выполняться без ошибок.

После исправления нескольких ошибок, которые я допустил при установке npm, я отключил эту сеть с помощью команды: ./byfn.sh down и снова загрузил папку fabric-samples.Теперь при запуске ./byfn.sh up я не получил ошибки.Но я столкнулся с ошибкой при попытке выполнить эту команду:

 ./byfn.sh up -l node

ошибка: (как ни странно, orderer000.example.com и orderer000.example.com также были запущены, несмотря на отключение этой сети иудаление папки)

 himani@himani-HP-Notebook:~/fabric-samples/first-network$ ./byfn.sh up -l node
    Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
    Continue? [Y/n] y
    proceeding ...
    2018-06-05 12:01:27.340 UTC [main] main -> INFO 001 Exiting.....
    LOCAL_VERSION=1.1.0
    DOCKER_IMAGE_VERSION=1.1.0
    peer0.org2.example.com is up-to-date
    peer1.org2.example.com is up-to-date
    orderer000.example.com is up-to-date
    peer1.org1.example.com is up-to-date
    peer000.org001.example.com is up-to-date
    cli is up-to-date

     ____    _____      _      ____    _____ 
    / ___|  |_   _|    / \    |  _ \  |_   _|
    \___ \    | |     / _ \   | |_) |   | |  
     ___) |   | |    / ___ \  |  _ <    | |  
    |____/    |_|   /_/   \_\ |_| \_\   |_|  

    Build your first network (BYFN) end-to-end test

    Channel name : mychannel
    Creating channel...
    CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
    CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
    CORE_PEER_LOCALMSPID=Org1MSP
    CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
    CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
    CORE_PEER_TLS_ENABLED=true
    CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
    CORE_PEER_ID=cli
    CORE_LOGGING_LEVEL=INFO
    CORE_PEER_ADDRESS=peer0.org1.example.com:7051
    + peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
    + res=1
    + set +x
    2018-06-05 12:01:30.704 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
    Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating ReadSet: readset expected key [Group]  /Channel/Application at version 0, but got version 1
    Usage:
      peer channel create [flags]

    Flags:
      -c, --channelID string   In case of a newChain command, the channel ID to create.
      -f, --file string        Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
      -t, --timeout int        Channel creation timeout (default 5)

    Global Flags:
          --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
          --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
          --clientauth                          Use mutual TLS when communicating with the orderer endpoint
          --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
          --logging-level string                Default logging level and overrides, see core.yaml for full syntax
      -o, --orderer string                      Ordering service endpoint
          --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer.
          --tls                                 Use TLS when communicating with the orderer endpoint
      -v, --version                             Display current version of fabric peer server

    !!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
    ========= ERROR !!! FAILED to execute End-2-End Scenario ===========

    ERROR !!!! Test failed

  [1]: https://i.stack.imgur.com/afsMk.png



**UPDATE:**
Now, I get an error running `./byfn.sh up` also, but now `orderer000.example.com` and `peer000.org001.example.com` are not mentioned, but their correct version, `orderer.example.com` and `peer.org1.example.com` are.

I also referred to the solution of a similar question https://stackoverflow.com/questions/49648529/hyperledger-fabric-simples-issue-run-byfn-sh-m-up-failed by modifying first-network/base/peer-base.yaml to include this first line under `environment` section : `- GODEBUG=netdns=go` , but to no avail. I received the following error:

    himani@himani-HP-Notebook:~/fabric-samples/first-network$ ./byfn.sh up
    Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
    Continue? [Y/n] y
    proceeding ...
    2018-06-06 05:07:24.242 UTC [main] main -> INFO 001 Exiting.....
    LOCAL_VERSION=1.1.0
    DOCKER_IMAGE_VERSION=1.1.0
    peer0.org2.example.com is up-to-date
    orderer.example.com is up-to-date
    peer0.org1.example.com is up-to-date
    peer1.org1.example.com is up-to-date
    peer1.org2.example.com is up-to-date
    cli is up-to-date

     ____    _____      _      ____    _____ 
    / ___|  |_   _|    / \    |  _ \  |_   _|
    \___ \    | |     / _ \   | |_) |   | |  
     ___) |   | |    / ___ \  |  _ <    | |  
    |____/    |_|   /_/   \_\ |_| \_\   |_|  

    Build your first network (BYFN) end-to-end test

    Channel name : mychannel
    Creating channel...
    CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
    CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
    CORE_PEER_PROFILE_ENABLED=true
    CORE_PEER_GOSSIP_ORGLEADER=false
    CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
    CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
    CORE_PEER_TLS_ENABLED=true
    CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=net_byfn
    CORE_LOGGING_LEVEL=INFO
    CORE_PEER_GOSSIP_USELEADERELECTION=true
    + peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
    + res=1
    + set +x
    Error: failed to create deliver client: failed to load config for OrdererClient: unable to load orderer.tls.rootcert.file: open /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem: no such file or directory
    Usage:
      peer channel create [flags]

    Flags:
      -c, --channelID string   In case of a newChain command, the channel ID to create.
      -f, --file string        Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
      -t, --timeout int        Channel creation timeout (default 5)

    Global Flags:
          --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
          --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
          --clientauth                          Use mutual TLS when communicating with the orderer endpoint
          --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
          --logging-level string                Default logging level and overrides, see core.yaml for full syntax
      -o, --orderer string                      Ordering service endpoint
          --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer.
          --tls                                 Use TLS when communicating with the orderer endpoint
      -v, --version                             Display current version of fabric peer server

    !!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
    ========= ERROR !!! FAILED to execute End-2-End Scenario ===========

    ERROR !!!! Test failed

ОБНОВЛЕНИЕ 2: После down-ing и повторного запуска сети ./byfn.sh up работает отлично.Но ./byfn.sh up -l node снова выдает ошибку.

himani@himani-HP-Notebook:~/fabric-samples/first-network$ ./byfn.sh up -l node
Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
2018-06-06 09:06:22.325 UTC [main] main -> INFO 001 Exiting.....
LOCAL_VERSION=1.1.0
DOCKER_IMAGE_VERSION=1.1.0
orderer.example.com is up-to-date
peer0.org2.example.com is up-to-date
peer1.org2.example.com is up-to-date
peer0.org1.example.com is up-to-date
peer1.org1.example.com is up-to-date
cli is up-to-date

 ____    _____      _      ____    _____ 
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |  
 ___) |   | |    / ___ \  |  _ <    | |  
|____/    |_|   /_/   \_\ |_| \_\   |_|  

Build your first network (BYFN) end-to-end test

Channel name : mychannel
Creating channel...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=1
+ set +x
2018-06-06 09:06:25.547 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating ReadSet: readset expected key [Group]  /Channel/Application/Org2MSP at version 0, but got version 1
Usage:
  peer channel create [flags]

Flags:
  -c, --channelID string   In case of a newChain command, the channel ID to create.
  -f, --file string        Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
  -t, --timeout int        Channel creation timeout (default 5)

Global Flags:
      --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
      --clientauth                          Use mutual TLS when communicating with the orderer endpoint
      --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
      --logging-level string                Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string                      Ordering service endpoint
      --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer.
      --tls                                 Use TLS when communicating with the orderer endpoint
  -v, --version                             Display current version of fabric peer server

!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

ERROR !!!! Test failed

Ответы [ 3 ]

0 голосов
/ 07 июня 2018

после внимательного прочтения я понял, что между этими двумя вариантами есть ./byfn.sh up и ,.byfn.sh -l node.Как золотое правило, всякий раз, когда возникает проблема, выключение сети, а затем перезапуск всегда работали до сих пор

0 голосов
/ 26 февраля 2019

Пример для FirstNetwork пример репозитория:

Это сработало для меня: очистить среду:

docker ps -aq

^ это даст вам список идентификаторов контейнеров.удалите их один за другим:

docker rm -rf containerIds

выполните команду down:

./byfn.sh -m down

, затем выполните команду up:

./byfn.sh -m up
0 голосов
/ 05 июня 2018

Я бы предложил остановить все и удалить все контейнеры, а затем вернуть файлы yaml к их исходным именам.Затем попробуйте запустить все заново.

Команды для остановки и удаления контейнеров:

docker stop $(docker ps -q) и

docker rm $(docker ps -aq)

docker site содержит хорошую документацию для команд docker.

...