Fabric踩坑问题记录(无法创建交易链)

我在生成的时候都挺顺利的。
docker compose 启动也都正常

peer channel list 响应结果也是预期的(可以连上节点,看到连接的通道是空的)

但是我在创建通道的时候发生了异常

具体指令为
peer channel create -o orderer.t4cloud.com:7050 -c t4channel -f /etc/hyperledger/config/t4cloud.tx

其中的orderer.t4cloud.com,容器启动正常,我之前看过docker启动log,确实是等待服务的日志(视频中说这样就是启动成功了)
通道名称t4channel这个也是正常的,我尝试过使用别的,就会提示通道ID不一致。
最后的交易文件读取正常,如果修改成别的,也会提示文件无法读取

令我困惑的是他的异常提示,是空的,导致百度无法下手,看过好一些,无法解决,只能向老师求助一下。

图片描述

这是我的docker容器运行状态,看起来版本号都是1.0.0应该也没错

图片描述

此时被提醒查看order节点日志

--以下是补充的order日志

图片描述

我搜索过这个显眼的红色部分的异常,有一个前辈说是order节点的配置不对,正确的应该是GENESISMETHOD=file,我看了docker-compose中的order配置,我的确实是对的。其他能搜索到的结果都和这个不一样,陷入茫然。

然后我注意到了蓝色部分,也去搜索了一下,同样只有疑问没有解决办法。

再次求助前辈,发现我犯了一个简单的错误

以下是我使用的命令

生成证书
./cryptogen generate --config=./crypto-config.yaml

创建创世区块及交易
./configtxgen -profile OneOrgOrdererGenesis -outputBlock ./config/genesis.block -channelID t4channel
./configtxgen -profile TwoOrgChannel -outputCreateChannelTx ./config/t4cloud.tx -channelID t4channel

创建通道
peer channel create -o orderer.t4cloud.com:7050 -c t4channel -f /etc/hyperledger/config/t4cloud.tx

注意,一个是生成系统链,一个是生成交易链,ID不可一样!

后续异常补充

在我使用小写的不同的名字的时候,出现了go语言的异常,看起来好像是没有响应信息。
(这个我搜了下说是GO语言的环境有问题,可是当前是在官方的docker镜像中……)

图片描述

详细信息如下

2020-01-11 17:24:33.455 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=0x7f2b85f38259]

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

goroutine 7 [syscall, locked to thread]:
runtime.cgocall(0xb1e190, 0xc4200235f8, 0xc400000000)
    /opt/go/src/runtime/cgocall.go:131 +0x110 fp=0xc4200235b0 sp=0xc420023570
net._C2func_getaddrinfo(0x7f2b780008c0, 0x0, 0xc420181410, 0xc42002a258, 0x0, 0x0, 0x0)
    ??:0 +0x68 fp=0xc4200235f8 sp=0xc4200235b0
net.cgoLookupIPCNAME(0x7fff5487d7e4, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /opt/go/src/net/cgo_unix.go:146 +0x37c fp=0xc420023718 sp=0xc4200235f8
net.cgoIPLookup(0xc420016720, 0x7fff5487d7e4, 0x13)
    /opt/go/src/net/cgo_unix.go:198 +0x4d fp=0xc4200237a8 sp=0xc420023718
runtime.goexit()
    /opt/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc4200237b0 sp=0xc4200237a8
created by net.cgoLookupIP
    /opt/go/src/net/cgo_unix.go:208 +0xb4

goroutine 1 [runnable]:
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*ClientConn).GetMethodConfig(0xc42039e820, 0xdd0d4c, 0x20, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/clientconn.go:676 +0x170
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.newClientStream(0x7f2b86affd40, 0xc4200641b8, 0x14043e0, 0xc42039e820, 0xdd0d4c, 0x20, 0x0, 0x0, 0x0, 0x0, ...)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/stream.go:116 +0x109
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.NewClientStream(0x7f2b86affd40, 0xc4200641b8, 0x14043e0, 0xc42039e820, 0xdd0d4c, 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(0xc4200725e8, 0x7f2b86affd40, 0xc4200641b8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0xc0)
    /opt/gopath/src/github.com/hyperledger/fabric/protos/orderer/ab.pb.go:499 +0xba
github.com/hyperledger/fabric/peer/channel.InitCmdFactory(0xc420360100, 0x0, 0x0, 0x14106a0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:179 +0x2c0
github.com/hyperledger/fabric/peer/channel.getGenesisBlock(0xc42035abe0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/deliverclient.go:141 +0x11c
github.com/hyperledger/fabric/peer/channel.executeCreate(0xc42035abe0, 0xc42035abe0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:183 +0x50
github.com/hyperledger/fabric/peer/channel.create(0xc42027a240, 0xc42036c300, 0x0, 0x6, 0xc42035abe0, 0xdb63de, 0x5)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/create.go:213 +0x45
github.com/hyperledger/fabric/peer/channel.createCmd.func1(0xc42027a240, 0xc42036c300, 0x0, 0x6, 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(0xc42027a240, 0xc42036c240, 0x6, 0x6, 0xc42027a240, 0xc42036c240)
    /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(0x1407d60, 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(0x1407d60, 0x36, 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 22 [syscall]:
os/signal.signal_recv(0xc420022fa8)
    /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 6 [select]:
net.cgoLookupIP(0x141ef60, 0xc420016660, 0x7fff5487d7e4, 0x13, 0xc42022e480, 0xc420024668, 0x0, 0x0, 0x0, 0x0)
    /opt/go/src/net/cgo_unix.go:209 +0x2f5
net.lookupIP(0x141ef60, 0xc420016660, 0x7fff5487d7e4, 0x13, 0xc42036c960, 0x0, 0x0, 0x0, 0x40005)
    /opt/go/src/net/lookup_unix.go:70 +0xf9
net.glob..func11(0x141ef60, 0xc420016660, 0xe45118, 0x7fff5487d7e4, 0x13, 0xc4200246c8, 0x720699, 0xc420024708, 0xc420024718, 0x455cc0)
    /opt/go/src/net/hook.go:19 +0x52
net.lookupIPContext.func1(0xc42039e820, 0x7fff5487d7e4, 0x18, 0x0)
    /opt/go/src/net/lookup.go:119 +0x5c
internal/singleflight.(*Group).doCall(0x143be60, 0xc42001ba90, 0x7fff5487d7e4, 0x13, 0xc4201813b0)
    /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 41 [select]:
net.lookupIPContext(0x141ef60, 0xc420016660, 0x7fff5487d7e4, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0)
    /opt/go/src/net/lookup.go:122 +0x7bc
net.internetAddrList(0x141ef60, 0xc420016660, 0xdb57a4, 0x3, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0x0, 0x0, ...)
    /opt/go/src/net/ipsock.go:241 +0x5e0
net.resolveAddrList(0x141ef60, 0xc420016660, 0xdb5da8, 0x4, 0xdb57a4, 0x3, 0x7fff5487d7e4, 0x18, 0x0, 0x0, ...)
    /opt/go/src/net/dial.go:179 +0x106
net.(*Dialer).DialContext(0xc42004b6c8, 0x141ef60, 0xc420016660, 0xdb57a4, 0x3, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0x0, ...)
    /opt/go/src/net/dial.go:329 +0x238
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.dialContext(0x141ef60, 0xc420016660, 0xdb57a4, 0x3, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0xc4201462d0, 0xc420156b80)
    /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(0x7f2b86affe00, 0xc420016660, 0x7fff5487d7e4, 0x18, 0x1, 0x0, 0x14106a0, 0xc42018c910)
    /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(0x7f2b86affe00, 0xc420016660, 0x7fff5487d7e4, 0x18, 0x13, 0x410a5e, 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(0x7f2b86affe00, 0xc420016660, 0xc420371aa0, 0x7fff5487d7e4, 0x18, 0x410a5e, 0xc42013e1e0, 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(0x7f2b86affe00, 0xc420016660, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0xdc17ea, 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(0x7f2b86affe00, 0xc420016660, 0x7fff5487d7e4, 0x18, 0x0, 0x0, 0xdc17ea, 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(0xc4200f7a40, 0xc42036da00, 0x70e60c, 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(0xc4200f7a40)
    /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

然后看order节点的日志,好像是没问题,都成功了,排除order的问题

图片描述

在这种情况下,我尝试过无视异常,然后加入链,会提示tx文件不存在。
如果再次生成链,会生成失败,提示version为1,我搜了下,好像是代表链已存在。

【最终问题解决,成功创建通道】
网上说可能是容器环境有问题,一样面向百度,发现有个前辈说在官方提供的client容器的GODNS是不对的。看起来是个GO语言的问题,也不管什么容器,在所有的镜像都加上修正参数。

注意点
1.创世区块和交易链的通道ID不能一样
2.通道名称,不能有大写,(因为我写JAVA习惯了驼峰),但是在此处会有一场,order节点日志:通道ID有非法自读
3.cli客户端的环境变量中缺少 - GODEBUG=netdns=go 导致响应异常。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 220,458评论 6 513
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 94,030评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,879评论 0 358
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,278评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,296评论 6 397
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 52,019评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,633评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,541评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 46,068评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,181评论 3 340
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,318评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,991评论 5 347
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,670评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,183评论 0 23
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,302评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,655评论 3 375
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,327评论 2 358

推荐阅读更多精彩内容