/network.sh 执行错误

执行镜像文件(bootstrap.sh文件运行后正常情况下会生成fabric-samples文件)

cd scripts/
./bootstrap.sh

如果产生以下报错fabric-samples v2.4.3 does not exist, defaulting to main. fabric-samples main branch is intended to work with recent versions of fabric.

[root@localhost scripts]# ./bootstrap.sh

Clone hyperledger/fabric-samples repo

===> Changing directory to fabric-samples
fabric-samples v2.4.3 does not exist, defaulting to main. fabric-samples main branch is intended to work with recent versions of fabric.

Pull Hyperledger Fabric binaries


Pull Hyperledger Fabric docker images

FABRIC_IMAGES: peer orderer ccenv tools baseos
===> Pulling fabric Images
====> hyperledger/fabric-peer:2.4.3
2.4.3: Pulling from hyperledger/fabric-peer
Digest: sha256:6be12ebf5161df1735c024796cb1181cff8b6ce8cb0f7988adfea42b62813f9c
Status: Image is up to date for hyperledger/fabric-peer:2.4.3
docker.io/hyperledger/fabric-peer:2.4.3
====> hyperledger/fabric-orderer:2.4.3
2.4.3: Pulling from hyperledger/fabric-orderer
Digest: sha256:78fa78126c026c94c8f5a12ac36c39b205cbac13b08379872d849fff5e1df0a6
Status: Image is up to date for hyperledger/fabric-orderer:2.4.3
docker.io/hyperledger/fabric-orderer:2.4.3
====> hyperledger/fabric-ccenv:2.4.3
2.4.3: Pulling from hyperledger/fabric-ccenv
Digest: sha256:ce54559826100a4a4504ba804182af64c9428b69d4b2ce90234d34d32c8d74e9
Status: Image is up to date for hyperledger/fabric-ccenv:2.4.3
docker.io/hyperledger/fabric-ccenv:2.4.3
====> hyperledger/fabric-tools:2.4.3
2.4.3: Pulling from hyperledger/fabric-tools
Digest: sha256:d5d00426297b9347b6f08541e1e7de6e4244053b93bb442e16260c6df0ef6582
Status: Image is up to date for hyperledger/fabric-tools:2.4.3
docker.io/hyperledger/fabric-tools:2.4.3
====> hyperledger/fabric-baseos:2.4.3
2.4.3: Pulling from hyperledger/fabric-baseos
Digest: sha256:14e8994c0faa5ca5fbfe6ebcdb9dc42102ffae55d147fddcbbc2b19e570eab03
Status: Image is up to date for hyperledger/fabric-baseos:2.4.3
docker.io/hyperledger/fabric-baseos:2.4.3
===> Pulling fabric ca Image
====> hyperledger/fabric-ca:1.5.3
1.5.3: Pulling from hyperledger/fabric-ca
Digest: sha256:f4878c8fc60e71e509fa5827f04129bbb69e519fd89bca68b1dfabfc0272d5d5
Status: Image is up to date for hyperledger/fabric-ca:1.5.3
docker.io/hyperledger/fabric-ca:1.5.3
===> List out hyperledger docker images
hyperledger/fabric-ca        1.5       b2aed5002b3d   7 weeks ago    68.1MB
hyperledger/fabric-ca        1.5.3     b2aed5002b3d   7 weeks ago    68.1MB
hyperledger/fabric-ca        latest    b2aed5002b3d   7 weeks ago    68.1MB
hyperledger/fabric-tools     2.4       625237d887db   3 months ago   473MB
hyperledger/fabric-tools     2.4.3     625237d887db   3 months ago   473MB
hyperledger/fabric-tools     latest    625237d887db   3 months ago   473MB
hyperledger/fabric-peer      2.4       ee643d889779   3 months ago   62.3MB
hyperledger/fabric-peer      2.4.3     ee643d889779   3 months ago   62.3MB
hyperledger/fabric-peer      latest    ee643d889779   3 months ago   62.3MB
hyperledger/fabric-orderer   2.4       df64446ac2df   3 months ago   37.3MB
hyperledger/fabric-orderer   2.4.3     df64446ac2df   3 months ago   37.3MB
hyperledger/fabric-orderer   latest    df64446ac2df   3 months ago   37.3MB
hyperledger/fabric-ccenv     2.4       da4f00cb576a   3 months ago   517MB
hyperledger/fabric-ccenv     2.4.3     da4f00cb576a   3 months ago   517MB
hyperledger/fabric-ccenv     latest    da4f00cb576a   3 months ago   517MB
hyperledger/fabric-baseos    2.4       0287ebf8aaf3   3 months ago   6.94MB
hyperledger/fabric-baseos    2.4.3     0287ebf8aaf3   3 months ago   6.94MB
hyperledger/fabric-baseos    latest    0287ebf8aaf3   3 months ago   6.94MB

会发现根本不会产生fabric-samples目录
这种情况下需要我们手动下载

[lj@localhost scripts]$ git clone https://github.com/hyperledger/fabric-samples.git --depth 1
正克隆到 'fabric-samples'...
remote: Enumerating objects: 1199, done.
remote: Counting objects: 100% (1199/1199), done.
remote: Compressing objects: 100% (837/837), done.
remote: Total 1199 (delta 294), reused 780 (delta 160), pack-reused 0
接收对象中: 100% (1199/1199), 1.52 MiB | 2.43 MiB/s, done.
处理 delta 中: 100% (294/294), done.

好了,现在我们就下载好需要的fabric-samples
进入目录下执行./network.sh up时产生如下错误:

[root@localhost scripts]# cd fabric-samples
[root@localhost fabric-samples]# cd test-network
[root@localhost test-network]# ./network.sh up
Using docker and docker-compose
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'
Peer binary and configuration files not found..

Follow the instructions in the Fabric docs to install the Fabric Binaries:
https://hyperledger-fabric.readthedocs.io/en/latest/install.html

解决方法:
手动下载两个压缩文件

https://github.com/hyperledger/fabric/releases/download/v2.3.0/hyperledger-fabric-linux-amd64-2.3.0.tar.gz
https://github.com/hyperledger/fabric-ca/releases/download/v1.4.6/hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz

第一个文件下载过程:

[root@localhost scripts]# wget -t 0 -c https://github.com/hyperledger/fabric/releases/download/v2.3.0/hyperledger-fabric-linux-amd64-2.3.0.tar.gz
--2022-05-28 16:26:49--  https://github.com/hyperledger/fabric/releases/download/v2.3.0/hyperledger-fabric-linux-amd64-2.3.0.tar.gz
正在解析主机 github.com (github.com)... 20.205.243.166
正在连接 github.com (github.com)|20.205.243.166|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://objects.githubusercontent.com/github-production-release-asset-2e65be/66573241/be5ee000-29aa-11eb-81e9-e26a3e303fe8?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220528%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220528T082516Z&X-Amz-Expires=300&X-Amz-Signature=d5a251fa43bc2d8b7828dcf1f6c3cf0ed2b1d1a4d7727ebb9f6b0a5fb9c3532b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=66573241&response-content-disposition=attachment%3B%20filename%3Dhyperledger-fabric-linux-amd64-2.3.0.tar.gz&response-content-type=application%2Foctet-stream [跟随至新的 URL]
--2022-05-28 16:26:49--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/66573241/be5ee000-29aa-11eb-81e9-e26a3e303fe8?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220528%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220528T082516Z&X-Amz-Expires=300&X-Amz-Signature=d5a251fa43bc2d8b7828dcf1f6c3cf0ed2b1d1a4d7727ebb9f6b0a5fb9c3532b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=66573241&response-content-disposition=attachment%3B%20filename%3Dhyperledger-fabric-linux-amd64-2.3.0.tar.gz&response-content-type=application%2Foctet-stream
正在解析主机 objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133
正在连接 objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 206 Partial Content
长度:85748847 (82M),剩余 53862071 (51M) [application/octet-stream]
正在保存至: “hyperledger-fabric-linux-amd64-2.3.0.tar.gz”

38% [+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=>                                                                                                                          ] 32,965,208  13.0KB/s 剩余 48m 40s
100%[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++===========================================================================================================================>] 85,748,847  29.0KB/s 用时 45m 32s

2022-05-28 17:12:24 (19.3 KB/s) - 已保存 “hyperledger-fabric-linux-amd64-2.3.0.tar.gz” [85748847/85748847])


第二个文件下载过程:

[root@localhost scripts]# wget https://github.com/hyperledger/fabric-ca/releases/download/v1.4.6/hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz
--2022-05-28 17:14:00--  https://github.com/hyperledger/fabric-ca/releases/download/v1.4.6/hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz
正在解析主机 github.com (github.com)... 20.205.243.166
正在连接 github.com (github.com)|20.205.243.166|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://objects.githubusercontent.com/github-production-release-asset-2e65be/79410323/c3cc9900-7141-11ea-8a80-fcc1552d2f24?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220528%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220528T091400Z&X-Amz-Expires=300&X-Amz-Signature=da252fdf9e5841092905a8b85f108814935a3d1e2d5e71ad4b9417b0b8f7619b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=79410323&response-content-disposition=attachment%3B%20filename%3Dhyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz&response-content-type=application%2Foctet-stream [跟随至新的 URL]
--2022-05-28 17:14:00--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/79410323/c3cc9900-7141-11ea-8a80-fcc1552d2f24?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220528%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220528T091400Z&X-Amz-Expires=300&X-Amz-Signature=da252fdf9e5841092905a8b85f108814935a3d1e2d5e71ad4b9417b0b8f7619b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=79410323&response-content-disposition=attachment%3B%20filename%3Dhyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz&response-content-type=application%2Foctet-stream
正在解析主机 objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133
正在连接 objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:24446703 (23M) [application/octet-stream]
正在保存至: “hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz”

100%[====================================================================================================================================================================================================>] 24,446,703  22.1KB/s 用时 16m 33s

2022-05-28 17:30:35 (24.0 KB/s) - 已保存 “hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz” [24446703/24446703])

下载好后他们的位置如下图所示
在这里插入图片描述

解压文件,并把bin与config文件拷贝到fabric-samples中

[root@localhost scripts]# tar -xvf hyperledger-fabric-linux-amd64-2.3.0.tar.gz
bin/
bin/peer
bin/configtxgen
bin/cryptogen
bin/discover
bin/configtxlator
bin/idemixgen
bin/osnadmin
bin/orderer
config/
config/configtx.yaml
config/orderer.yaml
config/core.yaml
[root@localhost scripts]# sudo mv bin fabric-samples
[root@localhost scripts]# sudo mv config fabric-samples
[root@localhost scripts]# tar -xvf hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz
bin/
bin/fabric-ca-client
bin/fabric-ca-server
[root@localhost scripts]# sudo mv bin fabric-samples
mv: 无法将"bin" 移动至"fabric-samples/bin": 文件已存在
[root@localhost scripts]# sudo mv bin/* fabric-samples/bin

然后打开bootstrap.sh,将其中download方法进行修改

download() {
   local BINARY_FILE=$1
   local URL=$2
   echo "===> Downloading: " "${URL}"
   curl -L --retry 5 --retry-delay 3 "${URL}" | tar xz || rc=$?
   if [ -n "$rc" ]; then
       echo "==> There was an error downloading the binary file."
       return 22
   else
       echo "==> Done."
   fi
}

修改为

download() {
   echo "==>Done."
}

然后执行./bootstrap.sh

[root@localhost scripts]# ./bootstrap.sh

Clone hyperledger/fabric-samples repo

===> Changing directory to fabric-samples
fabric-samples v2.4.3 does not exist, defaulting to main. fabric-samples main branch is intended to work with recent versions of fabric.

Pull Hyperledger Fabric binaries

===> Downloading version 2.4.3 platform specific fabric binaries
==> Done.
===> Downloading version 1.5.3 platform specific fabric-ca-client binary
==> Done.

Pull Hyperledger Fabric docker images

FABRIC_IMAGES: peer orderer ccenv tools baseos
===> Pulling fabric Images
====> hyperledger/fabric-peer:2.4.3
2.4.3: Pulling from hyperledger/fabric-peer
Digest: sha256:6be12ebf5161df1735c024796cb1181cff8b6ce8cb0f7988adfea42b62813f9c
Status: Image is up to date for hyperledger/fabric-peer:2.4.3
docker.io/hyperledger/fabric-peer:2.4.3
====> hyperledger/fabric-orderer:2.4.3
2.4.3: Pulling from hyperledger/fabric-orderer
Digest: sha256:78fa78126c026c94c8f5a12ac36c39b205cbac13b08379872d849fff5e1df0a6
Status: Image is up to date for hyperledger/fabric-orderer:2.4.3
docker.io/hyperledger/fabric-orderer:2.4.3
====> hyperledger/fabric-ccenv:2.4.3
2.4.3: Pulling from hyperledger/fabric-ccenv
Digest: sha256:ce54559826100a4a4504ba804182af64c9428b69d4b2ce90234d34d32c8d74e9
Status: Image is up to date for hyperledger/fabric-ccenv:2.4.3
docker.io/hyperledger/fabric-ccenv:2.4.3
====> hyperledger/fabric-tools:2.4.3
2.4.3: Pulling from hyperledger/fabric-tools
Digest: sha256:d5d00426297b9347b6f08541e1e7de6e4244053b93bb442e16260c6df0ef6582
Status: Image is up to date for hyperledger/fabric-tools:2.4.3
docker.io/hyperledger/fabric-tools:2.4.3
====> hyperledger/fabric-baseos:2.4.3
2.4.3: Pulling from hyperledger/fabric-baseos
Digest: sha256:14e8994c0faa5ca5fbfe6ebcdb9dc42102ffae55d147fddcbbc2b19e570eab03
Status: Image is up to date for hyperledger/fabric-baseos:2.4.3
docker.io/hyperledger/fabric-baseos:2.4.3
===> Pulling fabric ca Image
====> hyperledger/fabric-ca:1.5.3
1.5.3: Pulling from hyperledger/fabric-ca
Digest: sha256:f4878c8fc60e71e509fa5827f04129bbb69e519fd89bca68b1dfabfc0272d5d5
Status: Image is up to date for hyperledger/fabric-ca:1.5.3
docker.io/hyperledger/fabric-ca:1.5.3
===> List out hyperledger docker images
hyperledger/fabric-ca        1.5       b2aed5002b3d   7 weeks ago    68.1MB
hyperledger/fabric-ca        1.5.3     b2aed5002b3d   7 weeks ago    68.1MB
hyperledger/fabric-ca        latest    b2aed5002b3d   7 weeks ago    68.1MB
hyperledger/fabric-tools     2.4       625237d887db   3 months ago   473MB
hyperledger/fabric-tools     2.4.3     625237d887db   3 months ago   473MB
hyperledger/fabric-tools     latest    625237d887db   3 months ago   473MB
hyperledger/fabric-peer      2.4       ee643d889779   3 months ago   62.3MB
hyperledger/fabric-peer      2.4.3     ee643d889779   3 months ago   62.3MB
hyperledger/fabric-peer      latest    ee643d889779   3 months ago   62.3MB
hyperledger/fabric-orderer   2.4       df64446ac2df   3 months ago   37.3MB
hyperledger/fabric-orderer   2.4.3     df64446ac2df   3 months ago   37.3MB
hyperledger/fabric-orderer   latest    df64446ac2df   3 months ago   37.3MB
hyperledger/fabric-ccenv     2.4       da4f00cb576a   3 months ago   517MB
hyperledger/fabric-ccenv     2.4.3     da4f00cb576a   3 months ago   517MB
hyperledger/fabric-ccenv     latest    da4f00cb576a   3 months ago   517MB
hyperledger/fabric-baseos    2.4       0287ebf8aaf3   3 months ago   6.94MB
hyperledger/fabric-baseos    2.4.3     0287ebf8aaf3   3 months ago   6.94MB
hyperledger/fabric-baseos    latest    0287ebf8aaf3   3 months ago   6.94MB

最后把里面的bin目录放到PATH环境变量

vi /etc/profile

最后增加一行,/home/lj/fabric/scripts/fabric-samples是我的测试目录,这里要换成你自己的

export PATH=$PATH:/home/lj/fabric/scripts/fabric-samples/bin

保存,退出,运行source /etc/profile使其生效

[root@localhost scripts]# vi /etc/profile
[root@localhost scripts]# source /etc/profile
[root@localhost scripts]# cd /home/lj/fabric/scripts/fabric-samples/test-network
[root@localhost test-network]# ./network.sh up
Using docker and docker-compose
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'
LOCAL_VERSION=2.3.0
DOCKER_IMAGE_VERSION=2.4.3
Local fabric binaries and docker images are out of  sync. This may cause problems.
/home/lj/fabric/scripts/fabric-samples/bin/cryptogen
Generating certificates using cryptogen tool
Creating Org1 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
org1.example.com
+ res=0
Creating Org2 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations
org2.example.com
+ res=0
Creating Orderer Org Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations
+ res=0
Generating CCP files for Org1 and Org2
Creating network "fabric_test" with the default driver
Creating volume "compose_orderer.example.com" with default driver
Creating volume "compose_peer0.org1.example.com" with default driver
Creating volume "compose_peer0.org2.example.com" with default driver
Creating peer0.org1.example.com ... done
Creating orderer.example.com    ... done
Creating peer0.org2.example.com ... done
Creating cli                    ... done
CONTAINER ID   IMAGE                               COMMAND             CREATED         STATUS                  PORTS                                                                                                                             NAMES
21caae6bbc81   hyperledger/fabric-tools:latest     "/bin/bash"         1 second ago    Up Less than a second                                                                                                                                     cli
3a624444b3cf   hyperledger/fabric-peer:latest      "peer node start"   3 seconds ago   Up Less than a second   0.0.0.0:9051->9051/tcp, :::9051->9051/tcp, 7051/tcp, 0.0.0.0:9445->9445/tcp, :::9445->9445/tcp                                    peer0.org2.example.com
cf821462d4c3   hyperledger/fabric-orderer:latest   "orderer"           3 seconds ago   Up Less than a second   0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp   orderer.example.com
0f59c549dffd   hyperledger/fabric-peer:latest      "peer node start"   3 seconds ago   Up Less than a second   0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:9444->9444/tcp, :::9444->9444/tcp                                              peer0.org1.example.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yitahutu79

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值