Caliper tests Fabric_kafka performance

Caliper tests Fabric_kafka performance

Reference https://blog.csdn.net/bean_business/article/details/108792976

Installation Environment

  • golang
  • docker
  • docker-compose
  • node
  • Fabric source file
  • caliper source file

installation steps

golang installation

下载文件夹到linux当前目录,注意下载linux版本//我这里用xshell下载到本地再上传,也可以
用wget
tar -C /usr/local -zxf go1.12.7.linux-amd64.tar.gz //解压下载的安装包到/usr/local
编辑环境变量
vim /etc/profile 
末端插入如下:
#go
export PATH=$PATH:/usr/local/go/bin 
export GOROOT=/usr/local/go 
export GOPATH=$HOME/go 
export PATH=$PATH:$HOME/go/bin
#
在vim编辑器输入:wq保存
source /etc/profile //环境变量生效
go version //弹出版本安装成功

docker installation

sudo yum install -y yum-utils //安装依赖工具
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/ centos/docker-ce.repo 
//利用工具配置docker镜像库
yum makecache fast   //刷新yum本地
sudo yum -y install docker-ce //安装docker环境
docker version //输出docker版本,弹出client和server安装成功。

Start the docker environment-add startup

systemctl start docker
systemctl enable docker

Add the current user to the dokcer group, so that ordinary users do not need docker to run docker

sudo usrmod -aG docker user(你的用户名)
newgrp docker //切换到docker群组

docker-compose installation

curl -L https://get.daocloud.io/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose//安装到当前家目录下
sudo mv ~/docker-compose /usr/local/bin/docker-compose  //转移到/usr/local/bin下
chmod +x /usr/local/bin/docker-compose //给该文件赋予可执行权限

Install Node.js

Install node-v8.9.0 version, 8.10.0 will be missing files, the reason is unknown.
sudo wget -P /usr/local https://cdn.npm.taobao.org/dist/node/v8.9.0/node-v8.9.0-linux-x64.tar.xz //下载安装包到 /usr/local
cd /usr/local
sudo tar -xvf node-v8.9.0-linux-x64.tar.xz //解压

Configuration environment takes effect

sudo chmod 777 -R node-v8.9.0-linux-x64//加权限
vim /etc/profile  //进入全体环境变量,末尾添加如下
export PATH=$PATH:/usr/local/node-v8.9.0-linux-x64/bin
输入:wq保存
source /etc/profile //刷新环境变量生效
node -v //有版本显示出来安装成功
npm -v

Download Hyperledger Caliper

mkdir -p ~/go/src/github.com/hyperledger //创建文件夹
cd /home/admin/go/src/github.com/hyperledger //切到该文件夹
git clone https://github.com/hyperledger/caliper-benchmarks.git//远程拉仓库
cd caliper-benchmarks
git checkout v0.3.0 //切换到0.3.0版本或者0.4.0版本,这里跟后面的caliper版本要对应
npm init -y //生成package.json文件,npm的配置文件。
npm install --only=prod @hyperledger/[email protected] //安装0.3.0
npx caliper bind --caliper-bind-sut fabric:1.4.0 //绑定对应fabric-sdk版本

Install fabric environment

cd ~/go/src/github.com/hyperledger
git clone https://github.com/hyperledger/fabric.git //远程拉取fabric源码
cd fabric/scripts //切换到fabric的脚本文件
打开当前文件夹下的bootstrap.sh,编辑版本参数如下
-------
verison=1.4.0
ca-version=1.4.0
-------
:wq保存
./bootstrap.sh  //执行该文件,自动生成镜像以及fabric的二进制工具文件,在当前目录下生成fabric-sample文件,文件里面有个bin文件夹,是生成fabric环境的工具文件夹。
cp -r fabric-samples/bin /home/admin/go/src/github.com/hyperledger/caliper-benchmarks/networks/fabric/config_kafka //移动该工具到caliper里面的配置文件夹下。
cd /home/admin/go/src/github.com/hyperledger/caliper-benchmarks/networks/fabric/config_kafka
执行./generate.sh//运行脚本,利用移动过来的bin工具,生成区块链环境。

Execute test

切换到caliper-benchmarks环境
cd /home/admin/go/src/github.com/hyperledger/caliper-benchmarks
-----------------------------------------------------------
正式测试,这一步是参考官方文档本地,正常运行就是成功
npx caliper launch master --caliper-workspace . --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-networkconfig networks/fabric/fabric-v1.4.0/2org1peergoleveldb_kafka/fabric-go.yaml 
-----------------------------------------------------------

operation result

caliper test results

Modifying the configuration file of caliper can improve the speed, and it is still testing.

Guess you like

Origin blog.csdn.net/hungrylion/article/details/109271923