阿里云服务器跑 hyperledger e2e-cli 运行

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wxb880114/article/details/79674347

go 安装

docker 安装

hyperledger fabric 源码运行

参加上篇博客

 CentOS 7 HyperLedger fabric 实战 e2e-cli 有运行成功图

问题及解决方法

2018-03-23 17:52:41.021 UTC [channelCmd] readBlock -> DEBU 016 Got status:*orderer.DeliverResponse_Status
2018-03-23 17:52:41.021 UTC [msp] GetLocalMSP -> DEBU 017 Returning existing local MSP
2018-03-23 17:52:41.021 UTC [msp] GetDefaultSigningIdentity -> DEBU 018 Obtaining default signing identity
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7fd45dffd259]

runtime stack:
runtime.throw(0xdc37a7, 0x2a)
        /opt/go/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
        /opt/go/src/runtime/sigpanic_unix.go:12 +0x2cc

goroutine 34 [syscall, locked to thread]:
runtime.cgocall(0xb08d50, 0xc420020df8, 0xc400000000)
        /opt/go/src/runtime/cgocall.go:131 +0x110 fp=0xc420020db0 sp=0xc420020d70
net._C2func_getaddrinfo(0x7fd4580008c0, 0x0, 0xc420343560, 0xc42012e5e8, 0x0, 0x0, 0x0)
        ??:0 +0x68 fp=0xc420020df8 sp=0xc420020db0
net.cgoLookupIPCNAME(0x7ffdd56a1a83, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /opt/go/src/net/cgo_unix.go:146 +0x37c fp=0xc420020f18 sp=0xc420020df8
net.cgoIPLookup(0xc4203a3560, 0x7ffdd56a1a83, 0x13)
        /opt/go/src/net/cgo_unix.go:198 +0x4d fp=0xc420020fa8 sp=0xc420020f18
runtime.goexit()
        /opt/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420020fb0 sp=0xc420020fa8
created by net.cgoLookupIP
        /opt/go/src/net/cgo_unix.go:208 +0xb4

goroutine 1 [select]:
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*addrConn).wait(0xc4201d68c0, 0x7fd45e37fda0, 0xc4203434a0, 0xc420150100, 0x8006f0, 0x7fd45e37fda0, 0xc4203434a0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:1032 +0x183
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*ClientConn).getTransport(0xc42014dd40, 0x7fd45e37fda0, 0xc4203434a0, 0xc420343400, 0x7fd45e37fda0, 0xc420343470, 0x19, 0x0, 0xc42015d900)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:724 +0x2f7
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.newClientStream(0x7fd45e37fda0, 0xc4203434a0, 0x13e1f40, 0xc42014dd40, 0xdb7f76, 0x20, 0x0, 0x0, 0x0, 0x0, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/stream.go:189 +0x599
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.NewClientStream(0x7fd45e37fd20, 0xc420012290, 0x13e1f40, 0xc42014dd40, 0xdb7f76, 0x20, 0x0, 0x0, 0x0, 0x18, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/stream.go:105 +0x162
github.com/hyperledger/fabric/protos/orderer.(*atomicBroadcastClient).Deliver(0xc42012e5d8, 0x7fd45e37fd20, 0xc420012290, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc42031a9a0, 0xbe4ab0)
        /opt/gopath/src/github.com/hyperledger/fabric/protos/orderer/ab.pb.go:499 +0xba
github.com/hyperledger/fabric/peer/channel.InitCmdFactory(0xc420350100, 0x0, 0x0, 0x13ee140)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:179 +0x2c0
github.com/hyperledger/fabric/peer/channel.getGenesisBlock(0xc420328f00, 0x0, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/deliverclient.go:141 +0x11c
github.com/hyperledger/fabric/peer/channel.executeCreate(0xc420328f00, 0xc420328f00, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:183 +0x50
github.com/hyperledger/fabric/peer/channel.create(0xc420249440, 0xc42020fcc0, 0x1, 0xa, 0xc420328f00, 0xd9d943, 0x5)
        /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:213 +0x45
github.com/hyperledger/fabric/peer/channel.createCmd.func1(0xc420249440, 0xc42020fcc0, 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(0xc420249440, 0xc42020fb80, 0xa, 0xa, 0xc420249440, 0xc42020fb80)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 +0x234
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x13e58c0, 0xf, 0xc420010035, 0x7)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 +0x367
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x13e58c0, 0x7d, 0xc420010035)
        /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:118 +0x54e

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /opt/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 19 [syscall]:
os/signal.signal_recv(0xc420025fa8)
        /opt/go/src/runtime/sigqueue.go:116 +0x157
os/signal.loop()
        /opt/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.1
        /opt/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 33 [select]:
net.cgoLookupIP(0x13fc8c0, 0xc4203a34a0, 0x7ffdd56a1a83, 0x13, 0xc420252180, 0xc42034e440, 0x0, 0x0, 0xc420026fa8, 0x8f6938)
        /opt/go/src/net/cgo_unix.go:209 +0x2f5
net.lookupIP(0x13fc8c0, 0xc4203a34a0, 0x7ffdd56a1a83, 0x13, 0x0, 0x0, 0x13f0a80, 0xc420339aa0, 0xc420018838)
        /opt/go/src/net/lookup_unix.go:70 +0xf9
net.glob..func11(0x13fc8c0, 0xc4203a34a0, 0xe2abc0, 0x7ffdd56a1a83, 0x13, 0xc420026ec8, 0x71c6a9, 0xc420026f08, 0xc420026f18, 0x455cc0)
        /opt/go/src/net/hook.go:19 +0x52
net.lookupIPContext.func1(0xc42014dd40, 0x7ffdd56a1a83, 0x18, 0x0)
        /opt/go/src/net/lookup.go:119 +0x5c
internal/singleflight.(*Group).doCall(0x1419790, 0xc4203a0be0, 0x7ffdd56a1a83, 0x13, 0xc420343500)
        /opt/go/src/internal/singleflight/singleflight.go:93 +0x3c
created by internal/singleflight.(*Group).DoChan
        /opt/go/src/internal/singleflight/singleflight.go:86 +0x339

goroutine 32 [select]:
net.lookupIPContext(0x13fc8c0, 0xc4203a34a0, 0x7ffdd56a1a83, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0)
        /opt/go/src/net/lookup.go:122 +0x7bc
net.internetAddrList(0x13fc8c0, 0xc4203a34a0, 0xd9cd17, 0x3, 0x7ffdd56a1a83, 0x18, 0x0, 0x0, 0x0, 0x0, ...)
        /opt/go/src/net/ipsock.go:241 +0x5e0
net.resolveAddrList(0x13fc8c0, 0xc4203a34a0, 0xd9d317, 0x4, 0xd9cd17, 0x3, 0x7ffdd56a1a83, 0x18, 0x0, 0x0, ...)
        /opt/go/src/net/dial.go:179 +0x106
net.(*Dialer).DialContext(0xc4200496c8, 0x13fc8c0, 0xc4203a34a0, 0xd9cd17, 0x3, 0x7ffdd56a1a83, 0x18, 0x0, 0x0, 0x0, ...)
        /opt/go/src/net/dial.go:329 +0x238
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.dialContext(0x13fc8c0, 0xc4203a34a0, 0xd9cd17, 0x3, 0x7ffdd56a1a83, 0x18, 0x0, 0x0, 0xc4202503c0, 0xc4203a6780)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/go17.go:53 +0xaa
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.DialContext.func1(0x7fd45e37fde0, 0xc4203a34a0, 0x7ffdd56a1a83, 0x18, 0x1, 0x0, 0x13ee140, 0xc42012d810)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:341 +0x86
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.newProxyDialer.func1(0x7fd45e37fde0, 0xc4203a34a0, 0x7ffdd56a1a83, 0x18, 0x13, 0x7fd45ebbc608, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/proxy.go:136 +0x143
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.dial(0x7fd45e37fde0, 0xc4203a34a0, 0xc4203936b0, 0x7ffdd56a1a83, 0x18, 0x410a5e, 0xc42039e5a0, 0xa0, 0x98)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:135 +0x5a
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.newHTTP2Client(0x7fd45e37fde0, 0xc4203a34a0, 0x7ffdd56a1a83, 0x18, 0x0, 0x0, 0xda8cf6, 0x11, 0x0, 0x0, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/http2_client.go:173 +0xbf
github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport.NewClientTransport(0x7fd45e37fde0, 0xc4203a34a0, 0x7ffdd56a1a83, 0x18, 0x0, 0x0, 0xda8cf6, 0x11, 0x0, 0x0, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/transport/transport.go:463 +0xae
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*addrConn).resetTransport(0xc4201d68c0, 0xc4203a2c00, 0x70a61c, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:876 +0x282
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*ClientConn).resetAddrConn.func1(0xc4201d68c0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:648 +0x34
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:657 +0x756
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
================== ERROR !!! FAILED to execute End-2-End Scenario ==================

 

 

切换路径

cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli 

 

关键步骤1

修改 /etc/resolv.conf 配置,将 options timeout:2 attempts:3 rotate single-request-reopen 内容注释掉,作者修改后的内容如下

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 100.100.2.136
nameserver 100.100.2.138
# options timeout:2 attempts:3 rotate single-request-reopen

执行启动命令,它会启动一个 mychannel 的channel 

./network_setup.sh up mychannel

 

关键步骤2 

阿里云 docker-compose-cli.yml 中cli增加

- GODEBUG=netdns=go

tips: 每个enviroment下都需要加上 - GODEBUG=netdns=go

 

问题2:

hyperledger make: *** release/linux-amd64/bin/configtxgen', needed by `linux-amd64/bin

解决方法:

cp -r fabric/bin/* release/linux-amd64/bin/

 

 

 

docker run -it cli /bin/bash 找不到image 

清除所有images

docker stop $(docker ps -q) & docker rm $(docker ps -aq)

 

欢迎大家一起加入讨论!!!

 

 

 

 

 

 

阅读更多

更多精彩内容