Error getting endorser client channel: endorser client failed to connect to peer0.org1.example.com:7051
Asked Answered
R

4

1

I am new to Hyperleger Fabric. I'm reading a tutorial on Building Your First Network and got stuck in the fabric-samples/first-network sample. I first run:

./byfn.sh generate

Then I run:

./byfn.sh up

The result of this is:

Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
2018-08-03 02:56:16.574 UTC [main] main -> INFO 001 Exiting.....
LOCAL_VERSION=1.1.1-snapshot-DOCKER_IMAGE_VERSION=1.1.0
=================== WARNING ===================
  Local fabric binaries and docker images are  
  out of  sync. This may cause problems.       
===============================================
/vagrant/src/github.com/hyperledger/fabric-samples/first-network/../bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
+ cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
+ res=0
+ set +x

/vagrant/src/github.com/hyperledger/fabric-samples/first-network/../bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
+ configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
2018-08-03 02:56:19.174 UTC [common/tools/configtxgen] main -> INFO 001 Loading configuration
2018-08-03 02:56:19.330 UTC [msp] getMspConfig -> INFO 002 Loading NodeOUs
2018-08-03 02:56:19.396 UTC [msp] getMspConfig -> INFO 003 Loading NodeOUs
2018-08-03 02:56:19.406 UTC [common/tools/configtxgen] doOutputBlock -> INFO 004 Generating genesis block
2018-08-03 02:56:19.407 UTC [common/tools/configtxgen] doOutputBlock -> INFO 005 Writing genesis block
+ res=0
+ set +x

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2018-08-03 02:56:19.552 UTC [common/tools/configtxgen] main -> INFO 001 Loading configuration
2018-08-03 02:56:19.590 UTC [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2018-08-03 02:56:19.648 UTC [msp] getMspConfig -> INFO 003 Loading NodeOUs
2018-08-03 02:56:19.710 UTC [msp] getMspConfig -> INFO 004 Loading NodeOUs
2018-08-03 02:56:19.747 UTC [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 005 Writing new channel tx
+ res=0
+ set +x

#################################################################
#######    Generating anchor peer update for Org1MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2018-08-03 02:56:19.900 UTC [common/tools/configtxgen] main -> INFO 001 Loading configuration
2018-08-03 02:56:19.938 UTC [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2018-08-03 02:56:19.940 UTC [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
+ res=0
+ set +x

#################################################################
#######    Generating anchor peer update for Org2MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2018-08-03 02:56:20.083 UTC [common/tools/configtxgen] main -> INFO 001 Loading configuration
2018-08-03 02:56:20.124 UTC [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2018-08-03 02:56:20.126 UTC [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
+ res=0
+ set +x

Creating network "net_byfn" with the default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_orderer.example.com" with default driver
Creating orderer.example.com ... 
Creating peer1.org2.example.com ... 
Creating peer0.org2.example.com ... 
Creating orderer.example.com
Creating peer1.org2.example.com
Creating peer0.org2.example.com
Creating peer1.org1.example.com ... 
Creating peer0.org1.example.com ... 
Creating peer1.org1.example.com
Creating peer1.org1.example.com ... done
Creating cli ... 
Creating cli ... done

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

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

Channel name : mychannel
Creating channel...
+ 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=0
+ set +x
2018-08-03 02:56:24.093 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-08-03 02:56:24.140 UTC [channelCmd] InitCmdFactory -> INFO 002 Endorser and orderer connections initialized
2018-08-03 02:56:24.344 UTC [main] main -> INFO 003 Exiting.....
===================== Channel 'mychannel' created ===================== 

Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=1
+ set +x
2018-08-03 02:56:24.489 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: proposal failed (err: rpc error: code = Unavailable desc = transport is closing)
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

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

peer0.org1 failed to join the channel, Retry after 3 seconds
+ peer channel join -b mychannel.block
+ res=1
+ set +x
Error: Error getting endorser client channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: context deadline exceeded
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

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

peer0.org1 failed to join the channel, Retry after 3 seconds
+ peer channel join -b mychannel.block
+ res=1
+ set +x
Error: Error getting endorser client channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: context deadline exceeded
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

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

peer0.org1 failed to join the channel, Retry after 3 seconds
+ peer channel join -b mychannel.block
+ res=1
+ set +x
Error: Error getting endorser client channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: context deadline exceeded
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

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

peer0.org1 failed to join the channel, Retry after 3 seconds
+ peer channel join -b mychannel.block
+ res=1
+ set +x
Error: Error getting endorser client channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: context deadline exceeded
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

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

!!!!!!!!!!!!!!! After 5 attempts, peer0.org1 has failed to join channel 'mychannel'  !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

ERROR !!!! Test failed

I don't know what's going wrong. How can I solve the problem?

Robber answered 3/8, 2018 at 6:15 Comment(6)
which OS are you using? I see Vagrant but which version of Linux?Fetid
Linux version 4.4.0-130-generic (buildd@lgw01-amd64-039) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) ) #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018Robber
I'm not sure if this is the issue, but you might want to have a look at https://mcmap.net/q/1920182/-error-starting-hyperledger-fabcar-sample-application which shows you how to modify the compose file and set the dns_search field. Do you happen to be connected to a VPN? Might also be that your ISP resolves unknown DNS hosts to a specific entryFetid
I didn't connected any vpn.Robber
It doesn't solve the problem.Robber
as it says, local fabric binaries are out of sync. Try to reinstall fabric-samples to the newest one. and restart again, should workBatruk
M
4

The only solution which worked for me is increasing sleep time to start fabric.

  1. Delete all hyperledger docker images before starting fabric (startFabric.sh will download latest images again.

    To delete all containers including its volumes use,

    docker rm -vf $(docker ps -a -q)
    

    To delete all the images,

    docker rmi -f $(docker images -a -q)
    
  2. open basic-network/start.sh
  3. make FABRIC_START_TIMEOUT=90 (default 10)
  4. ./startFabric.sh
Mylo answered 2/10, 2018 at 15:35 Comment(0)
D
0

I've met this problem twice.

In versoin 1.1.0

I fixed it by remove all docker images, to download all related images again. Because, at that time, i have so many versions of fabric images.

In version 1.2.0

I get this problem again in a new ecs machine again.

Dotard answered 4/8, 2018 at 14:54 Comment(0)
R
0

I got this error as well, via the IBM blockchain platform VS code extension. I'm on version 1.4.4 of Fabric.

I suspect I ran out of disk space so I ran docker system prune --volumes to delete dangling volumes and gained 22 GB back (I have other docker volumes consuming lots of space). Keep in mind that you should have running, the containers that you want to keep important data in the volumes for. This way the 'prune' won't delete these volumes.

After this, I re-started the IBM Blockchain Platform environment via the VS code extension and it started up as normal.

Rhinencephalon answered 7/12, 2019 at 7:55 Comment(0)
L
0

I solved this by cleaning up the docker station with this command:

docker rm -f $(docker ps -aq) && docker rmi -f $(docker images | grep dev | awk '{print $3}') && docker volume prune
Licit answered 12/11, 2020 at 16:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.