Hyperledger Fabric部署的坑(更新中)
1.映象需與fabric版本一致
fabric執行所需要的映象一共是12種
可以通過輸入docker images檢視你已下載的映象。
如果發現有少的映象則用下述語句下載,每條語句對應下載每一個映象,請根據所缺失的映象選擇語句並執行:
docker pull hyperledger/fabric-tools:x86_64-1.0.0
docker pull hyperledger/fabric-couchdb:x86_64-1.0.0
docker pull hyperledger/fabric-kafka:x86_64-1.0.0
docker pull hyperledger/fabric-orderer:x86_64-1.0.0
docker pull hyperledger/fabric-peer:x86_64-1.0.0
docker pull hyperledger/fabric-ca:x86_64-1.0.0
docker pull hyperledger/fabric-ccenv:x86_64-1.0.0
docker pull hyperledger/fabric-baseimage:x86_64-0.4.7
docker pull hyperledger/fabric-baseos:x86_64-0.4.7
docker pull hyperledger/fabric-zookeeper:x86_64-1.0.0
docker pull hyperledger/fabric-javaenv:x86_64-1.0.0
docker pull hyperledger/fabric-membersrvc:latest
請注意每個映象的版本號!大多數往往缺少baseimage,baseos,membersrvc這三種。
2 錯誤彙總
1.ERRO 001 Cannot run peer because error when setting up MSP from directory........msp.......
2.ERRO 001 Cannot run peer because error when setting up MSP from directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp......
解決辦法:
這兩個問題都是因為fabric版本和docker映象版本不一致
檢視fabric branch:git branch -a
結果帶*就是你的branch,如果不是v1.0.0,就git checkout v1.0.0
當然,也可以下載對應的映象(如果版本為v 1.1):
cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli/
source download-dockerimages.sh -c x86_64-1.1.0 -f x86_64-1.1.0
再檢視下fabric目錄下: make cryptogen。如果返回
CGO_CFLAGS=" " GOBIN=/opt/gopath/src/github.com/hyperledger/fabric/build/bin go install -tags "" -ldflags "-X github.com/hyperledger/fabric/common/tools/cryptogen/metadata.Version=1.0.1" github.com/hyperledger/fabric/common/tools/cryptogen
github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11
vendor/github.com/miekg/pkcs11/pkcs11.go:29:18: fatal error: ltdl.h: No such file or directory
compilation terminated.
Makefile:227: recipe for target 'build/bin/cryptogen' failed
make: *** [build/bin/cryptogen] Error 2
表明缺少ltdl.h檔案。執行以下命令:
apt-get install libtool libltdl-dev
make cryptogen
3 如果出現:
Error: Error endorsing chaincode: rpc error: code = Unknown desc = Error starting container: API error (404): {"message":"network e2ecli_default not found"}
解決辦法:
cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli/base
gedit peer-base.yaml
開啟檔案後將e2ecli_default修改為e2e_cli_default
4 go語言的環境問題
注意:cd ~
和 cd /home
是不一樣的!!!
7 docker刪除相同的映象出錯解決:
8 出現DEBU 001 Returning existing local MSP
有一種解決方法是:
執行一下命令 vim /etc/hosts
增加以下內容
172.16.10.188 orderer.example.com
但是,我覺的這種方法沒有什麼效果,因為我執行了這句話後,也沒解決問題
後來,看到一篇帖子,終於解決了:
是因為環境遺留的問題
解決方式,重新關閉網路
./network_setup.sh down mychannel
root@cc-fibric:/home/cc/go/src/github.com/hyperledger/fabric/examples/e2e_cli# ./network_setup.sh down mychannel
WARNING: The CHANNEL_NAME variable is not set. Defaulting to a blank string.
WARNING: The TIMEOUT variable is not set. Defaulting to a blank string.
Stopping cli ... done
Stopping kafka3 ... done
Stopping kafka0 ... done
Stopping kafka1 ... done
Stopping kafka2 ... done
Stopping peer1.org2.example.com ... done
Stopping zookeeper0 ... done
Stopping zookeeper2 ... done
Stopping zookeeper1 ... done
Stopping peer0.org1.example.com ... done
Stopping peer0.org2.example.com ... done
Stopping peer1.org1.example.com ... done
Removing cli ... done
Removing orderer.example.com ... done
Removing kafka3 ... done
Removing kafka0 ... done
Removing kafka1 ... done
Removing kafka2 ... done
Removing peer1.org2.example.com ... done
Removing zookeeper0 ... done
Removing zookeeper2 ... done
Removing zookeeper1 ... done
Removing peer0.org1.example.com ... done
Removing peer0.org2.example.com ... done
Removing peer1.org1.example.com ... done
Removing network e2e_cli_default
---- No containers available for deletion ----
---- No images available for deletion ----
當然,也有可能是e2e_cli檔案沒有許可權讀寫
後記:
我一開始是版本錯了,是v1.1 的版,下的docker映象卻是v1.0.0;
接下來,估計是由於前面執行過一次./network_setup.sh up ,所以有環境殘餘。
在執行完./network_setup.sh down mychannel後,
再啟動
./network_setup.sh up
root@cc-fibric:/home/cc/go/src/github.com/hyperledger/fabric/examples/e2e_cli# ./network_setup.sh up
setting to default channel 'mychannel'
mychannel
Using cryptogen -> /home/cc/go/src/github.com/hyperledger/fabric/examples/e2e_cli/../../release/linux-amd64/bin/cryptogen
##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
org1.example.com
org2.example.com
Using configtxgen -> /home/cc/go/src/github.com/hyperledger/fabric/examples/e2e_cli/../../release/linux-amd64/bin/configtxgen
##########################################################
######### Generating Orderer Genesis block ##############
##########################################################
相關文章
- Hyperledger Fabric 部署
- Hyperledger Fabric(Hyperledger Fabric模型)模型
- Hyperledger Fabric部署與測試(Ubuntu)Ubuntu
- 在Ubuntu上部署Hyperledger Fabric環境Ubuntu
- Hyperledger Fabric 部署在多個主機上
- Hyperledger Fabric 2.x 動態更新智慧合約
- 2.01 hyperledger fabric概念
- Hyperledger Fabric 核心概念
- 【Hyperledger Fabric】Fabric 2.2 手動安裝
- 2.02 hyperledger fabric入門
- 2.08 hyperledger fabric完整案例
- Hyperledger Fabric(分類賬)
- Hyperledger Fabric on SAP Cloud PlatformCloudPlatform
- Hyperledger Fabric 中智慧合約的基本元件概述元件
- Hyperledger Fabric的基本功能
- fabric sdk : org.hyperledger.fabric.sdk.exception.ProposalExceptionException
- 2.04 hyperledger fabric共識排序排序
- 2.06 hyperledger fabric智慧合約
- 2.07 hyperledger fabric鏈碼案例
- Hyperledger Fabric 2.0 Alpha釋出了!
- 2.03 hyperledger fabric系統架構架構
- 2.05 hyperledger fabric賬本儲存
- Hyperledger Fabric命令詳解之 up
- hyperledger fabric - chaincode fingerprint mismatch data mismatchAI
- 1-Hyperledger Fabric概念詳解
- Hyperledger fabric 鏈碼篇GO(四)Go
- 區塊鏈100講:Hyperledger Fabric 中的鏈碼(智慧合約)區塊鏈
- Hyperledger Fabric系統鏈碼介紹
- Hyperledger Fabric 2.x 環境搭建
- HyperLedger/Fabric SDK使用Docker容器映象快Docker
- Hyperledger Fabric 智慧合約開發及 fabric-sdk-go/fabric-gateway 使用示例GoGateway
- Hyperledger Fabric組織的動態新增和刪除
- Hyperledger Fabric節點的動態新增和刪除
- 區塊鏈開發Hyperledger Fabric入門區塊鏈
- 區塊鏈 2.0:Hyperledger Fabric 介紹(十)區塊鏈
- Hyperledger Fabric和FISCO BCOS技術對比
- Hyperledger Fabric原理詳解與實戰1
- Hyperledger Fabric原理詳解與實戰4