简体   繁体   中英

In fabric first-network example, hot to fix the error: “transport: error while dialing: dial tcp: lookup peer0.org1.example.com: no such host”

Can't run the fabric first-network example

This is the log when I run: ./byfn up


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

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
2019-06-27 22:22:11.117 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-06-27 22:22:12.361 UTC [cli.common] readBlock -> INFO 002 Received block: 0
===================== Channel 'mychannel' created ===================== 

Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=1
+ set +x
Error: error getting endorser client for channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp: lookup peer0.org1.example.com: no such host"
peer0.org1 failed to join the channel, Retry after 9 seconds

My environment:

Ubuntu 18.04
Docker version 18.06.1-ce, build e68fc7a
docker-compose version 1.24.0, build 0aa59064
go version go1.11.11 linux/amd64

echo $GOPATH results in /usr/local/go/bin

The peers should be able to join the channel

Try adding - GODEBUG=netdns=go in the environment section of peer-base.yaml file,it can be found in the fabric-samples/first-newtork/base/

This is a well known issue inshort this caused due to changes to the file resolv.conf, the inter-container domain name resolution in Hyperledger Fabric is switched from the pure Go resolver to the cgo resolver, an SIGSEGV error caused by the known static link cgo is triggered, and thus the deployment of Hyperledger Fabric fails. To know more follow this link .

this is the common problem, stop the network, remove all ur previous containers and prune the docker's volume, then restart the docker, finally re-run the network again:

$./byfn.sh down
$docker stop $(docker ps -a -q)
$docker rm $(docker ps -a -q)
$docker volume prune
$sudo systemctl daemon-reload
$sudo systemctl restart docker
$cd .....fabric-samples/first-network
$./byfn.sh -m generate
$./byfn.sh -m up

Solved it by running the examples in Ubuntu 16.04 LTS. Prior I was trying it on Ubuntu 18.04, but the target OS for Hyperledger Fabric development was Ubuntu 16, not the brand new 18, so it makes sense that it runs smoothly in Ubuntu 16.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM