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

简介: HyperLedger fabric 实战 e2e-cli 有运行成功图 安装GO语言 配置yum sudo wget http://mirrors.163.com/.help/CentOS6-Base-163.

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


安装GO语言

配置yum

sudo wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

mv CentOS6-Base-163.repo CentOS-Base.repo

yum install go

yum安装go

配置环境变量

编辑当前用户的环境变量

vi ~/.profile

添加以下内容

export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$HOME/go/bin

编辑保存并退出vi后,记得使这些环境变量生效source ~/.profile把go的目录GOPATH设置为当前用户的文件夹下,所以记得创建go文件夹

cd ~
mkdir go

异常

bash: /usr/local/go/bin/go: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
将32位go安装到64位服务器上

这样GO就顺利安装完毕了,有时候wget获取go安装包的时候会因为网络问题失败,也可以用apt安装go,只不过版本是比较老旧的1.6.2,但是我在测试中也可以正常使用sudo apt-get install golang添加的环境变量为

export PATH=$PATH:/usr/lib/go-1.6
export GOROOT=/usr/lib/go-1.6
export GOPATH=$HOME/go
export PATH=$PATH:$HOME/go/bin

安装Docker

卸载已有docker

列出你安装过的包
$ yum list installed | grep docker

docker-engine.x86_64   1.7.1-1.el7 @/docker-engine-1.7.1-1.el7.x86_64.rpm123

删除安装包
$ sudo yum -y remove docker-engine.x86_641

删除镜像/容器等
$ rm -rf /var/lib/docker


## 安装 docker

系统版本uname -r3.10.0-229.el7.x86_64

更新yumsudo yum update

yum install docker

安装Docker-compose

  1. 添加EPEL源在Shell中运行以下命令,安装EPEL源:yum install -y epel-release
  2. 安装python-pip在Shell中运行以下命令,安装Python-pip软件包:yum install -y python-pip升级一下版本pip install --upgrade pip
  3. 安装docker-compose在Shell中运行以下命令,通过pip安装docker-compose:pip install docker-compose

验证安装

  1. 检查docker版本通过Shell检查docker版本,若返回信息如下图所示,则表示安装成功:
docker version
  1. 检查docker-compose版本通过Shell检查docker-compose版本,若返回信息如下图所示,则表示安装成功:
docker-compose version

检查版本

输入图片说明

  1. 运行示例容器

运行hello-world镜像,若返回信息如下图所示,则表示docker配置正确:

输入图片说明

非root用户执行docker设置

主为root,权限为rw,可读可写;其属组为docker,权限为rw,可读可写。如果要当前用户可直接读取该文件,那么我们就为当前用户添加到docker属组即可。


如果还没有 docker group 就添加一个:

sudo groupadd docker


将用户加入该 group 内。然后退出并重新登录就生效啦。

sudo gpasswd -a ${USER} docker


重启 docker 服务

sudo service docker restart


切换当前会话到新 group 或者重启 X 会话

newgrp - docker




注意:最后一步是必须的,否则因为 groups 命令获取到的是缓存的组信息,刚添加的组信息未能生效,所以 docker images 执行时同样有错。

Git安装

sudo yum install git

nodejs安装

sudo yum install nodejs

输入图片说明

Hyperledger Fabric实战

cd $GOPATH
mkdir -p src/github.com/hyperledger 

cd src/github.com/hyperledger

git clone https://github.com/hyperledger/fabric.git

cd fabric

git checkout v1.0.0

cd examples/e2e_cli/

# 下载docker images
source download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0

或者 sudo ./download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0

./network_setup.sh up

[watt@localhost e2e_cli]$ ./network_setup.sh up
setting to default channel 'mychannel'
mychannel

Building cryptogen
find: ‘/src/github.com/hyperledger/fabric/core/chaincode/shim’: No such file or directory
make: Entering directory `/home/watt/go/src/github.com/hyperledger/fabric'
Building release/linux-amd64/bin/configtxgen for linux-amd64
mkdir -p release/linux-amd64/bin
CGO_CFLAGS=" " GOOS=linux GOARCH=amd64 go build -o /home/watt/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin/configtxgen -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/common/configtx/tool/configtxgen/metadata.Version=1.0.0" github.com/hyperledger/fabric/common/configtx/tool/configtxgen
Building release/linux-amd64/bin/cryptogen for linux-amd64

Creating network "e2ecli_default" with the default driver
Pulling orderer.example.com (hyperledger/fabric-orderer:latest)...
ERROR: manifest for hyperledger/fabric-orderer:latest not found
ERROR !!!! Unable to pull the images


error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/a1/a15c59ecda5b7faae9a370907fddd66208a1267f00979294e18cd99950c86f12/data?Expires=1520627639&Signature=d3trfYMkAe3Ec5v2miVTANKhntPyjoaJFv4euWBQbgaSWGOvtpUj-sSbOLwijze~mqGGXtjyeBet2NBulu6HwdqW~333ixTs3~WIqxTx-k-uBRytSrlY2Rjsj688orNJRcr6Wcz-nuCPaNAx57MfYFFpojtkDB9IJnDbnYAiZ5Q_&Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q: net/http: TLS handshake timeout
Error response from daemon: No such image: hyperledger/fabric-ca:x86_64-1.0.0


docker默认镜像拉取地址为国外仓库下载速度较慢,则会报错“net/http: TLS handshake timeout”。
此时,只需要将拉取地址改为国内镜像仓库即可。

标准格式为:


$ docker pull registry.docker-cn.com/myname/myrepo:mytag
例:


$ docker pull registry.docker-cn.com/library/ubuntu:16.04
   


为了永久性保留更改,您可以修改 /etc/docker/daemon.json 文件并添加上
 registry-mirrors 键值。


{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}



修改保存后重启 Docker 以使配置生效。

sudo service docker stop
sudo service docker start

输入图片说明

输入图片说明

ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
ERROR !!!! Unable to pull the images


systemctl daemon-reload

systemctl restart docker

仍然没解决问题




https://docs.docker.com/articles/systemd/

sudo ./network_setup.sh up

启动好了输入图片说明

2018-03-23 09:57:27.038 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-03-23 09:57:27.038 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-03-23 09:57:27.051 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-03-23 09:57:27.052 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2018-03-23 09:57:27.052 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2018-03-23 09:57:27.052 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2018-03-23 09:57:27.052 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2018-03-23 09:57:27.052 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D
2018-03-23 09:57:27.052 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: E60DC844BB4AEE61D3283BD546B4766E040A38769975AD5EA597820380A46A97
2018-03-23 09:57:27.052 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-03-23 09:57:27.052 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-03-23 09:57:27.052 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2018-03-23 09:57:27.052 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2018-03-23 09:57:27.052 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608879FD3D50522...B239F5C82D59A7A8E21076C02A75E7C4
2018-03-23 09:57:27.052 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 877BEB5EA117BD6B0C0150D4CB348CBAF7064BF33E5298C1CC650A0730C1202B
Error: Got unexpected status: BAD_REQUEST
Usage:
  peer channel create [flags]

Flags:
  -c, --channelID string   In case of a newChain command, the channel ID to create.
  -f, --file string        Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
  -t, --timeout int        Channel creation timeout (default 5)

Global Flags:
      --cafile string              Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string             Ordering service endpoint
      --test.coverprofile string   Done (default "coverage.cov")
      --tls                        Use TLS when communicating with the orderer endpoint
  -v, --version                    Display current version of fabric peer server

!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
================== ERROR !!! FAILED to execute End-2-End Scenario ==================


 ____    _____      _      ____    _____           _____   ____    _____
/ ___|  |_   _|    / \    |  _ \  |_   _|         | ____| |___ \  | ____
\___ \    | |     / _ \   | |_) |   | |    _____  |  _|     __) | |  _|  
 ___) |   | |    / ___ \  |  _ <    | |   |_____| | |___   / __/  | |___
|____/    |_|   /_/   \_\ |_| \_\   |_|           |_____| |_____| |_____

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=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2018-03-23 09:59:52.219 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-03-23 09:59:52.219 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-03-23 09:59:52.230 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-03-23 09:59:52.231 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2018-03-23 09:59:52.231 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2018-03-23 09:59:52.231 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2018-03-23 09:59:52.231 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2018-03-23 09:59:52.231 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D
2018-03-23 09:59:52.231 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 4E32EF5E499E6486FBB22FC4D469E41402274B288A1FDE9E9CA7E9CCCAE22B4A
2018-03-23 09:59:52.231 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-03-23 09:59:52.231 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-03-23 09:59:52.231 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2018-03-23 09:59:52.231 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2018-03-23 09:59:52.231 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A060898A0D3D50522...758B50C7D33769821B84F2C10A8F2718
2018-03-23 09:59:52.231 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 5721F3B93959C7C3CEAD3A6BA854096386F0710ADD13A33D44A6CB276C3D6EA1
Error: Got unexpected status: BAD_REQUEST
Usage:
  peer channel create [flags]

Flags:
  -c, --channelID string   In case of a newChain command, the channel ID to create.
  -f, --file string        Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
  -t, --timeout int        Channel creation timeout (default 5)

Global Flags:
      --cafile string              Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string             Ordering service endpoint
      --test.coverprofile string   Done (default "coverage.cov")
      --tls                        Use TLS when communicating with the orderer endpoint
  -v, --version                    Display current version of fabric peer server

!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
================== ERROR !!! FAILED to execute End-2-End Scenario ==================

解决方案:
sudo ./network_setup.sh down




目录
相关文章
|
5月前
|
Linux 数据库管理 Python
CentOS7编译安装Python3.10(含OpenSSL1.1.1安装),创建虚拟环境,运行Django项目(含sqlite版本报错)
CentOS7编译安装Python3.10(含OpenSSL1.1.1安装),创建虚拟环境,运行Django项目(含sqlite版本报错)
765 4
|
3月前
|
开发框架 IDE .NET
【Azure 微服务】Service Fabric中微服务在升级时,遇见Warning - System.Collections.Generic.KeyNotFoundException 服务无法正常运行
【Azure 微服务】Service Fabric中微服务在升级时,遇见Warning - System.Collections.Generic.KeyNotFoundException 服务无法正常运行
【Azure 微服务】Service Fabric中微服务在升级时,遇见Warning - System.Collections.Generic.KeyNotFoundException 服务无法正常运行
|
2月前
|
Oracle Java 关系型数据库
CentOS 7.6操作系统部署JDK实战案例
这篇文章介绍了在CentOS 7.6操作系统上通过多种方式部署JDK的详细步骤,包括使用yum安装openjdk、基于rpm包和二进制包安装Oracle JDK,并提供了配置环境变量的方法。
256 80
|
10天前
|
安全 Linux Shell
docker运行centos提示Operation not permitted
通过上述步骤,可以有效排查和解决在Docker中运行CentOS容器时遇到的"Operation not permitted"错误。这些措施涵盖了从权限配置、安全策略到容器运行参数的各个方面,确保在不同环境和使用场景下都能顺利运行容器。如果你需要进一步优化和管理你的Docker环境
14 3
|
25天前
|
NoSQL Linux Redis
Docker学习二(Centos):Docker安装并运行redis(成功运行)
这篇文章介绍了在CentOS系统上使用Docker安装并运行Redis数据库的详细步骤,包括拉取Redis镜像、创建挂载目录、下载配置文件、修改配置以及使用Docker命令运行Redis容器,并检查运行状态和使用Navicat连接Redis。
175 3
|
2月前
|
存储 Kubernetes 负载均衡
CentOS 7.9二进制部署K8S 1.28.3+集群实战
本文详细介绍了在CentOS 7.9上通过二进制方式部署Kubernetes 1.28.3+集群的全过程,包括环境准备、组件安装、证书生成、高可用配置以及网络插件部署等关键步骤。
343 3
CentOS 7.9二进制部署K8S 1.28.3+集群实战
|
2月前
|
存储 Linux Docker
CentOS 7.6安装Docker实战案例及存储引擎和服务进程简介
关于如何在CentOS 7.6上安装Docker、介绍Docker存储引擎以及服务进程关系的实战案例。
135 3
CentOS 7.6安装Docker实战案例及存储引擎和服务进程简介
|
2月前
|
Linux pouch 容器
CentOS7部署阿里巴巴开源的pouch容器管理工具实战
关于如何在CentOS 7.6操作系统上安装和使用阿里巴巴开源的Pouch容器管理工具的实战教程。
112 2
CentOS7部署阿里巴巴开源的pouch容器管理工具实战
|
2月前
|
Kubernetes Linux API
CentOS 7.6使用kubeadm部署k8s 1.17.2测试集群实战篇
该博客文章详细介绍了在CentOS 7.6操作系统上使用kubeadm工具部署kubernetes 1.17.2版本的测试集群的过程,包括主机环境准备、安装Docker、配置kubelet、初始化集群、添加节点、部署网络插件以及配置k8s node节点管理api server服务器。
112 0
CentOS 7.6使用kubeadm部署k8s 1.17.2测试集群实战篇
|
3月前
|
缓存 运维 Linux
深入解析:一步步掌握 CentOS 7 安装全流程及运维实战技巧
深入解析:一步步掌握 CentOS 7 安装全流程及运维实战技巧