问题
I want to build first-network of Hyperledger Fabric Samples
I get the simple code from git then download the platform-specific binaries follow the guide http://hyperledger-fabric.readthedocs.io/en/v1.0.5/samples.html But when I run the command ./byfn.sh -m generate there are different output in my screen and when I run ./byfn.sh -m up , the error occurred
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=2
+ set +x
2018-04-04 09:59:34.078 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7fc6bfc34259]
runtime stack:
runtime.throw(0xf11259, 0x2a)
/opt/go/src/runtime/panic.go:605 +0x95
runtime.sigpanic()
/opt/go/src/runtime/signal_unix.go:351 +0x2b8
goroutine 25 [syscall, locked to thread]:
runtime.cgocall(0xbf3800, 0xc420027de8, 0xf0fa21)
/opt/go/src/runtime/cgocall.go:132 +0xe4 fp=0xc420027da8 sp=0xc420027d68 pc=0x4023b4
net._C2func_getaddrinfo(0x7fc6b00008c0, 0x0, 0xc42038a3c0, 0xc42000e838, 0x0, 0x0, 0x0)
net/_obj/_cgo_gotypes.go:86 +0x5f fp=0xc420027de8 sp=0xc420027da8 pc=0x5f893f
net.cgoLookupIPCNAME.func2(0x7fc6b00008c0, 0x0, 0xc42038a3c0, 0xc42000e838, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x13)
/opt/go/src/net/cgo_unix.go:151 +0x13f fp=0xc420027e40 sp=0xc420027de8 pc=0x5ffedf
net.cgoLookupIPCNAME(0x7ffe5b6e1a3a, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/opt/go/src/net/cgo_unix.go:151 +0x175 fp=0xc420027f38 sp=0xc420027e40 pc=0x5fa195
net.cgoIPLookup(0xc420382360, 0x7ffe5b6e1a3a, 0x13)
/opt/go/src/net/cgo_unix.go:203 +0x4d fp=0xc420027fc8 sp=0xc420027f38 pc=0x5fa8dd
runtime.goexit()
/opt/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc420027fd0 sp=0xc420027fc8 pc=0x45e391
created by net.cgoLookupIP
/opt/go/src/net/cgo_unix.go:213 +0xaf
goroutine 1 [select]:
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.DialContext(0x7fc6bfe577e0, 0xc4203821e0, 0x7ffe5b6e1a3a, 0x18, 0xc420355780, 0x4, 0x4, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:422 +0x532
github.com/hyperledger/fabric/core/comm.(*grpcClient).NewConnection(0xc4203705f0, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/core/comm/client.go:217 +0x389
github.com/hyperledger/fabric/peer/common.(*OrdererClient).Broadcast(0xc42038a270, 0x0, 0x0, 0xc420153b10, 0xbc3839)
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/ordererclient.go:50 +0x6c
github.com/hyperledger/fabric/peer/common.GetBroadcastClient(0x380, 0xc420184a00, 0x138, 0x138)
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/broadcastclient.go:41 +0x3e
github.com/hyperledger/fabric/peer/channel.InitCmdFactory.func1(0xc420335680, 0xc420335e30, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:136 +0x29
github.com/hyperledger/fabric/peer/channel.sendCreateChainTransaction(0xc420265360, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:164 +0xa7
github.com/hyperledger/fabric/peer/channel.executeCreate(0xc420265360, 0xc420265360, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:178 +0x2f
github.com/hyperledger/fabric/peer/channel.create(0xc4201f7680, 0xc4201f5860, 0x1, 0xa, 0x0, 0xd5afc0, 0x16705c0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:213 +0x40
github.com/hyperledger/fabric/peer/channel.createCmd.func1(0xc4201f7680, 0xc4201f5860, 0x1, 0xa, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:59 +0x52
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute(0xc4201f7680, 0xc4201f5720, 0xa, 0xa, 0xc4201f7680, 0xc4201f5720)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 +0x3e8
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x164d4e0, 0x11, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 +0x2fe
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x164d4e0, 0x7d, 0xc420014035)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 +0x2b
main.main()
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:112 +0x5e1
goroutine 19 [runnable]:
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.(*http2Client).keepalive(0xc420332340)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:1272
created by github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.newHTTP2Client
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:292 +0xdd2
goroutine 18 [runnable]:
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.(*http2Client).controller(0xc420332340)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:1225
created by github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.newHTTP2Client
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:290 +0xd2e
goroutine 10 [syscall]:
os/signal.signal_recv(0x0)
/opt/go/src/runtime/sigqueue.go:131 +0xa6
os/signal.loop()
/opt/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
/opt/go/src/os/signal/signal_unix.go:28 +0x41
goroutine 21 [runnable]:
github.com/hyperledger/fabric/vendor/golang.org/x/net/trace.allocFamily(0xc42035a0c0, 0x19, 0x16c6c40)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/golang.org/x/net/trace/trace.go:514
created by github.com/hyperledger/fabric/vendor/golang.org/x/net/trace.New
/opt/gopath/src/github.com/hyperledger/fabric/vendor/golang.org/x/net/trace/trace.go:359 +0x235
goroutine 16 [runnable]:
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.(*http2Client).reader(0xc420332340)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:1137
created by github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.newHTTP2Client
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:260 +0xbf8
goroutine 20 [runnable]:
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*addrConn).transportMonitor(0xc420120540)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:990
created by github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*ClientConn).resetAddrConn
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:716 +0x67a
goroutine 22 [runnable]:
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.newClientStream.func3(0x166c200, 0xc420332340, 0xc420120380, 0xc42024d600, 0xc4200ff800)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/stream.go:254
created by github.com/hyperledger/fabric/vendor/google.golang.org/grpc.newClientStream
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/stream.go:254 +0xe23
goroutine 23 [select]:
net.(*Resolver).LookupIPAddr(0x169d370, 0x1667b40, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0)
/opt/go/src/net/lookup.go:196 +0x52b
net.(*Resolver).internetAddrList(0x169d370, 0x1667b40, 0xc4203822a0, 0xee7636, 0x3, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0x0, ...)
/opt/go/src/net/ipsock.go:293 +0x644
net.(*Resolver).resolveAddrList(0x169d370, 0x1667b40, 0xc4203822a0, 0xee7b40, 0x4, 0xee7636, 0x3, 0x7ffe5b6e1a3a, 0x18, 0x0, ...)
/opt/go/src/net/dial.go:193 +0x594
net.(*Dialer).DialContext(0xc42004f458, 0x1667b40, 0xc4203822a0, 0xee7636, 0x3, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0x0, ...)
/opt/go/src/net/dial.go:375 +0x248
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.dialContext(0x1667b40, 0xc4203822a0, 0xee7636, 0x3, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0xc4200ff900, 0xc420284e00)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/go17.go:38 +0xb3
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.DialContext.func1(0x7fc6bfe577e0, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0x16571c0, 0xc420140c80)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:329 +0x86
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.newProxyDialer.func1(0x7fc6bfe577e0, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0xc420334e10, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/proxy.go:121 +0x137
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.dial(0x7fc6bfe577e0, 0xc4203822a0, 0xc42037f790, 0x7ffe5b6e1a3a, 0x18, 0xc42017f780, 0xc4203235c0, 0x7fc6bfe55d10, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:119 +0x5a
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.newHTTP2Client(0x7fc6bfe577e0, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0xeef4b1, 0xd, 0x0, 0x0, ...)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:157 +0xa7
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.NewClientTransport(0x7fc6bfe577e0, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0xeef4b1, 0xd, 0x0, 0x0, ...)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/transport.go:505 +0xae
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*addrConn).resetTransport(0xc420120a80, 0xc42038a200, 0xc420120aa0, 0xc42038e108)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:929 +0x4b4
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*ClientConn).resetAddrConn(0xc4201208c0, 0x7ffe5b6e1a3a, 0x18, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:702 +0x340
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.DialContext.func3(0xc420382240, 0xc4201208c0, 0x1669a40, 0xc42000e828, 0x7ffe5b6e1a3a, 0x18)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:417 +0x223
created by github.com/hyperledger/fabric/vendor/google.golang.org/grpc.DialContext
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:386 +0x441
goroutine 24 [select]:
net.cgoLookupIP(0x1667b40, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x13, 0xc4201cbc80, 0x0, 0x0, 0x0, 0x0, 0x0)
/opt/go/src/net/cgo_unix.go:214 +0x1b0
net.(*Resolver).lookupIP(0x169d370, 0x1667b40, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0)
/opt/go/src/net/lookup_unix.go:95 +0x12d
net.(*Resolver).(net.lookupIP)-fm(0x1667b40, 0xc4203822a0, 0x7ffe5b6e1a3a, 0x13, 0x3, 0xc420340f00, 0xc420052080, 0x0, 0xc420020000)
/opt/go/src/net/lookup.go:187 +0x56
net.glob..func10(0x1667b40, 0xc4203822a0, 0xc42037f7f0, 0x7ffe5b6e1a3a, 0x13, 0x42ad09, 0xc400000008, 0xc420052080, 0x0, 0x8db329)
/opt/go/src/net/hook.go:19 +0x52
net.(*Resolver).LookupIPAddr.func1(0x18, 0x0, 0x0, 0x1)
/opt/go/src/net/lookup.go:193 +0x5c
internal/singleflight.(*Group).doCall(0x169d360, 0xc420370870, 0x7ffe5b6e1a3a, 0x13, 0xc42038a360)
/opt/go/src/internal/singleflight/singleflight.go:93 +0x2e
created by internal/singleflight.(*Group).DoChan
/opt/go/src/internal/singleflight/singleflight.go:86 +0x31f
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
ERROR !!!! Test failed
Please help me to fix this problem thanks!
回答1:
You should be able to resolve this by adding GODEBUG=netdns=go to the environment variables section of your the Docker Compose file(s).
If you take a look at https://github.com/hyperledger/fabric-samples/blob/release-1.1/first-network/base/peer-base.yaml, you can modify the contents like this:
version: '2'
services:
peer-base:
image: hyperledger/fabric-peer:$IMAGE_TAG
environment:
- GODEBUG=netdns=go
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# the following setting starts chaincode containers on the same
# bridge network as the peers
# https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- CORE_LOGGING_LEVEL=INFO
#- CORE_LOGGING_LEVEL=DEBUG
- 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=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
The other possible solution is to add the dns_search property:
version: '2'
services:
peer-base:
image: hyperledger/fabric-peer:$IMAGE_TAG
dns_search: .
environment:
- GODEBUG=netdns=go
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# the following setting starts chaincode containers on the same
# bridge network as the peers
# https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- CORE_LOGGING_LEVEL=INFO
#- CORE_LOGGING_LEVEL=DEBUG
- 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=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
or try both as well
回答2:
You seem to have mismatched the version of the samples and Hyperledger Fabric images and binaries (I noticed that the version of the output matches code added for v1.1.0). Before running the first-network sample (or any other) make sure that you checkout the corresponding version of the fabric-samples git repository for the docker images and binaries you downloaded.
e.g.
git clone https://github.com/hyperledger/fabric-samples.git
git checkout v1.0.6
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/v1.0.6/scripts/bootstrap.sh | bash -s 1.0.6
cd first-network
./byfn.sh -m generate
...
回答3:
Its an issue of dns-go. Add this tag to the environment of peer container in docker-compose.yml.
- GODEBUG=netdns=go
来源:https://stackoverflow.com/questions/49648529/hyperledger-fabric-simples-issue-run-byfn-sh-m-up-failed