在v2.1 Hyperledger Fabric网络中升级链码失败。

问题描述 投票:0回答:1

我正在尝试将我的Hyperledger Fabric网络从v1.4.7升级到v2.1。升级对等体和定单器很顺利,已经实例化的链码也很好用。(通道功能仍然保持v1.x.)但是,当我尝试升级新版本的链码时,一直失败。

在v1.4.7中,我用Fabric SDK v1.4.x搭建了一个服务器来安装instantiateupgrade链码,但是,我发现所有与安装instantiatingupgrade链码相关的API都已经从Fabric SDK v2.1中删除了。所以,就像文档里说的那样,我试着用Fabric SDK v1.4.x升级一个链码。peer CLI。

首先,我把我的链码用 peer lifecycle chaincode ... 命令。这时,我将 FABRIC_CFG_PATHcore.yamlfabric-samples 文件夹(我不明白为什么我只对一个链码进行打包,但无论如何我都按照文档的要求做了)。然后我设置了 CORE_PEER_MSPCONFIGPATH 到我的管理员用户msp文件夹。

当我得到我的链码包后,我连接到我的第一个peer。peer0.identity.bpl,使用 docker exec -it peer0.identity.bpl /bin/sh 命令,我的docker容器在生产模式下没有打开外面的端口,所以我需要在里面连接容器。我的docker容器在生产模式下没有打开外面的端口,所以我需要连接容器内部。

然后,我输入了下面的命令,我得到了错误信息。

/artifacts # peer lifecycle chaincode install identity_cc_v1.2.0.tar.gz

Error: chaincode install failed with status: 500 - Failed to authorize invocation due to failed ACL check: Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [The identity is not an admin under this MSP [BPLMSP]: The identity does not contain OU [ADMIN], MSP: [BPLMSP]]

所以,我想我需要一些 "管理员 "的身份 所以我把我的admin msp文件夹复制到了这个对等体上。然后,我设置了 CORE_PEER_MSPCONFIGPATH 到这个复制的admin msp文件夹。然后我就得到了。

/artifacts # export CORE_PEER_MSPCONFIGPATH=/artifacts/org-admin/msp
/artifacts # peer lifecycle chaincode install identity_cc_v1.2.0.tar.gz

2020-05-26 07:21:47.020 UTC [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /artifacts/org-admin/msp: administrators must be declared when no admin ou classification is set

我想可能是OU的设置有问题吧 所以,我在 config.yaml 文件。但是,我又得到了同样的错误信息。

所以,我把 CORE_PEER_MSPCONFIGPATH 又设置成原来的设置,但现在又说这不是管理员身份。

/artifacts # export CORE_PEER_MSPCONFIGPATH=/artifacts/msp
/artifacts # peer lifecycle chaincode install identity_cc_v1.2.0.tar.gz

Error: chaincode install failed with status: 500 - Failed to authorize invocation due to failed ACL check: Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [This identity is not an admin]

我明白了。这个身份只是一个同行身份,不是管理员身份。于是,我试着在这个同行中注册管理员,但这个 fabric-peer docker镜像不包含 fabric-ca-client 二进制。所以,我以为我做错了什么,这不是预定的方式。

此时,我如何安装和实例化我的链码的新版本?

hyperledger-fabric hyperledger hyperledger-chaincode chaincode
1个回答
0
投票

我把OU配置设置为admin msp,复制到peer后,每个问题都解决了,安装提交链码也很好用。

© www.soinside.com 2019 - 2024. All rights reserved.