【问题标题】:Failed to upgrade a chaincode in v2.1 Hyperledger Fabric Network在 v2.1 Hyperledger Fabric 网络中升级链码失败
【发布时间】:2020-05-26 07:30:17
【问题描述】:

我正在尝试将我的 Hyperledger Fabric 网络从 v1.4.7 升级到 v2.1。升级对等节点和排序节点很顺利,并且已经实例化的链码运行良好。 (通道功能仍然保留 v1.x。)但是,当我尝试升级我的链代码的新版本时,它一直失败。

在 v1.4.7 中,我使用 Fabric SDK v1.4.x 构建了一个服务器来安装/实例化/升级链代码。但是,我发现所有与安装/实例化/升级链代码相关的 API 都已从 Fabric SDK v2.1 中删除。因此,正如文档所说,我尝试使用 peer CLI 升级链代码。

首先,我使用peer lifecycle chaincode ... 命令打包了我的链代码。此时,我将FABRIC_CFG_PATH 设置为fabric-samples 文件夹中的core.yaml(我不明白为什么我这样做只是为了打包一个链码,但无论如何我按照文档所说的做了)。我将CORE_PEER_MSPCONFIGPATH 设置为我的管理员用户 msp 文件夹。

获得我的链码包后,我使用docker exec -it peer0.identity.bpl /bin/sh 命令连接到我的第一个对等点peer0.identity.bpl。我的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]]

所以,我想我需要一些“管理员”身份,所以我将我的管理员 msp 文件夹复制到了这个对等方。然后,我将CORE_PEER_MSPCONFIGPATH 设置为这个复制的管理 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 文件中禁用了OU 设置。但是,我又收到了同样的错误信息。

所以,我再次将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】:

    在我将 OU 配置设置为复制到对等方的管理 msp 后,所有问题都已解决,并且安装/提交链码运行良好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-19
      • 2019-04-07
      • 1970-01-01
      • 1970-01-01
      • 2021-01-26
      • 2018-04-21
      相关资源
      最近更新 更多