1.搭建基础环境

阿里云安装出现的一些问题解决

1. [signal SIGSEGV: segmentation violation code=0x1 addr=xxx pc=xxx] 类似的错误:原始错误的代码(来自peer节点):

2020-02-09 22:43:43.665 CST [couchdb] handleRequest -> WARN 016 Retrying couchdb request in 125ms. Attempt:1  Error:Get http://couchdb:5984/: dial tcp 172.18.0.4:5984: getsockopt: connection refused
2020-02-09 22:43:43.790 CST [couchdb] handleRequest -> DEBU 017 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip | |
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f17e8243259] 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 88 [syscall, locked to thread]:
runtime.cgocall(0xbf3800, 0xc42028fac8, 0xf0fa21)

修改自己阿里云ecs机器里面的/etc/resolv.conf,把里面的 options timeout:2 attempts:3 rotate single-request-reopen 这一行内容注释掉 :解决方法:

例如我的/etc/resolv.conf :

# 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

原因解析:然后问题就解决了

这个问题是出在go的DNS解析问题,由于go的Resolver不支持options single-request-reopen从而走了CGO Resolver方法导致失败了,因此只需要把/etc/resolv.conf里面的single-request-reopen这一行注释掉即可

参考为什么通过CGO Resolver失败的原因: Static Cgo Builds, What Could Go Wrong?

2.禁止访问

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=1
+ set +x
2020-02-10 05:29:16.805 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: FORBIDDEN -- implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Writers' sub-policies to be satisfied: permission denied
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

ERROR !!!! Test failed

查看一下orderer的日志,看清楚它到底是具体的哪一个部分有问题,看到大多数的问题在于:

报错信息:

2020-02-10 05:29:15.706 UTC [nodeCmd] serve -> INFO 01e Started peer with ID=[name:"peer0.org1.example.com" ], network ID=[dev], address=[peer0.org1.example.com:7051]
2020-02-10 05:29:15.706 UTC [kvledger] LoadPreResetHeight -> INFO 01f Loading prereset height from path [/var/hyperledger/production/ledgersData/chains]
2020-02-10 05:29:15.706 UTC [fsblkstorage] LoadPreResetHeight -> INFO 020 Loading Pre-reset heights
2020-02-10 05:29:15.706 UTC [fsblkstorage] preRestHtFiles -> INFO 021 Dir [/var/hyperledger/production/ledgersData/chains/chains] missing... exiting
2020-02-10 05:29:15.706 UTC [fsblkstorage] LoadPreResetHeight -> INFO 022 Pre-reset heights loaded
2020-02-10 05:29:15.706 UTC [nodeCmd] func7 -> INFO 023 Starting profiling server with listenAddress = 0.0.0.0:6060
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f67665ee259]

错误原因:没有删除干净的环境中启动复用的之前的volume
解决方案:执行如下命令删除卷

docker-compose -f docker-compose-cli.yaml down --volumes --remove-orphans
docker rm -f $(docker ps -a | grep "hyperledger/*" | awk "{print \$1}")
docker volume prune

3.orderer节点无法启动

-- ::13.057 UTC [orderer.common.server] Start -> PANI  Failed validating bootstrap block: initializing channelconfig failed: 
could not create channel Orderer sub-group config: setting up the MSP manager failed: the supplied identity is not valid: x509: certificate signed by unknown authority
panic: Failed validating bootstrap block: initializing channelconfig failed:
could not create channel Orderer sub-group config: setting up the MSP manager failed: the supplied identity is not valid: x509: certificate signed by unknown authority

错误原因:之前搭建过网络没清除干净

解决方法:清除网络重新再来

./byfn.sh -m down

4.链码实例化失败

情况1

报错信息:

root@f36b56f939d7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.example.com: --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
-- ::28.712 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO Using default escc
-- ::28.712 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code , msg chaincode registration failed: timeout expired while starting chaincode mycc:1.0 for transaction

或者一直卡在这里

root@d44eb17e9375:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.example.com: --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
-- ::25.792 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO Using default escc
-- ::25.792 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO Using default vscc

错误原因:

因为防火墙的原因node无法下载部分依赖包

解决方法:

设置你的网络挂载VPN或者用其他语言(Go/Java)链码

情况2

Error: could not assemble transaction, err proposal response was not successful, error code , msg error starting container: error starting container: API error (): network _byfn not found
!!!!!!!!!!!!!!! Chaincode instantiation on peer0.org2 on channel 'mychannel' failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End--End Scenario ===========

5.无法创建一个带有私有数据的弹珠

错误信息

输入

export MARBLE=$(echo -n "{"name":"marble1","color":"blue","size":35,"owner":"tom","price":99}" | base64 | tr -d \n) 
peer chaincode invoke -o orderer.example.com: --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n marblesp -c '{"Args":["initMarble"]}' --transient "{"marble":"$MARBLE"}"

输出

root@451d8e400f25:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com: --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n marblesp -c '{"Args":["initMarble"]}' --transient "{"marble":"$MARBLE"}"
Error: error parsing transient string: invalid character 'm' looking for beginning of object key string - proposal response: <nil>

错误原因

未进行转义

解决方法

 输入
root@451d8e400f25:/opt/gopath/src/github.com/hyperledger/fabric/peer# export MARBLE=$(echo -n "{\"name\":\"marble1\",\"color\":\"blue\",\"size\":35,\"owner\":\"tom\",\"price\":99}" | base64 | tr -d \\n)
root@451d8e400f25:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com: --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n marblesp -c '{"Args":["initMarble"]}' --transient "{\"marble\":\"$MARBLE\"}"

成功

-- ::59.621 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO  Chaincode invoke successful. result: status:

6.tools无法启动

错误信息

Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'myc': error authorizing update: error validating ReadSet: proposed update requires that key [Group]  /Channel/Application be at version , but it is currently at version 

错误原因

未将网络清理干净

解决方法:具体结合自己文件清理

docker-compose -f docker-compose-cli.yaml down --volumes --remove-orphans
docker rm -f $(docker ps -a | grep "hyperledger/*" | awk "{print \$1}")
docker volume prune

7.采用kafka共识无法创建管道

错误信息

代码

// the bug is located in fabric source code file: fabric/orderer/kafka/retry.go
func (rp *retryProcess) try(interval, total time.Duration) error {
// ... some code removed
tickInterval := time.NewTicker(interval)
tickTotal := time.NewTicker(total)
defer tickTotal.Stop()
defer tickInterval.Stop()
logger.Debugf("[channel: %s] Retrying every %s for a total of %s", rp.channel.topic(), interval.String(), total.String()) for {
select {
case <-rp.exit:
exitErr := fmt.Errorf("[channel: %s] process asked to exit", rp.channel.topic())
logger.Warning(exitErr.Error()) // Log it at the warning level
return exitErr
case <-tickTotal.C:
return err
case <-tickInterval.C:
logger.Debugf("[channel: %s] "+rp.msg, rp.channel.topic())
if err = rp.fn(); err == nil {
logger.Debugf("[channel: %s] Error is nil, breaking the retry loop", rp.channel.topic())
return err
}
}
}
}

错误原因

卡夫卡未能连接,未将网络清理干净

解决方法:

./byfn.sh -m down

Hyperledger Fabric 踩坑汇总的更多相关文章

  1. golang的defer踩坑汇总

    原文链接:http://www.zhoubotong.site/post/50.html defer语句用于延迟函数调用,每次会把一个函数压入栈中,函数返回前再把延迟的函数取出并执行.延迟函数可以有参 ...

  2. Azure Service Fabric 踩坑日志

    近期项目上面用到了Azure Service Fabric这个服务,它是用来做微服务架构的,由于这套代码和架构都是以前同学留下来的,缺少文档,项目组在折腾时也曾遇到几个问题,这里整理如下,以供参考. ...

  3. vscode 踩坑汇总

    gopls 提示 update 将 "go.useLanguageServer": true 改为 "go.useLanguageServer": false

  4. 微信小程序踩坑集合

    1:官方工具:https://mp.weixin.qq.com/debug/w ... tml?t=1476434678461 2:简易教程:https://mp.weixin.qq.com/debu ...

  5. navicate 连接mysql8.0,个人踩坑问题汇总

    navicate 连接mysql8.0,个人踩坑问题汇总本文目录:1:安装mysql8.0新增全新验证方式,安装如果不修改mysql连接不上2:mysql启动命令问题3:navicate 运程连接My ...

  6. Nuxt.js的踩坑指南(常见问题汇总)

    本文会不定期更新在nuxt.js中遇到的问题进行汇总.转发请注明出处,尊重作者,谢谢! 强烈推荐作者文档版踩坑指南,点击跳转踩坑指南 在Nuxt的官方文档中,中文文档和英文文档都存在着不小的差异. 1 ...

  7. Hyperledger Fabric Capabilities——超级账本功能汇总

    Hyperledger Fabric是一种模块化的区块链架构,是分布式记账技术(DLT)的一种独特的实现,它提供了可供企业运用的网络,具备安全.可伸缩.加密和可执行等特性.Hyperledger Fa ...

  8. 区块链之智能合约 solidity踩坑 --上篇

    概述 最近在写合约时遇到一些坑,做一下总结: 介绍主要分一下三个方面: 对区块链的简单描述 结合业务场景,编写简单智能合约,时遇到的坑(上篇) assembly 的使用说明(下篇) 正文 进入正题之前 ...

  9. Spark踩坑记——共享变量

    [TOC] 前言 Spark踩坑记--初试 Spark踩坑记--数据库(Hbase+Mysql) Spark踩坑记--Spark Streaming+kafka应用及调优 在前面总结的几篇spark踩 ...

随机推荐

  1. K3/Cloud点按钮打开单据,列表,动态表单,简单账表和直接Sql报表示例

    BOS IDE中配置了个界面,拖了动态表单界面,加了5个测试按钮. 点击“打开单据”维护界面, 会跳转到一个新的主界面页签,[物料]新增 点击“打开列表”,会弹出[物料]列表界面 点击“打开动态表单” ...

  2. python3练习100题——020

    原题链接:http://www.runoob.com/python/python-exercise-example20.html 题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半:再落下 ...

  3. python之pandas简介

    一. Pandas简介 1.Python Data Analysis Library 或 pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的.Pandas 纳入了大量库和 ...

  4. codeforces 1284E. New Year and Castle Construction(极角排序+扫描枚举)

    链接:https://codeforces.com/problemset/problem/1284/E 题意:平面上有n个点,问你存在多少组四个点围成的四边形 严格包围某个点P的情况.不存在三点共线. ...

  5. 刷题75. Sort Colors

    一.题目说明 题目75. Sort Colors,给定n个整数的列表(0代表red,1代表white,2代表blue),排序实现相同颜色在一起.难度是Medium. 二.我的解答 这个是一个排序,还是 ...

  6. SpringBoot+springDataJpa实现单表字段动态部分更新

    写在前面 所谓的动态部分更新是指:并非对数据记录的所有字段整体更新,而是知道运行时才确定哪个或者哪些字段需要被更新. 1)Spring Data Jpa对于Entity的更新,是对数据表中Entity ...

  7. IntelliJ IDEA 2017.3尚硅谷-----模板

    https://www.jetbrains.com/help/idea/using-live-templates.html  

  8. Educational Codeforces Round 76 (Rated for Div. 2) C. Dominated Subarray

    Let's call an array tt dominated by value vv in the next situation. At first, array tt should have a ...

  9. 随笔js

    js中的函数定义之后,函数名就是这个函数(JS中函数其实也是对象)的地址(句柄) js读取函数内存地址: 首先想读内存地址只有C或者C++,汇编抛开不谈,其他高级语言一般都封装起来了,不过我也不能确定 ...

  10. winform学习(5)MDI窗体

    SDI窗体 single document interface 单文档界面,即单个简单的窗体 MDI窗体 multiple document interface 多文档界面(主窗体与子窗体的关系,避免 ...